Use more standardized phpcs

This commit is contained in:
Dane Everitt 2021-01-23 12:33:34 -08:00
parent a043071e3c
commit c449ca5155
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
493 changed files with 1116 additions and 3903 deletions

49
.php_cs
View file

@ -1,58 +1,43 @@
<?php
$finder = PhpCsFixer\Finder::create()
->in([
'app',
'bootstrap',
'config',
'database',
'resources/lang',
'routes',
'tests',
]);
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
return PhpCsFixer\Config::create()
$finder = (new Finder)->in([
'app',
'bootstrap',
'config',
'database',
'resources/lang',
'routes',
'tests',
]);
return (new Config)
->setRiskyAllowed(true)
->setFinder($finder)
->setRules([
'@Symfony' => true,
'@PSR1' => true,
'@PSR2' => true,
'@PSR12' => true,
'align_multiline_comment' => ['comment_type' => 'phpdocs_like'],
'array_syntax' => ['syntax' => 'short'],
'blank_line_before_return' => true,
'blank_line_before_statement' => false,
'combine_consecutive_unsets' => true,
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => ['space' => 'single'],
'heredoc_to_nowdoc' => true,
'increment_style' => ['style' => 'post'],
'linebreak_after_opening_tag' => true,
'method_argument_space' => [
'ensure_fully_multiline' => false,
'keep_multiple_spaces_after_comma' => false,
],
'new_with_braces' => false,
'no_alias_functions' => true,
'no_multiline_whitespace_before_semicolons' => true,
'no_superfluous_phpdoc_tags' => false,
'no_unreachable_default_argument_value' => true,
'no_useless_return' => true,
'not_operator_with_successor_space' => true,
'ordered_imports' => [
'sortAlgorithm' => 'length',
],
'phpdoc_align' => false,
'phpdoc_separation' => false,
'protected_to_private' => false,
'psr0' => ['dir' => 'app'],
'psr4' => true,
'random_api_migration' => true,
'single_line_throw' => false,
'single_trait_insert_per_statement' => false,
'standardize_not_equals' => true,
'ternary_to_null_coalescing' => true,
'yoda_style' => [
'equal' => false,
'identical' => false,
'less_and_greater' => false,
],
])->setRiskyAllowed(true)->setFinder($finder);
]);

View file

@ -19,13 +19,13 @@ class AppSettingsCommand extends Command
{
use EnvironmentWriterTrait;
const ALLOWED_CACHE_DRIVERS = [
public const ALLOWED_CACHE_DRIVERS = [
'redis' => 'Redis (recommended)',
'memcached' => 'Memcached',
'file' => 'Filesystem',
];
const ALLOWED_SESSION_DRIVERS = [
public const ALLOWED_SESSION_DRIVERS = [
'redis' => 'Redis (recommended)',
'memcached' => 'Memcached',
'database' => 'MySQL Database',
@ -33,7 +33,7 @@ class AppSettingsCommand extends Command
'cookie' => 'Cookie',
];
const ALLOWED_QUEUE_DRIVERS = [
public const ALLOWED_QUEUE_DRIVERS = [
'redis' => 'Redis (recommended)',
'database' => 'MySQL Database',
'sync' => 'Sync',
@ -77,9 +77,6 @@ class AppSettingsCommand extends Command
/**
* AppSettingsCommand constructor.
*
* @param \Illuminate\Contracts\Config\Repository $config
* @param \Illuminate\Contracts\Console\Kernel $command
*/
public function __construct(ConfigRepository $config, Kernel $command)
{
@ -102,43 +99,45 @@ class AppSettingsCommand extends Command
$this->output->comment(trans('command/messages.environment.app.author_help'));
$this->variables['APP_SERVICE_AUTHOR'] = $this->option('author') ?? $this->ask(
trans('command/messages.environment.app.author'), $this->config->get('pterodactyl.service.author', 'unknown@unknown.com')
);
trans('command/messages.environment.app.author'),
$this->config->get('pterodactyl.service.author', 'unknown@unknown.com')
);
$this->output->comment(trans('command/messages.environment.app.app_url_help'));
$this->variables['APP_URL'] = $this->option('url') ?? $this->ask(
trans('command/messages.environment.app.app_url'), $this->config->get('app.url', 'http://example.org')
);
trans('command/messages.environment.app.app_url'),
$this->config->get('app.url', 'http://example.org')
);
$this->output->comment(trans('command/messages.environment.app.timezone_help'));
$this->variables['APP_TIMEZONE'] = $this->option('timezone') ?? $this->anticipate(
trans('command/messages.environment.app.timezone'),
DateTimeZone::listIdentifiers(DateTimeZone::ALL),
$this->config->get('app.timezone')
);
trans('command/messages.environment.app.timezone'),
DateTimeZone::listIdentifiers(DateTimeZone::ALL),
$this->config->get('app.timezone')
);
$selected = $this->config->get('cache.default', 'redis');
$this->variables['CACHE_DRIVER'] = $this->option('cache') ?? $this->choice(
trans('command/messages.environment.app.cache_driver'),
self::ALLOWED_CACHE_DRIVERS,
array_key_exists($selected, self::ALLOWED_CACHE_DRIVERS) ? $selected : null
);
trans('command/messages.environment.app.cache_driver'),
self::ALLOWED_CACHE_DRIVERS,
array_key_exists($selected, self::ALLOWED_CACHE_DRIVERS) ? $selected : null
);
$selected = $this->config->get('session.driver', 'redis');
$this->variables['SESSION_DRIVER'] = $this->option('session') ?? $this->choice(
trans('command/messages.environment.app.session_driver'),
self::ALLOWED_SESSION_DRIVERS,
array_key_exists($selected, self::ALLOWED_SESSION_DRIVERS) ? $selected : null
);
trans('command/messages.environment.app.session_driver'),
self::ALLOWED_SESSION_DRIVERS,
array_key_exists($selected, self::ALLOWED_SESSION_DRIVERS) ? $selected : null
);
$selected = $this->config->get('queue.default', 'redis');
$this->variables['QUEUE_CONNECTION'] = $this->option('queue') ?? $this->choice(
trans('command/messages.environment.app.queue_driver'),
self::ALLOWED_QUEUE_DRIVERS,
array_key_exists($selected, self::ALLOWED_QUEUE_DRIVERS) ? $selected : null
);
trans('command/messages.environment.app.queue_driver'),
self::ALLOWED_QUEUE_DRIVERS,
array_key_exists($selected, self::ALLOWED_QUEUE_DRIVERS) ? $selected : null
);
if (! is_null($this->option('settings-ui'))) {
if (!is_null($this->option('settings-ui'))) {
$this->variables['APP_ENVIRONMENT_ONLY'] = $this->option('settings-ui') == 'true' ? 'false' : 'true';
} else {
$this->variables['APP_ENVIRONMENT_ONLY'] = $this->confirm(trans('command/messages.environment.app.settings'), true) ? 'false' : 'true';
@ -171,11 +170,12 @@ class AppSettingsCommand extends Command
$this->output->note(trans('command/messages.environment.app.using_redis'));
$this->variables['REDIS_HOST'] = $this->option('redis-host') ?? $this->ask(
trans('command/messages.environment.app.redis_host'), $this->config->get('database.redis.default.host')
);
trans('command/messages.environment.app.redis_host'),
$this->config->get('database.redis.default.host')
);
$askForRedisPassword = true;
if (! empty($this->config->get('database.redis.default.password'))) {
if (!empty($this->config->get('database.redis.default.password'))) {
$this->variables['REDIS_PASSWORD'] = $this->config->get('database.redis.default.password');
$askForRedisPassword = $this->confirm(trans('command/messages.environment.app.redis_pass_defined'));
}
@ -183,8 +183,8 @@ class AppSettingsCommand extends Command
if ($askForRedisPassword) {
$this->output->comment(trans('command/messages.environment.app.redis_pass_help'));
$this->variables['REDIS_PASSWORD'] = $this->option('redis-pass') ?? $this->output->askHidden(
trans('command/messages.environment.app.redis_password')
);
trans('command/messages.environment.app.redis_password')
);
}
if (empty($this->variables['REDIS_PASSWORD'])) {
@ -192,7 +192,8 @@ class AppSettingsCommand extends Command
}
$this->variables['REDIS_PORT'] = $this->option('redis-port') ?? $this->ask(
trans('command/messages.environment.app.redis_port'), $this->config->get('database.redis.default.port')
);
trans('command/messages.environment.app.redis_port'),
$this->config->get('database.redis.default.port')
);
}
}

View file

@ -57,10 +57,6 @@ class DatabaseSettingsCommand extends Command
/**
* DatabaseSettingsCommand constructor.
*
* @param \Illuminate\Contracts\Config\Repository $config
* @param \Illuminate\Database\DatabaseManager $database
* @param \Illuminate\Contracts\Console\Kernel $console
*/
public function __construct(ConfigRepository $config, DatabaseManager $database, Kernel $console)
{
@ -82,24 +78,28 @@ class DatabaseSettingsCommand extends Command
{
$this->output->note(trans('command/messages.environment.database.host_warning'));
$this->variables['DB_HOST'] = $this->option('host') ?? $this->ask(
trans('command/messages.environment.database.host'), $this->config->get('database.connections.mysql.host', '127.0.0.1')
);
trans('command/messages.environment.database.host'),
$this->config->get('database.connections.mysql.host', '127.0.0.1')
);
$this->variables['DB_PORT'] = $this->option('port') ?? $this->ask(
trans('command/messages.environment.database.port'), $this->config->get('database.connections.mysql.port', 3306)
);
trans('command/messages.environment.database.port'),
$this->config->get('database.connections.mysql.port', 3306)
);
$this->variables['DB_DATABASE'] = $this->option('database') ?? $this->ask(
trans('command/messages.environment.database.database'), $this->config->get('database.connections.mysql.database', 'panel')
);
trans('command/messages.environment.database.database'),
$this->config->get('database.connections.mysql.database', 'panel')
);
$this->output->note(trans('command/messages.environment.database.username_warning'));
$this->variables['DB_USERNAME'] = $this->option('username') ?? $this->ask(
trans('command/messages.environment.database.username'), $this->config->get('database.connections.mysql.username', 'pterodactyl')
);
trans('command/messages.environment.database.username'),
$this->config->get('database.connections.mysql.username', 'pterodactyl')
);
$askForMySQLPassword = true;
if (! empty($this->config->get('database.connections.mysql.password')) && $this->input->isInteractive()) {
if (!empty($this->config->get('database.connections.mysql.password')) && $this->input->isInteractive()) {
$this->variables['DB_PASSWORD'] = $this->config->get('database.connections.mysql.password');
$askForMySQLPassword = $this->confirm(trans('command/messages.environment.database.password_defined'));
}

View file

@ -47,8 +47,6 @@ class EmailSettingsCommand extends Command
/**
* EmailSettingsCommand constructor.
*
* @param \Illuminate\Contracts\Config\Repository $config
*/
public function __construct(ConfigRepository $config)
{
@ -65,13 +63,15 @@ class EmailSettingsCommand extends Command
public function handle()
{
$this->variables['MAIL_DRIVER'] = $this->option('driver') ?? $this->choice(
trans('command/messages.environment.mail.ask_driver'), [
trans('command/messages.environment.mail.ask_driver'),
[
'smtp' => 'SMTP Server',
'mail' => 'PHP\'s Internal Mail Function',
'mailgun' => 'Mailgun Transactional Email',
'mandrill' => 'Mandrill Transactional Email',
'postmark' => 'Postmarkapp Transactional Email',
], $this->config->get('mail.driver', 'smtp')
],
$this->config->get('mail.driver', 'smtp')
);
$method = 'setup' . studly_case($this->variables['MAIL_DRIVER']) . 'DriverVariables';
@ -80,16 +80,20 @@ class EmailSettingsCommand extends Command
}
$this->variables['MAIL_FROM'] = $this->option('email') ?? $this->ask(
trans('command/messages.environment.mail.ask_mail_from'), $this->config->get('mail.from.address')
);
trans('command/messages.environment.mail.ask_mail_from'),
$this->config->get('mail.from.address')
);
$this->variables['MAIL_FROM_NAME'] = $this->option('from') ?? $this->ask(
trans('command/messages.environment.mail.ask_mail_name'), $this->config->get('mail.from.name')
);
trans('command/messages.environment.mail.ask_mail_name'),
$this->config->get('mail.from.name')
);
$this->variables['MAIL_ENCRYPTION'] = $this->option('encryption') ?? $this->choice(
trans('command/messages.environment.mail.ask_encryption'), ['tls' => 'TLS', 'ssl' => 'SSL', '' => 'None'], $this->config->get('mail.encryption', 'tls')
);
trans('command/messages.environment.mail.ask_encryption'),
['tls' => 'TLS', 'ssl' => 'SSL', '' => 'None'],
$this->config->get('mail.encryption', 'tls')
);
$this->writeToEnvironment($this->variables);
@ -103,20 +107,23 @@ class EmailSettingsCommand extends Command
private function setupSmtpDriverVariables()
{
$this->variables['MAIL_HOST'] = $this->option('host') ?? $this->ask(
trans('command/messages.environment.mail.ask_smtp_host'), $this->config->get('mail.host')
);
trans('command/messages.environment.mail.ask_smtp_host'),
$this->config->get('mail.host')
);
$this->variables['MAIL_PORT'] = $this->option('port') ?? $this->ask(
trans('command/messages.environment.mail.ask_smtp_port'), $this->config->get('mail.port')
);
trans('command/messages.environment.mail.ask_smtp_port'),
$this->config->get('mail.port')
);
$this->variables['MAIL_USERNAME'] = $this->option('username') ?? $this->ask(
trans('command/messages.environment.mail.ask_smtp_username'), $this->config->get('mail.username')
);
trans('command/messages.environment.mail.ask_smtp_username'),
$this->config->get('mail.username')
);
$this->variables['MAIL_PASSWORD'] = $this->option('password') ?? $this->secret(
trans('command/messages.environment.mail.ask_smtp_password')
);
trans('command/messages.environment.mail.ask_smtp_password')
);
}
/**
@ -125,12 +132,14 @@ class EmailSettingsCommand extends Command
private function setupMailgunDriverVariables()
{
$this->variables['MAILGUN_DOMAIN'] = $this->option('host') ?? $this->ask(
trans('command/messages.environment.mail.ask_mailgun_domain'), $this->config->get('services.mailgun.domain')
);
trans('command/messages.environment.mail.ask_mailgun_domain'),
$this->config->get('services.mailgun.domain')
);
$this->variables['MAILGUN_SECRET'] = $this->option('password') ?? $this->ask(
trans('command/messages.environment.mail.ask_mailgun_secret'), $this->config->get('services.mailgun.secret')
);
trans('command/messages.environment.mail.ask_mailgun_secret'),
$this->config->get('services.mailgun.secret')
);
}
/**
@ -139,8 +148,9 @@ class EmailSettingsCommand extends Command
private function setupMandrillDriverVariables()
{
$this->variables['MANDRILL_SECRET'] = $this->option('password') ?? $this->ask(
trans('command/messages.environment.mail.ask_mandrill_secret'), $this->config->get('services.mandrill.secret')
);
trans('command/messages.environment.mail.ask_mandrill_secret'),
$this->config->get('services.mandrill.secret')
);
}
/**
@ -152,7 +162,8 @@ class EmailSettingsCommand extends Command
$this->variables['MAIL_HOST'] = 'smtp.postmarkapp.com';
$this->variables['MAIL_PORT'] = 587;
$this->variables['MAIL_USERNAME'] = $this->variables['MAIL_PASSWORD'] = $this->option('username') ?? $this->ask(
trans('command/messages.environment.mail.ask_postmark_username'), $this->config->get('mail.username')
);
trans('command/messages.environment.mail.ask_postmark_username'),
$this->config->get('mail.username')
);
}
}

View file

@ -37,9 +37,6 @@ class InfoCommand extends Command
/**
* VersionCommand constructor.
*
* @param \Illuminate\Contracts\Config\Repository $config
* @param \Pterodactyl\Services\Helpers\SoftwareVersionService $versionService
*/
public function __construct(ConfigRepository $config, SoftwareVersionService $versionService)
{
@ -65,7 +62,7 @@ class InfoCommand extends Command
$this->output->title('Application Configuration');
$this->table([], [
['Environment', $this->formatText($this->config->get('app.env'), $this->config->get('app.env') === 'production' ?: 'bg=red')],
['Debug Mode', $this->formatText($this->config->get('app.debug') ? 'Yes' : 'No', ! $this->config->get('app.debug') ?: 'bg=red')],
['Debug Mode', $this->formatText($this->config->get('app.debug') ? 'Yes' : 'No', !$this->config->get('app.debug') ?: 'bg=red')],
['Installation URL', $this->config->get('app.url')],
['Installation Directory', base_path()],
['Timezone', $this->config->get('app.timezone')],
@ -104,6 +101,7 @@ class InfoCommand extends Command
*
* @param string $value
* @param string $opts
*
* @return string
*/
private function formatText($value, $opts = '')

View file

@ -42,9 +42,6 @@ class DeleteLocationCommand extends Command
/**
* DeleteLocationCommand constructor.
*
* @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $repository
* @param \Pterodactyl\Services\Locations\LocationDeletionService $deletionService
*/
public function __construct(
LocationDeletionService $deletionService,
@ -66,8 +63,9 @@ class DeleteLocationCommand extends Command
{
$this->locations = $this->locations ?? $this->repository->all();
$short = $this->option('short') ?? $this->anticipate(
trans('command/messages.location.ask_short'), $this->locations->pluck('short')->toArray()
);
trans('command/messages.location.ask_short'),
$this->locations->pluck('short')->toArray()
);
$location = $this->locations->where('short', $short)->first();
if (is_null($location)) {

View file

@ -33,8 +33,6 @@ class MakeLocationCommand extends Command
/**
* Create a new command instance.
*
* @param \Pterodactyl\Services\Locations\LocationCreationService $creationService
*/
public function __construct(LocationCreationService $creationService)
{

View file

@ -9,7 +9,7 @@ use Illuminate\Contracts\Filesystem\Factory as FilesystemFactory;
class CleanServiceBackupFilesCommand extends Command
{
const BACKUP_THRESHOLD_MINUTES = 5;
public const BACKUP_THRESHOLD_MINUTES = 5;
/**
* @var string
@ -28,8 +28,6 @@ class CleanServiceBackupFilesCommand extends Command
/**
* CleanServiceBackupFilesCommand constructor.
*
* @param \Illuminate\Contracts\Filesystem\Factory $filesystem
*/
public function __construct(FilesystemFactory $filesystem)
{

View file

@ -19,13 +19,10 @@ class PruneOrphanedBackupsCommand extends Command
*/
protected $description = 'Marks all backups that have not completed in the last "n" minutes as being failed.';
/**
* @param \Pterodactyl\Repositories\Eloquent\BackupRepository $repository
*/
public function handle(BackupRepository $repository)
{
$since = $this->option('since-minutes');
if (! is_digit($since)) {
if (!is_digit($since)) {
throw new InvalidArgumentException('The --since-minutes option must be a valid numeric digit.');
}
@ -34,7 +31,7 @@ class PruneOrphanedBackupsCommand extends Command
->whereDate('created_at', '<=', CarbonImmutable::now()->subMinutes($since));
$count = $query->count();
if (! $count) {
if (!$count) {
$this->info('There are no orphaned backups to be marked as failed.');
return;

View file

@ -25,8 +25,6 @@ class CleanOrphanedApiKeysCommand extends Command
/**
* CleanOrphanedApiKeysCommand constructor.
*
* @param \Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface $repository
*/
public function __construct(ApiKeyRepositoryInterface $repository)
{
@ -44,10 +42,11 @@ class CleanOrphanedApiKeysCommand extends Command
{
$count = $this->repository->findCountWhere([['key_type', '=', ApiKey::TYPE_NONE]]);
$continue = $this->confirm(
'This action will remove ' . $count . ' keys from the database. Are you sure you wish to continue?', false
'This action will remove ' . $count . ' keys from the database. Are you sure you wish to continue?',
false
);
if (! $continue) {
if (!$continue) {
return null;
}

View file

@ -12,13 +12,13 @@ class KeyGenerateCommand extends BaseKeyGenerateCommand
*/
public function handle()
{
if (! empty(config('app.key')) && $this->input->isInteractive()) {
if (!empty(config('app.key')) && $this->input->isInteractive()) {
$this->output->warning(trans('command/messages.key.warning'));
if (! $this->confirm(trans('command/messages.key.confirm'))) {
if (!$this->confirm(trans('command/messages.key.confirm'))) {
return;
}
if (! $this->confirm(trans('command/messages.key.final_confirm'))) {
if (!$this->confirm(trans('command/messages.key.final_confirm'))) {
return;
}
}

View file

@ -17,7 +17,7 @@ class SeedCommand extends BaseSeedCommand
*/
public function handle()
{
if (! $this->hasCompletedMigrations()) {
if (!$this->hasCompletedMigrations()) {
return $this->showMigrationWarning();
}

View file

@ -14,7 +14,7 @@ class UpCommand extends BaseUpCommand
*/
public function handle()
{
if (! $this->hasCompletedMigrations()) {
if (!$this->hasCompletedMigrations()) {
return $this->showMigrationWarning();
}

View file

@ -54,7 +54,6 @@ class ProcessRunnableCommand extends Command
* never throw an exception out, otherwise you'll end up killing the entire run group causing
* any other schedules to not process correctly.
*
* @param \Pterodactyl\Models\Schedule $schedule
* @see https://github.com/pterodactyl/panel/issues/2609
*/
protected function processSchedule(Schedule $schedule)

View file

@ -27,8 +27,6 @@ class BulkPowerActionCommand extends Command
/**
* Handle the bulk power request.
*
* @param \Pterodactyl\Repositories\Wings\DaemonPowerRepository $powerRepository
* @param \Illuminate\Validation\Factory $validator
* @throws \Illuminate\Validation\ValidationException
*/
public function handle(DaemonPowerRepository $powerRepository, ValidatorFactory $validator)
@ -58,7 +56,7 @@ class BulkPowerActionCommand extends Command
}
$count = $this->getQueryBuilder($servers, $nodes)->count();
if (! $this->confirm(trans('command/messages.server.power.confirm', ['action' => $action, 'count' => $count])) && $this->input->isInteractive()) {
if (!$this->confirm(trans('command/messages.server.power.confirm', ['action' => $action, 'count' => $count])) && $this->input->isInteractive()) {
return;
}
@ -87,8 +85,6 @@ class BulkPowerActionCommand extends Command
/**
* Returns the query builder instance that will return the servers that should be affected.
*
* @param array $servers
* @param array $nodes
* @return \Illuminate\Database\Eloquent\Builder
*/
protected function getQueryBuilder(array $servers, array $nodes)
@ -97,11 +93,11 @@ class BulkPowerActionCommand extends Command
->where('suspended', false)
->where('installed', Server::STATUS_INSTALLED);
if (! empty($nodes) && ! empty($servers)) {
if (!empty($nodes) && !empty($servers)) {
$instance->whereIn('id', $servers)->orWhereIn('node_id', $nodes);
} elseif (empty($nodes) && ! empty($servers)) {
} elseif (empty($nodes) && !empty($servers)) {
$instance->whereIn('id', $servers);
} elseif (! empty($nodes) && empty($servers)) {
} elseif (!empty($nodes) && empty($servers)) {
$instance->whereIn('node_id', $nodes);
}

View file

@ -47,10 +47,6 @@ class BulkReinstallActionCommand extends Command
/**
* BulkReinstallActionCommand constructor.
*
* @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonRepository
* @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $configurationStructureService
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository
*/
public function __construct(
DaemonServerRepository $daemonRepository,
@ -71,7 +67,7 @@ class BulkReinstallActionCommand extends Command
{
$servers = $this->getServersToProcess();
if (! $this->confirm(trans('command/messages.server.reinstall.confirm')) && $this->input->isInteractive()) {
if (!$this->confirm(trans('command/messages.server.reinstall.confirm')) && $this->input->isInteractive()) {
return;
}

View file

@ -38,8 +38,6 @@ class DeleteUserCommand extends Command
/**
* DeleteUserCommand constructor.
*
* @param \Pterodactyl\Services\Users\UserDeletionService $deletionService
*/
public function __construct(UserDeletionService $deletionService)
{
@ -50,6 +48,7 @@ class DeleteUserCommand extends Command
/**
* @return bool
*
* @throws \Pterodactyl\Exceptions\DisplayException
*/
public function handle()
@ -79,7 +78,7 @@ class DeleteUserCommand extends Command
}
$this->table(['User ID', 'Email', 'Name'], $tableValues);
if (! $deleteUser = $this->ask(trans('command/messages.user.select_search_user'))) {
if (!$deleteUser = $this->ask(trans('command/messages.user.select_search_user'))) {
return $this->handle();
}
} else {
@ -92,7 +91,7 @@ class DeleteUserCommand extends Command
$deleteUser = $results->first();
}
if ($this->confirm(trans('command/messages.user.confirm_delete')) || ! $this->input->isInteractive()) {
if ($this->confirm(trans('command/messages.user.confirm_delete')) || !$this->input->isInteractive()) {
$this->deletionService->handle($deleteUser);
$this->info(trans('command/messages.user.deleted'));
}

View file

@ -31,8 +31,6 @@ class DisableTwoFactorCommand extends Command
/**
* DisableTwoFactorCommand constructor.
*
* @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository
*/
public function __construct(UserRepositoryInterface $repository)
{

View file

@ -31,8 +31,6 @@ class MakeUserCommand extends Command
/**
* MakeUserCommand constructor.
*
* @param \Pterodactyl\Services\Users\UserCreationService $creationService
*/
public function __construct(UserCreationService $creationService)
{
@ -55,7 +53,7 @@ class MakeUserCommand extends Command
$name_first = $this->option('name-first') ?? $this->ask(trans('command/messages.user.ask_name_first'));
$name_last = $this->option('name-last') ?? $this->ask(trans('command/messages.user.ask_name_last'));
if (is_null($password = $this->option('password')) && ! $this->option('no-password')) {
if (is_null($password = $this->option('password')) && !$this->option('no-password')) {
$this->warn(trans('command/messages.user.ask_password_help'));
$this->line(trans('command/messages.user.ask_password_tip'));
$password = $this->secret(trans('command/messages.user.ask_password'));

View file

@ -17,8 +17,6 @@ class Kernel extends ConsoleKernel
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
*/
protected function schedule(Schedule $schedule)
{

View file

@ -9,8 +9,6 @@ trait RequiresDatabaseMigrations
{
/**
* Checks if the migrations have finished running by comparing the last migration file.
*
* @return bool
*/
protected function hasCompletedMigrations(): bool
{
@ -19,7 +17,7 @@ trait RequiresDatabaseMigrations
$files = $migrator->getMigrationFiles(database_path('migrations'));
if (! $migrator->repositoryExists()) {
if (!$migrator->repositoryExists()) {
return false;
}
@ -34,8 +32,6 @@ trait RequiresDatabaseMigrations
* Throw a massive error into the console to hopefully catch the users attention and get
* them to properly run the migrations rather than ignoring all of the other previous
* errors...
*
* @return int
*/
protected function showMigrationWarning(): int
{

View file

@ -8,8 +8,6 @@ interface ReceivesEvents
{
/**
* Handles receiving an event from the application.
*
* @param \Pterodactyl\Events\Event $notification
*/
public function handle(Event $notification): void;
}

View file

@ -17,7 +17,7 @@ interface CriteriaInterface
* Apply selected criteria to a repository call.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @param \Pterodactyl\Repositories\Repository $repository
*
* @return mixed
*/
public function apply($model, Repository $repository);

View file

@ -17,7 +17,8 @@ interface HashidsInterface extends VendorHashidsInterface
* Decode an encoded hashid and return the first result.
*
* @param string $encoded
* @param null $default
* @param null $default
*
* @return mixed
*
* @throws \InvalidArgumentException

View file

@ -8,8 +8,6 @@ interface ClientPermissionsRequest
* Returns the permissions string indicating which permission should be used to
* validate that the authenticated user has permission to perform this action aganist
* the given resource (server).
*
* @return string
*/
public function permission(): string;
}

View file

@ -7,18 +7,12 @@ interface AllocationRepositoryInterface extends RepositoryInterface
/**
* Return all of the allocations that exist for a node that are not currently
* allocated.
*
* @param int $node
* @return array
*/
public function getUnassignedAllocationIds(int $node): array;
/**
* Return a single allocation from those meeting the requirements.
*
* @param array $nodes
* @param array $ports
* @param bool $dedicated
* @return \Pterodactyl\Models\Allocation|null
*/
public function getRandomAllocation(array $nodes, array $ports, bool $dedicated = false);

View file

@ -9,35 +9,21 @@ interface ApiKeyRepositoryInterface extends RepositoryInterface
{
/**
* Get all of the account API keys that exist for a specific user.
*
* @param \Pterodactyl\Models\User $user
* @return \Illuminate\Support\Collection
*/
public function getAccountKeys(User $user): Collection;
/**
* Get all of the application API keys that exist for a specific user.
*
* @param \Pterodactyl\Models\User $user
* @return \Illuminate\Support\Collection
*/
public function getApplicationKeys(User $user): Collection;
/**
* Delete an account API key from the panel for a specific user.
*
* @param \Pterodactyl\Models\User $user
* @param string $identifier
* @return int
*/
public function deleteAccountKey(User $user, string $identifier): int;
/**
* Delete an application API key from the panel for a specific user.
*
* @param \Pterodactyl\Models\User $user
* @param string $identifier
* @return int
*/
public function deleteApplicationKey(User $user, string $identifier): int;
}

View file

@ -9,8 +9,6 @@ interface DatabaseHostRepositoryInterface extends RepositoryInterface
/**
* Return database hosts with a count of databases and the node
* information for which it is attached.
*
* @return \Illuminate\Support\Collection
*/
public function getWithViewDetails(): Collection;
}

View file

@ -8,89 +8,60 @@ use Illuminate\Contracts\Pagination\LengthAwarePaginator;
interface DatabaseRepositoryInterface extends RepositoryInterface
{
const DEFAULT_CONNECTION_NAME = 'dynamic';
public const DEFAULT_CONNECTION_NAME = 'dynamic';
/**
* Set the connection name to execute statements against.
*
* @param string $connection
* @return $this
*/
public function setConnection(string $connection);
/**
* Return the connection to execute statements against.
*
* @return string
*/
public function getConnection(): string;
/**
* Return all of the databases belonging to a server.
*
* @param int $server
* @return \Illuminate\Support\Collection
*/
public function getDatabasesForServer(int $server): Collection;
/**
* Return all of the databases for a given host with the server relationship loaded.
*
* @param int $host
* @param int $count
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
*/
public function getDatabasesForHost(int $host, int $count = 25): LengthAwarePaginator;
/**
* Create a new database on a given connection.
*
* @param string $database
* @return bool
*/
public function createDatabase(string $database): bool;
/**
* Create a new database user on a given connection.
*
* @param string $username
* @param string $remote
* @param string $password
* @param $max_connections
* @return bool
*/
public function createUser(string $username, string $remote, string $password, string $max_connections): bool;
/**
* Give a specific user access to a given database.
*
* @param string $database
* @param string $username
* @param string $remote
* @return bool
*/
public function assignUserToDatabase(string $database, string $username, string $remote): bool;
/**
* Flush the privileges for a given connection.
*
* @return bool
*/
public function flush(): bool;
/**
* Drop a given database on a specific connection.
*
* @param string $database
* @return bool
*/
public function dropDatabase(string $database): bool;
/**
* Drop a given user on a specific connection.
*
* @param string $username
* @param string $remote
* @return mixed
*/
public function dropUser(string $username, string $remote): bool;

View file

@ -17,17 +17,12 @@ interface EggRepositoryInterface extends RepositoryInterface
/**
* Return an egg with the variables relation attached.
*
* @param int $id
* @return \Pterodactyl\Models\Egg
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithVariables(int $id): Egg;
/**
* Return all eggs and their relations to be used in the daemon API.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getAllWithCopyAttributes(): Collection;
@ -35,27 +30,18 @@ interface EggRepositoryInterface extends RepositoryInterface
* Return an egg with the scriptFrom and configFrom relations loaded onto the model.
*
* @param int|string $value
* @param string $column
* @return \Pterodactyl\Models\Egg
*/
public function getWithCopyAttributes($value, string $column = 'id'): Egg;
/**
* Return all of the data needed to export a service.
*
* @param int $id
* @return \Pterodactyl\Models\Egg
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithExportAttributes(int $id): Egg;
/**
* Confirm a copy script belongs to the same nest as the item trying to use it.
*
* @param int $copyFromId
* @param int $service
* @return bool
*/
public function isCopyableScript(int $copyFromId, int $service): bool;
}

View file

@ -16,9 +16,6 @@ interface EggVariableRepositoryInterface extends RepositoryInterface
/**
* Return editable variables for a given egg. Editable variables must be set to
* user viewable in order to be picked up by this function.
*
* @param int $egg
* @return \Illuminate\Support\Collection
*/
public function getEditableVariables(int $egg): Collection;
}

View file

@ -9,22 +9,17 @@ interface LocationRepositoryInterface extends RepositoryInterface
{
/**
* Return locations with a count of nodes and servers attached to it.
*
* @return \Illuminate\Support\Collection
*/
public function getAllWithDetails(): Collection;
/**
* Return all of the available locations with the nodes as a relationship.
*
* @return \Illuminate\Support\Collection
*/
public function getAllWithNodes(): Collection;
/**
* Return all of the nodes and their respective count of servers for a location.
*
* @param int $id
* @return mixed
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
@ -34,7 +29,6 @@ interface LocationRepositoryInterface extends RepositoryInterface
/**
* Return a location and the count of nodes in that location.
*
* @param int $id
* @return mixed
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException

View file

@ -17,6 +17,7 @@ interface NestRepositoryInterface extends RepositoryInterface
* Return a nest or all nests with their associated eggs and variables.
*
* @param int $id
*
* @return \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Nest
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
@ -26,7 +27,6 @@ interface NestRepositoryInterface extends RepositoryInterface
/**
* Return a nest or all nests and the count of eggs and servers for that nest.
*
* @param int|null $id
* @return \Pterodactyl\Models\Nest|\Illuminate\Database\Eloquent\Collection
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
@ -36,9 +36,6 @@ interface NestRepositoryInterface extends RepositoryInterface
/**
* Return a nest along with its associated eggs and the servers relation on those eggs.
*
* @param int $id
* @return \Pterodactyl\Models\Nest
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithEggServers(int $id): Nest;

View file

@ -7,48 +7,32 @@ use Illuminate\Support\Collection;
interface NodeRepositoryInterface extends RepositoryInterface
{
const THRESHOLD_PERCENTAGE_LOW = 75;
const THRESHOLD_PERCENTAGE_MEDIUM = 90;
public const THRESHOLD_PERCENTAGE_LOW = 75;
public const THRESHOLD_PERCENTAGE_MEDIUM = 90;
/**
* Return the usage stats for a single node.
*
* @param \Pterodactyl\Models\Node $node
* @return array
*/
public function getUsageStats(Node $node): array;
/**
* Return the usage stats for a single node.
*
* @param \Pterodactyl\Models\Node $node
* @return array
*/
public function getUsageStatsRaw(Node $node): array;
/**
* Return a single node with location and server information.
*
* @param \Pterodactyl\Models\Node $node
* @param bool $refresh
* @return \Pterodactyl\Models\Node
*/
public function loadLocationAndServerCount(Node $node, bool $refresh = false): Node;
/**
* Attach a paginated set of allocations to a node mode including
* any servers that are also attached to those allocations.
*
* @param \Pterodactyl\Models\Node $node
* @param bool $refresh
* @return \Pterodactyl\Models\Node
*/
public function loadNodeAllocations(Node $node, bool $refresh = false): Node;
/**
* Return a collection of nodes for all locations to use in server creation UI.
*
* @return \Illuminate\Support\Collection
*/
public function getNodesForServerCreation(): Collection;
}

View file

@ -39,6 +39,7 @@ interface RepositoryInterface
* An array of columns to filter the response by.
*
* @param array|string $columns
*
* @return $this
*/
public function setColumns($columns = ['*']);
@ -62,7 +63,6 @@ interface RepositoryInterface
* Set whether or not the repository should return a fresh model
* when changes are committed.
*
* @param bool $fresh
* @return $this
*/
public function setFreshModel(bool $fresh = true);
@ -70,9 +70,6 @@ interface RepositoryInterface
/**
* Create a new model instance and persist it to the database.
*
* @param array $fields
* @param bool $validate
* @param bool $force
* @return mixed
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
@ -82,7 +79,6 @@ interface RepositoryInterface
/**
* Find a model that has the specific ID passed.
*
* @param int $id
* @return mixed
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
@ -91,16 +87,12 @@ interface RepositoryInterface
/**
* Find a model matching an array of where clauses.
*
* @param array $fields
* @return \Illuminate\Support\Collection
*/
public function findWhere(array $fields): Collection;
/**
* Find and return the first matching instance for the given fields.
*
* @param array $fields
* @return mixed
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
@ -109,25 +101,16 @@ interface RepositoryInterface
/**
* Return a count of records matching the passed arguments.
*
* @param array $fields
* @return int
*/
public function findCountWhere(array $fields): int;
/**
* Delete a given record from the database.
*
* @param int $id
* @return int
*/
public function delete(int $id): int;
/**
* Delete records matching the given attributes.
*
* @param array $attributes
* @return int
*/
public function deleteWhere(array $attributes): int;
@ -135,9 +118,7 @@ interface RepositoryInterface
* Update a given ID with the passed array of fields.
*
* @param int $id
* @param array $fields
* @param bool $validate
* @param bool $force
*
* @return mixed
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
@ -148,21 +129,12 @@ interface RepositoryInterface
/**
* Perform a mass update where matching records are updated using whereIn.
* This does not perform any model data validation.
*
* @param string $column
* @param array $values
* @param array $fields
* @return int
*/
public function updateWhereIn(string $column, array $values, array $fields): int;
/**
* Update a record if it exists in the database, otherwise create it.
*
* @param array $where
* @param array $fields
* @param bool $validate
* @param bool $force
* @return mixed
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
@ -171,40 +143,27 @@ interface RepositoryInterface
/**
* Return all records associated with the given model.
*
* @return Collection
*/
public function all(): Collection;
/**
* Return a paginated result set using a search term if set on the repository.
*
* @param int $perPage
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
*/
public function paginated(int $perPage): LengthAwarePaginator;
/**
* Insert a single or multiple records into the database at once skipping
* validation and mass assignment checking.
*
* @param array $data
* @return bool
*/
public function insert(array $data): bool;
/**
* Insert multiple records into the database and ignore duplicates.
*
* @param array $values
* @return bool
*/
public function insertIgnore(array $values): bool;
/**
* Get the amount of entries in the database.
*
* @return int
*/
public function count(): int;
}

View file

@ -9,18 +9,12 @@ interface ScheduleRepositoryInterface extends RepositoryInterface
{
/**
* Return all of the schedules for a given server.
*
* @param int $server
* @return \Illuminate\Support\Collection
*/
public function findServerSchedules(int $server): Collection;
/**
* Return a schedule model with all of the associated tasks as a relationship.
*
* @param int $schedule
* @return \Pterodactyl\Models\Schedule
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getScheduleWithTasks(int $schedule): Schedule;

View file

@ -10,37 +10,22 @@ interface ServerRepositoryInterface extends RepositoryInterface
{
/**
* Load the egg relations onto the server model.
*
* @param \Pterodactyl\Models\Server $server
* @param bool $refresh
* @return \Pterodactyl\Models\Server
*/
public function loadEggRelations(Server $server, bool $refresh = false): Server;
/**
* Return a collection of servers with their associated data for rebuild operations.
*
* @param int|null $server
* @param int|null $node
* @return \Illuminate\Support\Collection
*/
public function getDataForRebuild(int $server = null, int $node = null): Collection;
/**
* Return a collection of servers with their associated data for reinstall operations.
*
* @param int|null $server
* @param int|null $node
* @return \Illuminate\Support\Collection
*/
public function getDataForReinstall(int $server = null, int $node = null): Collection;
/**
* Return a server model and all variables associated with the server.
*
* @param int $id
* @return \Pterodactyl\Models\Server
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function findWithVariables(int $id): Server;
@ -49,28 +34,16 @@ interface ServerRepositoryInterface extends RepositoryInterface
* Get the primary allocation for a given server. If a model is passed into
* the function, load the allocation relationship onto it. Otherwise, find and
* return the server from the database.
*
* @param \Pterodactyl\Models\Server $server
* @param bool $refresh
* @return \Pterodactyl\Models\Server
*/
public function getPrimaryAllocation(Server $server, bool $refresh = false): Server;
/**
* Return enough data to be used for the creation of a server via the daemon.
*
* @param \Pterodactyl\Models\Server $server
* @param bool $refresh
* @return \Pterodactyl\Models\Server
*/
public function getDataForCreation(Server $server, bool $refresh = false): Server;
/**
* Load associated databases onto the server model.
*
* @param \Pterodactyl\Models\Server $server
* @param bool $refresh
* @return \Pterodactyl\Models\Server
*/
public function loadDatabaseRelations(Server $server, bool $refresh = false): Server;
@ -78,46 +51,28 @@ interface ServerRepositoryInterface extends RepositoryInterface
* Get data for use when updating a server on the Daemon. Returns an array of
* the egg which is used for build and rebuild. Only loads relations
* if they are missing, or refresh is set to true.
*
* @param \Pterodactyl\Models\Server $server
* @param bool $refresh
* @return array
*/
public function getDaemonServiceData(Server $server, bool $refresh = false): array;
/**
* Return a server by UUID.
*
* @param string $uuid
* @return \Pterodactyl\Models\Server
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getByUuid(string $uuid): Server;
/**
* Check if a given UUID and UUID-Short string are unique to a server.
*
* @param string $uuid
* @param string $short
* @return bool
*/
public function isUniqueUuidCombo(string $uuid, string $short): bool;
/**
* Get the amount of servers that are suspended.
*
* @return int
*/
public function getSuspendedServersCount(): int;
/**
* Returns all of the servers that exist for a given node in a paginated response.
*
* @param int $node
* @param int $limit
*
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
*/
public function loadAllServersForNode(int $node, int $limit): LengthAwarePaginator;
}

View file

@ -8,17 +8,12 @@ interface SessionRepositoryInterface extends RepositoryInterface
{
/**
* Return all of the active sessions for a user.
*
* @param int $user
* @return \Illuminate\Support\Collection
*/
public function getUserSessions(int $user): Collection;
/**
* Delete a session for a given user.
*
* @param int $user
* @param string $session
* @return int|null
*/
public function deleteUserSession(int $user, string $session);

View file

@ -7,9 +7,6 @@ interface SettingsRepositoryInterface extends RepositoryInterface
/**
* Store a new persistent setting in the database.
*
* @param string $key
* @param string|null $value
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
@ -18,16 +15,14 @@ interface SettingsRepositoryInterface extends RepositoryInterface
/**
* Retrieve a persistent setting from the database.
*
* @param string $key
* @param mixed $default
*
* @return mixed
*/
public function get(string $key, $default);
/**
* Remove a key from the database cache.
*
* @param string $key
*/
public function forget(string $key);
}

View file

@ -8,29 +8,17 @@ interface SubuserRepositoryInterface extends RepositoryInterface
{
/**
* Return a subuser with the associated server relationship.
*
* @param \Pterodactyl\Models\Subuser $subuser
* @param bool $refresh
* @return \Pterodactyl\Models\Subuser
*/
public function loadServerAndUserRelations(Subuser $subuser, bool $refresh = false): Subuser;
/**
* Return a subuser with the associated permissions relationship.
*
* @param \Pterodactyl\Models\Subuser $subuser
* @param bool $refresh
* @return \Pterodactyl\Models\Subuser
*/
public function getWithPermissions(Subuser $subuser, bool $refresh = false): Subuser;
/**
* Return a subuser and associated permissions given a user_id and server_id.
*
* @param int $user
* @param int $server
* @return \Pterodactyl\Models\Subuser
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithPermissionsUsingUserAndServer(int $user, int $server): Subuser;

View file

@ -9,9 +9,6 @@ interface TaskRepositoryInterface extends RepositoryInterface
/**
* Get a task and the server relationship for that task.
*
* @param int $id
* @return \Pterodactyl\Models\Task
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getTaskForJobProcess(int $id): Task;
@ -19,8 +16,6 @@ interface TaskRepositoryInterface extends RepositoryInterface
/**
* Returns the next task in a schedule.
*
* @param int $schedule
* @param int $index
* @return \Pterodactyl\Models\Task|null
*/
public function getNextTask(int $schedule, int $index);

View file

@ -25,8 +25,6 @@ class Created
/**
* Create a new event instance.
*
* @param \Pterodactyl\Models\Server $server
*/
public function __construct(Server $server)
{

View file

@ -25,8 +25,6 @@ class Creating
/**
* Create a new event instance.
*
* @param \Pterodactyl\Models\Server $server
*/
public function __construct(Server $server)
{

View file

@ -25,8 +25,6 @@ class Deleted
/**
* Create a new event instance.
*
* @param \Pterodactyl\Models\Server $server
*/
public function __construct(Server $server)
{

View file

@ -25,8 +25,6 @@ class Deleting
/**
* Create a new event instance.
*
* @param \Pterodactyl\Models\Server $server
*/
public function __construct(Server $server)
{

View file

@ -25,8 +25,6 @@ class Saved
/**
* Create a new event instance.
*
* @param \Pterodactyl\Models\Server $server
*/
public function __construct(Server $server)
{

View file

@ -25,8 +25,6 @@ class Saving
/**
* Create a new event instance.
*
* @param \Pterodactyl\Models\Server $server
*/
public function __construct(Server $server)
{

View file

@ -25,8 +25,6 @@ class Updated
/**
* Create a new event instance.
*
* @param \Pterodactyl\Models\Server $server
*/
public function __construct(Server $server)
{

View file

@ -25,8 +25,6 @@ class Updating
/**
* Create a new event instance.
*
* @param \Pterodactyl\Models\Server $server
*/
public function __construct(Server $server)
{

View file

@ -25,8 +25,6 @@ class Created
/**
* Create a new event instance.
*
* @param \Pterodactyl\Models\Subuser $subuser
*/
public function __construct(Subuser $subuser)
{

View file

@ -25,8 +25,6 @@ class Creating
/**
* Create a new event instance.
*
* @param \Pterodactyl\Models\Subuser $subuser
*/
public function __construct(Subuser $subuser)
{

View file

@ -25,8 +25,6 @@ class Deleted
/**
* Create a new event instance.
*
* @param \Pterodactyl\Models\Subuser $subuser
*/
public function __construct(Subuser $subuser)
{

View file

@ -25,8 +25,6 @@ class Deleting
/**
* Create a new event instance.
*
* @param \Pterodactyl\Models\Subuser $subuser
*/
public function __construct(Subuser $subuser)
{

View file

@ -25,8 +25,6 @@ class Created
/**
* Create a new event instance.
*
* @param \Pterodactyl\Models\User $user
*/
public function __construct(User $user)
{

View file

@ -25,8 +25,6 @@ class Creating
/**
* Create a new event instance.
*
* @param \Pterodactyl\Models\User $user
*/
public function __construct(User $user)
{

View file

@ -25,8 +25,6 @@ class Deleted
/**
* Create a new event instance.
*
* @param \Pterodactyl\Models\User $user
*/
public function __construct(User $user)
{

View file

@ -25,8 +25,6 @@ class Deleting
/**
* Create a new event instance.
*
* @param \Pterodactyl\Models\User $user
*/
public function __construct(User $user)
{

View file

@ -11,10 +11,10 @@ use Prologue\Alerts\AlertsMessageBag;
class DisplayException extends PterodactylException
{
const LEVEL_DEBUG = 'debug';
const LEVEL_INFO = 'info';
const LEVEL_WARNING = 'warning';
const LEVEL_ERROR = 'error';
public const LEVEL_DEBUG = 'debug';
public const LEVEL_INFO = 'info';
public const LEVEL_WARNING = 'warning';
public const LEVEL_ERROR = 'error';
/**
* @var string
@ -25,9 +25,8 @@ class DisplayException extends PterodactylException
* Exception constructor.
*
* @param string $message
* @param Throwable|null $previous
* @param string $level
* @param int $code
* @param int $code
*/
public function __construct($message, Throwable $previous = null, $level = self::LEVEL_ERROR, $code = 0)
{
@ -58,6 +57,7 @@ class DisplayException extends PterodactylException
* request originated from an API hit, return the error in JSONAPI spec format.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
*/
public function render($request)
@ -83,7 +83,7 @@ class DisplayException extends PterodactylException
*/
public function report()
{
if (! $this->getPrevious() instanceof Exception || ! Handler::isReportable($this->getPrevious())) {
if (!$this->getPrevious() instanceof Exception || !Handler::isReportable($this->getPrevious())) {
return null;
}

View file

@ -112,7 +112,7 @@ class Handler extends ExceptionHandler
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Throwable $exception
*
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Throwable
@ -142,7 +142,7 @@ class Handler extends ExceptionHandler
* calls to the API.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Validation\ValidationException $exception
*
* @return \Illuminate\Http\JsonResponse
*/
public function invalidJson($request, ValidationException $exception)
@ -162,7 +162,8 @@ class Handler extends ExceptionHandler
$meta = [
'source_field' => $field,
'rule' => str_replace(self::PTERODACTYL_RULE_STRING, 'p_', Arr::get(
$codes, str_replace('.', '_', $field) . '.' . $key
$codes,
str_replace('.', '_', $field) . '.' . $key
)),
];
@ -183,10 +184,6 @@ class Handler extends ExceptionHandler
/**
* Return the exception as a JSONAPI representation for use on API requests.
*
* @param \Throwable $exception
* @param array $override
* @return array
*/
public static function convertToArray(Throwable $exception, array $override = []): array
{
@ -225,9 +222,6 @@ class Handler extends ExceptionHandler
/**
* Return an array of exceptions that should not be reported.
*
* @param \Exception $exception
* @return bool
*/
public static function isReportable(Exception $exception): bool
{
@ -238,7 +232,7 @@ class Handler extends ExceptionHandler
* Convert an authentication exception into an unauthenticated response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception
*
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
*/
protected function unauthenticated($request, AuthenticationException $exception)
@ -254,7 +248,6 @@ class Handler extends ExceptionHandler
* Converts an exception into an array to render in the response. Overrides
* Laravel's built-in converter to output as a JSONAPI spec compliant object.
*
* @param \Throwable $exception
* @return array
*/
protected function convertExceptionToArray(Throwable $exception)

View file

@ -19,9 +19,6 @@ class DaemonConnectionException extends DisplayException
/**
* Throw a displayable exception caused by a daemon connection error.
*
* @param \GuzzleHttp\Exception\GuzzleException $previous
* @param bool $useStatusCode
*/
public function __construct(GuzzleException $previous, bool $useStatusCode = true)
{
@ -38,7 +35,7 @@ class DaemonConnectionException extends DisplayException
// Attempt to pull the actual error message off the response and return that if it is not
// a 500 level error.
if ($this->statusCode < 500 && ! is_null($response)) {
if ($this->statusCode < 500 && !is_null($response)) {
$body = $response->getBody();
if (is_string($body) || (is_object($body) && method_exists($body, '__toString'))) {
$body = json_decode(is_string($body) ? $body : $body->__toString(), true);

View file

@ -9,9 +9,6 @@ class HttpForbiddenException extends HttpException
{
/**
* HttpForbiddenException constructor.
*
* @param string|null $message
* @param \Throwable|null $previous
*/
public function __construct(string $message = null, \Throwable $previous = null)
{

View file

@ -11,8 +11,6 @@ class TwoFactorAuthRequiredException extends HttpException implements HttpExcept
{
/**
* TwoFactorAuthRequiredException constructor.
*
* @param \Throwable|null $previous
*/
public function __construct(Throwable $previous = null)
{

View file

@ -18,8 +18,6 @@ class DataValidationException extends PterodactylException implements HttpExcept
/**
* DataValidationException constructor.
*
* @param \Illuminate\Contracts\Validation\Validator $validator
*/
public function __construct(Validator $validator)
{

View file

@ -8,8 +8,6 @@ class TooManyBackupsException extends DisplayException
{
/**
* TooManyBackupsException constructor.
*
* @param int $backupLimit
*/
public function __construct(int $backupLimit)
{

View file

@ -10,9 +10,6 @@ class ServiceLimitExceededException extends DisplayException
/**
* Exception thrown when something goes over a defined limit, such as allocated
* ports, tasks, databases, etc.
*
* @param string $message
* @param \Throwable|null $previous
*/
public function __construct(string $message, Throwable $previous = null)
{

View file

@ -42,8 +42,6 @@ class BackupManager
/**
* BackupManager constructor.
*
* @param \Illuminate\Foundation\Application $app
*/
public function __construct(Application $app)
{
@ -54,7 +52,6 @@ class BackupManager
/**
* Returns a backup adapter instance.
*
* @param string|null $name
* @return \League\Flysystem\AdapterInterface
*/
public function adapter(string $name = null)
@ -65,8 +62,8 @@ class BackupManager
/**
* Set the given backup adapter instance.
*
* @param string $name
* @param \League\Flysystem\AdapterInterface $disk
*
* @return $this
*/
public function set(string $name, $disk)
@ -79,7 +76,6 @@ class BackupManager
/**
* Gets a backup adapter.
*
* @param string $name
* @return \League\Flysystem\AdapterInterface
*/
protected function get(string $name)
@ -90,7 +86,6 @@ class BackupManager
/**
* Resolve the given backup disk.
*
* @param string $name
* @return \League\Flysystem\AdapterInterface
*/
protected function resolve(string $name)
@ -98,9 +93,7 @@ class BackupManager
$config = $this->getConfig($name);
if (empty($config['adapter'])) {
throw new InvalidArgumentException(
"Backup disk [{$name}] does not have a configured adapter."
);
throw new InvalidArgumentException("Backup disk [{$name}] does not have a configured adapter.");
}
$adapter = $config['adapter'];
@ -124,7 +117,6 @@ class BackupManager
/**
* Calls a custom creator for a given adapter type.
*
* @param array $config
* @return \League\Flysystem\AdapterInterface
*/
protected function callCustomCreator(array $config)
@ -139,7 +131,6 @@ class BackupManager
/**
* Creates a new wings adapter.
*
* @param array $config
* @return \League\Flysystem\AdapterInterface
*/
public function createWingsAdapter(array $config)
@ -150,14 +141,13 @@ class BackupManager
/**
* Creates a new S3 adapter.
*
* @param array $config
* @return \League\Flysystem\AdapterInterface
*/
public function createS3Adapter(array $config)
{
$config['version'] = 'latest';
if (! empty($config['key']) && ! empty($config['secret'])) {
if (!empty($config['key']) && !empty($config['secret'])) {
$config['credentials'] = Arr::only($config, ['key', 'secret', 'token']);
}
@ -169,7 +159,6 @@ class BackupManager
/**
* Returns the configuration associated with a given backup type.
*
* @param string $name
* @return array
*/
protected function getConfig(string $name)
@ -189,8 +178,6 @@ class BackupManager
/**
* Set the default session driver name.
*
* @param string $name
*/
public function setDefaultAdapter(string $name)
{
@ -201,6 +188,7 @@ class BackupManager
* Unset the given adapter instances.
*
* @param string|string[] $adapter
*
* @return $this
*/
public function forget($adapter)
@ -215,8 +203,6 @@ class BackupManager
/**
* Register a custom adapter creator closure.
*
* @param string $adapter
* @param \Closure $callback
* @return $this
*/
public function extend(string $adapter, Closure $callback)

View file

@ -16,9 +16,9 @@ use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface;
class DynamicDatabaseConnection
{
const DB_CHARSET = 'utf8';
const DB_COLLATION = 'utf8_unicode_ci';
const DB_DRIVER = 'mysql';
public const DB_CHARSET = 'utf8';
public const DB_COLLATION = 'utf8_unicode_ci';
public const DB_DRIVER = 'mysql';
/**
* @var \Illuminate\Config\Repository
@ -37,10 +37,6 @@ class DynamicDatabaseConnection
/**
* DynamicDatabaseConnection constructor.
*
* @param \Illuminate\Config\Repository $config
* @param \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface $repository
* @param \Illuminate\Contracts\Encryption\Encrypter $encrypter
*/
public function __construct(
ConfigRepository $config,
@ -55,15 +51,15 @@ class DynamicDatabaseConnection
/**
* Adds a dynamic database connection entry to the runtime config.
*
* @param string $connection
* @param string $connection
* @param \Pterodactyl\Models\DatabaseHost|int $host
* @param string $database
* @param string $database
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function set($connection, $host, $database = 'mysql')
{
if (! $host instanceof DatabaseHost) {
if (!$host instanceof DatabaseHost) {
$host = $this->repository->find($host);
}

View file

@ -20,7 +20,7 @@ class Hashids extends VendorHashids implements HashidsInterface
public function decodeFirst($encoded, $default = null)
{
$result = $this->decode($encoded);
if (! is_array($result)) {
if (!is_array($result)) {
return $default;
}

View file

@ -13,14 +13,11 @@ final class TimestampDates implements ClaimsFormatter
* by Wings and will cause a flood of errors and panic conditions because the times
* cannot be parsed correctly. The default is time with microseconds, we just need
* to use the normal unix timestamp here.
*
* @param array $claims
* @return array
*/
public function formatClaims(array $claims): array
{
foreach (RegisteredClaims::DATE_CLAIMS as $claim) {
if (! array_key_exists($claim, $claims)) {
if (!array_key_exists($claim, $claims)) {
continue;
}

View file

@ -10,7 +10,7 @@ class PterodactylSerializer extends ArraySerializer
* Serialize an item.
*
* @param string $resourceKey
* @param array $data
*
* @return array
*/
public function item($resourceKey, array $data)
@ -25,7 +25,7 @@ class PterodactylSerializer extends ArraySerializer
* Serialize a collection.
*
* @param string $resourceKey
* @param array $data
*
* @return array
*/
public function collection($resourceKey, array $data)
@ -59,6 +59,7 @@ class PterodactylSerializer extends ArraySerializer
*
* @param array $transformedData
* @param array $includedData
*
* @return array
*/
public function mergeIncludes($transformedData, $includedData)

View file

@ -22,7 +22,7 @@ class Fractal extends SpatieFractal
{
// Set the serializer by default.
if (is_null($this->serializer)) {
$this->serializer = new PterodactylSerializer;
$this->serializer = new PterodactylSerializer();
}
// Automatically set the paginator on the response object if the

View file

@ -12,9 +12,6 @@ final class Time
* for named timezones in MySQL.
*
* Returns the timezone as a string like +08:00 or -05:00 depending on the app timezone.
*
* @param string $timezone
* @return string
*/
public static function getMySQLTimezoneOffset(string $timezone): string
{

View file

@ -13,9 +13,6 @@ class Utilities
/**
* Generates a random string and injects special characters into it, in addition to
* the randomness of the alpha-numeric default response.
*
* @param int $length
* @return string
*/
public static function randomStringWithSpecialCharacters(int $length = 16): string
{
@ -23,7 +20,7 @@ class Utilities
// Given a random string of characters, randomly loop through the characters and replace some
// with special characters to avoid issues with MySQL password requirements on some servers.
try {
for ($i = 0; $i < random_int(2, 6); $i++) {
for ($i = 0; $i < random_int(2, 6); ++$i) {
$character = ['!', '@', '=', '.', '+', '^'][random_int(0, 5)];
$string = substr_replace($string, $character, random_int(0, $length - 1), 1);
@ -39,11 +36,6 @@ class Utilities
/**
* Converts schedule cron data into a carbon object.
*
* @param string $minute
* @param string $hour
* @param string $dayOfMonth
* @param string $month
* @param string $dayOfWeek
* @return \Carbon\Carbon
*/
public static function getScheduleNextRunDate(string $minute, string $hour, string $dayOfMonth, string $month, string $dayOfWeek)
@ -54,8 +46,8 @@ class Utilities
}
/**
* @param string $name
* @param mixed $default
*
* @return string
*/
public static function checked(string $name, $default)

View file

@ -33,10 +33,6 @@ class ApiController extends Controller
/**
* ApplicationApiController constructor.
*
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface $repository
* @param \Pterodactyl\Services\Api\KeyCreationService $keyCreationService
*/
public function __construct(
AlertsMessageBag $alert,
@ -50,9 +46,6 @@ class ApiController extends Controller
/**
* Render view showing all of a user's application API keys.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View
*/
public function index(Request $request): View
{
@ -64,7 +57,6 @@ class ApiController extends Controller
/**
* Render view allowing an admin to create a new application API key.
*
* @return \Illuminate\View\View
* @throws \ReflectionException
*/
public function create(): View
@ -85,9 +77,6 @@ class ApiController extends Controller
/**
* Store the new key and redirect the user back to the application key listing.
*
* @param \Pterodactyl\Http\Requests\Admin\Api\StoreApplicationApiKeyRequest $request
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/
public function store(StoreApplicationApiKeyRequest $request): RedirectResponse
@ -104,10 +93,6 @@ class ApiController extends Controller
/**
* Delete an application API key from the database.
*
* @param \Illuminate\Http\Request $request
* @param string $identifier
* @return \Illuminate\Http\Response
*/
public function delete(Request $request, string $identifier): Response
{

View file

@ -15,8 +15,6 @@ class BaseController extends Controller
/**
* BaseController constructor.
*
* @param \Pterodactyl\Services\Helpers\SoftwareVersionService $version
*/
public function __construct(SoftwareVersionService $version)
{
@ -25,8 +23,6 @@ class BaseController extends Controller
/**
* Return the admin index view.
*
* @return \Illuminate\View\View
*/
public function index(): View
{

View file

@ -56,14 +56,6 @@ class DatabaseController extends Controller
/**
* DatabaseController constructor.
*
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface $repository
* @param \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface $databaseRepository
* @param \Pterodactyl\Services\Databases\Hosts\HostCreationService $creationService
* @param \Pterodactyl\Services\Databases\Hosts\HostDeletionService $deletionService
* @param \Pterodactyl\Services\Databases\Hosts\HostUpdateService $updateService
* @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $locationRepository
*/
public function __construct(
AlertsMessageBag $alert,
@ -85,8 +77,6 @@ class DatabaseController extends Controller
/**
* Display database host index.
*
* @return \Illuminate\View\View
*/
public function index(): View
{
@ -99,9 +89,6 @@ class DatabaseController extends Controller
/**
* Display database host to user.
*
* @param int $host
* @return \Illuminate\View\View
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function view(int $host): View
@ -116,9 +103,6 @@ class DatabaseController extends Controller
/**
* Handle request to create a new database host.
*
* @param \Pterodactyl\Http\Requests\Admin\DatabaseHostFormRequest $request
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Throwable
*/
public function create(DatabaseHostFormRequest $request): RedirectResponse
@ -145,10 +129,6 @@ class DatabaseController extends Controller
/**
* Handle updating database host.
*
* @param \Pterodactyl\Http\Requests\Admin\DatabaseHostFormRequest $request
* @param \Pterodactyl\Models\DatabaseHost $host
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Throwable
*/
public function update(DatabaseHostFormRequest $request, DatabaseHost $host): RedirectResponse
@ -178,9 +158,6 @@ class DatabaseController extends Controller
/**
* Handle request to delete a database host.
*
* @param int $host
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Service\HasActiveServersException
*/
public function delete(int $host): RedirectResponse

View file

@ -48,12 +48,6 @@ class LocationController extends Controller
/**
* LocationController constructor.
*
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Pterodactyl\Services\Locations\LocationCreationService $creationService
* @param \Pterodactyl\Services\Locations\LocationDeletionService $deletionService
* @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $repository
* @param \Pterodactyl\Services\Locations\LocationUpdateService $updateService
*/
public function __construct(
AlertsMessageBag $alert,
@ -85,6 +79,7 @@ class LocationController extends Controller
* Return the location view page.
*
* @param int $id
*
* @return \Illuminate\View\View
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
@ -99,7 +94,6 @@ class LocationController extends Controller
/**
* Handle request to create new location.
*
* @param \Pterodactyl\Http\Requests\Admin\LocationFormRequest $request
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Throwable
@ -115,8 +109,6 @@ class LocationController extends Controller
/**
* Handle request to update or delete location.
*
* @param \Pterodactyl\Http\Requests\Admin\LocationFormRequest $request
* @param \Pterodactyl\Models\Location $location
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Throwable
@ -136,7 +128,6 @@ class LocationController extends Controller
/**
* Delete a location from the system.
*
* @param \Pterodactyl\Models\Location $location
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Exception

View file

@ -38,11 +38,6 @@ class MountController extends Controller
/**
* MountController constructor.
*
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $nestRepository
* @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $locationRepository
* @param \Pterodactyl\Repositories\Eloquent\MountRepository $repository
*/
public function __construct(
AlertsMessageBag $alert,
@ -72,6 +67,7 @@ class MountController extends Controller
* Return the mount view page.
*
* @param string $id
*
* @return \Illuminate\View\View
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
@ -91,7 +87,6 @@ class MountController extends Controller
/**
* Handle request to create new mount.
*
* @param \Pterodactyl\Http\Requests\Admin\MountFormRequest $request
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Throwable
@ -112,8 +107,6 @@ class MountController extends Controller
/**
* Handle request to update or delete location.
*
* @param \Pterodactyl\Http\Requests\Admin\MountFormRequest $request
* @param \Pterodactyl\Models\Mount $mount
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Throwable
@ -134,7 +127,6 @@ class MountController extends Controller
/**
* Delete a location from the system.
*
* @param \Pterodactyl\Models\Mount $mount
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Exception
@ -149,8 +141,6 @@ class MountController extends Controller
/**
* Adds eggs to the mount's many to many relation.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Mount $mount
* @return \Illuminate\Http\RedirectResponse
*/
public function addEggs(Request $request, Mount $mount)
@ -172,8 +162,6 @@ class MountController extends Controller
/**
* Adds nodes to the mount's many to many relation.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Mount $mount
* @return \Illuminate\Http\RedirectResponse
*/
public function addNodes(Request $request, Mount $mount)
@ -193,8 +181,6 @@ class MountController extends Controller
/**
* Deletes an egg from the mount's many to many relation.
*
* @param \Pterodactyl\Models\Mount $mount
* @param int $egg_id
* @return \Illuminate\Http\Response
*/
public function deleteEgg(Mount $mount, int $egg_id)
@ -207,8 +193,6 @@ class MountController extends Controller
/**
* Deletes an node from the mount's many to many relation.
*
* @param \Pterodactyl\Models\Mount $mount
* @param int $node_id
* @return \Illuminate\Http\Response
*/
public function deleteNode(Mount $mount, int $node_id)

View file

@ -55,8 +55,6 @@ class EggController extends Controller
/**
* Handle a request to display the Egg creation page.
*
* @return \Illuminate\View\View
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function create(): View
@ -70,16 +68,13 @@ class EggController extends Controller
/**
* Handle request to store a new Egg.
*
* @param \Pterodactyl\Http\Requests\Admin\Egg\EggFormRequest $request
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Service\Egg\NoParentConfigurationFoundException
*/
public function store(EggFormRequest $request): RedirectResponse
{
$data = $request->normalize();
if (! empty($data['docker_images']) && ! is_array($data['docker_images'])) {
if (!empty($data['docker_images']) && !is_array($data['docker_images'])) {
$data['docker_images'] = array_map(function ($value) {
return trim($value);
}, explode("\n", $data['docker_images']));
@ -93,9 +88,6 @@ class EggController extends Controller
/**
* Handle request to view a single Egg.
*
* @param \Pterodactyl\Models\Egg $egg
* @return \Illuminate\View\View
*/
public function view(Egg $egg): View
{
@ -105,10 +97,6 @@ class EggController extends Controller
/**
* Handle request to update an Egg.
*
* @param \Pterodactyl\Http\Requests\Admin\Egg\EggFormRequest $request
* @param \Pterodactyl\Models\Egg $egg
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
* @throws \Pterodactyl\Exceptions\Service\Egg\NoParentConfigurationFoundException
@ -116,7 +104,7 @@ class EggController extends Controller
public function update(EggFormRequest $request, Egg $egg): RedirectResponse
{
$data = $request->normalize();
if (! empty($data['docker_images']) && ! is_array($data['docker_images'])) {
if (!empty($data['docker_images']) && !is_array($data['docker_images'])) {
$data['docker_images'] = array_map(function ($value) {
return trim($value);
}, explode("\n", $data['docker_images']));
@ -131,9 +119,6 @@ class EggController extends Controller
/**
* Handle request to destroy an egg.
*
* @param \Pterodactyl\Models\Egg $egg
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Service\Egg\HasChildrenException
* @throws \Pterodactyl\Exceptions\Service\HasActiveServersException
*/

View file

@ -30,10 +30,6 @@ class EggScriptController extends Controller
/**
* EggScriptController constructor.
*
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository
* @param \Pterodactyl\Services\Eggs\Scripts\InstallScriptService $installScriptService
*/
public function __construct(
AlertsMessageBag $alert,
@ -47,9 +43,6 @@ class EggScriptController extends Controller
/**
* Handle requests to render installation script for an Egg.
*
* @param int $egg
* @return \Illuminate\View\View
*/
public function index(int $egg): View
{
@ -74,10 +67,6 @@ class EggScriptController extends Controller
/**
* Handle a request to update the installation script for an Egg.
*
* @param \Pterodactyl\Http\Requests\Admin\Egg\EggScriptFormRequest $request
* @param \Pterodactyl\Models\Egg $egg
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
* @throws \Pterodactyl\Exceptions\Service\Egg\InvalidCopyFromException

View file

@ -43,11 +43,6 @@ class EggShareController extends Controller
/**
* OptionShareController constructor.
*
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Pterodactyl\Services\Eggs\Sharing\EggExporterService $exporterService
* @param \Pterodactyl\Services\Eggs\Sharing\EggImporterService $importerService
* @param \Pterodactyl\Services\Eggs\Sharing\EggUpdateImporterService $updateImporterService
*/
public function __construct(
AlertsMessageBag $alert,
@ -62,9 +57,6 @@ class EggShareController extends Controller
}
/**
* @param \Pterodactyl\Models\Egg $egg
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function export(Egg $egg): Response
@ -82,9 +74,6 @@ class EggShareController extends Controller
/**
* Import a new service option using an XML file.
*
* @param \Pterodactyl\Http\Requests\Admin\Egg\EggImportFormRequest $request
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
* @throws \Pterodactyl\Exceptions\Service\Egg\BadJsonFormatException
@ -101,10 +90,6 @@ class EggShareController extends Controller
/**
* Update an existing Egg using a new imported file.
*
* @param \Pterodactyl\Http\Requests\Admin\Egg\EggImportFormRequest $request
* @param \Pterodactyl\Models\Egg $egg
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
* @throws \Pterodactyl\Exceptions\Service\Egg\BadJsonFormatException

View file

@ -50,12 +50,6 @@ class EggVariableController extends Controller
/**
* EggVariableController constructor.
*
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Pterodactyl\Services\Eggs\Variables\VariableCreationService $creationService
* @param \Pterodactyl\Services\Eggs\Variables\VariableUpdateService $updateService
* @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository
* @param \Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface $variableRepository
*/
public function __construct(
AlertsMessageBag $alert,
@ -74,9 +68,6 @@ class EggVariableController extends Controller
/**
* Handle request to view the variables attached to an Egg.
*
* @param int $egg
* @return \Illuminate\View\View
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function view(int $egg): View
@ -89,10 +80,6 @@ class EggVariableController extends Controller
/**
* Handle a request to create a new Egg variable.
*
* @param \Pterodactyl\Http\Requests\Admin\Egg\EggVariableFormRequest $request
* @param \Pterodactyl\Models\Egg $egg
*
* @return \Illuminate\Http\RedirectResponse
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Service\Egg\Variable\BadValidationRuleException
* @throws \Pterodactyl\Exceptions\Service\Egg\Variable\ReservedVariableNameException
@ -108,11 +95,6 @@ class EggVariableController extends Controller
/**
* Handle a request to update an existing Egg variable.
*
* @param \Pterodactyl\Http\Requests\Admin\Egg\EggVariableFormRequest $request
* @param \Pterodactyl\Models\Egg $egg
* @param \Pterodactyl\Models\EggVariable $variable
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
@ -130,10 +112,6 @@ class EggVariableController extends Controller
/**
* Handle a request to delete an existing Egg variable from the Panel.
*
* @param int $egg
* @param \Pterodactyl\Models\EggVariable $variable
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(int $egg, EggVariable $variable): RedirectResponse
{

View file

@ -48,12 +48,6 @@ class NestController extends Controller
/**
* NestController constructor.
*
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Pterodactyl\Services\Nests\NestCreationService $nestCreationService
* @param \Pterodactyl\Services\Nests\NestDeletionService $nestDeletionService
* @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $repository
* @param \Pterodactyl\Services\Nests\NestUpdateService $nestUpdateService
*/
public function __construct(
AlertsMessageBag $alert,
@ -72,8 +66,6 @@ class NestController extends Controller
/**
* Render nest listing page.
*
* @return \Illuminate\View\View
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function index(): View
@ -85,8 +77,6 @@ class NestController extends Controller
/**
* Render nest creation page.
*
* @return \Illuminate\View\View
*/
public function create(): View
{
@ -96,9 +86,6 @@ class NestController extends Controller
/**
* Handle the storage of a new nest.
*
* @param \Pterodactyl\Http\Requests\Admin\Nest\StoreNestFormRequest $request
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/
public function store(StoreNestFormRequest $request): RedirectResponse
@ -112,9 +99,6 @@ class NestController extends Controller
/**
* Return details about a nest including all of the eggs and servers per egg.
*
* @param int $nest
* @return \Illuminate\View\View
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function view(int $nest): View
@ -127,10 +111,6 @@ class NestController extends Controller
/**
* Handle request to update a nest.
*
* @param \Pterodactyl\Http\Requests\Admin\Nest\StoreNestFormRequest $request
* @param int $nest
*
* @return \Illuminate\Http\RedirectResponse
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
@ -145,9 +125,6 @@ class NestController extends Controller
/**
* Handle request to delete a nest.
*
* @param int $nest
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Service\HasActiveServersException
*/
public function destroy(int $nest): RedirectResponse

View file

@ -30,10 +30,6 @@ class NodeAutoDeployController extends Controller
/**
* NodeAutoDeployController constructor.
*
* @param \Pterodactyl\Repositories\Eloquent\ApiKeyRepository $repository
* @param \Illuminate\Contracts\Encryption\Encrypter $encrypter
* @param \Pterodactyl\Services\Api\KeyCreationService $keyCreationService
*/
public function __construct(
ApiKeyRepository $repository,
@ -49,8 +45,6 @@ class NodeAutoDeployController extends Controller
* Generates a new API key for the logged in user with only permission to read
* nodes, and returns that as the deployment key for a node.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Node $node
* @return \Illuminate\Http\JsonResponse
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
@ -72,7 +66,7 @@ class NodeAutoDeployController extends Controller
// We couldn't find a key that exists for this user with only permission for
// reading nodes. Go ahead and create it now.
if (! $key) {
if (!$key) {
$key = $this->keyCreationService->setKeyType(ApiKey::TYPE_APPLICATION)->handle([
'user_id' => $request->user()->id,
'memo' => 'Automatically generated node deployment key.',

View file

@ -23,9 +23,6 @@ class NodeController extends Controller
/**
* NodeController constructor.
*
* @param \Pterodactyl\Repositories\Eloquent\NodeRepository $repository
* @param \Illuminate\Contracts\View\Factory $view
*/
public function __construct(NodeRepository $repository, Factory $view)
{
@ -36,7 +33,6 @@ class NodeController extends Controller
/**
* Returns a listing of nodes on the system.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\View
*/
public function index(Request $request)

View file

@ -51,13 +51,6 @@ class NodeViewController extends Controller
/**
* NodeViewController constructor.
*
* @param \Pterodactyl\Repositories\Eloquent\AllocationRepository $allocationRepository
* @param \Pterodactyl\Repositories\Eloquent\LocationRepository $locationRepository
* @param \Pterodactyl\Repositories\Eloquent\NodeRepository $repository
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $serverRepository
* @param \Pterodactyl\Services\Helpers\SoftwareVersionService $versionService
* @param \Illuminate\Contracts\View\Factory $view
*/
public function __construct(
AllocationRepository $allocationRepository,
@ -78,8 +71,6 @@ class NodeViewController extends Controller
/**
* Returns index view for a specific node on the system.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Node $node
* @return \Illuminate\Contracts\View\View
*/
public function index(Request $request, Node $node)
@ -96,8 +87,6 @@ class NodeViewController extends Controller
/**
* Returns the settings page for a specific node.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Node $node
* @return \Illuminate\Contracts\View\View
*/
public function settings(Request $request, Node $node)
@ -111,8 +100,6 @@ class NodeViewController extends Controller
/**
* Return the node configuration page for a specific node.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Node $node
* @return \Illuminate\Contracts\View\View
*/
public function configuration(Request $request, Node $node)
@ -123,8 +110,6 @@ class NodeViewController extends Controller
/**
* Return the node allocation management page.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Node $node
* @return \Illuminate\Contracts\View\View
*/
public function allocations(Request $request, Node $node)
@ -145,8 +130,6 @@ class NodeViewController extends Controller
/**
* Return a listing of servers that exist for this specific node.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Node $node
* @return \Illuminate\Contracts\View\View
*/
public function servers(Request $request, Node $node)

View file

@ -18,8 +18,6 @@ class SystemInformationController extends Controller
/**
* SystemInformationController constructor.
*
* @param \Pterodactyl\Repositories\Wings\DaemonConfigurationRepository $repository
*/
public function __construct(DaemonConfigurationRepository $repository)
{
@ -29,8 +27,6 @@ class SystemInformationController extends Controller
/**
* Returns system information from the Daemon.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Node $node
* @return \Illuminate\Http\JsonResponse
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException

View file

@ -94,19 +94,6 @@ class NodesController extends Controller
/**
* NodesController constructor.
*
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Pterodactyl\Services\Allocations\AllocationDeletionService $allocationDeletionService
* @param \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface $allocationRepository
* @param \Pterodactyl\Services\Allocations\AssignmentService $assignmentService
* @param \Illuminate\Cache\Repository $cache
* @param \Pterodactyl\Services\Nodes\NodeCreationService $creationService
* @param \Pterodactyl\Services\Nodes\NodeDeletionService $deletionService
* @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $locationRepository
* @param \Pterodactyl\Contracts\Repository\NodeRepositoryInterface $repository
* @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $serverRepository
* @param \Pterodactyl\Services\Nodes\NodeUpdateService $updateService
* @param \Pterodactyl\Services\Helpers\SoftwareVersionService $versionService
*/
public function __construct(
AlertsMessageBag $alert,
@ -156,7 +143,6 @@ class NodesController extends Controller
/**
* Post controller to create a new node on the system.
*
* @param \Pterodactyl\Http\Requests\Admin\Node\NodeFormRequest $request
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
@ -172,8 +158,6 @@ class NodesController extends Controller
/**
* Updates settings for a node.
*
* @param \Pterodactyl\Http\Requests\Admin\Node\NodeFormRequest $request
* @param \Pterodactyl\Models\Node $node
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\DisplayException
@ -191,10 +175,6 @@ class NodesController extends Controller
/**
* Removes a single allocation from a node.
*
* @param int $node
* @param \Pterodactyl\Models\Allocation $allocation
* @return \Illuminate\Http\Response
*
* @throws \Pterodactyl\Exceptions\Service\Allocation\ServerUsingAllocationException
*/
public function allocationRemoveSingle(int $node, Allocation $allocation): Response
@ -207,10 +187,6 @@ class NodesController extends Controller
/**
* Removes multiple individual allocations from a node.
*
* @param \Illuminate\Http\Request $request
* @param int $node
* @return \Illuminate\Http\Response
*
* @throws \Pterodactyl\Exceptions\Service\Allocation\ServerUsingAllocationException
*/
public function allocationRemoveMultiple(Request $request, int $node): Response
@ -228,8 +204,8 @@ class NodesController extends Controller
/**
* Remove all allocations for a specific IP at once on a node.
*
* @param \Illuminate\Http\Request $request
* @param int $node
*
* @return \Illuminate\Http\RedirectResponse
*/
public function allocationRemoveBlock(Request $request, $node)
@ -249,7 +225,6 @@ class NodesController extends Controller
/**
* Sets an alias for a specific allocation on a node.
*
* @param \Pterodactyl\Http\Requests\Admin\Node\AllocationAliasFormRequest $request
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
@ -267,8 +242,8 @@ class NodesController extends Controller
/**
* Creates new allocations on a node.
*
* @param \Pterodactyl\Http\Requests\Admin\Node\AllocationFormRequest $request
* @param int|\Pterodactyl\Models\Node $node
*
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Service\Allocation\CidrOutOfRangeException
@ -288,6 +263,7 @@ class NodesController extends Controller
* Deletes a node from the system.
*
* @param $node
*
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\DisplayException

View file

@ -47,13 +47,6 @@ class CreateServerController extends Controller
/**
* CreateServerController constructor.
*
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Pterodactyl\Repositories\Eloquent\NestRepository $nestRepository
* @param \Pterodactyl\Repositories\Eloquent\LocationRepository $locationRepository
* @param \Pterodactyl\Repositories\Eloquent\NodeRepository $nodeRepository
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository
* @param \Pterodactyl\Services\Servers\ServerCreationService $creationService
*/
public function __construct(
AlertsMessageBag $alert,
@ -75,6 +68,7 @@ class CreateServerController extends Controller
* Displays the create server page.
*
* @return \Illuminate\Contracts\View\Factory
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function index()
@ -106,7 +100,6 @@ class CreateServerController extends Controller
/**
* Create a new server on the remote system.
*
* @param \Pterodactyl\Http\Requests\Admin\ServerFormRequest $request
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Illuminate\Validation\ValidationException
@ -118,7 +111,7 @@ class CreateServerController extends Controller
public function store(ServerFormRequest $request)
{
$data = $request->except(['_token']);
if (! empty($data['custom_image'])) {
if (!empty($data['custom_image'])) {
$data['image'] = $data['custom_image'];
unset($data['custom_image']);
}

View file

@ -25,9 +25,6 @@ class ServerController extends Controller
/**
* ServerController constructor.
*
* @param \Illuminate\Contracts\View\Factory $view
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository
*/
public function __construct(
Factory $view,
@ -41,7 +38,6 @@ class ServerController extends Controller
* Returns all of the servers that exist on the system using a paginated result set. If
* a query is passed along in the request it is also passed to the repository function.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\View
*/
public function index(Request $request)
@ -49,7 +45,7 @@ class ServerController extends Controller
$servers = QueryBuilder::for(Server::query()->with('node', 'user', 'allocation'))
->allowedFilters([
AllowedFilter::exact('owner_id'),
AllowedFilter::custom('*', new AdminServerFilter),
AllowedFilter::custom('*', new AdminServerFilter()),
])
->paginate(config()->get('pterodactyl.paginate.admin.servers'));

View file

@ -53,14 +53,6 @@ class ServerTransferController extends Controller
/**
* ServerTransferController constructor.
*
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface $allocationRepository
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository
* @param \Pterodactyl\Repositories\Eloquent\LocationRepository $locationRepository
* @param \Pterodactyl\Repositories\Eloquent\NodeRepository $nodeRepository
* @param \Pterodactyl\Services\Servers\TransferService $transferService
* @param \Pterodactyl\Repositories\Wings\DaemonConfigurationRepository $daemonConfigurationRepository
*/
public function __construct(
AlertsMessageBag $alert,
@ -83,8 +75,6 @@ class ServerTransferController extends Controller
/**
* Starts a transfer of a server to a new node.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Server $server
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Throwable
@ -108,7 +98,7 @@ class ServerTransferController extends Controller
$this->daemonConfigurationRepository->setNode($node)->getSystemInformation();
// Create a new ServerTransfer entry.
$transfer = new ServerTransfer;
$transfer = new ServerTransfer();
$transfer->server_id = $server->id;
$transfer->old_node = $server->node_id;
@ -136,11 +126,6 @@ class ServerTransferController extends Controller
/**
* Assigns the specified allocations to the specified server.
*
* @param Server $server
* @param int $node_id
* @param int $allocation_id
* @param array $additional_allocations
*/
private function assignAllocationsToServer(Server $server, int $node_id, int $allocation_id, array $additional_allocations)
{
@ -151,14 +136,14 @@ class ServerTransferController extends Controller
$updateIds = [];
foreach ($allocations as $allocation) {
if (! in_array($allocation, $unassigned)) {
if (!in_array($allocation, $unassigned)) {
continue;
}
$updateIds[] = $allocation;
}
if (! empty($updateIds)) {
if (!empty($updateIds)) {
$this->allocationRepository->updateWhereIn('id', $updateIds, ['server_id' => $server->id]);
}
}

View file

@ -64,15 +64,6 @@ class ServerViewController extends Controller
/**
* ServerViewController constructor.
*
* @param \Illuminate\Contracts\View\Factory $view
* @param \Pterodactyl\Repositories\Eloquent\DatabaseHostRepository $databaseHostRepository
* @param \Pterodactyl\Repositories\Eloquent\LocationRepository $locationRepository
* @param \Pterodactyl\Repositories\Eloquent\MountRepository $mountRepository
* @param \Pterodactyl\Repositories\Eloquent\NestRepository $nestRepository
* @param \Pterodactyl\Repositories\Eloquent\NodeRepository $nodeRepository
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository
* @param \Pterodactyl\Services\Servers\EnvironmentService $environmentService
*/
public function __construct(
Factory $view,
@ -97,8 +88,6 @@ class ServerViewController extends Controller
/**
* Returns the index view for a server.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Server $server
* @return \Illuminate\Contracts\View\View
*/
public function index(Request $request, Server $server)
@ -109,8 +98,6 @@ class ServerViewController extends Controller
/**
* Returns the server details page.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Server $server
* @return \Illuminate\Contracts\View\View
*/
public function details(Request $request, Server $server)
@ -121,8 +108,6 @@ class ServerViewController extends Controller
/**
* Returns a view of server build settings.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Server $server
* @return \Illuminate\Contracts\View\View
*/
public function build(Request $request, Server $server)
@ -139,8 +124,6 @@ class ServerViewController extends Controller
/**
* Returns the server startup management page.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Server $server
* @return \Illuminate\Contracts\View\View
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
@ -166,8 +149,6 @@ class ServerViewController extends Controller
/**
* Returns all of the databases that exist for the server.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Server $server
* @return \Illuminate\Contracts\View\View
*/
public function database(Request $request, Server $server)
@ -181,8 +162,6 @@ class ServerViewController extends Controller
/**
* Returns all of the mounts that exist for the server.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Server $server
* @return \Illuminate\Contracts\View\View
*/
public function mounts(Request $request, Server $server)
@ -199,8 +178,6 @@ class ServerViewController extends Controller
* Returns the base server management page, or an exception if the server
* is in a state that cannot be recovered from.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Server $server
* @return \Illuminate\Contracts\View\View
*
* @throws \Pterodactyl\Exceptions\DisplayException
@ -208,9 +185,7 @@ class ServerViewController extends Controller
public function manage(Request $request, Server $server)
{
if ($server->installed > 1) {
throw new DisplayException(
'This server is in a failed install state and cannot be recovered. Please delete and re-create the server.'
);
throw new DisplayException('This server is in a failed install state and cannot be recovered. Please delete and re-create the server.');
}
// Check if the panel doesn't have at least 2 nodes configured.
@ -234,8 +209,6 @@ class ServerViewController extends Controller
/**
* Returns the server deletion page.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Server $server
* @return \Illuminate\Contracts\View\View
*/
public function delete(Request $request, Server $server)

View file

@ -132,25 +132,6 @@ class ServersController extends Controller
/**
* ServersController constructor.
*
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface $allocationRepository
* @param \Pterodactyl\Services\Servers\BuildModificationService $buildModificationService
* @param \Illuminate\Contracts\Config\Repository $config
* @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonServerRepository
* @param \Pterodactyl\Services\Databases\DatabaseManagementService $databaseManagementService
* @param \Pterodactyl\Services\Databases\DatabasePasswordService $databasePasswordService
* @param \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface $databaseRepository
* @param \Pterodactyl\Repositories\Eloquent\DatabaseHostRepository $databaseHostRepository
* @param \Pterodactyl\Services\Servers\ServerDeletionService $deletionService
* @param \Pterodactyl\Services\Servers\DetailsModificationService $detailsModificationService
* @param \Pterodactyl\Services\Servers\ReinstallServerService $reinstallService
* @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository
* @param \Pterodactyl\Repositories\Eloquent\MountRepository $mountRepository
* @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $nestRepository
* @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $serverConfigurationStructureService
* @param \Pterodactyl\Services\Servers\StartupModificationService $startupModificationService
* @param \Pterodactyl\Services\Servers\SuspensionService $suspensionService
*/
public function __construct(
AlertsMessageBag $alert,
@ -195,8 +176,6 @@ class ServersController extends Controller
/**
* Update the details for a server.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Server $server
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
@ -216,7 +195,6 @@ class ServersController extends Controller
/**
* Toggles the install status for a server.
*
* @param \Pterodactyl\Models\Server $server
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\DisplayException
@ -230,7 +208,7 @@ class ServersController extends Controller
}
$this->repository->update($server->id, [
'installed' => ! $server->installed,
'installed' => !$server->installed,
], true, true);
$this->alert->success(trans('admin/server.alerts.install_toggled'))->flash();
@ -241,7 +219,6 @@ class ServersController extends Controller
/**
* Reinstalls the server with the currently assigned service.
*
* @param \Pterodactyl\Models\Server $server
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\DisplayException
@ -259,8 +236,6 @@ class ServersController extends Controller
/**
* Manage the suspension status for a server.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Server $server
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\DisplayException
@ -280,8 +255,6 @@ class ServersController extends Controller
/**
* Update the build configuration for a server.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Server $server
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\DisplayException
@ -308,8 +281,6 @@ class ServersController extends Controller
/**
* Start the server deletion process.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Server $server
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\DisplayException
@ -326,8 +297,6 @@ class ServersController extends Controller
/**
* Update the startup command as well as variables.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Server $server
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Illuminate\Validation\ValidationException
@ -335,7 +304,7 @@ class ServersController extends Controller
public function saveStartup(Request $request, Server $server)
{
$data = $request->except('_token');
if (! empty($data['custom_docker_image'])) {
if (!empty($data['custom_docker_image'])) {
$data['docker_image'] = $data['custom_docker_image'];
unset($data['custom_docker_image']);
}
@ -356,8 +325,6 @@ class ServersController extends Controller
/**
* Creates a new database assigned to a specific server.
*
* @param \Pterodactyl\Http\Requests\Admin\Servers\Databases\StoreServerDatabaseRequest $request
* @param \Pterodactyl\Models\Server $server
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Throwable
@ -377,8 +344,8 @@ class ServersController extends Controller
/**
* Resets the database password for a specific database on this server.
*
* @param \Illuminate\Http\Request $request
* @param int $server
*
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Throwable
@ -400,6 +367,7 @@ class ServersController extends Controller
*
* @param int $server
* @param int $database
*
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Exception
@ -420,15 +388,13 @@ class ServersController extends Controller
/**
* Add a mount to a server.
*
* @param Server $server
* @param \Pterodactyl\Models\Mount $mount
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Throwable
*/
public function addMount(Server $server, Mount $mount)
{
$mountServer = (new MountServer)->forceFill([
$mountServer = (new MountServer())->forceFill([
'mount_id' => $mount->id,
'server_id' => $server->id,
]);
@ -443,8 +409,6 @@ class ServersController extends Controller
/**
* Remove a mount from a server.
*
* @param Server $server
* @param \Pterodactyl\Models\Mount $mount
* @return \Illuminate\Http\RedirectResponse
*/
public function deleteMount(Server $server, Mount $mount)

View file

@ -35,11 +35,6 @@ class AdvancedController extends Controller
/**
* AdvancedController constructor.
*
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Illuminate\Contracts\Config\Repository $config
* @param \Illuminate\Contracts\Console\Kernel $kernel
* @param \Pterodactyl\Contracts\Repository\SettingsRepositoryInterface $settings
*/
public function __construct(
AlertsMessageBag $alert,
@ -55,8 +50,6 @@ class AdvancedController extends Controller
/**
* Render advanced Panel settings UI.
*
* @return \Illuminate\View\View
*/
public function index(): View
{
@ -74,8 +67,6 @@ class AdvancedController extends Controller
}
/**
* @param \Pterodactyl\Http\Requests\Admin\Settings\AdvancedSettingsFormRequest $request
* @return \Illuminate\Http\RedirectResponse
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/

View file

@ -38,17 +38,13 @@ class IndexController extends Controller
/**
* IndexController constructor.
*
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Illuminate\Contracts\Console\Kernel $kernel
* @param \Pterodactyl\Contracts\Repository\SettingsRepositoryInterface $settings
* @param \Pterodactyl\Services\Helpers\SoftwareVersionService $versionService
*/
public function __construct(
AlertsMessageBag $alert,
Kernel $kernel,
SettingsRepositoryInterface $settings,
SoftwareVersionService $versionService)
SoftwareVersionService $versionService
)
{
$this->alert = $alert;
$this->kernel = $kernel;
@ -58,8 +54,6 @@ class IndexController extends Controller
/**
* Render the UI for basic Panel settings.
*
* @return \Illuminate\View\View
*/
public function index(): View
{
@ -72,8 +66,6 @@ class IndexController extends Controller
/**
* Handle settings update.
*
* @param \Pterodactyl\Http\Requests\Admin\Settings\BaseSettingsFormRequest $request
* @return \Illuminate\Http\RedirectResponse
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/

View file

@ -47,12 +47,6 @@ class MailController extends Controller
/**
* MailController constructor.
*
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Illuminate\Contracts\Config\Repository $config
* @param \Illuminate\Contracts\Encryption\Encrypter $encrypter
* @param \Illuminate\Contracts\Console\Kernel $kernel
* @param \Pterodactyl\Contracts\Repository\SettingsRepositoryInterface $settings
*/
public function __construct(
AlertsMessageBag $alert,
@ -71,8 +65,6 @@ class MailController extends Controller
/**
* Render UI for editing mail settings. This UI should only display if
* the server is configured to send mail using SMTP.
*
* @return \Illuminate\View\View
*/
public function index(): View
{
@ -84,9 +76,6 @@ class MailController extends Controller
/**
* Handle request to update SMTP mail settings.
*
* @param \Pterodactyl\Http\Requests\Admin\Settings\MailSettingsFormRequest $request
* @return \Illuminate\Http\Response
*
* @throws DisplayException
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
@ -103,7 +92,7 @@ class MailController extends Controller
}
foreach ($values as $key => $value) {
if (in_array($key, SettingsServiceProvider::getEncryptedKeys()) && ! empty($value)) {
if (in_array($key, SettingsServiceProvider::getEncryptedKeys()) && !empty($value)) {
$value = $this->encrypter->encrypt($value);
}
@ -117,9 +106,6 @@ class MailController extends Controller
/**
* Submit a request to send a test mail message.
*
* @param Request $request
* @return \Illuminate\Http\Response
*/
public function test(Request $request): Response
{

View file

@ -46,7 +46,7 @@ class StatisticsController extends Controller
public function index()
{
throw new NotFoundHttpException;
throw new NotFoundHttpException();
$servers = $this->serverRepository->all();
$nodes = $this->nodeRepository->all();
$usersCount = $this->userRepository->count();

View file

@ -52,13 +52,6 @@ class UserController extends Controller
/**
* UserController constructor.
*
* @param \Prologue\Alerts\AlertsMessageBag $alert
* @param \Pterodactyl\Services\Users\UserCreationService $creationService
* @param \Pterodactyl\Services\Users\UserDeletionService $deletionService
* @param \Illuminate\Contracts\Translation\Translator $translator
* @param \Pterodactyl\Services\Users\UserUpdateService $updateService
* @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository
*/
public function __construct(
AlertsMessageBag $alert,
@ -79,7 +72,6 @@ class UserController extends Controller
/**
* Display user index page.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View
*/
public function index(Request $request)
@ -114,7 +106,6 @@ class UserController extends Controller
/**
* Display user view page.
*
* @param \Pterodactyl\Models\User $user
* @return \Illuminate\View\View
*/
public function view(User $user)
@ -128,8 +119,6 @@ class UserController extends Controller
/**
* Delete a user from the system.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\User $user
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Exception
@ -149,7 +138,6 @@ class UserController extends Controller
/**
* Create a user.
*
* @param \Pterodactyl\Http\Requests\Admin\UserFormRequest $request
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Exception
@ -166,8 +154,6 @@ class UserController extends Controller
/**
* Update a user on the system.
*
* @param \Pterodactyl\Http\Requests\Admin\UserFormRequest $request
* @param \Pterodactyl\Models\User $user
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
@ -187,7 +173,6 @@ class UserController extends Controller
/**
* Get a JSON response of users on the system.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Support\Collection|\Pterodactyl\Models\Model
*/
public function json(Request $request)

View file

@ -45,9 +45,6 @@ abstract class ApplicationApiController extends Controller
/**
* Perform dependency injection of certain classes needed for core functionality
* without littering the constructors of classes that extend this abstract.
*
* @param \Pterodactyl\Extensions\Spatie\Fractalistic\Fractal $fractal
* @param \Illuminate\Http\Request $request
*/
public function loadDependencies(Fractal $fractal, Request $request)
{
@ -58,7 +55,6 @@ abstract class ApplicationApiController extends Controller
/**
* Return an instance of an application transformer.
*
* @param string $abstract
* @return \Pterodactyl\Transformers\Api\Application\BaseTransformer
*/
public function getTransformer(string $abstract)
@ -74,8 +70,6 @@ abstract class ApplicationApiController extends Controller
/**
* Return a HTTP/204 response for the API.
*
* @return \Illuminate\Http\Response
*/
protected function returnNoContent(): Response
{

View file

@ -42,11 +42,6 @@ class LocationController extends ApplicationApiController
/**
* LocationController constructor.
*
* @param \Pterodactyl\Services\Locations\LocationCreationService $creationService
* @param \Pterodactyl\Services\Locations\LocationDeletionService $deletionService
* @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $repository
* @param \Pterodactyl\Services\Locations\LocationUpdateService $updateService
*/
public function __construct(
LocationCreationService $creationService,
@ -64,9 +59,6 @@ class LocationController extends ApplicationApiController
/**
* Return all of the locations currently registered on the Panel.
*
* @param \Pterodactyl\Http\Requests\Api\Application\Locations\GetLocationsRequest $request
* @return array
*/
public function index(GetLocationsRequest $request): array
{
@ -82,9 +74,6 @@ class LocationController extends ApplicationApiController
/**
* Return a single location.
*
* @param \Pterodactyl\Http\Requests\Api\Application\Locations\GetLocationRequest $request
* @return array
*/
public function view(GetLocationRequest $request): array
{
@ -97,9 +86,6 @@ class LocationController extends ApplicationApiController
* Store a new location on the Panel and return a HTTP/201 response code with the
* new location attached.
*
* @param \Pterodactyl\Http\Requests\Api\Application\Locations\StoreLocationRequest $request
* @return \Illuminate\Http\JsonResponse
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/
public function store(StoreLocationRequest $request): JsonResponse
@ -119,9 +105,6 @@ class LocationController extends ApplicationApiController
/**
* Update a location on the Panel and return the updated record to the user.
*
* @param \Pterodactyl\Http\Requests\Api\Application\Locations\UpdateLocationRequest $request
* @return array
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
@ -137,9 +120,6 @@ class LocationController extends ApplicationApiController
/**
* Delete a location from the Panel.
*
* @param \Pterodactyl\Http\Requests\Api\Application\Locations\DeleteLocationRequest $request
* @return \Illuminate\Http\Response
*
* @throws \Pterodactyl\Exceptions\Service\Location\HasActiveNodesException
*/
public function delete(DeleteLocationRequest $request): Response

Some files were not shown because too many files have changed in this diff Show more