diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f5e4a4f2e..99801aa3b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -25,6 +25,12 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.REGISTRY_TOKEN }} + - name: Bump Version + if: "!contains(github.ref, 'develop')" + env: + REF: ${{ github.ref }} + run: | + sed -i "s/ 'version' => 'canary',/ 'version' => '${REF:11}',/" config/app.php - name: Release Production Build uses: docker/build-push-action@v2 if: "!contains(github.ref, 'develop')" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 73d56ad72..adc36412a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,9 +19,9 @@ jobs: - 3306 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 strategy: - fail-fast: true + fail-fast: false matrix: - php: [7.3, 7.4] + php: [7.4, 8.0] name: PHP ${{ matrix.php }} steps: - name: checkout @@ -44,14 +44,14 @@ jobs: with: php-version: ${{ matrix.php }} extensions: cli, openssl, gd, mysql, pdo, mbstring, tokenizer, bcmath, xml, curl, zip - tools: composer:v1 + tools: composer:v2 coverage: none - name: configure run: cp .env.ci .env - name: install dependencies run: composer install --prefer-dist --no-interaction --no-progress - name: run cs-fixer - run: vendor/bin/php-cs-fixer fix --dry-run --diff --diff-format=udiff + run: vendor/bin/php-cs-fixer fix --dry-run --diff --diff-format=udiff --rules=psr_autoloading continue-on-error: true - name: execute unit tests run: vendor/bin/phpunit --bootstrap bootstrap/app.php tests/Unit diff --git a/.gitignore b/.gitignore index 58250120e..11f82a76e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ /vendor *.DS_Store* -.env +!.env.ci +!.env.dusk +!.env.example +.env* .vagrant/* .vscode/* storage/framework/* diff --git a/.php_cs b/.php_cs deleted file mode 100644 index e72e8e70a..000000000 --- a/.php_cs +++ /dev/null @@ -1,58 +0,0 @@ -in([ - 'app', - 'bootstrap', - 'config', - 'database', - 'resources/lang', - 'routes', - 'tests', - ]); - -return PhpCsFixer\Config::create() - ->setRules([ - '@Symfony' => true, - '@PSR1' => true, - '@PSR2' => 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); diff --git a/.php_cs.dist b/.php_cs.dist new file mode 100644 index 000000000..3eb33508b --- /dev/null +++ b/.php_cs.dist @@ -0,0 +1,33 @@ +in(__DIR__)->exclude(['vendor', 'node_modules', 'storage', 'bootstrap/cache']); + +return (new Config()) + ->setRiskyAllowed(true) + ->setFinder($finder) + ->setRules([ + '@Symfony' => true, + '@PSR1' => true, + '@PSR2' => true, + '@PSR12' => true, + 'align_multiline_comment' => ['comment_type' => 'phpdocs_like'], + 'combine_consecutive_unsets' => true, + 'concat_space' => ['spacing' => 'one'], + 'heredoc_to_nowdoc' => true, + 'no_alias_functions' => true, + 'no_unreachable_default_argument_value' => true, + 'no_useless_return' => true, + 'ordered_imports' => [ + 'sortAlgorithm' => 'length', + ], + 'random_api_migration' => true, + 'ternary_to_null_coalescing' => true, + 'yoda_style' => [ + 'equal' => false, + 'identical' => false, + 'less_and_greater' => false, + ], + ]); diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f04a6d88..e09ae67f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ This file is a running track of new features and fixes to each version of the pa This project follows [Semantic Versioning](http://semver.org) guidelines. +## v1.2.2 +* **[security]** Fixes authentication bypass allowing a user to take control of specific server actions such as executing schedules, rotating database passwords, and viewing or deleting a backup. + ## v1.2.1 ### Fixed * Fixes URL-encoding of filenames when working in the filemanager to fix issues when moving, renaming, or deleting files. diff --git a/app/Console/Commands/Environment/AppSettingsCommand.php b/app/Console/Commands/Environment/AppSettingsCommand.php index 01518d610..cfe1d7981 100644 --- a/app/Console/Commands/Environment/AppSettingsCommand.php +++ b/app/Console/Commands/Environment/AppSettingsCommand.php @@ -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') + ); } } diff --git a/app/Console/Commands/Environment/DatabaseSettingsCommand.php b/app/Console/Commands/Environment/DatabaseSettingsCommand.php index 0a0e56b28..b983fcc9f 100644 --- a/app/Console/Commands/Environment/DatabaseSettingsCommand.php +++ b/app/Console/Commands/Environment/DatabaseSettingsCommand.php @@ -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')); } diff --git a/app/Console/Commands/Environment/EmailSettingsCommand.php b/app/Console/Commands/Environment/EmailSettingsCommand.php index add1296e6..6d98b63c3 100644 --- a/app/Console/Commands/Environment/EmailSettingsCommand.php +++ b/app/Console/Commands/Environment/EmailSettingsCommand.php @@ -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') + ); } } diff --git a/app/Console/Commands/InfoCommand.php b/app/Console/Commands/InfoCommand.php index 7ee140a1f..4db0be702 100644 --- a/app/Console/Commands/InfoCommand.php +++ b/app/Console/Commands/InfoCommand.php @@ -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 = '') diff --git a/app/Console/Commands/Location/DeleteLocationCommand.php b/app/Console/Commands/Location/DeleteLocationCommand.php index b6782207e..898dbb924 100644 --- a/app/Console/Commands/Location/DeleteLocationCommand.php +++ b/app/Console/Commands/Location/DeleteLocationCommand.php @@ -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)) { diff --git a/app/Console/Commands/Location/MakeLocationCommand.php b/app/Console/Commands/Location/MakeLocationCommand.php index 791129727..db4d4e2e0 100644 --- a/app/Console/Commands/Location/MakeLocationCommand.php +++ b/app/Console/Commands/Location/MakeLocationCommand.php @@ -33,8 +33,6 @@ class MakeLocationCommand extends Command /** * Create a new command instance. - * - * @param \Pterodactyl\Services\Locations\LocationCreationService $creationService */ public function __construct(LocationCreationService $creationService) { diff --git a/app/Console/Commands/Maintenance/CleanServiceBackupFilesCommand.php b/app/Console/Commands/Maintenance/CleanServiceBackupFilesCommand.php index 1b5ded4d6..69a3b118a 100644 --- a/app/Console/Commands/Maintenance/CleanServiceBackupFilesCommand.php +++ b/app/Console/Commands/Maintenance/CleanServiceBackupFilesCommand.php @@ -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) { diff --git a/app/Console/Commands/Maintenance/PruneOrphanedBackupsCommand.php b/app/Console/Commands/Maintenance/PruneOrphanedBackupsCommand.php index af4590d47..4aef591a2 100644 --- a/app/Console/Commands/Maintenance/PruneOrphanedBackupsCommand.php +++ b/app/Console/Commands/Maintenance/PruneOrphanedBackupsCommand.php @@ -12,21 +12,18 @@ class PruneOrphanedBackupsCommand extends Command /** * @var string */ - protected $signature = 'p:maintenance:prune-backups {--since-minutes=30}'; + protected $signature = 'p:maintenance:prune-backups {--prune-age=}'; /** * @var string */ 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)) { - throw new InvalidArgumentException('The --since-minutes option must be a valid numeric digit.'); + $since = $this->option('prune-age') ?? config('backups.prune_age', 360); + if (!$since || !is_digit($since)) { + throw new InvalidArgumentException('The "--prune-age" argument must be a value greater than 0.'); } $query = $repository->getBuilder() @@ -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; diff --git a/app/Console/Commands/Migration/CleanOrphanedApiKeysCommand.php b/app/Console/Commands/Migration/CleanOrphanedApiKeysCommand.php deleted file mode 100644 index e7d863992..000000000 --- a/app/Console/Commands/Migration/CleanOrphanedApiKeysCommand.php +++ /dev/null @@ -1,58 +0,0 @@ -repository = $repository; - } - - /** - * Delete all orphaned API keys from the database when upgrading from 0.6 to 0.7. - * - * @return void|null - */ - public function handle() - { - $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 - ); - - if (! $continue) { - return null; - } - - $this->info('Deleting keys...'); - $this->repository->deleteWhere([['key_type', '=', ApiKey::TYPE_NONE]]); - $this->info('Keys were successfully deleted.'); - } -} diff --git a/app/Console/Commands/Overrides/KeyGenerateCommand.php b/app/Console/Commands/Overrides/KeyGenerateCommand.php index aa9294999..bc8a4edb6 100644 --- a/app/Console/Commands/Overrides/KeyGenerateCommand.php +++ b/app/Console/Commands/Overrides/KeyGenerateCommand.php @@ -12,13 +12,13 @@ class KeyGenerateCommand extends BaseKeyGenerateCommand */ public function handle() { - 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 (!empty(config('app.key')) && $this->input->isInteractive()) { + $this->output->warning('It appears you have already configured an application encryption key. Continuing with this process with overwrite that key and cause data corruption for any existing encrypted data. DO NOT CONTINUE UNLESS YOU KNOW WHAT YOU ARE DOING.'); + if (!$this->confirm('I understand the consequences of performing this command and accept all responsibility for the loss of encrypted data.')) { return; } - if (! $this->confirm(trans('command/messages.key.final_confirm'))) { + if (!$this->confirm('Are you sure you wish to continue? Changing the application encryption key WILL CAUSE DATA LOSS.')) { return; } } diff --git a/app/Console/Commands/Overrides/SeedCommand.php b/app/Console/Commands/Overrides/SeedCommand.php index 91b555d4b..5f050e340 100644 --- a/app/Console/Commands/Overrides/SeedCommand.php +++ b/app/Console/Commands/Overrides/SeedCommand.php @@ -10,17 +10,17 @@ class SeedCommand extends BaseSeedCommand use RequiresDatabaseMigrations; /** - * Block someone from running this seed command if they have not completed the migration - * process. - * - * @return int + * Block someone from running this seed command if they have not completed + * the migration process. */ public function handle() { if (!$this->hasCompletedMigrations()) { - return $this->showMigrationWarning(); + $this->showMigrationWarning(); + + return; } - return parent::handle(); + parent::handle(); } } diff --git a/app/Console/Commands/Overrides/UpCommand.php b/app/Console/Commands/Overrides/UpCommand.php index 3a5f34610..3001edcbe 100644 --- a/app/Console/Commands/Overrides/UpCommand.php +++ b/app/Console/Commands/Overrides/UpCommand.php @@ -10,14 +10,17 @@ class UpCommand extends BaseUpCommand use RequiresDatabaseMigrations; /** - * @return bool|int + * Block someone from running this up command if they have not completed + * the migration process. */ public function handle() { if (!$this->hasCompletedMigrations()) { - return $this->showMigrationWarning(); + $this->showMigrationWarning(); + + return; } - return parent::handle(); + parent::handle(); } } diff --git a/app/Console/Commands/Schedule/ProcessRunnableCommand.php b/app/Console/Commands/Schedule/ProcessRunnableCommand.php index 310b2f3b1..9e51feaeb 100644 --- a/app/Console/Commands/Schedule/ProcessRunnableCommand.php +++ b/app/Console/Commands/Schedule/ProcessRunnableCommand.php @@ -2,8 +2,8 @@ namespace Pterodactyl\Console\Commands\Schedule; -use Throwable; use Exception; +use Throwable; use Illuminate\Console\Command; use Pterodactyl\Models\Schedule; use Illuminate\Support\Facades\Log; @@ -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) diff --git a/app/Console/Commands/Server/BulkPowerActionCommand.php b/app/Console/Commands/Server/BulkPowerActionCommand.php index 32d9868b5..460df7194 100644 --- a/app/Console/Commands/Server/BulkPowerActionCommand.php +++ b/app/Console/Commands/Server/BulkPowerActionCommand.php @@ -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); - } else if (empty($nodes) && ! empty($servers)) { + } elseif (empty($nodes) && !empty($servers)) { $instance->whereIn('id', $servers); - } else if (! empty($nodes) && empty($servers)) { + } elseif (!empty($nodes) && empty($servers)) { $instance->whereIn('node_id', $nodes); } diff --git a/app/Console/Commands/Server/BulkReinstallActionCommand.php b/app/Console/Commands/Server/BulkReinstallActionCommand.php deleted file mode 100644 index a56cefc79..000000000 --- a/app/Console/Commands/Server/BulkReinstallActionCommand.php +++ /dev/null @@ -1,113 +0,0 @@ -. - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ - -namespace Pterodactyl\Console\Commands\Server; - -use Webmozart\Assert\Assert; -use Illuminate\Console\Command; -use GuzzleHttp\Exception\RequestException; -use Pterodactyl\Repositories\Eloquent\ServerRepository; -use Pterodactyl\Repositories\Wings\DaemonServerRepository; -use Pterodactyl\Services\Servers\ServerConfigurationStructureService; - -class BulkReinstallActionCommand extends Command -{ - /** - * @var \Pterodactyl\Services\Servers\ServerConfigurationStructureService - */ - private $configurationStructureService; - - /** - * @var \Pterodactyl\Repositories\Wings\DaemonServerRepository - */ - private $daemonRepository; - - /** - * @var \Pterodactyl\Repositories\Eloquent\ServerRepository - */ - private $repository; - - /** - * @var string - */ - protected $description = 'Reinstall a single server, all servers on a node, or all servers on the panel.'; - - /** - * @var string - */ - protected $signature = 'p:server:reinstall - {server? : The ID of the server to reinstall.} - {--node= : ID of the node to reinstall all servers on. Ignored if server is passed.}'; - - /** - * 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, - ServerConfigurationStructureService $configurationStructureService, - ServerRepository $repository - ) { - parent::__construct(); - - $this->configurationStructureService = $configurationStructureService; - $this->daemonRepository = $daemonRepository; - $this->repository = $repository; - } - - /** - * Handle command execution. - */ - public function handle() - { - $servers = $this->getServersToProcess(); - - if (! $this->confirm(trans('command/messages.server.reinstall.confirm')) && $this->input->isInteractive()) { - return; - } - - $bar = $this->output->createProgressBar(count($servers)); - - $servers->each(function ($server) use ($bar) { - $bar->clear(); - - try { - $this->daemonRepository->setServer($server)->reinstall(); - } catch (RequestException $exception) { - $this->output->error(trans('command/messages.server.reinstall.failed', [ - 'name' => $server->name, - 'id' => $server->id, - 'node' => $server->node->name, - 'message' => $exception->getMessage(), - ])); - } - - $bar->advance(); - $bar->display(); - }); - - $this->line(''); - } - - /** - * Return the servers to be reinstalled. - * - * @return \Illuminate\Support\Collection - */ - private function getServersToProcess() - { - Assert::nullOrIntegerish($this->argument('server'), 'Value passed in server argument must be null or an integer, received %s.'); - Assert::nullOrIntegerish($this->option('node'), 'Value passed in node option must be null or integer, received %s.'); - - return $this->repository->getDataForReinstall($this->argument('server'), $this->option('node')); - } -} diff --git a/app/Console/Commands/UpgradeCommand.php b/app/Console/Commands/UpgradeCommand.php new file mode 100644 index 000000000..d42964942 --- /dev/null +++ b/app/Console/Commands/UpgradeCommand.php @@ -0,0 +1,178 @@ +option('skip-download'); + if (!$skipDownload) { + $this->output->warning('This command does not verify the integrity of downloaded assets. Please ensure that you trust the download source before continuing. If you do not wish to download an archive, please indicate that using the --skip-download flag, or answering "no" to the question below.'); + $this->output->comment('Download Source (set with --url=):'); + $this->line($this->getUrl()); + } + + if (version_compare(PHP_VERSION, '7.4.0') < 0) { + $this->error('Cannot execute self-upgrade process. The minimum required PHP version required is 7.4.0, you have [' . PHP_VERSION . '].'); + } + + $user = 'www-data'; + if ($this->input->isInteractive()) { + if (!$skipDownload) { + $skipDownload = !$this->confirm('Would you like to download and unpack the archive files for the latest version?', true); + } + + if (is_null($this->option('user'))) { + $details = posix_getpwuid(fileowner('public')); + $user = $details['name'] ?? 'www-data'; + + if (!$this->confirm("Your webserver user has been detected as [{$user}]: is this correct?", true)) { + $user = $this->anticipate( + 'Please enter the name of the user running your webserver process. This varies from system to system, but is generally "www-data", "nginx", or "apache".', + [ + 'www-data', + 'apache', + 'nginx', + ] + ); + } + } + + if (!$this->confirm('Are you sure you want to run the upgrade process for your Panel?')) { + return; + } + } + + ini_set('output_buffering', 0); + $bar = $this->output->createProgressBar($skipDownload ? 9 : 10); + $bar->start(); + + if (!$skipDownload) { + $this->withProgress($bar, function () { + $this->line("\$upgrader> curl -L \"{$this->getUrl()}\" | tar -xzv"); + $process = Process::fromShellCommandline("curl -L \"{$this->getUrl()}\" | tar -xzvf"); + $process->run(function ($type, $buffer) { + $this->{$type === Process::ERR ? 'error' : 'line'}($buffer); + }); + }); + } + + $this->withProgress($bar, function () { + $this->line('$upgrader> php artisan down'); + $this->call('down'); + }); + + $this->withProgress($bar, function () { + $this->line('$upgrader> chmod -R 755 storage bootstrap/cache'); + $process = new Process(['chmod', '-R', '755', 'storage', 'bootstrap/cache']); + $process->run(function ($type, $buffer) { + $this->{$type === Process::ERR ? 'error' : 'line'}($buffer); + }); + }); + + $this->withProgress($bar, function () { + $command = ['composer', 'install', '--no-ansi']; + if (config('app.env') === 'production' && !config('app.debug')) { + $command[] = '--optimize-autoloader'; + $command[] = '--no-dev'; + } + + $this->line('$upgrader> ' . implode(' ', $command)); + $process = new Process($command); + $process->setTimeout(10 * 60); + $process->run(function ($type, $buffer) { + $this->line($buffer); + }); + }); + + /** @var \Illuminate\Foundation\Application $app */ + $app = require __DIR__ . '/../../../bootstrap/app.php'; + /** @var \Pterodactyl\Console\Kernel $kernel */ + $kernel = $app->make(Kernel::class); + $kernel->bootstrap(); + $this->setLaravel($app); + + $this->withProgress($bar, function () { + $this->line('$upgrader> php artisan view:clear'); + $this->call('view:clear'); + }); + + $this->withProgress($bar, function () { + $this->line('$upgrader> php artisan config:clear'); + $this->call('config:clear'); + }); + + $this->withProgress($bar, function () { + $this->line('$upgrader> php artisan migrate --seed --force'); + $this->call('migrate', ['--seed' => '', '--force' => '']); + }); + + $this->withProgress($bar, function () use ($user) { + $this->line("\$upgrader> chown -R {$user}:{$user} *"); + $process = Process::fromShellCommandline("chown -R {$user}:{$user} *", $this->getLaravel()->basePath()); + $process->setTimeout(10 * 60); + $process->run(function ($type, $buffer) { + $this->{$type === Process::ERR ? 'error' : 'line'}($buffer); + }); + }); + + $this->withProgress($bar, function () { + $this->line('$upgrader> php artisan queue:restart'); + $this->call('queue:restart'); + }); + + $this->withProgress($bar, function () { + $this->line('$upgrader> php artisan up'); + $this->call('up'); + }); + + $this->newLine(); + $this->info('Finished running upgrade.'); + } + + protected function withProgress(ProgressBar $bar, Closure $callback) + { + $bar->clear(); + $callback(); + $bar->advance(); + $bar->display(); + } + + protected function getUrl(): string + { + if ($this->option('url')) { + return $this->option('url'); + } + + return sprintf(self::DEFAULT_URL, $this->option('release') ? 'download/v' . $this->option('release') : 'latest/download'); + } +} diff --git a/app/Console/Commands/User/DeleteUserCommand.php b/app/Console/Commands/User/DeleteUserCommand.php index 64885dca1..4c847257e 100644 --- a/app/Console/Commands/User/DeleteUserCommand.php +++ b/app/Console/Commands/User/DeleteUserCommand.php @@ -9,11 +9,10 @@ namespace Pterodactyl\Console\Commands\User; -use Webmozart\Assert\Assert; use Pterodactyl\Models\User; +use Webmozart\Assert\Assert; use Illuminate\Console\Command; use Pterodactyl\Services\Users\UserDeletionService; -use Pterodactyl\Contracts\Repository\UserRepositoryInterface; class DeleteUserCommand extends Command { @@ -39,10 +38,9 @@ class DeleteUserCommand extends Command /** * DeleteUserCommand constructor. - * - * @param \Pterodactyl\Services\Users\UserDeletionService $deletionService */ - public function __construct(UserDeletionService $deletionService) { + public function __construct(UserDeletionService $deletionService) + { parent::__construct(); $this->deletionService = $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,11 +91,9 @@ 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')); } - - return; } } diff --git a/app/Console/Commands/User/DisableTwoFactorCommand.php b/app/Console/Commands/User/DisableTwoFactorCommand.php index f2cab910d..05e98c045 100644 --- a/app/Console/Commands/User/DisableTwoFactorCommand.php +++ b/app/Console/Commands/User/DisableTwoFactorCommand.php @@ -31,8 +31,6 @@ class DisableTwoFactorCommand extends Command /** * DisableTwoFactorCommand constructor. - * - * @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository */ public function __construct(UserRepositoryInterface $repository) { diff --git a/app/Console/Commands/User/MakeUserCommand.php b/app/Console/Commands/User/MakeUserCommand.php index 35060b53f..f981a2f23 100644 --- a/app/Console/Commands/User/MakeUserCommand.php +++ b/app/Console/Commands/User/MakeUserCommand.php @@ -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')); diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 4fa0845e5..d5fa25ec4 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -17,20 +17,15 @@ class Kernel extends ConsoleKernel /** * Define the application's command schedule. - * - * @param \Illuminate\Console\Scheduling\Schedule $schedule */ protected function schedule(Schedule $schedule) { // Execute scheduled commands for servers every minute, as if there was a normal cron running. $schedule->command('p:schedule:process')->everyMinute()->withoutOverlapping(); - // Every 30 minutes, run the backup pruning command so that any abandoned backups can be deleted. - $pruneAge = config('backups.prune_age', 360); // Defaults to 6 hours (time is in minuteS) - if ($pruneAge > 0) { - $schedule->command('p:maintenance:prune-backups', [ - '--since-minutes' => $pruneAge, - ])->everyThirtyMinutes(); + if (config('backups.prune_age')) { + // Every 30 minutes, run the backup pruning command so that any abandoned backups can be deleted. + $schedule->command('p:maintenance:prune-backups')->everyThirtyMinutes(); } // Every day cleanup any internal backups of service files. diff --git a/app/Console/RequiresDatabaseMigrations.php b/app/Console/RequiresDatabaseMigrations.php index f288ca1f1..0a4ca4944 100644 --- a/app/Console/RequiresDatabaseMigrations.php +++ b/app/Console/RequiresDatabaseMigrations.php @@ -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,12 +32,10 @@ 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 + protected function showMigrationWarning() { - $this->getOutput()->writeln(" + $this->getOutput()->writeln(' | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | | | | Your database has not been properly migrated! | @@ -52,10 +48,8 @@ You must run the following command to finish migrating your database: You will not be able to use Pterodactyl Panel as expected without fixing your database state by running the command above. -"); +'); - $this->getOutput()->error("You must correct the error above before continuing."); - - return 1; + $this->getOutput()->error('You must correct the error above before continuing.'); } } diff --git a/app/Contracts/Core/ReceivesEvents.php b/app/Contracts/Core/ReceivesEvents.php index a6c1aa10f..dbbad4458 100644 --- a/app/Contracts/Core/ReceivesEvents.php +++ b/app/Contracts/Core/ReceivesEvents.php @@ -8,8 +8,6 @@ interface ReceivesEvents { /** * Handles receiving an event from the application. - * - * @param \Pterodactyl\Events\Event $notification */ public function handle(Event $notification): void; } diff --git a/app/Contracts/Criteria/CriteriaInterface.php b/app/Contracts/Criteria/CriteriaInterface.php index 1b8328192..cb9f56d7f 100644 --- a/app/Contracts/Criteria/CriteriaInterface.php +++ b/app/Contracts/Criteria/CriteriaInterface.php @@ -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); diff --git a/app/Contracts/Extensions/HashidsInterface.php b/app/Contracts/Extensions/HashidsInterface.php index 8e1e69900..e8d525f34 100644 --- a/app/Contracts/Extensions/HashidsInterface.php +++ b/app/Contracts/Extensions/HashidsInterface.php @@ -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 diff --git a/app/Contracts/Http/ClientPermissionsRequest.php b/app/Contracts/Http/ClientPermissionsRequest.php index 6b863fce9..85eae2259 100644 --- a/app/Contracts/Http/ClientPermissionsRequest.php +++ b/app/Contracts/Http/ClientPermissionsRequest.php @@ -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; } diff --git a/app/Contracts/Repository/AllocationRepositoryInterface.php b/app/Contracts/Repository/AllocationRepositoryInterface.php index 400279733..24507f9a7 100644 --- a/app/Contracts/Repository/AllocationRepositoryInterface.php +++ b/app/Contracts/Repository/AllocationRepositoryInterface.php @@ -2,25 +2,17 @@ namespace Pterodactyl\Contracts\Repository; -use Illuminate\Support\Collection; - 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); diff --git a/app/Contracts/Repository/ApiKeyRepositoryInterface.php b/app/Contracts/Repository/ApiKeyRepositoryInterface.php index 89a722b22..91e0a3827 100644 --- a/app/Contracts/Repository/ApiKeyRepositoryInterface.php +++ b/app/Contracts/Repository/ApiKeyRepositoryInterface.php @@ -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; } diff --git a/app/Contracts/Repository/DatabaseHostRepositoryInterface.php b/app/Contracts/Repository/DatabaseHostRepositoryInterface.php index a924d85a9..01f1ca4b4 100644 --- a/app/Contracts/Repository/DatabaseHostRepositoryInterface.php +++ b/app/Contracts/Repository/DatabaseHostRepositoryInterface.php @@ -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; } diff --git a/app/Contracts/Repository/DatabaseRepositoryInterface.php b/app/Contracts/Repository/DatabaseRepositoryInterface.php index 5926adb7c..622072203 100644 --- a/app/Contracts/Repository/DatabaseRepositoryInterface.php +++ b/app/Contracts/Repository/DatabaseRepositoryInterface.php @@ -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; diff --git a/app/Contracts/Repository/EggRepositoryInterface.php b/app/Contracts/Repository/EggRepositoryInterface.php index 0f6a88aa7..733e70cfb 100644 --- a/app/Contracts/Repository/EggRepositoryInterface.php +++ b/app/Contracts/Repository/EggRepositoryInterface.php @@ -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; } diff --git a/app/Contracts/Repository/EggVariableRepositoryInterface.php b/app/Contracts/Repository/EggVariableRepositoryInterface.php index 77b46f96d..6a00955d4 100644 --- a/app/Contracts/Repository/EggVariableRepositoryInterface.php +++ b/app/Contracts/Repository/EggVariableRepositoryInterface.php @@ -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; } diff --git a/app/Contracts/Repository/LocationRepositoryInterface.php b/app/Contracts/Repository/LocationRepositoryInterface.php index 76a952e43..d24cee5bd 100644 --- a/app/Contracts/Repository/LocationRepositoryInterface.php +++ b/app/Contracts/Repository/LocationRepositoryInterface.php @@ -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 diff --git a/app/Contracts/Repository/NestRepositoryInterface.php b/app/Contracts/Repository/NestRepositoryInterface.php index e457262f6..1f430dbf8 100644 --- a/app/Contracts/Repository/NestRepositoryInterface.php +++ b/app/Contracts/Repository/NestRepositoryInterface.php @@ -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; diff --git a/app/Contracts/Repository/NodeRepositoryInterface.php b/app/Contracts/Repository/NodeRepositoryInterface.php index 76ed7da93..87d5b4de5 100644 --- a/app/Contracts/Repository/NodeRepositoryInterface.php +++ b/app/Contracts/Repository/NodeRepositoryInterface.php @@ -4,54 +4,35 @@ namespace Pterodactyl\Contracts\Repository; use Pterodactyl\Models\Node; use Illuminate\Support\Collection; -use Illuminate\Support\LazyCollection; -use Illuminate\Contracts\Pagination\LengthAwarePaginator; -use Pterodactyl\Contracts\Repository\Attributes\SearchableInterface; 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; } diff --git a/app/Contracts/Repository/RepositoryInterface.php b/app/Contracts/Repository/RepositoryInterface.php index 5caaac907..e9350d5f0 100644 --- a/app/Contracts/Repository/RepositoryInterface.php +++ b/app/Contracts/Repository/RepositoryInterface.php @@ -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; } diff --git a/app/Contracts/Repository/ScheduleRepositoryInterface.php b/app/Contracts/Repository/ScheduleRepositoryInterface.php index b6e73a2de..c7bb0ee26 100644 --- a/app/Contracts/Repository/ScheduleRepositoryInterface.php +++ b/app/Contracts/Repository/ScheduleRepositoryInterface.php @@ -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; diff --git a/app/Contracts/Repository/ServerRepositoryInterface.php b/app/Contracts/Repository/ServerRepositoryInterface.php index 55cf79a39..323e1cd36 100644 --- a/app/Contracts/Repository/ServerRepositoryInterface.php +++ b/app/Contracts/Repository/ServerRepositoryInterface.php @@ -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; } diff --git a/app/Contracts/Repository/SessionRepositoryInterface.php b/app/Contracts/Repository/SessionRepositoryInterface.php index e1dafed1e..305752fb4 100644 --- a/app/Contracts/Repository/SessionRepositoryInterface.php +++ b/app/Contracts/Repository/SessionRepositoryInterface.php @@ -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); diff --git a/app/Contracts/Repository/SettingsRepositoryInterface.php b/app/Contracts/Repository/SettingsRepositoryInterface.php index 6c4db9dca..e5b2bb773 100644 --- a/app/Contracts/Repository/SettingsRepositoryInterface.php +++ b/app/Contracts/Repository/SettingsRepositoryInterface.php @@ -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); } diff --git a/app/Contracts/Repository/SubuserRepositoryInterface.php b/app/Contracts/Repository/SubuserRepositoryInterface.php index 6babbfcc2..1379e120b 100644 --- a/app/Contracts/Repository/SubuserRepositoryInterface.php +++ b/app/Contracts/Repository/SubuserRepositoryInterface.php @@ -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; diff --git a/app/Contracts/Repository/TaskRepositoryInterface.php b/app/Contracts/Repository/TaskRepositoryInterface.php index ea9486254..18811ba5c 100644 --- a/app/Contracts/Repository/TaskRepositoryInterface.php +++ b/app/Contracts/Repository/TaskRepositoryInterface.php @@ -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); diff --git a/app/Events/Server/Created.php b/app/Events/Server/Created.php index 8ca547004..8963b3cbf 100644 --- a/app/Events/Server/Created.php +++ b/app/Events/Server/Created.php @@ -25,8 +25,6 @@ class Created /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Server $server */ public function __construct(Server $server) { diff --git a/app/Events/Server/Creating.php b/app/Events/Server/Creating.php index 318156b6d..457f586ed 100644 --- a/app/Events/Server/Creating.php +++ b/app/Events/Server/Creating.php @@ -25,8 +25,6 @@ class Creating /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Server $server */ public function __construct(Server $server) { diff --git a/app/Events/Server/Deleted.php b/app/Events/Server/Deleted.php index 258ac75b1..c9f69cab5 100644 --- a/app/Events/Server/Deleted.php +++ b/app/Events/Server/Deleted.php @@ -25,8 +25,6 @@ class Deleted /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Server $server */ public function __construct(Server $server) { diff --git a/app/Events/Server/Deleting.php b/app/Events/Server/Deleting.php index 49219afc9..e411e2a70 100644 --- a/app/Events/Server/Deleting.php +++ b/app/Events/Server/Deleting.php @@ -25,8 +25,6 @@ class Deleting /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Server $server */ public function __construct(Server $server) { diff --git a/app/Events/Server/Saved.php b/app/Events/Server/Saved.php index 4b8ae2165..c6dc024c5 100644 --- a/app/Events/Server/Saved.php +++ b/app/Events/Server/Saved.php @@ -25,8 +25,6 @@ class Saved /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Server $server */ public function __construct(Server $server) { diff --git a/app/Events/Server/Saving.php b/app/Events/Server/Saving.php index 9bb8153fe..9e80d6265 100644 --- a/app/Events/Server/Saving.php +++ b/app/Events/Server/Saving.php @@ -25,8 +25,6 @@ class Saving /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Server $server */ public function __construct(Server $server) { diff --git a/app/Events/Server/Updated.php b/app/Events/Server/Updated.php index 7157d4b34..b813b0997 100644 --- a/app/Events/Server/Updated.php +++ b/app/Events/Server/Updated.php @@ -25,8 +25,6 @@ class Updated /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Server $server */ public function __construct(Server $server) { diff --git a/app/Events/Server/Updating.php b/app/Events/Server/Updating.php index c91c8a122..4c8ead093 100644 --- a/app/Events/Server/Updating.php +++ b/app/Events/Server/Updating.php @@ -25,8 +25,6 @@ class Updating /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Server $server */ public function __construct(Server $server) { diff --git a/app/Events/Subuser/Created.php b/app/Events/Subuser/Created.php index 63941b2af..2467fe99a 100644 --- a/app/Events/Subuser/Created.php +++ b/app/Events/Subuser/Created.php @@ -25,8 +25,6 @@ class Created /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Subuser $subuser */ public function __construct(Subuser $subuser) { diff --git a/app/Events/Subuser/Creating.php b/app/Events/Subuser/Creating.php index 5d6f6d800..03aa5f7fd 100644 --- a/app/Events/Subuser/Creating.php +++ b/app/Events/Subuser/Creating.php @@ -25,8 +25,6 @@ class Creating /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Subuser $subuser */ public function __construct(Subuser $subuser) { diff --git a/app/Events/Subuser/Deleted.php b/app/Events/Subuser/Deleted.php index ee53388b7..0e9744c3f 100644 --- a/app/Events/Subuser/Deleted.php +++ b/app/Events/Subuser/Deleted.php @@ -25,8 +25,6 @@ class Deleted /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Subuser $subuser */ public function __construct(Subuser $subuser) { diff --git a/app/Events/Subuser/Deleting.php b/app/Events/Subuser/Deleting.php index 6d25a3ebb..9d1e12c2f 100644 --- a/app/Events/Subuser/Deleting.php +++ b/app/Events/Subuser/Deleting.php @@ -25,8 +25,6 @@ class Deleting /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Subuser $subuser */ public function __construct(Subuser $subuser) { diff --git a/app/Events/User/Created.php b/app/Events/User/Created.php index b66d531d4..72eba811c 100644 --- a/app/Events/User/Created.php +++ b/app/Events/User/Created.php @@ -25,8 +25,6 @@ class Created /** * Create a new event instance. - * - * @param \Pterodactyl\Models\User $user */ public function __construct(User $user) { diff --git a/app/Events/User/Creating.php b/app/Events/User/Creating.php index d6297440b..7948d7067 100644 --- a/app/Events/User/Creating.php +++ b/app/Events/User/Creating.php @@ -25,8 +25,6 @@ class Creating /** * Create a new event instance. - * - * @param \Pterodactyl\Models\User $user */ public function __construct(User $user) { diff --git a/app/Events/User/Deleted.php b/app/Events/User/Deleted.php index 1b1682ef0..48b524874 100644 --- a/app/Events/User/Deleted.php +++ b/app/Events/User/Deleted.php @@ -25,8 +25,6 @@ class Deleted /** * Create a new event instance. - * - * @param \Pterodactyl\Models\User $user */ public function __construct(User $user) { diff --git a/app/Events/User/Deleting.php b/app/Events/User/Deleting.php index 05e3ba252..a386bd951 100644 --- a/app/Events/User/Deleting.php +++ b/app/Events/User/Deleting.php @@ -25,8 +25,6 @@ class Deleting /** * Create a new event instance. - * - * @param \Pterodactyl\Models\User $user */ public function __construct(User $user) { diff --git a/app/Exceptions/DisplayException.php b/app/Exceptions/DisplayException.php index 94a920056..f3120471d 100644 --- a/app/Exceptions/DisplayException.php +++ b/app/Exceptions/DisplayException.php @@ -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; } diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 00484d943..a94ad8aad 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -5,10 +5,14 @@ namespace Pterodactyl\Exceptions; use Exception; use Throwable; use PDOException; -use Psr\Log\LoggerInterface; +use Illuminate\Support\Arr; +use Illuminate\Support\Str; use Swift_TransportException; +use Illuminate\Http\JsonResponse; +use Illuminate\Support\Collection; use Illuminate\Container\Container; use Illuminate\Database\Connection; +use Illuminate\Foundation\Application; use Illuminate\Auth\AuthenticationException; use Illuminate\Session\TokenMismatchException; use Illuminate\Validation\ValidationException; @@ -43,17 +47,6 @@ class Handler extends ExceptionHandler ValidationException::class, ]; - /** - * A list of exceptions that should be logged with cleaned stack - * traces to avoid exposing credentials or other sensitive information. - * - * @var array - */ - protected $cleanStacks = [ - PDOException::class, - Swift_TransportException::class, - ]; - /** * A list of the inputs that are never flashed for validation exceptions. * @@ -67,56 +60,40 @@ class Handler extends ExceptionHandler ]; /** - * Report or log an exception. Skips Laravel's internal reporter since we - * don't need or want the user information in our logs by default. + * Registers the exception handling callbacks for the application. This + * will capture specific exception types that we do not want to include + * the detailed stack traces for since they could reveal credentials to + * whoever can read the logs. * - * If you want to implement logging in a different format to integrate with - * services such as AWS Cloudwatch or other monitoring you can replace the - * contents of this function with a call to the parent reporter. - * - * @param \Throwable $exception - * @return mixed - * - * @throws \Throwable + * @noinspection PhpUnusedLocalVariableInspection */ - public function report(Throwable $exception) + public function register() { - if (! config('app.exceptions.report_all', false) && $this->shouldntReport($exception)) { - return null; + if (config('app.exceptions.report_all', false)) { + $this->dontReport = []; } - if (method_exists($exception, 'report')) { - return $exception->report(); - } + $this->reportable(function (PDOException $ex) { + $ex = $this->generateCleanedExceptionStack($ex); + }); - try { - $logger = $this->container->make(LoggerInterface::class); - } catch (Exception $ex) { - throw $exception; - } - - foreach ($this->cleanStacks as $class) { - if ($exception instanceof $class) { - $exception = $this->generateCleanedExceptionStack($exception); - break; - } - } - - return $logger->error($exception); + $this->reportable(function (Swift_TransportException $ex) { + $ex = $this->generateCleanedExceptionStack($ex); + }); } - private function generateCleanedExceptionStack(Throwable $exception) + private function generateCleanedExceptionStack(Throwable $exception): string { $cleanedStack = ''; foreach ($exception->getTrace() as $index => $item) { $cleanedStack .= sprintf( "#%d %s(%d): %s%s%s\n", $index, - array_get($item, 'file'), - array_get($item, 'line'), - array_get($item, 'class'), - array_get($item, 'type'), - array_get($item, 'function') + Arr::get($item, 'file'), + Arr::get($item, 'line'), + Arr::get($item, 'class'), + Arr::get($item, 'type'), + Arr::get($item, 'function') ); } @@ -135,14 +112,14 @@ 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 */ public function render($request, Throwable $exception) { - $connections = Container::getInstance()->make(Connection::class); + $connections = $this->container->make(Connection::class); // If we are currently wrapped up inside a transaction, we will roll all the way // back to the beginning. This needs to happen, otherwise session data does not @@ -165,27 +142,28 @@ 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) { - $codes = collect($exception->validator->failed())->mapWithKeys(function ($reasons, $field) { + $codes = Collection::make($exception->validator->failed())->mapWithKeys(function ($reasons, $field) { $cleaned = []; foreach ($reasons as $reason => $attrs) { - $cleaned[] = snake_case($reason); + $cleaned[] = Str::snake($reason); } return [str_replace('.', '_', $field) => $cleaned]; })->toArray(); - $errors = collect($exception->errors())->map(function ($errors, $field) use ($codes, $exception) { + $errors = Collection::make($exception->errors())->map(function ($errors, $field) use ($codes, $exception) { $response = []; foreach ($errors as $key => $error) { $meta = [ 'source_field' => $field, - 'rule' => str_replace(self::PTERODACTYL_RULE_STRING, 'p_', array_get( - $codes, str_replace('.', '_', $field) . '.' . $key + 'rule' => str_replace(self::PTERODACTYL_RULE_STRING, 'p_', Arr::get( + $codes, + str_replace('.', '_', $field) . '.' . $key )), ]; @@ -206,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 { @@ -235,7 +209,7 @@ class Handler extends ExceptionHandler 'detail' => $exception->getMessage(), 'source' => [ 'line' => $exception->getLine(), - 'file' => str_replace(base_path(), '', $exception->getFile()), + 'file' => str_replace(Application::getInstance()->basePath(), '', $exception->getFile()), ], 'meta' => [ 'trace' => explode("\n", $exception->getTraceAsString()), @@ -248,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 { @@ -261,23 +232,22 @@ 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\Response + * + * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse */ protected function unauthenticated($request, AuthenticationException $exception) { if ($request->expectsJson()) { - return response()->json(self::convertToArray($exception), 401); + return new JsonResponse(self::convertToArray($exception), JsonResponse::HTTP_UNAUTHORIZED); } - return redirect()->guest(route('auth.login')); + return $this->container->make('redirect')->guest('/auth/login'); } /** * 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) diff --git a/app/Exceptions/Http/Connection/DaemonConnectionException.php b/app/Exceptions/Http/Connection/DaemonConnectionException.php index 138a665c3..2a03a627f 100644 --- a/app/Exceptions/Http/Connection/DaemonConnectionException.php +++ b/app/Exceptions/Http/Connection/DaemonConnectionException.php @@ -29,9 +29,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) { diff --git a/app/Exceptions/Http/HttpForbiddenException.php b/app/Exceptions/Http/HttpForbiddenException.php index fa2aae9be..1488265a9 100644 --- a/app/Exceptions/Http/HttpForbiddenException.php +++ b/app/Exceptions/Http/HttpForbiddenException.php @@ -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) { diff --git a/app/Exceptions/Http/TwoFactorAuthRequiredException.php b/app/Exceptions/Http/TwoFactorAuthRequiredException.php index c38503572..cecb64626 100644 --- a/app/Exceptions/Http/TwoFactorAuthRequiredException.php +++ b/app/Exceptions/Http/TwoFactorAuthRequiredException.php @@ -11,11 +11,9 @@ class TwoFactorAuthRequiredException extends HttpException implements HttpExcept { /** * TwoFactorAuthRequiredException constructor. - * - * @param \Throwable|null $previous */ public function __construct(Throwable $previous = null) { - parent::__construct(Response::HTTP_BAD_REQUEST, "Two-factor authentication is required on this account in order to access this endpoint.", $previous); + parent::__construct(Response::HTTP_BAD_REQUEST, 'Two-factor authentication is required on this account in order to access this endpoint.', $previous); } } diff --git a/app/Exceptions/Model/DataValidationException.php b/app/Exceptions/Model/DataValidationException.php index 5840e6d9c..1118081e5 100644 --- a/app/Exceptions/Model/DataValidationException.php +++ b/app/Exceptions/Model/DataValidationException.php @@ -18,8 +18,6 @@ class DataValidationException extends PterodactylException implements HttpExcept /** * DataValidationException constructor. - * - * @param \Illuminate\Contracts\Validation\Validator $validator */ public function __construct(Validator $validator) { diff --git a/app/Exceptions/Service/Backup/TooManyBackupsException.php b/app/Exceptions/Service/Backup/TooManyBackupsException.php index a96baed50..8ccbaf76b 100644 --- a/app/Exceptions/Service/Backup/TooManyBackupsException.php +++ b/app/Exceptions/Service/Backup/TooManyBackupsException.php @@ -8,8 +8,6 @@ class TooManyBackupsException extends DisplayException { /** * TooManyBackupsException constructor. - * - * @param int $backupLimit */ public function __construct(int $backupLimit) { diff --git a/app/Exceptions/Service/ServiceLimitExceededException.php b/app/Exceptions/Service/ServiceLimitExceededException.php index 55ee6c94b..7236034fe 100644 --- a/app/Exceptions/Service/ServiceLimitExceededException.php +++ b/app/Exceptions/Service/ServiceLimitExceededException.php @@ -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) { diff --git a/app/Extensions/Backups/BackupManager.php b/app/Extensions/Backups/BackupManager.php index fb0e0a26a..80515848e 100644 --- a/app/Extensions/Backups/BackupManager.php +++ b/app/Extensions/Backups/BackupManager.php @@ -8,8 +8,8 @@ use Illuminate\Support\Arr; use Illuminate\Support\Str; use Webmozart\Assert\Assert; use InvalidArgumentException; -use League\Flysystem\AdapterInterface; use Illuminate\Foundation\Application; +use League\Flysystem\AdapterInterface; use League\Flysystem\AwsS3v3\AwsS3Adapter; use League\Flysystem\Memory\MemoryAdapter; use Illuminate\Contracts\Config\Repository; @@ -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) diff --git a/app/Extensions/DynamicDatabaseConnection.php b/app/Extensions/DynamicDatabaseConnection.php index f31a92b19..e45243e50 100644 --- a/app/Extensions/DynamicDatabaseConnection.php +++ b/app/Extensions/DynamicDatabaseConnection.php @@ -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); } diff --git a/app/Extensions/Hashids.php b/app/Extensions/Hashids.php index 60e5d956b..ab07fc86d 100644 --- a/app/Extensions/Hashids.php +++ b/app/Extensions/Hashids.php @@ -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; } diff --git a/app/Extensions/Lcobucci/JWT/Encoding/TimestampDates.php b/app/Extensions/Lcobucci/JWT/Encoding/TimestampDates.php new file mode 100644 index 000000000..e13133c34 --- /dev/null +++ b/app/Extensions/Lcobucci/JWT/Encoding/TimestampDates.php @@ -0,0 +1,30 @@ +getTimestamp(); + } + + return $claims; + } +} diff --git a/app/Extensions/League/Fractal/Serializers/PterodactylSerializer.php b/app/Extensions/League/Fractal/Serializers/PterodactylSerializer.php index 4a76d8ff6..2481cf96e 100644 --- a/app/Extensions/League/Fractal/Serializers/PterodactylSerializer.php +++ b/app/Extensions/League/Fractal/Serializers/PterodactylSerializer.php @@ -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) diff --git a/app/Extensions/Spatie/Fractalistic/Fractal.php b/app/Extensions/Spatie/Fractalistic/Fractal.php index 5bb0dd52b..b9c651d35 100644 --- a/app/Extensions/Spatie/Fractalistic/Fractal.php +++ b/app/Extensions/Spatie/Fractalistic/Fractal.php @@ -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 diff --git a/app/Helpers/Time.php b/app/Helpers/Time.php index 248ff55f0..fd9a265a3 100644 --- a/app/Helpers/Time.php +++ b/app/Helpers/Time.php @@ -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 { diff --git a/app/Helpers/Utilities.php b/app/Helpers/Utilities.php index d6b4e752f..b48e9f091 100644 --- a/app/Helpers/Utilities.php +++ b/app/Helpers/Utilities.php @@ -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,22 +36,18 @@ class Utilities /** * Converts schedule cron data into a carbon object. * - * @param string $minute - * @param string $hour - * @param string $dayOfMonth - * @param string $dayOfWeek * @return \Carbon\Carbon */ - public static function getScheduleNextRunDate(string $minute, string $hour, string $dayOfMonth, string $dayOfWeek) + public static function getScheduleNextRunDate(string $minute, string $hour, string $dayOfMonth, string $month, string $dayOfWeek) { return Carbon::instance(CronExpression::factory( - sprintf('%s %s %s * %s', $minute, $hour, $dayOfMonth, $dayOfWeek) + sprintf('%s %s %s %s %s', $minute, $hour, $dayOfMonth, $month, $dayOfWeek) )->getNextRunDate()); } /** - * @param string $name * @param mixed $default + * * @return string */ public static function checked(string $name, $default) diff --git a/app/Http/Controllers/Admin/ApiController.php b/app/Http/Controllers/Admin/ApiController.php index 6067b423c..ef9c86355 100644 --- a/app/Http/Controllers/Admin/ApiController.php +++ b/app/Http/Controllers/Admin/ApiController.php @@ -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 { diff --git a/app/Http/Controllers/Admin/BaseController.php b/app/Http/Controllers/Admin/BaseController.php index b80676f2e..68e923ad8 100644 --- a/app/Http/Controllers/Admin/BaseController.php +++ b/app/Http/Controllers/Admin/BaseController.php @@ -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 { diff --git a/app/Http/Controllers/Admin/DatabaseController.php b/app/Http/Controllers/Admin/DatabaseController.php index 0aee86806..9e6cc000a 100644 --- a/app/Http/Controllers/Admin/DatabaseController.php +++ b/app/Http/Controllers/Admin/DatabaseController.php @@ -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 diff --git a/app/Http/Controllers/Admin/LocationController.php b/app/Http/Controllers/Admin/LocationController.php index 286d15cf9..195977f27 100644 --- a/app/Http/Controllers/Admin/LocationController.php +++ b/app/Http/Controllers/Admin/LocationController.php @@ -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 diff --git a/app/Http/Controllers/Admin/MountController.php b/app/Http/Controllers/Admin/MountController.php index 79c729976..811abfba2 100644 --- a/app/Http/Controllers/Admin/MountController.php +++ b/app/Http/Controllers/Admin/MountController.php @@ -3,17 +3,13 @@ namespace Pterodactyl\Http\Controllers\Admin; use Ramsey\Uuid\Uuid; -use Illuminate\Support\Str; use Illuminate\Http\Request; use Pterodactyl\Models\Nest; use Pterodactyl\Models\Mount; use Pterodactyl\Models\Location; use Prologue\Alerts\AlertsMessageBag; use Pterodactyl\Http\Controllers\Controller; -use Pterodactyl\Services\Mounts\MountUpdateService; use Pterodactyl\Http\Requests\Admin\MountFormRequest; -use Pterodactyl\Services\Mounts\MountCreationService; -use Pterodactyl\Services\Mounts\MountDeletionService; use Pterodactyl\Repositories\Eloquent\MountRepository; use Pterodactyl\Contracts\Repository\NestRepositoryInterface; use Pterodactyl\Contracts\Repository\LocationRepositoryInterface; @@ -42,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, @@ -76,6 +67,7 @@ class MountController extends Controller * Return the mount view page. * * @param string $id + * * @return \Illuminate\View\View * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -95,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 @@ -116,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 @@ -138,7 +127,6 @@ class MountController extends Controller /** * Delete a location from the system. * - * @param \Pterodactyl\Models\Mount $mount * @return \Illuminate\Http\RedirectResponse * * @throws \Exception @@ -153,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) @@ -176,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) @@ -197,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) @@ -211,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) diff --git a/app/Http/Controllers/Admin/Nests/EggController.php b/app/Http/Controllers/Admin/Nests/EggController.php index 4e3dd5e94..f8d365515 100644 --- a/app/Http/Controllers/Admin/Nests/EggController.php +++ b/app/Http/Controllers/Admin/Nests/EggController.php @@ -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,9 +68,6 @@ 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 */ @@ -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 @@ -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 */ diff --git a/app/Http/Controllers/Admin/Nests/EggScriptController.php b/app/Http/Controllers/Admin/Nests/EggScriptController.php index ea8d4dfa9..4ae8f410b 100644 --- a/app/Http/Controllers/Admin/Nests/EggScriptController.php +++ b/app/Http/Controllers/Admin/Nests/EggScriptController.php @@ -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 diff --git a/app/Http/Controllers/Admin/Nests/EggShareController.php b/app/Http/Controllers/Admin/Nests/EggShareController.php index 7845680e4..32882ba5c 100644 --- a/app/Http/Controllers/Admin/Nests/EggShareController.php +++ b/app/Http/Controllers/Admin/Nests/EggShareController.php @@ -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 diff --git a/app/Http/Controllers/Admin/Nests/EggVariableController.php b/app/Http/Controllers/Admin/Nests/EggVariableController.php index c0677abb5..193f3b9b5 100644 --- a/app/Http/Controllers/Admin/Nests/EggVariableController.php +++ b/app/Http/Controllers/Admin/Nests/EggVariableController.php @@ -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 { diff --git a/app/Http/Controllers/Admin/Nests/NestController.php b/app/Http/Controllers/Admin/Nests/NestController.php index 155df2a5c..89e1efd77 100644 --- a/app/Http/Controllers/Admin/Nests/NestController.php +++ b/app/Http/Controllers/Admin/Nests/NestController.php @@ -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 diff --git a/app/Http/Controllers/Admin/NodeAutoDeployController.php b/app/Http/Controllers/Admin/NodeAutoDeployController.php index be6301c31..a638a3f1d 100644 --- a/app/Http/Controllers/Admin/NodeAutoDeployController.php +++ b/app/Http/Controllers/Admin/NodeAutoDeployController.php @@ -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.', diff --git a/app/Http/Controllers/Admin/Nodes/NodeController.php b/app/Http/Controllers/Admin/Nodes/NodeController.php index 5a7bc1e30..d3d53fc8c 100644 --- a/app/Http/Controllers/Admin/Nodes/NodeController.php +++ b/app/Http/Controllers/Admin/Nodes/NodeController.php @@ -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) diff --git a/app/Http/Controllers/Admin/Nodes/NodeViewController.php b/app/Http/Controllers/Admin/Nodes/NodeViewController.php index 2121985c9..b45b23a09 100644 --- a/app/Http/Controllers/Admin/Nodes/NodeViewController.php +++ b/app/Http/Controllers/Admin/Nodes/NodeViewController.php @@ -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) diff --git a/app/Http/Controllers/Admin/Nodes/SystemInformationController.php b/app/Http/Controllers/Admin/Nodes/SystemInformationController.php index 4e1a3fe8f..476cea49c 100644 --- a/app/Http/Controllers/Admin/Nodes/SystemInformationController.php +++ b/app/Http/Controllers/Admin/Nodes/SystemInformationController.php @@ -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 diff --git a/app/Http/Controllers/Admin/NodesController.php b/app/Http/Controllers/Admin/NodesController.php index d482c47ae..193326dee 100644 --- a/app/Http/Controllers/Admin/NodesController.php +++ b/app/Http/Controllers/Admin/NodesController.php @@ -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 diff --git a/app/Http/Controllers/Admin/Servers/CreateServerController.php b/app/Http/Controllers/Admin/Servers/CreateServerController.php index 1cea7651a..b8f5a320b 100644 --- a/app/Http/Controllers/Admin/Servers/CreateServerController.php +++ b/app/Http/Controllers/Admin/Servers/CreateServerController.php @@ -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 diff --git a/app/Http/Controllers/Admin/Servers/ServerController.php b/app/Http/Controllers/Admin/Servers/ServerController.php index c8e54b1c3..f369b7ad5 100644 --- a/app/Http/Controllers/Admin/Servers/ServerController.php +++ b/app/Http/Controllers/Admin/Servers/ServerController.php @@ -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')); diff --git a/app/Http/Controllers/Admin/Servers/ServerTransferController.php b/app/Http/Controllers/Admin/Servers/ServerTransferController.php index 5207ef9d1..b4afa2cab 100644 --- a/app/Http/Controllers/Admin/Servers/ServerTransferController.php +++ b/app/Http/Controllers/Admin/Servers/ServerTransferController.php @@ -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,13 +75,12 @@ 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 */ - public function transfer(Request $request, Server $server) { + public function transfer(Request $request, Server $server) + { $validatedData = $request->validate([ 'node_id' => 'required|exists:nodes,id', 'allocation_id' => 'required|bail|unique:servers|exists:allocations,id', @@ -107,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; @@ -135,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) { @@ -150,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]); } } diff --git a/app/Http/Controllers/Admin/Servers/ServerViewController.php b/app/Http/Controllers/Admin/Servers/ServerViewController.php index 64c2b7f49..e4c63e2e5 100644 --- a/app/Http/Controllers/Admin/Servers/ServerViewController.php +++ b/app/Http/Controllers/Admin/Servers/ServerViewController.php @@ -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 @@ -234,8 +211,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) diff --git a/app/Http/Controllers/Admin/ServersController.php b/app/Http/Controllers/Admin/ServersController.php index 29016f792..a187c8922 100644 --- a/app/Http/Controllers/Admin/ServersController.php +++ b/app/Http/Controllers/Admin/ServersController.php @@ -9,14 +9,12 @@ namespace Pterodactyl\Http\Controllers\Admin; -use Illuminate\Support\Arr; use Illuminate\Http\Request; use Pterodactyl\Models\User; use Pterodactyl\Models\Mount; use Pterodactyl\Models\Server; use Pterodactyl\Models\MountServer; use Prologue\Alerts\AlertsMessageBag; -use GuzzleHttp\Exception\RequestException; use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Http\Controllers\Controller; use Illuminate\Validation\ValidationException; @@ -37,7 +35,6 @@ use Illuminate\Contracts\Config\Repository as ConfigRepository; use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface; use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface; -use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; use Pterodactyl\Services\Servers\ServerConfigurationStructureService; use Pterodactyl\Http\Requests\Admin\Servers\Databases\StoreServerDatabaseRequest; @@ -135,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, @@ -198,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 @@ -219,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 @@ -244,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 @@ -262,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 @@ -283,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 @@ -311,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 @@ -329,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 @@ -359,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 @@ -380,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 @@ -403,6 +367,7 @@ class ServersController extends Controller * * @param int $server * @param int $database + * * @return \Illuminate\Http\RedirectResponse * * @throws \Exception @@ -423,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, ]); @@ -446,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) diff --git a/app/Http/Controllers/Admin/Settings/AdvancedController.php b/app/Http/Controllers/Admin/Settings/AdvancedController.php index 54409d190..49959bddd 100644 --- a/app/Http/Controllers/Admin/Settings/AdvancedController.php +++ b/app/Http/Controllers/Admin/Settings/AdvancedController.php @@ -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 */ diff --git a/app/Http/Controllers/Admin/Settings/IndexController.php b/app/Http/Controllers/Admin/Settings/IndexController.php index 1bf61d65a..190646fd4 100644 --- a/app/Http/Controllers/Admin/Settings/IndexController.php +++ b/app/Http/Controllers/Admin/Settings/IndexController.php @@ -38,18 +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; $this->settings = $settings; @@ -58,8 +53,6 @@ class IndexController extends Controller /** * Render the UI for basic Panel settings. - * - * @return \Illuminate\View\View */ public function index(): View { @@ -72,8 +65,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 */ diff --git a/app/Http/Controllers/Admin/Settings/MailController.php b/app/Http/Controllers/Admin/Settings/MailController.php index ccd84fa5c..8f3e15ed6 100644 --- a/app/Http/Controllers/Admin/Settings/MailController.php +++ b/app/Http/Controllers/Admin/Settings/MailController.php @@ -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 { diff --git a/app/Http/Controllers/Admin/StatisticsController.php b/app/Http/Controllers/Admin/StatisticsController.php index 612f04b62..5601e98e6 100644 --- a/app/Http/Controllers/Admin/StatisticsController.php +++ b/app/Http/Controllers/Admin/StatisticsController.php @@ -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(); diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index b5126c766..60a2529b9 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -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) diff --git a/app/Http/Controllers/Api/Application/ApplicationApiController.php b/app/Http/Controllers/Api/Application/ApplicationApiController.php index 903edeb65..6078b6f2c 100644 --- a/app/Http/Controllers/Api/Application/ApplicationApiController.php +++ b/app/Http/Controllers/Api/Application/ApplicationApiController.php @@ -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 { diff --git a/app/Http/Controllers/Api/Application/Locations/LocationController.php b/app/Http/Controllers/Api/Application/Locations/LocationController.php index 62ab4ea45..cdcf013b3 100644 --- a/app/Http/Controllers/Api/Application/Locations/LocationController.php +++ b/app/Http/Controllers/Api/Application/Locations/LocationController.php @@ -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 diff --git a/app/Http/Controllers/Api/Application/Nests/EggController.php b/app/Http/Controllers/Api/Application/Nests/EggController.php index 21ce4ec9f..1eb596f99 100644 --- a/app/Http/Controllers/Api/Application/Nests/EggController.php +++ b/app/Http/Controllers/Api/Application/Nests/EggController.php @@ -19,8 +19,6 @@ class EggController extends ApplicationApiController /** * EggController constructor. - * - * @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository */ public function __construct(EggRepositoryInterface $repository) { @@ -31,9 +29,6 @@ class EggController extends ApplicationApiController /** * Return all eggs that exist for a given nest. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Nests\Eggs\GetEggsRequest $request - * @return array */ public function index(GetEggsRequest $request): array { @@ -48,9 +43,6 @@ class EggController extends ApplicationApiController /** * Return a single egg that exists on the specified nest. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Nests\Eggs\GetEggRequest $request - * @return array */ public function view(GetEggRequest $request): array { diff --git a/app/Http/Controllers/Api/Application/Nests/NestController.php b/app/Http/Controllers/Api/Application/Nests/NestController.php index adeacc56c..92de473e8 100644 --- a/app/Http/Controllers/Api/Application/Nests/NestController.php +++ b/app/Http/Controllers/Api/Application/Nests/NestController.php @@ -17,8 +17,6 @@ class NestController extends ApplicationApiController /** * NestController constructor. - * - * @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $repository */ public function __construct(NestRepositoryInterface $repository) { @@ -29,9 +27,6 @@ class NestController extends ApplicationApiController /** * Return all Nests that exist on the Panel. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Nests\GetNestsRequest $request - * @return array */ public function index(GetNestsRequest $request): array { @@ -44,9 +39,6 @@ class NestController extends ApplicationApiController /** * Return information about a single Nest model. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Nests\GetNestsRequest $request - * @return array */ public function view(GetNestsRequest $request): array { diff --git a/app/Http/Controllers/Api/Application/Nodes/AllocationController.php b/app/Http/Controllers/Api/Application/Nodes/AllocationController.php index 01ec37fe1..c66701494 100644 --- a/app/Http/Controllers/Api/Application/Nodes/AllocationController.php +++ b/app/Http/Controllers/Api/Application/Nodes/AllocationController.php @@ -27,9 +27,6 @@ class AllocationController extends ApplicationApiController /** * AllocationController constructor. - * - * @param \Pterodactyl\Services\Allocations\AssignmentService $assignmentService - * @param \Pterodactyl\Services\Allocations\AllocationDeletionService $deletionService */ public function __construct( AssignmentService $assignmentService, @@ -43,10 +40,6 @@ class AllocationController extends ApplicationApiController /** * Return all of the allocations that exist for a given node. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Allocations\GetAllocationsRequest $request - * @param \Pterodactyl\Models\Node $node - * @return array */ public function index(GetAllocationsRequest $request, Node $node): array { @@ -60,10 +53,6 @@ class AllocationController extends ApplicationApiController /** * Store new allocations for a given node. * - * @param \Pterodactyl\Http\Requests\Api\Application\Allocations\StoreAllocationRequest $request - * @param \Pterodactyl\Models\Node $node - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Service\Allocation\CidrOutOfRangeException * @throws \Pterodactyl\Exceptions\Service\Allocation\InvalidPortMappingException * @throws \Pterodactyl\Exceptions\Service\Allocation\PortOutOfRangeException @@ -79,11 +68,6 @@ class AllocationController extends ApplicationApiController /** * Delete a specific allocation from the Panel. * - * @param \Pterodactyl\Http\Requests\Api\Application\Allocations\DeleteAllocationRequest $request - * @param \Pterodactyl\Models\Node $node - * @param \Pterodactyl\Models\Allocation $allocation - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Service\Allocation\ServerUsingAllocationException */ public function delete(DeleteAllocationRequest $request, Node $node, Allocation $allocation): JsonResponse diff --git a/app/Http/Controllers/Api/Application/Nodes/NodeConfigurationController.php b/app/Http/Controllers/Api/Application/Nodes/NodeConfigurationController.php index fc0c35f75..058f542b6 100644 --- a/app/Http/Controllers/Api/Application/Nodes/NodeConfigurationController.php +++ b/app/Http/Controllers/Api/Application/Nodes/NodeConfigurationController.php @@ -14,8 +14,6 @@ class NodeConfigurationController extends ApplicationApiController * to remote machines so long as an API key is provided to the machine to make the request * with, and the node is known. * - * @param \Pterodactyl\Http\Requests\Api\Application\Nodes\GetNodeRequest $request - * @param \Pterodactyl\Models\Node $node * @return \Illuminate\Http\JsonResponse */ public function __invoke(GetNodeRequest $request, Node $node) diff --git a/app/Http/Controllers/Api/Application/Nodes/NodeController.php b/app/Http/Controllers/Api/Application/Nodes/NodeController.php index 7198611ba..61f27b822 100644 --- a/app/Http/Controllers/Api/Application/Nodes/NodeController.php +++ b/app/Http/Controllers/Api/Application/Nodes/NodeController.php @@ -41,11 +41,6 @@ class NodeController extends ApplicationApiController /** * NodeController constructor. - * - * @param \Pterodactyl\Services\Nodes\NodeCreationService $creationService - * @param \Pterodactyl\Services\Nodes\NodeDeletionService $deletionService - * @param \Pterodactyl\Services\Nodes\NodeUpdateService $updateService - * @param \Pterodactyl\Contracts\Repository\NodeRepositoryInterface $repository */ public function __construct( NodeCreationService $creationService, @@ -63,9 +58,6 @@ class NodeController extends ApplicationApiController /** * Return all of the nodes currently available on the Panel. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Nodes\GetNodesRequest $request - * @return array */ public function index(GetNodesRequest $request): array { @@ -81,10 +73,6 @@ class NodeController extends ApplicationApiController /** * Return data for a single instance of a node. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Nodes\GetNodeRequest $request - * @param \Pterodactyl\Models\Node $node - * @return array */ public function view(GetNodeRequest $request, Node $node): array { @@ -97,9 +85,6 @@ class NodeController extends ApplicationApiController * Create a new node on the Panel. Returns the created node and a HTTP/201 * status response on success. * - * @param \Pterodactyl\Http\Requests\Api\Application\Nodes\StoreNodeRequest $request - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ public function store(StoreNodeRequest $request): JsonResponse @@ -119,16 +104,14 @@ class NodeController extends ApplicationApiController /** * Update an existing node on the Panel. * - * @param \Pterodactyl\Http\Requests\Api\Application\Nodes\UpdateNodeRequest $request - * @param \Pterodactyl\Models\Node $node - * @return array - * * @throws \Throwable */ public function update(UpdateNodeRequest $request, Node $node): array { $node = $this->updateService->handle( - $node, $request->validated(), $request->input('reset_secret') === true + $node, + $request->validated(), + $request->input('reset_secret') === true ); return $this->fractal->item($node) @@ -140,10 +123,6 @@ class NodeController extends ApplicationApiController * Deletes a given node from the Panel as long as there are no servers * currently attached to it. * - * @param \Pterodactyl\Http\Requests\Api\Application\Nodes\DeleteNodeRequest $request - * @param \Pterodactyl\Models\Node $node - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Service\HasActiveServersException */ public function delete(DeleteNodeRequest $request, Node $node): JsonResponse diff --git a/app/Http/Controllers/Api/Application/Nodes/NodeDeploymentController.php b/app/Http/Controllers/Api/Application/Nodes/NodeDeploymentController.php index 411b7d457..1714bf7ca 100644 --- a/app/Http/Controllers/Api/Application/Nodes/NodeDeploymentController.php +++ b/app/Http/Controllers/Api/Application/Nodes/NodeDeploymentController.php @@ -16,8 +16,6 @@ class NodeDeploymentController extends ApplicationApiController /** * NodeDeploymentController constructor. - * - * @param \Pterodactyl\Services\Deployment\FindViableNodesService $viableNodesService */ public function __construct(FindViableNodesService $viableNodesService) { @@ -31,9 +29,6 @@ class NodeDeploymentController extends ApplicationApiController * similarly to the server creation process, but allows you to pass the deployment object * to this endpoint and get back a list of all Nodes satisfying the requirements. * - * @param \Pterodactyl\Http\Requests\Api\Application\Nodes\GetDeployableNodesRequest $request - * @return array - * * @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableNodeException */ public function __invoke(GetDeployableNodesRequest $request): array diff --git a/app/Http/Controllers/Api/Application/Servers/DatabaseController.php b/app/Http/Controllers/Api/Application/Servers/DatabaseController.php index 829a6ca5d..73f96737d 100644 --- a/app/Http/Controllers/Api/Application/Servers/DatabaseController.php +++ b/app/Http/Controllers/Api/Application/Servers/DatabaseController.php @@ -35,10 +35,6 @@ class DatabaseController extends ApplicationApiController /** * DatabaseController constructor. - * - * @param \Pterodactyl\Services\Databases\DatabaseManagementService $databaseManagementService - * @param \Pterodactyl\Services\Databases\DatabasePasswordService $databasePasswordService - * @param \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface $repository */ public function __construct( DatabaseManagementService $databaseManagementService, @@ -55,10 +51,6 @@ class DatabaseController extends ApplicationApiController /** * Return a listing of all databases currently available to a single * server. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\Databases\GetServerDatabasesRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array */ public function index(GetServerDatabasesRequest $request, Server $server): array { @@ -69,11 +61,6 @@ class DatabaseController extends ApplicationApiController /** * Return a single server database. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\Databases\GetServerDatabaseRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Database $database - * @return array */ public function view(GetServerDatabaseRequest $request, Server $server, Database $database): array { @@ -85,11 +72,6 @@ class DatabaseController extends ApplicationApiController /** * Reset the password for a specific server database. * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\Databases\ServerDatabaseWriteRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Database $database - * @return \Illuminate\Http\JsonResponse - * * @throws \Throwable */ public function resetPassword(ServerDatabaseWriteRequest $request, Server $server, Database $database): JsonResponse @@ -102,10 +84,6 @@ class DatabaseController extends ApplicationApiController /** * Create a new database on the Panel for a given server. * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\Databases\StoreServerDatabaseRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\JsonResponse - * * @throws \Throwable */ public function store(StoreServerDatabaseRequest $request, Server $server): JsonResponse @@ -128,9 +106,6 @@ class DatabaseController extends ApplicationApiController /** * Handle a request to delete a specific server database from the Panel. * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\Databases\ServerDatabaseWriteRequest $request - * @return \Illuminate\Http\Response - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function delete(ServerDatabaseWriteRequest $request): Response diff --git a/app/Http/Controllers/Api/Application/Servers/ExternalServerController.php b/app/Http/Controllers/Api/Application/Servers/ExternalServerController.php index 391c5645c..0cecb977a 100644 --- a/app/Http/Controllers/Api/Application/Servers/ExternalServerController.php +++ b/app/Http/Controllers/Api/Application/Servers/ExternalServerController.php @@ -10,9 +10,6 @@ class ExternalServerController extends ApplicationApiController { /** * Retrieve a specific server from the database using its external ID. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\GetExternalServerRequest $request - * @return array */ public function index(GetExternalServerRequest $request): array { diff --git a/app/Http/Controllers/Api/Application/Servers/ServerController.php b/app/Http/Controllers/Api/Application/Servers/ServerController.php index 126c91921..795999721 100644 --- a/app/Http/Controllers/Api/Application/Servers/ServerController.php +++ b/app/Http/Controllers/Api/Application/Servers/ServerController.php @@ -35,10 +35,6 @@ class ServerController extends ApplicationApiController /** * ServerController constructor. - * - * @param \Pterodactyl\Services\Servers\ServerCreationService $creationService - * @param \Pterodactyl\Services\Servers\ServerDeletionService $deletionService - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository */ public function __construct( ServerCreationService $creationService, @@ -54,9 +50,6 @@ class ServerController extends ApplicationApiController /** * Return all of the servers that currently exist on the Panel. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\GetServersRequest $request - * @return array */ public function index(GetServersRequest $request): array { @@ -73,9 +66,6 @@ class ServerController extends ApplicationApiController /** * Create a new server on the system. * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\StoreServerRequest $request - * @return \Illuminate\Http\JsonResponse - * * @throws \Throwable * @throws \Illuminate\Validation\ValidationException * @throws \Pterodactyl\Exceptions\DisplayException @@ -95,9 +85,6 @@ class ServerController extends ApplicationApiController /** * Show a single server transformed for the application API. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\GetServerRequest $request - * @return array */ public function view(GetServerRequest $request): array { @@ -107,11 +94,6 @@ class ServerController extends ApplicationApiController } /** - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest $request - * @param \Pterodactyl\Models\Server $server - * @param string $force - * @return \Illuminate\Http\Response - * * @throws \Pterodactyl\Exceptions\DisplayException */ public function delete(ServerWriteRequest $request, Server $server, string $force = ''): Response diff --git a/app/Http/Controllers/Api/Application/Servers/ServerDetailsController.php b/app/Http/Controllers/Api/Application/Servers/ServerDetailsController.php index c2c3fa1cf..06bbf6bca 100644 --- a/app/Http/Controllers/Api/Application/Servers/ServerDetailsController.php +++ b/app/Http/Controllers/Api/Application/Servers/ServerDetailsController.php @@ -24,9 +24,6 @@ class ServerDetailsController extends ApplicationApiController /** * ServerDetailsController constructor. - * - * @param \Pterodactyl\Services\Servers\BuildModificationService $buildModificationService - * @param \Pterodactyl\Services\Servers\DetailsModificationService $detailsModificationService */ public function __construct( BuildModificationService $buildModificationService, @@ -41,9 +38,6 @@ class ServerDetailsController extends ApplicationApiController /** * Update the details for a specific server. * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\UpdateServerDetailsRequest $request - * @return array - * * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -51,7 +45,8 @@ class ServerDetailsController extends ApplicationApiController public function details(UpdateServerDetailsRequest $request): array { $server = $this->detailsModificationService->returnUpdatedModel()->handle( - $request->getModel(Server::class), $request->validated() + $request->getModel(Server::class), + $request->validated() ); return $this->fractal->item($server) @@ -62,10 +57,6 @@ class ServerDetailsController extends ApplicationApiController /** * Update the build details for a specific server. * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\UpdateServerBuildConfigurationRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array - * * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException diff --git a/app/Http/Controllers/Api/Application/Servers/ServerManagementController.php b/app/Http/Controllers/Api/Application/Servers/ServerManagementController.php index 5052c884e..ddbbbe1dd 100644 --- a/app/Http/Controllers/Api/Application/Servers/ServerManagementController.php +++ b/app/Http/Controllers/Api/Application/Servers/ServerManagementController.php @@ -23,9 +23,6 @@ class ServerManagementController extends ApplicationApiController /** * SuspensionController constructor. - * - * @param \Pterodactyl\Services\Servers\ReinstallServerService $reinstallServerService - * @param \Pterodactyl\Services\Servers\SuspensionService $suspensionService */ public function __construct( ReinstallServerService $reinstallServerService, @@ -40,10 +37,6 @@ class ServerManagementController extends ApplicationApiController /** * Suspend a server on the Panel. * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\Response - * * @throws \Throwable */ public function suspend(ServerWriteRequest $request, Server $server): Response @@ -56,10 +49,6 @@ class ServerManagementController extends ApplicationApiController /** * Unsuspend a server on the Panel. * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\Response - * * @throws \Throwable */ public function unsuspend(ServerWriteRequest $request, Server $server): Response @@ -72,10 +61,6 @@ class ServerManagementController extends ApplicationApiController /** * Mark a server as needing to be reinstalled. * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\Response - * * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException diff --git a/app/Http/Controllers/Api/Application/Servers/StartupController.php b/app/Http/Controllers/Api/Application/Servers/StartupController.php index 0265af464..e8300754f 100644 --- a/app/Http/Controllers/Api/Application/Servers/StartupController.php +++ b/app/Http/Controllers/Api/Application/Servers/StartupController.php @@ -18,8 +18,6 @@ class StartupController extends ApplicationApiController /** * StartupController constructor. - * - * @param \Pterodactyl\Services\Servers\StartupModificationService $modificationService */ public function __construct(StartupModificationService $modificationService) { @@ -31,9 +29,6 @@ class StartupController extends ApplicationApiController /** * Update the startup and environment settings for a specific server. * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\UpdateServerStartupRequest $request - * @return array - * * @throws \Illuminate\Validation\ValidationException * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException * @throws \Pterodactyl\Exceptions\Model\DataValidationException diff --git a/app/Http/Controllers/Api/Application/Users/ExternalUserController.php b/app/Http/Controllers/Api/Application/Users/ExternalUserController.php index f58138173..a253b6e19 100644 --- a/app/Http/Controllers/Api/Application/Users/ExternalUserController.php +++ b/app/Http/Controllers/Api/Application/Users/ExternalUserController.php @@ -10,9 +10,6 @@ class ExternalUserController extends ApplicationApiController { /** * Retrieve a specific user from the database using their external ID. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Users\GetExternalUserRequest $request - * @return array */ public function index(GetExternalUserRequest $request): array { diff --git a/app/Http/Controllers/Api/Application/Users/UserController.php b/app/Http/Controllers/Api/Application/Users/UserController.php index c8b309d85..41a13f66c 100644 --- a/app/Http/Controllers/Api/Application/Users/UserController.php +++ b/app/Http/Controllers/Api/Application/Users/UserController.php @@ -41,11 +41,6 @@ class UserController extends ApplicationApiController /** * UserController constructor. - * - * @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository - * @param \Pterodactyl\Services\Users\UserCreationService $creationService - * @param \Pterodactyl\Services\Users\UserDeletionService $deletionService - * @param \Pterodactyl\Services\Users\UserUpdateService $updateService */ public function __construct( UserRepositoryInterface $repository, @@ -65,9 +60,6 @@ class UserController extends ApplicationApiController * Handle request to list all users on the panel. Returns a JSON-API representation * of a collection of users including any defined relations passed in * the request. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Users\GetUsersRequest $request - * @return array */ public function index(GetUsersRequest $request): array { @@ -84,10 +76,6 @@ class UserController extends ApplicationApiController /** * Handle a request to view a single user. Includes any relations that * were defined in the request. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Users\GetUsersRequest $request - * @param \Pterodactyl\Models\User $user - * @return array */ public function view(GetUsersRequest $request, User $user): array { @@ -104,10 +92,6 @@ class UserController extends ApplicationApiController * Revocation errors are returned under the 'revocation_errors' key in the response * meta. If there are no errors this is an empty array. * - * @param \Pterodactyl\Http\Requests\Api\Application\Users\UpdateUserRequest $request - * @param \Pterodactyl\Models\User $user - * @return array - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -126,9 +110,6 @@ class UserController extends ApplicationApiController * Store a new user on the system. Returns the created user and a HTTP/201 * header on successful creation. * - * @param \Pterodactyl\Http\Requests\Api\Application\Users\StoreUserRequest $request - * @return \Illuminate\Http\JsonResponse - * * @throws \Exception * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ @@ -150,10 +131,6 @@ class UserController extends ApplicationApiController * Handle a request to delete a user from the Panel. Returns a HTTP/204 response * on successful deletion. * - * @param \Pterodactyl\Http\Requests\Api\Application\Users\DeleteUserRequest $request - * @param \Pterodactyl\Models\User $user - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\DisplayException */ public function delete(DeleteUserRequest $request, User $user): JsonResponse diff --git a/app/Http/Controllers/Api/Client/AccountController.php b/app/Http/Controllers/Api/Client/AccountController.php index 25900f059..5e790d474 100644 --- a/app/Http/Controllers/Api/Client/AccountController.php +++ b/app/Http/Controllers/Api/Client/AccountController.php @@ -25,9 +25,6 @@ class AccountController extends ClientApiController /** * AccountController constructor. - * - * @param \Illuminate\Auth\AuthManager $sessionGuard - * @param \Pterodactyl\Services\Users\UserUpdateService $updateService */ public function __construct(AuthManager $sessionGuard, UserUpdateService $updateService) { @@ -37,10 +34,6 @@ class AccountController extends ClientApiController $this->sessionGuard = $sessionGuard; } - /** - * @param Request $request - * @return array - */ public function index(Request $request): array { return $this->fractal->item($request->user()) @@ -51,9 +44,6 @@ class AccountController extends ClientApiController /** * Update the authenticated user's email address. * - * @param \Pterodactyl\Http\Requests\Api\Client\Account\UpdateEmailRequest $request - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -68,9 +58,6 @@ class AccountController extends ClientApiController * Update the authenticated user's password. All existing sessions will be logged * out immediately. * - * @param \Pterodactyl\Http\Requests\Api\Client\Account\UpdatePasswordRequest $request - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ diff --git a/app/Http/Controllers/Api/Client/ApiKeyController.php b/app/Http/Controllers/Api/Client/ApiKeyController.php index 5662e19cd..34694d66c 100644 --- a/app/Http/Controllers/Api/Client/ApiKeyController.php +++ b/app/Http/Controllers/Api/Client/ApiKeyController.php @@ -32,10 +32,6 @@ class ApiKeyController extends ClientApiController /** * ApiKeyController constructor. - * - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter - * @param \Pterodactyl\Services\Api\KeyCreationService $keyCreationService - * @param \Pterodactyl\Repositories\Eloquent\ApiKeyRepository $repository */ public function __construct( Encrypter $encrypter, @@ -52,7 +48,6 @@ class ApiKeyController extends ClientApiController /** * Returns all of the API keys that exist for the given client. * - * @param \Pterodactyl\Http\Requests\Api\Client\ClientApiRequest $request * @return array */ public function index(ClientApiRequest $request) @@ -65,7 +60,6 @@ class ApiKeyController extends ClientApiController /** * Store a new API key for a user's account. * - * @param \Pterodactyl\Http\Requests\Api\Client\Account\StoreApiKeyRequest $request * @return array * * @throws \Pterodactyl\Exceptions\DisplayException @@ -74,9 +68,7 @@ class ApiKeyController extends ClientApiController public function store(StoreApiKeyRequest $request) { if ($request->user()->apiKeys->count() >= 5) { - throw new DisplayException( - 'You have reached the account limit for number of API keys.' - ); + throw new DisplayException('You have reached the account limit for number of API keys.'); } $key = $this->keyCreationService->setKeyType(ApiKey::TYPE_ACCOUNT)->handle([ @@ -96,8 +88,6 @@ class ApiKeyController extends ClientApiController /** * Deletes a given API key. * - * @param \Pterodactyl\Http\Requests\Api\Client\ClientApiRequest $request - * @param string $identifier * @return \Illuminate\Http\JsonResponse */ public function delete(ClientApiRequest $request, string $identifier) @@ -108,8 +98,8 @@ class ApiKeyController extends ClientApiController 'identifier' => $identifier, ]); - if (! $response) { - throw new NotFoundHttpException; + if (!$response) { + throw new NotFoundHttpException(); } return JsonResponse::create([], JsonResponse::HTTP_NO_CONTENT); diff --git a/app/Http/Controllers/Api/Client/ClientApiController.php b/app/Http/Controllers/Api/Client/ClientApiController.php index 56c3db1f7..c7f6f1a49 100644 --- a/app/Http/Controllers/Api/Client/ClientApiController.php +++ b/app/Http/Controllers/Api/Client/ClientApiController.php @@ -13,8 +13,6 @@ abstract class ClientApiController extends ApplicationApiController /** * Returns only the includes which are valid for the given transformer. * - * @param \Pterodactyl\Transformers\Api\Client\BaseClientTransformer $transformer - * @param array $merge * @return string[] */ protected function getIncludesForTransformer(BaseClientTransformer $transformer, array $merge = []) @@ -35,7 +33,7 @@ abstract class ClientApiController extends ApplicationApiController { $includes = $this->request->query('include') ?? []; - if (! is_string($includes)) { + if (!is_string($includes)) { return $includes; } @@ -47,7 +45,6 @@ abstract class ClientApiController extends ApplicationApiController /** * Return an instance of an application transformer. * - * @param string $abstract * @return \Pterodactyl\Transformers\Api\Client\BaseClientTransformer */ public function getTransformer(string $abstract) diff --git a/app/Http/Controllers/Api/Client/ClientController.php b/app/Http/Controllers/Api/Client/ClientController.php index 243868b5e..16923c56f 100644 --- a/app/Http/Controllers/Api/Client/ClientController.php +++ b/app/Http/Controllers/Api/Client/ClientController.php @@ -20,8 +20,6 @@ class ClientController extends ClientApiController /** * ClientController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository */ public function __construct(ServerRepository $repository) { @@ -33,9 +31,6 @@ class ClientController extends ClientApiController /** * Return all of the servers available to the client making the API * request, including servers the user has access to as a subuser. - * - * @param \Pterodactyl\Http\Requests\Api\Client\GetServersRequest $request - * @return array */ public function index(GetServersRequest $request): array { @@ -49,7 +44,7 @@ class ClientController extends ClientApiController 'uuid', 'name', 'external_id', - AllowedFilter::custom('*', new MultiFieldServerFilter), + AllowedFilter::custom('*', new MultiFieldServerFilter()), ]); $type = $request->input('type'); @@ -60,14 +55,14 @@ class ClientController extends ClientApiController if (in_array($type, ['admin', 'admin-all'])) { // If they aren't an admin but want all the admin servers don't fail the request, just // make it a query that will never return any results back. - if (! $user->root_admin) { + if (!$user->root_admin) { $builder->whereRaw('1 = 2'); } else { $builder = $type === 'admin-all' ? $builder : $builder->whereNotIn('servers.id', $user->accessibleServers()->pluck('id')->all()); } - } else if ($type === 'owner') { + } elseif ($type === 'owner') { $builder = $builder->where('servers.owner_id', $user->id); } else { $builder = $builder->whereIn('servers.id', $user->accessibleServers()->pluck('id')->all()); diff --git a/app/Http/Controllers/Api/Client/Servers/BackupController.php b/app/Http/Controllers/Api/Client/Servers/BackupController.php index f2f942880..f1e344370 100644 --- a/app/Http/Controllers/Api/Client/Servers/BackupController.php +++ b/app/Http/Controllers/Api/Client/Servers/BackupController.php @@ -86,8 +86,6 @@ class BackupController extends ClientApiController /** * Starts the backup process for a server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Backups\StoreBackupRequest $request - * @param \Pterodactyl\Models\Server $server * @return array * * @throws \Exception|\Throwable diff --git a/app/Http/Controllers/Api/Client/Servers/CommandController.php b/app/Http/Controllers/Api/Client/Servers/CommandController.php index b8390673e..f9663138c 100644 --- a/app/Http/Controllers/Api/Client/Servers/CommandController.php +++ b/app/Http/Controllers/Api/Client/Servers/CommandController.php @@ -21,8 +21,6 @@ class CommandController extends ClientApiController /** * CommandController constructor. - * - * @param \Pterodactyl\Repositories\Wings\DaemonCommandRepository $repository */ public function __construct(DaemonCommandRepository $repository) { @@ -34,10 +32,6 @@ class CommandController extends ClientApiController /** * Send a command to a running server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\SendCommandRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\Response - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function index(SendCommandRequest $request, Server $server): Response @@ -52,9 +46,7 @@ class CommandController extends ClientApiController $previous->getResponse() instanceof ResponseInterface && $previous->getResponse()->getStatusCode() === Response::HTTP_BAD_GATEWAY ) { - throw new HttpException( - Response::HTTP_BAD_GATEWAY, 'Server must be online in order to send commands.', $exception - ); + throw new HttpException(Response::HTTP_BAD_GATEWAY, 'Server must be online in order to send commands.', $exception); } } diff --git a/app/Http/Controllers/Api/Client/Servers/DatabaseController.php b/app/Http/Controllers/Api/Client/Servers/DatabaseController.php index 2eacfb9e2..4f9aed59d 100644 --- a/app/Http/Controllers/Api/Client/Servers/DatabaseController.php +++ b/app/Http/Controllers/Api/Client/Servers/DatabaseController.php @@ -40,11 +40,6 @@ class DatabaseController extends ClientApiController /** * DatabaseController constructor. - * - * @param \Pterodactyl\Services\Databases\DatabaseManagementService $managementService - * @param \Pterodactyl\Services\Databases\DatabasePasswordService $passwordService - * @param \Pterodactyl\Repositories\Eloquent\DatabaseRepository $repository - * @param \Pterodactyl\Services\Databases\DeployServerDatabaseService $deployDatabaseService */ public function __construct( DatabaseManagementService $managementService, @@ -62,10 +57,6 @@ class DatabaseController extends ClientApiController /** * Return all of the databases that belong to the given server. - * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Databases\GetDatabasesRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array */ public function index(GetDatabasesRequest $request, Server $server): array { @@ -77,10 +68,6 @@ class DatabaseController extends ClientApiController /** * Create a new database for the given server and return it. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Databases\StoreDatabaseRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array - * * @throws \Throwable * @throws \Pterodactyl\Exceptions\Service\Database\TooManyDatabasesException * @throws \Pterodactyl\Exceptions\Service\Database\DatabaseClientFeatureNotEnabledException @@ -99,9 +86,6 @@ class DatabaseController extends ClientApiController * Rotates the password for the given server model and returns a fresh instance to * the caller. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Databases\RotatePasswordRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Database $database * @return array * * @throws \Throwable @@ -120,11 +104,6 @@ class DatabaseController extends ClientApiController /** * Removes a database from the server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Databases\DeleteDatabaseRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Database $database - * @return \Illuminate\Http\Response - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function delete(DeleteDatabaseRequest $request, Server $server, Database $database): Response diff --git a/app/Http/Controllers/Api/Client/Servers/FileController.php b/app/Http/Controllers/Api/Client/Servers/FileController.php index df0fdded6..d405cd146 100644 --- a/app/Http/Controllers/Api/Client/Servers/FileController.php +++ b/app/Http/Controllers/Api/Client/Servers/FileController.php @@ -15,9 +15,9 @@ use Pterodactyl\Http\Controllers\Api\Client\ClientApiController; use Pterodactyl\Http\Requests\Api\Client\Servers\Files\CopyFileRequest; use Pterodactyl\Http\Requests\Api\Client\Servers\Files\PullFileRequest; use Pterodactyl\Http\Requests\Api\Client\Servers\Files\ListFilesRequest; +use Pterodactyl\Http\Requests\Api\Client\Servers\Files\ChmodFilesRequest; use Pterodactyl\Http\Requests\Api\Client\Servers\Files\DeleteFileRequest; use Pterodactyl\Http\Requests\Api\Client\Servers\Files\RenameFileRequest; -use Pterodactyl\Http\Requests\Api\Client\Servers\Files\ChmodFilesRequest; use Pterodactyl\Http\Requests\Api\Client\Servers\Files\CreateFolderRequest; use Pterodactyl\Http\Requests\Api\Client\Servers\Files\CompressFilesRequest; use Pterodactyl\Http\Requests\Api\Client\Servers\Files\DecompressFilesRequest; @@ -43,10 +43,6 @@ class FileController extends ClientApiController /** * FileController constructor. - * - * @param \Illuminate\Contracts\Routing\ResponseFactory $responseFactory - * @param \Pterodactyl\Services\Nodes\NodeJWTService $jwtService - * @param \Pterodactyl\Repositories\Wings\DaemonFileRepository $fileRepository */ public function __construct( ResponseFactory $responseFactory, @@ -63,10 +59,6 @@ class FileController extends ClientApiController /** * Returns a listing of files in a given directory. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\ListFilesRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function directory(ListFilesRequest $request, Server $server): array @@ -102,8 +94,6 @@ class FileController extends ClientApiController * Generates a one-time token with a link that the user can use to * download a given file. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\GetFileContentsRequest $request - * @param \Pterodactyl\Models\Server $server * @return array * * @throws \Throwable @@ -128,7 +118,7 @@ class FileController extends ClientApiController 'url' => sprintf( '%s/download/file?token=%s', $server->node->getConnectionAddress(), - $token->__toString() + $token->toString() ), ], ]; @@ -137,11 +127,7 @@ class FileController extends ClientApiController /** * Writes the contents of the specified file to the server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\WriteFileContentRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\JsonResponse - * - * @throws \Throwable + * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function write(WriteFileContentRequest $request, Server $server): JsonResponse { @@ -205,11 +191,7 @@ class FileController extends ClientApiController /** * Copies a file on the server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\CopyFileRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\JsonResponse - * - * @throws \Throwable + * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function copy(CopyFileRequest $request, Server $server): JsonResponse { @@ -226,11 +208,7 @@ class FileController extends ClientApiController } /** - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\CompressFilesRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array - * - * @throws \Throwable + * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function compress(CompressFilesRequest $request, Server $server): array { @@ -252,11 +230,7 @@ class FileController extends ClientApiController } /** - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\DecompressFilesRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\JsonResponse - * - * @throws \Throwable + * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function decompress(DecompressFilesRequest $request, Server $server): JsonResponse { @@ -276,11 +250,7 @@ class FileController extends ClientApiController /** * Deletes files or folders for the server in the given root directory. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\DeleteFileRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\JsonResponse - * - * @throws \Throwable + * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function delete(DeleteFileRequest $request, Server $server): JsonResponse { @@ -299,17 +269,14 @@ class FileController extends ClientApiController /** * Updates file permissions for file(s) in the given root directory. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\ChmodFilesRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function chmod(ChmodFilesRequest $request, Server $server): JsonResponse { $this->fileRepository->setServer($server) ->chmodFiles( - $request->input('root'), $request->input('files') + $request->input('root'), + $request->input('files') ); return new JsonResponse([], Response::HTTP_NO_CONTENT); @@ -319,8 +286,6 @@ class FileController extends ClientApiController * Requests that a file be downloaded from a remote location by Wings. * * @param $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\JsonResponse * * @throws \Throwable */ diff --git a/app/Http/Controllers/Api/Client/Servers/FileUploadController.php b/app/Http/Controllers/Api/Client/Servers/FileUploadController.php index e8f5ad080..236273c75 100644 --- a/app/Http/Controllers/Api/Client/Servers/FileUploadController.php +++ b/app/Http/Controllers/Api/Client/Servers/FileUploadController.php @@ -19,8 +19,6 @@ class FileUploadController extends ClientApiController /** * FileUploadController constructor. - * - * @param \Pterodactyl\Services\Nodes\NodeJWTService $jwtService */ public function __construct( NodeJWTService $jwtService @@ -33,9 +31,6 @@ class FileUploadController extends ClientApiController /** * Returns a url where files can be uploaded to. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\UploadFileRequest $request - * @param \Pterodactyl\Models\Server $server - * * @return \Illuminate\Http\JsonResponse */ public function __invoke(UploadFileRequest $request, Server $server) @@ -51,8 +46,6 @@ class FileUploadController extends ClientApiController /** * Returns a url where files can be uploaded to. * - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\User $user * @return string */ protected function getUploadUrl(Server $server, User $user) @@ -67,7 +60,7 @@ class FileUploadController extends ClientApiController return sprintf( '%s/upload/file?token=%s', $server->node->getConnectionAddress(), - $token->__toString() + $token->toString() ); } } diff --git a/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php b/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php index 43140f622..855cb6780 100644 --- a/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php +++ b/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php @@ -36,10 +36,6 @@ class NetworkAllocationController extends ClientApiController /** * NetworkController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\AllocationRepository $repository - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $serverRepository - * @param \Pterodactyl\Services\Allocations\FindAssignableAllocationService $assignableAllocationService */ public function __construct( AllocationRepository $repository, @@ -56,10 +52,6 @@ class NetworkAllocationController extends ClientApiController /** * Lists all of the allocations available to a server and wether or * not they are currently assigned as the primary for this server. - * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Network\GetNetworkRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array */ public function index(GetNetworkRequest $request, Server $server): array { @@ -71,11 +63,6 @@ class NetworkAllocationController extends ClientApiController /** * Set the primary allocation for a server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Network\UpdateAllocationRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Allocation $allocation - * @return array - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -93,11 +80,6 @@ class NetworkAllocationController extends ClientApiController /** * Set the primary allocation for a server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Network\SetPrimaryAllocationRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Allocation $allocation - * @return array - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -112,20 +94,14 @@ class NetworkAllocationController extends ClientApiController /** * Set the notes for the allocation for a server. - *s - * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Network\NewAllocationRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array + *s. * * @throws \Pterodactyl\Exceptions\DisplayException */ public function store(NewAllocationRequest $request, Server $server): array { if ($server->allocations()->count() >= $server->allocation_limit) { - throw new DisplayException( - 'Cannot assign additional allocations to this server: limit has been reached.' - ); + throw new DisplayException('Cannot assign additional allocations to this server: limit has been reached.'); } $allocation = $this->assignableAllocationService->handle($server); @@ -138,9 +114,6 @@ class NetworkAllocationController extends ClientApiController /** * Delete an allocation from a server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Network\DeleteAllocationRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Allocation $allocation * @return \Illuminate\Http\JsonResponse * * @throws \Pterodactyl\Exceptions\DisplayException @@ -148,9 +121,7 @@ class NetworkAllocationController extends ClientApiController public function delete(DeleteAllocationRequest $request, Server $server, Allocation $allocation) { if ($allocation->id === $server->allocation_id) { - throw new DisplayException( - 'You cannot delete the primary allocation for this server.' - ); + throw new DisplayException('You cannot delete the primary allocation for this server.'); } Allocation::query()->where('id', $allocation->id)->update([ diff --git a/app/Http/Controllers/Api/Client/Servers/PowerController.php b/app/Http/Controllers/Api/Client/Servers/PowerController.php index 12e2d75bb..984a1edca 100644 --- a/app/Http/Controllers/Api/Client/Servers/PowerController.php +++ b/app/Http/Controllers/Api/Client/Servers/PowerController.php @@ -17,8 +17,6 @@ class PowerController extends ClientApiController /** * PowerController constructor. - * - * @param \Pterodactyl\Repositories\Wings\DaemonPowerRepository $repository */ public function __construct(DaemonPowerRepository $repository) { @@ -30,10 +28,6 @@ class PowerController extends ClientApiController /** * Send a power action to a server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\SendPowerRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\Response - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function index(SendPowerRequest $request, Server $server): Response diff --git a/app/Http/Controllers/Api/Client/Servers/ResourceUtilizationController.php b/app/Http/Controllers/Api/Client/Servers/ResourceUtilizationController.php index 0d56c21bd..4cf0d249b 100644 --- a/app/Http/Controllers/Api/Client/Servers/ResourceUtilizationController.php +++ b/app/Http/Controllers/Api/Client/Servers/ResourceUtilizationController.php @@ -17,8 +17,6 @@ class ResourceUtilizationController extends ClientApiController /** * ResourceUtilizationController constructor. - * - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $repository */ public function __construct(DaemonServerRepository $repository) { @@ -30,10 +28,6 @@ class ResourceUtilizationController extends ClientApiController /** * Return the current resource utilization for a server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\GetServerRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function __invoke(GetServerRequest $request, Server $server): array diff --git a/app/Http/Controllers/Api/Client/Servers/ScheduleController.php b/app/Http/Controllers/Api/Client/Servers/ScheduleController.php index a9310abd6..320133595 100644 --- a/app/Http/Controllers/Api/Client/Servers/ScheduleController.php +++ b/app/Http/Controllers/Api/Client/Servers/ScheduleController.php @@ -10,7 +10,6 @@ use Pterodactyl\Models\Server; use Pterodactyl\Models\Schedule; use Illuminate\Http\JsonResponse; use Pterodactyl\Helpers\Utilities; -use Pterodactyl\Jobs\Schedule\RunTaskJob; use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Repositories\Eloquent\ScheduleRepository; use Pterodactyl\Services\Schedules\ProcessScheduleService; @@ -38,9 +37,6 @@ class ScheduleController extends ClientApiController /** * ScheduleController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\ScheduleRepository $repository - * @param \Pterodactyl\Services\Schedules\ProcessScheduleService $service */ public function __construct(ScheduleRepository $repository, ProcessScheduleService $service) { @@ -53,8 +49,6 @@ class ScheduleController extends ClientApiController /** * Returns all of the schedules belonging to a given server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\ViewScheduleRequest $request - * @param \Pterodactyl\Models\Server $server * @return array */ public function index(ViewScheduleRequest $request, Server $server) @@ -70,8 +64,6 @@ class ScheduleController extends ClientApiController /** * Store a new schedule for a server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\StoreScheduleRequest $request - * @param \Pterodactyl\Models\Server $server * @return array * * @throws \Pterodactyl\Exceptions\DisplayException @@ -84,6 +76,7 @@ class ScheduleController extends ClientApiController 'server_id' => $server->id, 'name' => $request->input('name'), 'cron_day_of_week' => $request->input('day_of_week'), + 'cron_month' => $request->input('month'), 'cron_day_of_month' => $request->input('day_of_month'), 'cron_hour' => $request->input('hour'), 'cron_minute' => $request->input('minute'), @@ -99,15 +92,12 @@ class ScheduleController extends ClientApiController /** * Returns a specific schedule for the server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\ViewScheduleRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Schedule $schedule * @return array */ public function view(ViewScheduleRequest $request, Server $server, Schedule $schedule) { if ($schedule->server_id !== $server->id) { - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } $schedule->loadMissing('tasks'); @@ -120,9 +110,6 @@ class ScheduleController extends ClientApiController /** * Updates a given schedule with the new data provided. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\UpdateScheduleRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Schedule $schedule * @return array * * @throws \Pterodactyl\Exceptions\DisplayException @@ -136,6 +123,7 @@ class ScheduleController extends ClientApiController $data = [ 'name' => $request->input('name'), 'cron_day_of_week' => $request->input('day_of_week'), + 'cron_month' => $request->input('month'), 'cron_day_of_month' => $request->input('day_of_month'), 'cron_hour' => $request->input('hour'), 'cron_minute' => $request->input('minute'), @@ -162,9 +150,6 @@ class ScheduleController extends ClientApiController * Executes a given schedule immediately rather than waiting on it's normally scheduled time * to pass. This does not care about the schedule state. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\TriggerScheduleRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Schedule $schedule * @return \Illuminate\Http\JsonResponse * * @throws \Throwable @@ -172,9 +157,7 @@ class ScheduleController extends ClientApiController public function execute(TriggerScheduleRequest $request, Server $server, Schedule $schedule) { if (!$schedule->is_active) { - throw new BadRequestHttpException( - 'Cannot trigger schedule exection for a schedule that is not currently active.' - ); + throw new BadRequestHttpException('Cannot trigger schedule exection for a schedule that is not currently active.'); } $this->service->handle($schedule, true); @@ -185,9 +168,6 @@ class ScheduleController extends ClientApiController /** * Deletes a schedule and it's associated tasks. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\DeleteScheduleRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Schedule $schedule * @return \Illuminate\Http\JsonResponse */ public function delete(DeleteScheduleRequest $request, Server $server, Schedule $schedule) @@ -200,8 +180,6 @@ class ScheduleController extends ClientApiController /** * Get the next run timestamp based on the cron data provided. * - * @param \Illuminate\Http\Request $request - * @return \Carbon\Carbon * @throws \Pterodactyl\Exceptions\DisplayException */ protected function getNextRunAt(Request $request): Carbon @@ -211,12 +189,11 @@ class ScheduleController extends ClientApiController $request->input('minute'), $request->input('hour'), $request->input('day_of_month'), + $request->input('month'), $request->input('day_of_week') ); } catch (Exception $exception) { - throw new DisplayException( - 'The cron data provided does not evaluate to a valid expression.' - ); + throw new DisplayException('The cron data provided does not evaluate to a valid expression.'); } } } diff --git a/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php b/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php index c6f8ee339..a652071a2 100644 --- a/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php +++ b/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php @@ -26,8 +26,6 @@ class ScheduleTaskController extends ClientApiController /** * ScheduleTaskController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\TaskRepository $repository */ public function __construct(TaskRepository $repository) { @@ -39,9 +37,6 @@ class ScheduleTaskController extends ClientApiController /** * Create a new task for a given schedule and store it in the database. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\StoreTaskRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Schedule $schedule * @return array * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -51,9 +46,7 @@ class ScheduleTaskController extends ClientApiController { $limit = config('pterodactyl.client_features.schedules.per_schedule_task_limit', 10); if ($schedule->tasks()->count() >= $limit) { - throw new ServiceLimitExceededException( - "Schedules may not have more than {$limit} tasks associated with them. Creating this task would put this schedule over the limit." - ); + throw new ServiceLimitExceededException("Schedules may not have more than {$limit} tasks associated with them. Creating this task would put this schedule over the limit."); } /** @var \Pterodactyl\Models\Task|null $lastTask */ @@ -76,10 +69,6 @@ class ScheduleTaskController extends ClientApiController /** * Updates a given task for a server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\StoreTaskRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Schedule $schedule - * @param \Pterodactyl\Models\Task $task * @return array * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -88,7 +77,7 @@ class ScheduleTaskController extends ClientApiController public function update(StoreTaskRequest $request, Server $server, Schedule $schedule, Task $task) { if ($schedule->id !== $task->schedule_id || $server->id !== $schedule->server_id) { - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } $this->repository->update($task->id, [ @@ -106,10 +95,6 @@ class ScheduleTaskController extends ClientApiController * Delete a given task for a schedule. If there are subsequent tasks stored in the database * for this schedule their sequence IDs are decremented properly. * - * @param \Pterodactyl\Http\Requests\Api\Client\ClientApiRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Schedule $schedule - * @param \Pterodactyl\Models\Task $task * @return \Illuminate\Http\JsonResponse * * @throws \Exception @@ -117,10 +102,10 @@ class ScheduleTaskController extends ClientApiController public function delete(ClientApiRequest $request, Server $server, Schedule $schedule, Task $task) { if ($task->schedule_id !== $schedule->id || $schedule->server_id !== $server->id) { - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } - if (! $request->user()->can(Permission::ACTION_SCHEDULE_UPDATE, $server)) { + if (!$request->user()->can(Permission::ACTION_SCHEDULE_UPDATE, $server)) { throw new HttpForbiddenException('You do not have permission to perform this action.'); } diff --git a/app/Http/Controllers/Api/Client/Servers/ServerController.php b/app/Http/Controllers/Api/Client/Servers/ServerController.php index 96e276324..82091c48b 100644 --- a/app/Http/Controllers/Api/Client/Servers/ServerController.php +++ b/app/Http/Controllers/Api/Client/Servers/ServerController.php @@ -23,9 +23,6 @@ class ServerController extends ClientApiController /** * ServerController constructor. - * - * @param \Pterodactyl\Services\Servers\GetUserPermissionsService $permissionsService - * @param \Pterodactyl\Repositories\Eloquent\SubuserRepository $repository */ public function __construct(GetUserPermissionsService $permissionsService, SubuserRepository $repository) { @@ -38,10 +35,6 @@ class ServerController extends ClientApiController /** * Transform an individual server into a response that can be consumed by a * client using the API. - * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\GetServerRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array */ public function index(GetServerRequest $request, Server $server): array { diff --git a/app/Http/Controllers/Api/Client/Servers/SettingsController.php b/app/Http/Controllers/Api/Client/Servers/SettingsController.php index 80fc0e181..110cd0868 100644 --- a/app/Http/Controllers/Api/Client/Servers/SettingsController.php +++ b/app/Http/Controllers/Api/Client/Servers/SettingsController.php @@ -2,7 +2,6 @@ namespace Pterodactyl\Http\Controllers\Api\Client\Servers; -use Illuminate\Http\Request; use Illuminate\Http\Response; use Pterodactyl\Models\Server; use Illuminate\Http\JsonResponse; @@ -28,9 +27,6 @@ class SettingsController extends ClientApiController /** * SettingsController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository - * @param \Pterodactyl\Services\Servers\ReinstallServerService $reinstallServerService */ public function __construct( ServerRepository $repository, @@ -45,8 +41,6 @@ class SettingsController extends ClientApiController /** * Renames a server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Settings\RenameServerRequest $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\JsonResponse * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -64,8 +58,6 @@ class SettingsController extends ClientApiController /** * Reinstalls the server on the daemon. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Settings\ReinstallServerRequest $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\JsonResponse * * @throws \Throwable @@ -80,8 +72,6 @@ class SettingsController extends ClientApiController /** * Changes the Docker image in use by the server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Settings\SetDockerImageRequest $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\JsonResponse * * @throws \Throwable @@ -89,9 +79,7 @@ class SettingsController extends ClientApiController public function dockerImage(SetDockerImageRequest $request, Server $server) { if (!in_array($server->image, $server->egg->docker_images)) { - throw new BadRequestHttpException( - 'This server\'s Docker image has been manually set by an administrator and cannot be updated.' - ); + throw new BadRequestHttpException('This server\'s Docker image has been manually set by an administrator and cannot be updated.'); } $server->forceFill(['image' => $request->input('docker_image')])->saveOrFail(); diff --git a/app/Http/Controllers/Api/Client/Servers/StartupController.php b/app/Http/Controllers/Api/Client/Servers/StartupController.php index 7e06abf8e..06b4a5066 100644 --- a/app/Http/Controllers/Api/Client/Servers/StartupController.php +++ b/app/Http/Controllers/Api/Client/Servers/StartupController.php @@ -31,10 +31,6 @@ class StartupController extends ClientApiController /** * StartupController constructor. - * - * @param \Pterodactyl\Services\Servers\VariableValidatorService $service - * @param \Pterodactyl\Services\Servers\StartupCommandService $startupCommandService - * @param \Pterodactyl\Repositories\Eloquent\ServerVariableRepository $repository */ public function __construct(VariableValidatorService $service, StartupCommandService $startupCommandService, ServerVariableRepository $repository) { @@ -48,8 +44,6 @@ class StartupController extends ClientApiController /** * Returns the startup information for the server including all of the variables. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Startup\GetStartupRequest $request - * @param \Pterodactyl\Models\Server $server * @return array */ public function index(GetStartupRequest $request, Server $server) @@ -71,8 +65,6 @@ class StartupController extends ClientApiController /** * Updates a single variable for a server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Startup\UpdateStartupVariableRequest $request - * @param \Pterodactyl\Models\Server $server * @return array * * @throws \Illuminate\Validation\ValidationException @@ -84,14 +76,10 @@ class StartupController extends ClientApiController /** @var \Pterodactyl\Models\EggVariable $variable */ $variable = $server->variables()->where('env_variable', $request->input('key'))->first(); - if (is_null($variable) || ! $variable->user_viewable) { - throw new BadRequestHttpException( - "The environment variable you are trying to edit does not exist." - ); - } else if (! $variable->user_editable) { - throw new BadRequestHttpException( - "The environment variable you are trying to edit is read-only." - ); + if (is_null($variable) || !$variable->user_viewable) { + throw new BadRequestHttpException('The environment variable you are trying to edit does not exist.'); + } elseif (!$variable->user_editable) { + throw new BadRequestHttpException('The environment variable you are trying to edit is read-only.'); } // Revalidate the variable value using the egg variable specific validation rules for it. diff --git a/app/Http/Controllers/Api/Client/Servers/SubuserController.php b/app/Http/Controllers/Api/Client/Servers/SubuserController.php index 81238d33b..68f32cf8b 100644 --- a/app/Http/Controllers/Api/Client/Servers/SubuserController.php +++ b/app/Http/Controllers/Api/Client/Servers/SubuserController.php @@ -37,10 +37,6 @@ class SubuserController extends ClientApiController /** * SubuserController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\SubuserRepository $repository - * @param \Pterodactyl\Services\Subusers\SubuserCreationService $creationService - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $serverRepository */ public function __construct( SubuserRepository $repository, @@ -57,8 +53,6 @@ class SubuserController extends ClientApiController /** * Return the users associated with this server instance. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Subusers\GetSubuserRequest $request - * @param \Pterodactyl\Models\Server $server * @return array */ public function index(GetSubuserRequest $request, Server $server) @@ -71,7 +65,6 @@ class SubuserController extends ClientApiController /** * Returns a single subuser associated with this server instance. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Subusers\GetSubuserRequest $request * @return array */ public function view(GetSubuserRequest $request) @@ -86,8 +79,6 @@ class SubuserController extends ClientApiController /** * Create a new subuser for the given server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Subusers\StoreSubuserRequest $request - * @param \Pterodactyl\Models\Server $server * @return array * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -98,7 +89,9 @@ class SubuserController extends ClientApiController public function store(StoreSubuserRequest $request, Server $server) { $response = $this->creationService->handle( - $server, $request->input('email'), $this->getDefaultPermissions($request) + $server, + $request->input('email'), + $this->getDefaultPermissions($request) ); return $this->fractal->item($response) @@ -109,10 +102,6 @@ class SubuserController extends ClientApiController /** * Update a given subuser in the system for the server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Subusers\UpdateSubuserRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -151,8 +140,6 @@ class SubuserController extends ClientApiController /** * Removes a subusers from a server's assignment. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Subusers\DeleteSubuserRequest $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\JsonResponse */ public function delete(DeleteSubuserRequest $request, Server $server) @@ -174,9 +161,6 @@ class SubuserController extends ClientApiController /** * Returns the default permissions for all subusers to ensure none are ever removed wrongly. - * - * @param \Illuminate\Http\Request $request - * @return array */ protected function getDefaultPermissions(Request $request): array { diff --git a/app/Http/Controllers/Api/Client/Servers/WebsocketController.php b/app/Http/Controllers/Api/Client/Servers/WebsocketController.php index 1de41b08e..08abee27d 100644 --- a/app/Http/Controllers/Api/Client/Servers/WebsocketController.php +++ b/app/Http/Controllers/Api/Client/Servers/WebsocketController.php @@ -26,9 +26,6 @@ class WebsocketController extends ClientApiController /** * WebsocketController constructor. - * - * @param \Pterodactyl\Services\Nodes\NodeJWTService $jwtService - * @param \Pterodactyl\Services\Servers\GetUserPermissionsService $permissionsService */ public function __construct( NodeJWTService $jwtService, @@ -46,8 +43,6 @@ class WebsocketController extends ClientApiController * allows us to continually renew this token and avoid users mainitaining sessions wrongly, * as well as ensure that user's only perform actions they're allowed to. * - * @param \Pterodactyl\Http\Requests\Api\Client\ClientApiRequest $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\JsonResponse */ public function __invoke(ClientApiRequest $request, Server $server) @@ -60,9 +55,9 @@ class WebsocketController extends ClientApiController $permissions = $this->permissionsService->handle($server, $user); $node = $server->node; - if (! is_null($server->transfer)) { + if (!is_null($server->transfer)) { // Check if the user has permissions to receive transfer logs. - if (! in_array('admin.websocket.transfer', $permissions)) { + if (!in_array('admin.websocket.transfer', $permissions)) { throw new HttpForbiddenException('You do not have permission to view server transfer logs.'); } @@ -85,7 +80,7 @@ class WebsocketController extends ClientApiController return new JsonResponse([ 'data' => [ - 'token' => $token->__toString(), + 'token' => $token->toString(), 'socket' => $socket . sprintf('/api/servers/%s/ws', $server->uuid), ], ]); diff --git a/app/Http/Controllers/Api/Client/TwoFactorController.php b/app/Http/Controllers/Api/Client/TwoFactorController.php index 93be78fbc..4f7145add 100644 --- a/app/Http/Controllers/Api/Client/TwoFactorController.php +++ b/app/Http/Controllers/Api/Client/TwoFactorController.php @@ -31,10 +31,6 @@ class TwoFactorController extends ClientApiController /** * TwoFactorController constructor. - * - * @param \Pterodactyl\Services\Users\ToggleTwoFactorService $toggleTwoFactorService - * @param \Pterodactyl\Services\Users\TwoFactorSetupService $setupService - * @param \Illuminate\Contracts\Validation\Factory $validation */ public function __construct( ToggleTwoFactorService $toggleTwoFactorService, @@ -53,7 +49,6 @@ class TwoFactorController extends ClientApiController * it on their account. If two-factor is already enabled this endpoint * will return a 400 error. * - * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\JsonResponse * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -75,7 +70,6 @@ class TwoFactorController extends ClientApiController /** * Updates a user's account to have two-factor enabled. * - * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\JsonResponse * * @throws \Illuminate\Validation\ValidationException @@ -110,15 +104,12 @@ class TwoFactorController extends ClientApiController * Disables two-factor authentication on an account if the password provided * is valid. * - * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\JsonResponse */ public function delete(Request $request) { - if (! password_verify($request->input('password') ?? '', $request->user()->password)) { - throw new BadRequestHttpException( - 'The password provided was not valid.' - ); + if (!password_verify($request->input('password') ?? '', $request->user()->password)) { + throw new BadRequestHttpException('The password provided was not valid.'); } /** @var \Pterodactyl\Models\User $user */ diff --git a/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php b/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php index e89783b76..042486c24 100644 --- a/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php +++ b/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php @@ -15,7 +15,7 @@ use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; class BackupRemoteUploadController extends Controller { - const PART_SIZE = 5 * 1024 * 1024 * 1024; + public const PART_SIZE = 5 * 1024 * 1024 * 1024; /** * @var \Pterodactyl\Repositories\Eloquent\BackupRepository @@ -29,9 +29,6 @@ class BackupRemoteUploadController extends Controller /** * BackupRemoteUploadController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\BackupRepository $repository - * @param \Pterodactyl\Extensions\Backups\BackupManager $backupManager */ public function __construct(BackupRepository $repository, BackupManager $backupManager) { @@ -42,9 +39,6 @@ class BackupRemoteUploadController extends Controller /** * Returns the required presigned urls to upload a backup to S3 cloud storage. * - * @param \Illuminate\Http\Request $request - * @param string $backup - * * @return \Illuminate\Http\JsonResponse * * @throws \Exception @@ -64,13 +58,13 @@ class BackupRemoteUploadController extends Controller // Prevent backups that have already been completed from trying to // be uploaded again. - if (! is_null($backup->completed_at)) { + if (!is_null($backup->completed_at)) { throw new ConflictHttpException('This backup is already in a completed state.'); } // Ensure we are using the S3 adapter. $adapter = $this->backupManager->adapter(); - if (! $adapter instanceof AwsS3Adapter) { + if (!$adapter instanceof AwsS3Adapter) { throw new BadRequestHttpException('The configured backup adapter is not an S3 compatible adapter.'); } @@ -97,9 +91,10 @@ class BackupRemoteUploadController extends Controller // Create as many UploadPart presigned urls as needed $parts = []; - for ($i = 0; $i < ($size / self::PART_SIZE); $i++) { + for ($i = 0; $i < ($size / self::PART_SIZE); ++$i) { $parts[] = $client->createPresignedRequest( - $client->getCommand('UploadPart', array_merge($params, ['PartNumber' => $i + 1])), $expires + $client->getCommand('UploadPart', array_merge($params, ['PartNumber' => $i + 1])), + $expires )->getUri()->__toString(); } diff --git a/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php b/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php index 85be59a60..1dca51822 100644 --- a/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php +++ b/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php @@ -9,8 +9,8 @@ use Pterodactyl\Models\Server; use Pterodactyl\Models\AuditLog; use Illuminate\Http\JsonResponse; use League\Flysystem\AwsS3v3\AwsS3Adapter; -use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Exceptions\DisplayException; +use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Extensions\Backups\BackupManager; use Pterodactyl\Repositories\Eloquent\BackupRepository; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; @@ -30,9 +30,6 @@ class BackupStatusController extends Controller /** * BackupStatusController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\BackupRepository $repository - * @param \Pterodactyl\Extensions\Backups\BackupManager $backupManager */ public function __construct(BackupRepository $repository, BackupManager $backupManager) { @@ -43,8 +40,6 @@ class BackupStatusController extends Controller /** * Handles updating the state of a backup. * - * @param \Pterodactyl\Http\Requests\Api\Remote\ReportBackupCompleteRequest $request - * @param string $backup * @return \Illuminate\Http\JsonResponse * * @throws \Throwable @@ -54,10 +49,8 @@ class BackupStatusController extends Controller /** @var \Pterodactyl\Models\Backup $model */ $model = Backup::query()->where('uuid', $backup)->firstOrFail(); - if (! is_null($model->completed_at)) { - throw new BadRequestHttpException( - 'Cannot update the status of a backup that is already marked as completed.' - ); + if (!is_null($model->completed_at)) { + throw new BadRequestHttpException('Cannot update the status of a backup that is already marked as completed.'); } $action = $request->input('successful') @@ -124,10 +117,6 @@ class BackupStatusController extends Controller * Marks a multipart upload in a given S3-compatiable instance as failed or successful for * the given backup. * - * @param \Pterodactyl\Models\Backup $backup - * @param \League\Flysystem\AwsS3v3\AwsS3Adapter $adapter - * @param bool $successful - * * @throws \Exception * @throws \Pterodactyl\Exceptions\DisplayException */ @@ -139,7 +128,7 @@ class BackupStatusController extends Controller // A failed backup doesn't need to error here, this can happen if the backup encouters // an error before we even start the upload. AWS gives you tooling to clear these failed // multipart uploads as needed too. - if (! $successful) { + if (!$successful) { return; } throw new DisplayException('Cannot complete backup request: no upload_id present on model.'); @@ -152,7 +141,7 @@ class BackupStatusController extends Controller ]; $client = $adapter->getClient(); - if (! $successful) { + if (!$successful) { $client->execute($client->getCommand('AbortMultipartUpload', $params)); return; diff --git a/app/Http/Controllers/Api/Remote/EggInstallController.php b/app/Http/Controllers/Api/Remote/EggInstallController.php index d26da5c85..e1f804be2 100644 --- a/app/Http/Controllers/Api/Remote/EggInstallController.php +++ b/app/Http/Controllers/Api/Remote/EggInstallController.php @@ -22,9 +22,6 @@ class EggInstallController extends Controller /** * EggInstallController constructor. - * - * @param \Pterodactyl\Services\Servers\EnvironmentService $environment - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository */ public function __construct(EnvironmentService $environment, ServerRepositoryInterface $repository) { @@ -36,10 +33,6 @@ class EggInstallController extends Controller * Handle request to get script and installation information for a server * that is being created on the node. * - * @param \Illuminate\Http\Request $request - * @param string $uuid - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function index(Request $request, string $uuid): JsonResponse @@ -57,7 +50,7 @@ class EggInstallController extends Controller return response()->json([ 'scripts' => [ - 'install' => ! $egg->copy_script_install ? null : str_replace(["\r\n", "\n", "\r"], "\n", $egg->copy_script_install), + 'install' => !$egg->copy_script_install ? null : str_replace(["\r\n", "\n", "\r"], "\n", $egg->copy_script_install), 'privileged' => $egg->script_is_privileged, ], 'config' => [ diff --git a/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php b/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php index 99ba71362..a409d494b 100644 --- a/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php +++ b/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php @@ -31,11 +31,6 @@ class ServerDetailsController extends Controller /** * ServerConfigurationController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository - * @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $configurationStructureService - * @param \Pterodactyl\Services\Eggs\EggConfigurationService $eggConfigurationService - * @param \Pterodactyl\Repositories\Eloquent\NodeRepository $nodeRepository */ public function __construct( ServerRepository $repository, @@ -52,8 +47,8 @@ class ServerDetailsController extends Controller * Returns details about the server that allows Wings to self-recover and ensure * that the state of the server matches the Panel at all times. * - * @param \Illuminate\Http\Request $request * @param string $uuid + * * @return \Illuminate\Http\JsonResponse * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -71,7 +66,6 @@ class ServerDetailsController extends Controller /** * Lists all servers with their configurations that are assigned to the requesting node. * - * @param \Illuminate\Http\Request $request * @return \Pterodactyl\Http\Resources\Wings\ServerConfigurationCollection */ public function list(Request $request) @@ -85,7 +79,7 @@ class ServerDetailsController extends Controller ->where('node_id', $node->id) // If you don't cast this to a string you'll end up with a stringified per_page returned in // the metadata, and then Wings will panic crash as a result. - ->paginate((int)$request->input('per_page', 50)); + ->paginate((int) $request->input('per_page', 50)); return new ServerConfigurationCollection($servers); } diff --git a/app/Http/Controllers/Api/Remote/Servers/ServerInstallController.php b/app/Http/Controllers/Api/Remote/Servers/ServerInstallController.php index c8f09fe8f..e2217adff 100644 --- a/app/Http/Controllers/Api/Remote/Servers/ServerInstallController.php +++ b/app/Http/Controllers/Api/Remote/Servers/ServerInstallController.php @@ -19,8 +19,6 @@ class ServerInstallController extends Controller /** * ServerInstallController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository */ public function __construct(ServerRepository $repository) { @@ -30,8 +28,6 @@ class ServerInstallController extends Controller /** * Returns installation information for a server. * - * @param \Illuminate\Http\Request $request - * @param string $uuid * @return \Illuminate\Http\JsonResponse * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -51,8 +47,6 @@ class ServerInstallController extends Controller /** * Updates the installation state of a server. * - * @param \Pterodactyl\Http\Requests\Api\Remote\InstallationDataRequest $request - * @param string $uuid * @return \Illuminate\Http\JsonResponse * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException diff --git a/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php b/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php index cc097a637..9259c32d8 100644 --- a/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php +++ b/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php @@ -2,7 +2,7 @@ namespace Pterodactyl\Http\Controllers\Api\Remote\Servers; -use Cake\Chronos\Chronos; +use Carbon\CarbonImmutable; use Illuminate\Support\Arr; use Illuminate\Http\Request; use Illuminate\Http\Response; @@ -53,13 +53,6 @@ class ServerTransferController extends Controller /** * ServerTransferController constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonServerRepository - * @param \Pterodactyl\Repositories\Wings\DaemonTransferRepository $daemonTransferRepository - * @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $configurationStructureService - * @param \Pterodactyl\Services\Nodes\NodeJWTService $jwtService */ public function __construct( ConnectionInterface $connection, @@ -80,8 +73,6 @@ class ServerTransferController extends Controller /** * The daemon notifies us about the archive status. * - * @param \Illuminate\Http\Request $request - * @param string $uuid * @return \Illuminate\Http\JsonResponse * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -92,7 +83,7 @@ class ServerTransferController extends Controller $server = $this->repository->getByUuid($uuid); // Unsuspend the server and don't continue the transfer. - if (! $request->input('successful')) { + if (!$request->input('successful')) { return $this->processFailedTransfer($server->transfer); } @@ -110,11 +101,11 @@ class ServerTransferController extends Controller Arr::set($data, 'suspended', false); $this->connection->transaction(function () use ($data, $server) { - // This token is used by the new node the server is being transfered to. It allows + // This token is used by the new node the server is being transferred to. It allows // that node to communicate with the old node during the process to initiate the // actual file transfer. $token = $this->jwtService - ->setExpiresAt(Chronos::now()->addMinutes(15)) + ->setExpiresAt(CarbonImmutable::now()->addMinutes(15)) ->setSubject($server->uuid) ->handle($server->node, $server->uuid, 'sha256'); @@ -128,7 +119,7 @@ class ServerTransferController extends Controller $this->daemonTransferRepository ->setServer($server) ->setNode($server->transfer->newNode) - ->notify($server, $data, $server->node, $token->__toString()); + ->notify($server, $data, $server->node, $token->toString()); }); return new JsonResponse([], Response::HTTP_NO_CONTENT); @@ -137,7 +128,6 @@ class ServerTransferController extends Controller /** * The daemon notifies us about a transfer failure. * - * @param string $uuid * @return \Illuminate\Http\JsonResponse * * @throws \Throwable @@ -152,7 +142,6 @@ class ServerTransferController extends Controller /** * The daemon notifies us about a transfer success. * - * @param string $uuid * @return \Illuminate\Http\JsonResponse * * @throws \Throwable @@ -165,7 +154,7 @@ class ServerTransferController extends Controller /** @var \Pterodactyl\Models\Server $server */ $server = $this->connection->transaction(function () use ($server, $transfer) { $allocations = [$transfer->old_allocation]; - if (! empty($transfer->old_additional_allocations)) { + if (!empty($transfer->old_additional_allocations)) { array_push($allocations, $transfer->old_additional_allocations); } @@ -201,7 +190,6 @@ class ServerTransferController extends Controller * Release all of the reserved allocations for this transfer and mark it as failed in * the database. * - * @param \Pterodactyl\Models\ServerTransfer $transfer * @return \Illuminate\Http\JsonResponse * * @throws \Throwable @@ -212,7 +200,7 @@ class ServerTransferController extends Controller $transfer->forceFill(['successful' => false])->saveOrFail(); $allocations = [$transfer->new_allocation]; - if (! empty($transfer->new_additional_allocations)) { + if (!empty($transfer->new_additional_allocations)) { array_push($allocations, $transfer->new_additional_allocations); } diff --git a/app/Http/Controllers/Api/Remote/SftpAuthenticationController.php b/app/Http/Controllers/Api/Remote/SftpAuthenticationController.php index efa6fe48c..178f311e5 100644 --- a/app/Http/Controllers/Api/Remote/SftpAuthenticationController.php +++ b/app/Http/Controllers/Api/Remote/SftpAuthenticationController.php @@ -38,10 +38,6 @@ class SftpAuthenticationController extends Controller /** * SftpController constructor. - * - * @param \Pterodactyl\Services\Servers\GetUserPermissionsService $permissionsService - * @param \Pterodactyl\Repositories\Eloquent\UserRepository $userRepository - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $serverRepository */ public function __construct( GetUserPermissionsService $permissionsService, @@ -57,9 +53,6 @@ class SftpAuthenticationController extends Controller * Authenticate a set of credentials and return the associated server details * for a SFTP connection on the daemon. * - * @param \Pterodactyl\Http\Requests\Api\Remote\SftpAuthenticationFormRequest $request - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function __invoke(SftpAuthenticationFormRequest $request): JsonResponse @@ -76,15 +69,13 @@ class SftpAuthenticationController extends Controller if ($this->hasTooManyLoginAttempts($request)) { $seconds = $this->limiter()->availableIn($this->throttleKey($request)); - throw new TooManyRequestsHttpException( - $seconds, "Too many login attempts for this account, please try again in {$seconds} seconds." - ); + throw new TooManyRequestsHttpException($seconds, "Too many login attempts for this account, please try again in {$seconds} seconds."); } /** @var \Pterodactyl\Models\Node $node */ $node = $request->attributes->get('node'); if (empty($connection['server'])) { - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } /** @var \Pterodactyl\Models\User $user */ @@ -93,27 +84,23 @@ class SftpAuthenticationController extends Controller ]); $server = $this->serverRepository->getByUuid($connection['server'] ?? ''); - if (! password_verify($request->input('password'), $user->password) || $server->node_id !== $node->id) { + if (!password_verify($request->input('password'), $user->password) || $server->node_id !== $node->id) { $this->incrementLoginAttempts($request); - throw new HttpForbiddenException( - 'Authorization credentials were not correct, please try again.' - ); + throw new HttpForbiddenException('Authorization credentials were not correct, please try again.'); } - if (! $user->root_admin && $server->owner_id !== $user->id) { + if (!$user->root_admin && $server->owner_id !== $user->id) { $permissions = $this->permissionsService->handle($server, $user); - if (! in_array(Permission::ACTION_FILE_SFTP, $permissions)) { - throw new HttpForbiddenException( - 'You do not have permission to access SFTP for this server.' - ); + if (!in_array(Permission::ACTION_FILE_SFTP, $permissions)) { + throw new HttpForbiddenException('You do not have permission to access SFTP for this server.'); } } // Prevent SFTP access to servers that are being transferred. - if (! is_null($server->transfer)) { - throw new ServerTransferringException; + if (!is_null($server->transfer)) { + throw new ServerTransferringException(); } // Remember, for security purposes, only reveal the existence of the server to people that @@ -132,9 +119,6 @@ class SftpAuthenticationController extends Controller /** * Get the throttle key for the given request. - * - * @param \Illuminate\Http\Request $request - * @return string */ protected function throttleKey(Request $request): string { diff --git a/app/Http/Controllers/Auth/AbstractLoginController.php b/app/Http/Controllers/Auth/AbstractLoginController.php index b24a1a62a..601cdc142 100644 --- a/app/Http/Controllers/Auth/AbstractLoginController.php +++ b/app/Http/Controllers/Auth/AbstractLoginController.php @@ -50,9 +50,6 @@ abstract class AbstractLoginController extends Controller /** * LoginController constructor. - * - * @param \Illuminate\Auth\AuthManager $auth - * @param \Illuminate\Contracts\Config\Repository $config */ public function __construct(AuthManager $auth, Repository $config) { @@ -66,10 +63,6 @@ abstract class AbstractLoginController extends Controller /** * Get the failed login response instance. * - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Contracts\Auth\Authenticatable|null $user - * @param string|null $message - * * @throws \Pterodactyl\Exceptions\DisplayException */ protected function sendFailedLoginResponse(Request $request, Authenticatable $user = null, string $message = null) @@ -80,9 +73,7 @@ abstract class AbstractLoginController extends Controller ]); if ($request->route()->named('auth.login-checkpoint')) { - throw new DisplayException( - $message ?? trans('auth.two_factor.checkpoint_failed') - ); + throw new DisplayException($message ?? trans('auth.two_factor.checkpoint_failed')); } throw new DisplayException(trans('auth.failed')); @@ -90,10 +81,6 @@ abstract class AbstractLoginController extends Controller /** * Send the response after the user was authenticated. - * - * @param \Pterodactyl\Models\User $user - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\JsonResponse */ protected function sendLoginResponse(User $user, Request $request): JsonResponse { @@ -115,7 +102,6 @@ abstract class AbstractLoginController extends Controller * Determine if the user is logging in using an email or username,. * * @param string $input - * @return string */ protected function getField(string $input = null): string { @@ -124,9 +110,6 @@ abstract class AbstractLoginController extends Controller /** * Fire a failed login event. - * - * @param \Illuminate\Contracts\Auth\Authenticatable|null $user - * @param array $credentials */ protected function fireFailedLoginEvent(Authenticatable $user = null, array $credentials = []) { diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index 8f78f8c09..7b409e519 100644 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -18,7 +18,6 @@ class ForgotPasswordController extends Controller * * @param \Illuminate\Http\Request * @param string $response - * @return \Illuminate\Http\JsonResponse */ protected function sendResetLinkFailedResponse(Request $request, $response): JsonResponse { @@ -33,9 +32,7 @@ class ForgotPasswordController extends Controller /** * Get the response for a successful password reset link. * - * @param \Illuminate\Http\Request $request * @param string $response - * @return \Illuminate\Http\JsonResponse */ protected function sendResetLinkResponse(Request $request, $response): JsonResponse { diff --git a/app/Http/Controllers/Auth/LoginCheckpointController.php b/app/Http/Controllers/Auth/LoginCheckpointController.php index 70d83a323..3710da3a2 100644 --- a/app/Http/Controllers/Auth/LoginCheckpointController.php +++ b/app/Http/Controllers/Auth/LoginCheckpointController.php @@ -12,7 +12,6 @@ use Illuminate\Database\Eloquent\ModelNotFoundException; use Pterodactyl\Http\Requests\Auth\LoginCheckpointRequest; use Illuminate\Contracts\Cache\Repository as CacheRepository; use Pterodactyl\Contracts\Repository\UserRepositoryInterface; -use Pterodactyl\Exceptions\Repository\RecordNotFoundException; use Pterodactyl\Repositories\Eloquent\RecoveryTokenRepository; class LoginCheckpointController extends AbstractLoginController @@ -44,14 +43,6 @@ class LoginCheckpointController extends AbstractLoginController /** * LoginCheckpointController constructor. - * - * @param \Illuminate\Auth\AuthManager $auth - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter - * @param \PragmaRX\Google2FA\Google2FA $google2FA - * @param \Illuminate\Contracts\Config\Repository $config - * @param \Illuminate\Contracts\Cache\Repository $cache - * @param \Pterodactyl\Repositories\Eloquent\RecoveryTokenRepository $recoveryTokenRepository - * @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository */ public function __construct( AuthManager $auth, @@ -76,7 +67,6 @@ class LoginCheckpointController extends AbstractLoginController * token. Once a user has reached this stage it is assumed that they have already * provided a valid username and password. * - * @param \Pterodactyl\Http\Requests\Auth\LoginCheckpointRequest $request * @return \Illuminate\Http\JsonResponse|void * * @throws \PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException @@ -99,12 +89,14 @@ class LoginCheckpointController extends AbstractLoginController $this->incrementLoginAttempts($request); return $this->sendFailedLoginResponse( - $request, null, 'The authentication token provided has expired, please refresh the page and try again.' + $request, + null, + 'The authentication token provided has expired, please refresh the page and try again.' ); } // Recovery tokens go through a slightly different pathway for usage. - if (! is_null($recoveryToken = $request->input('recovery_token'))) { + if (!is_null($recoveryToken = $request->input('recovery_token'))) { if ($this->isValidRecoveryToken($user, $recoveryToken)) { return $this->sendLoginResponse($user, $request); } @@ -120,15 +112,13 @@ class LoginCheckpointController extends AbstractLoginController $this->incrementLoginAttempts($request); - return $this->sendFailedLoginResponse($request, $user, ! empty($recoveryToken) ? 'The recovery token provided is not valid.' : null); + return $this->sendFailedLoginResponse($request, $user, !empty($recoveryToken) ? 'The recovery token provided is not valid.' : null); } /** * Determines if a given recovery token is valid for the user account. If we find a matching token * it will be deleted from the database. * - * @param \Pterodactyl\Models\User $user - * @param string $value * @return bool * * @throws \Exception diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 593189db1..db74ab125 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -2,7 +2,7 @@ namespace Pterodactyl\Http\Controllers\Auth; -use Cake\Chronos\Chronos; +use Carbon\CarbonImmutable; use Illuminate\Support\Str; use Illuminate\Http\Request; use Illuminate\Auth\AuthManager; @@ -33,12 +33,6 @@ class LoginController extends AbstractLoginController /** * LoginController constructor. - * - * @param \Illuminate\Auth\AuthManager $auth - * @param \Illuminate\Contracts\Config\Repository $config - * @param \Illuminate\Contracts\Cache\Repository $cache - * @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository - * @param \Illuminate\Contracts\View\Factory $view */ public function __construct( AuthManager $auth, @@ -58,8 +52,6 @@ class LoginController extends AbstractLoginController * Handle all incoming requests for the authentication routes and render the * base authentication view component. Vuejs will take over at this point and * turn the login area into a SPA. - * - * @return \Illuminate\Contracts\View\View */ public function index(): View { @@ -69,7 +61,6 @@ class LoginController extends AbstractLoginController /** * Handle a login request to the application. * - * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\JsonResponse|void * * @throws \Pterodactyl\Exceptions\DisplayException @@ -95,13 +86,13 @@ class LoginController extends AbstractLoginController // continue. Previously this was handled in the 2FA checkpoint, however that has // a flaw in which you can discover if an account exists simply by seeing if you // can proceede to the next step in the login process. - if (! password_verify($request->input('password'), $user->password)) { + if (!password_verify($request->input('password'), $user->password)) { return $this->sendFailedLoginResponse($request, $user); } if ($user->use_totp) { $token = Str::random(64); - $this->cache->put($token, $user->id, Chronos::now()->addMinutes(5)); + $this->cache->put($token, $user->id, CarbonImmutable::now()->addMinutes(5)); return new JsonResponse([ 'data' => [ diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index fe5591516..b8a02ee72 100644 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -47,10 +47,6 @@ class ResetPasswordController extends Controller /** * ResetPasswordController constructor. - * - * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher - * @param \Illuminate\Contracts\Hashing\Hasher $hasher - * @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $userRepository */ public function __construct(Dispatcher $dispatcher, Hasher $hasher, UserRepositoryInterface $userRepository) { @@ -62,9 +58,6 @@ class ResetPasswordController extends Controller /** * Reset the given user's password. * - * @param \Pterodactyl\Http\Requests\Auth\ResetPasswordRequest $request - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\DisplayException */ public function __invoke(ResetPasswordRequest $request): JsonResponse @@ -73,7 +66,8 @@ class ResetPasswordController extends Controller // will update the password on an actual user model and persist it to the // database. Otherwise we will parse the error and return the response. $response = $this->broker()->reset( - $this->credentials($request), function ($user, $password) { + $this->credentials($request), + function ($user, $password) { $this->resetPassword($user, $password); } ); @@ -94,7 +88,7 @@ class ResetPasswordController extends Controller * form with a note telling them their password was changed and to log back in. * * @param \Illuminate\Contracts\Auth\CanResetPassword|\Pterodactyl\Models\User $user - * @param string $password + * @param string $password * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -110,7 +104,7 @@ class ResetPasswordController extends Controller // If the user is not using 2FA log them in, otherwise skip this step and force a // fresh login where they'll be prompted to enter a token. - if (! $user->use_totp) { + if (!$user->use_totp) { $this->guard()->login($user); } @@ -119,8 +113,6 @@ class ResetPasswordController extends Controller /** * Send a successful password reset response back to the callee. - * - * @return \Illuminate\Http\JsonResponse */ protected function sendResetResponse(): JsonResponse { diff --git a/app/Http/Controllers/Base/IndexController.php b/app/Http/Controllers/Base/IndexController.php index 41ff988f7..058280be6 100644 --- a/app/Http/Controllers/Base/IndexController.php +++ b/app/Http/Controllers/Base/IndexController.php @@ -14,8 +14,6 @@ class IndexController extends Controller /** * IndexController constructor. - * - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository */ public function __construct(ServerRepositoryInterface $repository) { diff --git a/app/Http/Controllers/Base/LocaleController.php b/app/Http/Controllers/Base/LocaleController.php index f29ba23d0..3bb6fbfba 100644 --- a/app/Http/Controllers/Base/LocaleController.php +++ b/app/Http/Controllers/Base/LocaleController.php @@ -16,8 +16,6 @@ class LocaleController extends Controller /** * LocaleController constructor. - * - * @param \Illuminate\Translation\Translator $translator */ public function __construct(Translator $translator) { @@ -27,9 +25,6 @@ class LocaleController extends Controller /** * Returns translation data given a specific locale and namespace. * - * @param \Illuminate\Http\Request $request - * @param string $locale - * @param string $namespace * @return \Illuminate\Http\JsonResponse */ public function __invoke(Request $request, string $locale, string $namespace) diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 2581e8b98..ee7af2f7a 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -9,5 +9,7 @@ use Illuminate\Foundation\Auth\Access\AuthorizesRequests; abstract class Controller extends BaseController { - use AuthorizesRequests, DispatchesJobs, ValidatesRequests; + use AuthorizesRequests; + use DispatchesJobs; + use ValidatesRequests; } diff --git a/app/Http/Middleware/Admin/Servers/ServerInstalled.php b/app/Http/Middleware/Admin/Servers/ServerInstalled.php index 69c7d5488..f4d0a6fbf 100644 --- a/app/Http/Middleware/Admin/Servers/ServerInstalled.php +++ b/app/Http/Middleware/Admin/Servers/ServerInstalled.php @@ -14,8 +14,6 @@ class ServerInstalled /** * Checks that the server is installed before allowing access through the route. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed */ public function handle(Request $request, Closure $next) @@ -23,10 +21,8 @@ class ServerInstalled /** @var \Pterodactyl\Models\Server|null $server */ $server = $request->route()->parameter('server'); - if (! $server instanceof Server) { - throw new NotFoundHttpException( - 'No server resource was located in the request parameters.' - ); + if (!$server instanceof Server) { + throw new NotFoundHttpException('No server resource was located in the request parameters.'); } if (! $server->isInstalled()) { diff --git a/app/Http/Middleware/AdminAuthenticate.php b/app/Http/Middleware/AdminAuthenticate.php index 878e56bb7..72a7c8629 100644 --- a/app/Http/Middleware/AdminAuthenticate.php +++ b/app/Http/Middleware/AdminAuthenticate.php @@ -18,16 +18,14 @@ class AdminAuthenticate /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed * * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException */ public function handle(Request $request, Closure $next) { - if (! $request->user() || ! $request->user()->root_admin) { - throw new AccessDeniedHttpException; + if (!$request->user() || !$request->user()->root_admin) { + throw new AccessDeniedHttpException(); } return $next($request); diff --git a/app/Http/Middleware/Api/ApiSubstituteBindings.php b/app/Http/Middleware/Api/ApiSubstituteBindings.php index 5ef3bca30..7ade7452a 100644 --- a/app/Http/Middleware/Api/ApiSubstituteBindings.php +++ b/app/Http/Middleware/Api/ApiSubstituteBindings.php @@ -42,7 +42,7 @@ class ApiSubstituteBindings extends SubstituteBindings * a 404 error if a model is not found. * * @param \Illuminate\Http\Request $request - * @param \Closure $next + * * @return mixed */ public function handle($request, Closure $next) @@ -50,7 +50,7 @@ class ApiSubstituteBindings extends SubstituteBindings $route = $request->route(); foreach (self::$mappings as $key => $model) { - if (! is_null($this->router->getBindingCallback($key))) { + if (!is_null($this->router->getBindingCallback($key))) { continue; } diff --git a/app/Http/Middleware/Api/Application/AuthenticateApplicationUser.php b/app/Http/Middleware/Api/Application/AuthenticateApplicationUser.php index 70c52f5b5..bf9a64606 100644 --- a/app/Http/Middleware/Api/Application/AuthenticateApplicationUser.php +++ b/app/Http/Middleware/Api/Application/AuthenticateApplicationUser.php @@ -12,13 +12,11 @@ class AuthenticateApplicationUser * Authenticate that the currently authenticated user is an administrator * and should be allowed to proceed through the application API. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed */ public function handle(Request $request, Closure $next) { - if (is_null($request->user()) || ! $request->user()->root_admin) { + if (is_null($request->user()) || !$request->user()->root_admin) { throw new AccessDeniedHttpException('This account does not have permission to access the API.'); } diff --git a/app/Http/Middleware/Api/AuthenticateIPAccess.php b/app/Http/Middleware/Api/AuthenticateIPAccess.php index 8f57b820d..2af34cfd9 100644 --- a/app/Http/Middleware/Api/AuthenticateIPAccess.php +++ b/app/Http/Middleware/Api/AuthenticateIPAccess.php @@ -13,8 +13,6 @@ class AuthenticateIPAccess /** * Determine if a request IP has permission to access the API. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed * * @throws \Exception diff --git a/app/Http/Middleware/Api/AuthenticateKey.php b/app/Http/Middleware/Api/AuthenticateKey.php index 515cc1fcf..db469bc5e 100644 --- a/app/Http/Middleware/Api/AuthenticateKey.php +++ b/app/Http/Middleware/Api/AuthenticateKey.php @@ -3,7 +3,7 @@ namespace Pterodactyl\Http\Middleware\Api; use Closure; -use Cake\Chronos\Chronos; +use Carbon\CarbonImmutable; use Illuminate\Http\Request; use Pterodactyl\Models\User; use Pterodactyl\Models\ApiKey; @@ -33,10 +33,6 @@ class AuthenticateKey /** * AuthenticateKey constructor. - * - * @param \Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface $repository - * @param \Illuminate\Auth\AuthManager $auth - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter */ public function __construct(ApiKeyRepositoryInterface $repository, AuthManager $auth, Encrypter $encrypter) { @@ -49,9 +45,6 @@ class AuthenticateKey * Handle an API request by verifying that the provided API key * is in a valid format and exists in the database. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param int $keyType * @return mixed * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -85,10 +78,6 @@ class AuthenticateKey /** * Authenticate an API key. * - * @param string $key - * @param int $keyType - * @return \Pterodactyl\Models\ApiKey - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -103,14 +92,14 @@ class AuthenticateKey ['key_type', '=', $keyType], ]); } catch (RecordNotFoundException $exception) { - throw new AccessDeniedHttpException; + throw new AccessDeniedHttpException(); } - if (! hash_equals($this->encrypter->decrypt($model->token), $token)) { - throw new AccessDeniedHttpException; + if (!hash_equals($this->encrypter->decrypt($model->token), $token)) { + throw new AccessDeniedHttpException(); } - $this->repository->withoutFreshModel()->update($model->id, ['last_used_at' => Chronos::now()]); + $this->repository->withoutFreshModel()->update($model->id, ['last_used_at' => CarbonImmutable::now()]); return $model; } diff --git a/app/Http/Middleware/Api/Client/Server/AllocationBelongsToServer.php b/app/Http/Middleware/Api/Client/Server/AllocationBelongsToServer.php deleted file mode 100644 index d027d563c..000000000 --- a/app/Http/Middleware/Api/Client/Server/AllocationBelongsToServer.php +++ /dev/null @@ -1,33 +0,0 @@ -route()->parameter('server'); - /** @var \Pterodactyl\Models\Allocation|null $allocation */ - $allocation = $request->route()->parameter('allocation'); - - if ($allocation && $allocation->server_id !== $server->id) { - throw new NotFoundHttpException; - } - - return $next($request); - } -} diff --git a/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php b/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php index 902a5e4df..4ab87ce44 100644 --- a/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php +++ b/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php @@ -8,8 +8,8 @@ use Pterodactyl\Models\Server; use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; use Symfony\Component\HttpKernel\Exception\ConflictHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Pterodactyl\Exceptions\Http\Server\ServerTransferringException; +use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; class AuthenticateServerAccess { @@ -29,8 +29,6 @@ class AuthenticateServerAccess /** * AuthenticateServerAccess constructor. - * - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository */ public function __construct(ServerRepositoryInterface $repository) { @@ -40,8 +38,6 @@ class AuthenticateServerAccess /** * Authenticate that this server exists and is not suspended or marked as installing. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed */ public function handle(Request $request, Closure $next) @@ -50,39 +46,37 @@ class AuthenticateServerAccess $user = $request->user(); $server = $request->route()->parameter('server'); - if (! $server instanceof Server) { + if (!$server instanceof Server) { throw new NotFoundHttpException(trans('exceptions.api.resource_not_found')); } // At the very least, ensure that the user trying to make this request is the // server owner, a subuser, or a root admin. We'll leave it up to the controllers // to authenticate more detailed permissions if needed. - if ($user->id !== $server->owner_id && ! $user->root_admin) { + if ($user->id !== $server->owner_id && !$user->root_admin) { // Check for subuser status. - if (! $server->subusers->contains('user_id', $user->id)) { + if (!$server->subusers->contains('user_id', $user->id)) { throw new NotFoundHttpException(trans('exceptions.api.resource_not_found')); } } - if ($server->isSuspended() && ! $request->routeIs('api:client:server.resources')) { - throw new BadRequestHttpException( - 'This server is currently suspended and the functionality requested is unavailable.' - ); + if ($server->suspended && !$request->routeIs('api:client:server.resources')) { + throw new BadRequestHttpException('This server is currently suspended and the functionality requested is unavailable.'); } // Still allow users to get information about their server if it is installing or being transferred. - if (! $request->routeIs('api:client:server.view')) { - if (! $server->isInstalled()) { + if (!$request->routeIs('api:client:server.view')) { + if (!$server->isInstalled()) { // Throw an exception for all server routes; however if the user is an admin and requesting the // server details, don't throw the exception for them. - if (! $user->root_admin || ($user->root_admin && ! $request->routeIs($this->except))) { + if (!$user->root_admin || ($user->root_admin && !$request->routeIs($this->except))) { throw new ConflictHttpException('Server has not completed the installation process.'); } } - if (! is_null($server->transfer)) { - if (! $user->root_admin || ($user->root_admin && ! $request->routeIs($this->except))) { - throw new ServerTransferringException; + if (!is_null($server->transfer)) { + if (!$user->root_admin || ($user->root_admin && !$request->routeIs($this->except))) { + throw new ServerTransferringException(); } } } diff --git a/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php b/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php new file mode 100644 index 000000000..d8c4731d3 --- /dev/null +++ b/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php @@ -0,0 +1,90 @@ +route()->parameters(); + if (is_null($params) || !$params['server'] instanceof Server) { + throw new InvalidArgumentException('This middleware cannot be used in a context that is missing a server in the parameters.'); + } + + /** @var \Pterodactyl\Models\Server $server */ + $server = $request->route()->parameter('server'); + $exception = new NotFoundHttpException('The requested resource was not found for this server.'); + foreach ($params as $key => $model) { + // Specifically skip the server, we're just trying to see if all of the + // other resources are assigned to this server. Also skip anything that + // is not currently a Model instance since those will just end up being + // a 404 down the road. + if ($key === 'server' || !$model instanceof Model) { + continue; + } + + switch (get_class($model)) { + // All of these models use "server_id" as the field key for the server + // they are assigned to, so the logic is identical for them all. + case Allocation::class: + case Backup::class: + case Database::class: + case Schedule::class: + case Subuser::class: + if ($model->server_id !== $server->id) { + throw $exception; + } + break; + // Regular users are a special case here as we need to make sure they're + // currently assigned as a subuser on the server. + case User::class: + $subuser = $server->subusers()->where('user_id', $model->id)->first(); + if (is_null($subuser)) { + throw $exception; + } + // This is a special case to avoid an additional query being triggered + // in the underlying logic. + $request->attributes->set('subuser', $subuser); + break; + // Tasks are special since they're (currently) the only item in the API + // that requires something in addition to the server in order to be accessed. + case Task::class: + $schedule = $request->route()->parameter('schedule'); + if ($model->schedule_id !== $schedule->id || $schedule->server_id !== $server->id) { + throw $exception; + } + break; + default: + // Don't return a 404 here since we want to make sure no one relies + // on this middleware in a context in which it will not work. Fail safe. + throw new InvalidArgumentException('There is no handler configured for a resource of this type: ' . get_class($model)); + } + } + + return $next($request); + } +} diff --git a/app/Http/Middleware/Api/Client/Server/SubuserBelongsToServer.php b/app/Http/Middleware/Api/Client/Server/SubuserBelongsToServer.php deleted file mode 100644 index a80f6eefd..000000000 --- a/app/Http/Middleware/Api/Client/Server/SubuserBelongsToServer.php +++ /dev/null @@ -1,36 +0,0 @@ -route()->parameter('server'); - /** @var \Pterodactyl\Models\User $user */ - $user = $request->route()->parameter('user'); - - // Don't do anything if there isn't a user present in the request. - if (is_null($user)) { - return $next($request); - } - - $request->attributes->set('subuser', $server->subusers()->where('user_id', $user->id)->firstOrFail()); - - return $next($request); - } -} diff --git a/app/Http/Middleware/Api/Client/SubstituteClientApiBindings.php b/app/Http/Middleware/Api/Client/SubstituteClientApiBindings.php index 7ab597b63..31590f28a 100644 --- a/app/Http/Middleware/Api/Client/SubstituteClientApiBindings.php +++ b/app/Http/Middleware/Api/Client/SubstituteClientApiBindings.php @@ -19,7 +19,7 @@ class SubstituteClientApiBindings extends ApiSubstituteBindings * a 404 error if a model is not found. * * @param \Illuminate\Http\Request $request - * @param \Closure $next + * * @return mixed */ public function handle($request, Closure $next) @@ -43,7 +43,7 @@ class SubstituteClientApiBindings extends ApiSubstituteBindings } }); - $this->router->bind('database', function ($value) use ($request) { + $this->router->bind('database', function ($value) { $id = Container::getInstance()->make(HashidsInterface::class)->decodeFirst($value); return Database::query()->where('id', $id)->firstOrFail(); diff --git a/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php b/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php index d222f58ec..174cef431 100644 --- a/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php +++ b/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php @@ -34,9 +34,6 @@ class DaemonAuthenticate /** * DaemonAuthenticate constructor. - * - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter - * @param \Pterodactyl\Repositories\Eloquent\NodeRepository $repository */ public function __construct(Encrypter $encrypter, NodeRepository $repository) { @@ -47,8 +44,6 @@ class DaemonAuthenticate /** * Check if a request from the daemon can be properly attributed back to a single node instance. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed * * @throws \Symfony\Component\HttpKernel\Exception\HttpException @@ -60,17 +55,13 @@ class DaemonAuthenticate } if (is_null($bearer = $request->bearerToken())) { - throw new HttpException( - 401, 'Access this this endpoint must include an Authorization header.', null, ['WWW-Authenticate' => 'Bearer'] - ); + throw new HttpException(401, 'Access this this endpoint must include an Authorization header.', null, ['WWW-Authenticate' => 'Bearer']); } $parts = explode('.', $bearer); // Ensure that all of the correct parts are provided in the header. if (count($parts) !== 2 || empty($parts[0]) || empty($parts[1])) { - throw new BadRequestHttpException( - 'The Authorization header provided was not in a valid format.' - ); + throw new BadRequestHttpException('The Authorization header provided was not in a valid format.'); } try { @@ -88,8 +79,6 @@ class DaemonAuthenticate // Do nothing, we don't want to expose a node not existing at all. } - throw new AccessDeniedHttpException( - 'You are not authorized to access this resource.' - ); + throw new AccessDeniedHttpException('You are not authorized to access this resource.'); } } diff --git a/app/Http/Middleware/Api/IsValidJson.php b/app/Http/Middleware/Api/IsValidJson.php index 20c54dab4..c3c8d6c85 100644 --- a/app/Http/Middleware/Api/IsValidJson.php +++ b/app/Http/Middleware/Api/IsValidJson.php @@ -13,23 +13,15 @@ class IsValidJson * parsing the data. This avoids confusing validation errors where every field is flagged and * it is not immediately clear that there is an issue with the JSON being passed. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed */ public function handle(Request $request, Closure $next) { - if ($request->isJson() && ! empty($request->getContent())) { + if ($request->isJson() && !empty($request->getContent())) { json_decode($request->getContent(), true); if (json_last_error() !== JSON_ERROR_NONE) { - throw new BadRequestHttpException( - sprintf( - 'The JSON data passed in the request appears to be malformed. err_code: %d err_message: "%s"', - json_last_error(), - json_last_error_msg() - ) - ); + throw new BadRequestHttpException(sprintf('The JSON data passed in the request appears to be malformed. err_code: %d err_message: "%s"', json_last_error(), json_last_error_msg())); } } diff --git a/app/Http/Middleware/Api/SetSessionDriver.php b/app/Http/Middleware/Api/SetSessionDriver.php index a04db7fab..1c8f59a0b 100644 --- a/app/Http/Middleware/Api/SetSessionDriver.php +++ b/app/Http/Middleware/Api/SetSessionDriver.php @@ -15,8 +15,6 @@ class SetSessionDriver /** * SetSessionDriver constructor. - * - * @param \Illuminate\Contracts\Config\Repository $config */ public function __construct(ConfigRepository $config) { @@ -26,8 +24,6 @@ class SetSessionDriver /** * Set the session for API calls to only last for the one request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed */ public function handle(Request $request, Closure $next) diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index ed8d31e02..f95180b20 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -11,16 +11,14 @@ class Authenticate /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed * * @throws \Illuminate\Auth\AuthenticationException */ public function handle(Request $request, Closure $next) { - if (! $request->user()) { - throw new AuthenticationException; + if (!$request->user()) { + throw new AuthenticationException(); } return $next($request); diff --git a/app/Http/Middleware/LanguageMiddleware.php b/app/Http/Middleware/LanguageMiddleware.php index 3dba67e22..914d4395f 100644 --- a/app/Http/Middleware/LanguageMiddleware.php +++ b/app/Http/Middleware/LanguageMiddleware.php @@ -15,8 +15,6 @@ class LanguageMiddleware /** * LanguageMiddleware constructor. - * - * @param \Illuminate\Foundation\Application $app */ public function __construct(Application $app) { @@ -26,8 +24,6 @@ class LanguageMiddleware /** * Handle an incoming request and set the user's preferred language. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed */ public function handle(Request $request, Closure $next) diff --git a/app/Http/Middleware/MaintenanceMiddleware.php b/app/Http/Middleware/MaintenanceMiddleware.php index 8f733bcd3..582626162 100644 --- a/app/Http/Middleware/MaintenanceMiddleware.php +++ b/app/Http/Middleware/MaintenanceMiddleware.php @@ -14,8 +14,6 @@ class MaintenanceMiddleware /** * MaintenanceMiddleware constructor. - * - * @param \Illuminate\Contracts\Routing\ResponseFactory $response */ public function __construct(ResponseFactory $response) { @@ -26,7 +24,7 @@ class MaintenanceMiddleware * Handle an incoming request. * * @param \Illuminate\Http\Request $request - * @param \Closure $next + * * @return mixed */ public function handle($request, Closure $next) diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index a8c51bb04..6c4019af4 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -15,8 +15,6 @@ class RedirectIfAuthenticated /** * RedirectIfAuthenticated constructor. - * - * @param \Illuminate\Auth\AuthManager $authManager */ public function __construct(AuthManager $authManager) { @@ -26,9 +24,6 @@ class RedirectIfAuthenticated /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string|null $guard * @return mixed */ public function handle(Request $request, Closure $next, string $guard = null) diff --git a/app/Http/Middleware/RequireTwoFactorAuthentication.php b/app/Http/Middleware/RequireTwoFactorAuthentication.php index d837df24d..6691179a3 100644 --- a/app/Http/Middleware/RequireTwoFactorAuthentication.php +++ b/app/Http/Middleware/RequireTwoFactorAuthentication.php @@ -10,9 +10,9 @@ use Pterodactyl\Exceptions\Http\TwoFactorAuthRequiredException; class RequireTwoFactorAuthentication { - const LEVEL_NONE = 0; - const LEVEL_ADMIN = 1; - const LEVEL_ALL = 2; + public const LEVEL_NONE = 0; + public const LEVEL_ADMIN = 1; + public const LEVEL_ALL = 2; /** * @var \Prologue\Alerts\AlertsMessageBag @@ -28,8 +28,6 @@ class RequireTwoFactorAuthentication /** * RequireTwoFactorAuthentication constructor. - * - * @param \Prologue\Alerts\AlertsMessageBag $alert */ public function __construct(AlertsMessageBag $alert) { @@ -42,8 +40,6 @@ class RequireTwoFactorAuthentication * order to perform actions. If so, we check the level at which it is required (all users * or just admins) and then check if the user has enabled it for their account. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed * * @throws \Pterodactyl\Exceptions\Http\TwoFactorAuthRequiredException @@ -55,24 +51,24 @@ class RequireTwoFactorAuthentication $uri = rtrim($request->getRequestUri(), '/') . '/'; $current = $request->route()->getName(); - if (! $user || Str::startsWith($uri, ['/auth/']) || Str::startsWith($current, ['auth.', 'account.'])) { + if (!$user || Str::startsWith($uri, ['/auth/']) || Str::startsWith($current, ['auth.', 'account.'])) { return $next($request); } - $level = (int)config('pterodactyl.auth.2fa_required'); + $level = (int) config('pterodactyl.auth.2fa_required'); // If this setting is not configured, or the user is already using 2FA then we can just // send them right through, nothing else needs to be checked. // // If the level is set as admin and the user is not an admin, pass them through as well. if ($level === self::LEVEL_NONE || $user->use_totp) { return $next($request); - } else if ($level === self::LEVEL_ADMIN && ! $user->root_admin) { + } elseif ($level === self::LEVEL_ADMIN && !$user->root_admin) { return $next($request); } // For API calls return an exception which gets rendered nicely in the API response. if ($request->isJson() || Str::startsWith($uri, '/api/')) { - throw new TwoFactorAuthRequiredException; + throw new TwoFactorAuthRequiredException(); } $this->alert->danger(trans('auth.2fa_must_be_enabled'))->flash(); diff --git a/app/Http/Middleware/Server/AccessingValidServer.php b/app/Http/Middleware/Server/AccessingValidServer.php index 77a9e0beb..095cecec5 100644 --- a/app/Http/Middleware/Server/AccessingValidServer.php +++ b/app/Http/Middleware/Server/AccessingValidServer.php @@ -31,10 +31,6 @@ class AccessingValidServer /** * AccessingValidServer constructor. - * - * @param \Illuminate\Contracts\Config\Repository $config - * @param \Illuminate\Contracts\Routing\ResponseFactory $response - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository */ public function __construct( ConfigRepository $config, @@ -49,8 +45,6 @@ class AccessingValidServer /** * Determine if a given user has permission to access a server. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return \Illuminate\Http\Response|mixed * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -81,9 +75,9 @@ class AccessingValidServer return $this->response->view('errors.installing', [], 409); } - if (! is_null($server->transfer)) { + if (!is_null($server->transfer)) { if ($isApiRequest) { - throw new ServerTransferringException; + throw new ServerTransferringException(); } return $this->response->view('errors.transferring', [], 409); diff --git a/app/Http/Middleware/VerifyReCaptcha.php b/app/Http/Middleware/VerifyReCaptcha.php index 710360479..c0841f2c9 100644 --- a/app/Http/Middleware/VerifyReCaptcha.php +++ b/app/Http/Middleware/VerifyReCaptcha.php @@ -26,9 +26,6 @@ class VerifyReCaptcha /** * VerifyReCaptcha constructor. - * - * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher - * @param \Illuminate\Contracts\Config\Repository $config */ public function __construct(Dispatcher $dispatcher, Repository $config) { @@ -40,12 +37,12 @@ class VerifyReCaptcha * Handle an incoming request. * * @param \Illuminate\Http\Request $request - * @param \Closure $next + * * @return \Illuminate\Http\RedirectResponse|mixed */ public function handle($request, Closure $next) { - if (! $this->config->get('recaptcha.enabled')) { + if (!$this->config->get('recaptcha.enabled')) { return $next($request); } @@ -61,7 +58,7 @@ class VerifyReCaptcha if ($res->getStatusCode() === 200) { $result = json_decode($res->getBody()); - if ($result->success && (! $this->config->get('recaptcha.verify_domain') || $this->isResponseVerified($result, $request))) { + if ($result->success && (!$this->config->get('recaptcha.verify_domain') || $this->isResponseVerified($result, $request))) { return $next($request); } } @@ -69,25 +66,20 @@ class VerifyReCaptcha $this->dispatcher->dispatch( new FailedCaptcha( - $request->ip(), ! empty($result) ? ($result->hostname ?? null) : null + $request->ip(), + !empty($result) ? ($result->hostname ?? null) : null ) ); - throw new HttpException( - Response::HTTP_BAD_REQUEST, 'Failed to validate reCAPTCHA data.' - ); + throw new HttpException(Response::HTTP_BAD_REQUEST, 'Failed to validate reCAPTCHA data.'); } /** * Determine if the response from the recaptcha servers was valid. - * - * @param stdClass $result - * @param \Illuminate\Http\Request $request - * @return bool */ private function isResponseVerified(stdClass $result, Request $request): bool { - if (! $this->config->get('recaptcha.verify_domain')) { + if (!$this->config->get('recaptcha.verify_domain')) { return false; } diff --git a/app/Http/Requests/Admin/AdminFormRequest.php b/app/Http/Requests/Admin/AdminFormRequest.php index 012d73364..e3107e26d 100644 --- a/app/Http/Requests/Admin/AdminFormRequest.php +++ b/app/Http/Requests/Admin/AdminFormRequest.php @@ -32,7 +32,6 @@ abstract class AdminFormRequest extends FormRequest * Return only the fields that we are interested in from the request. * This will include empty fields as a null value. * - * @param array|null $only * @return array */ public function normalize(array $only = null) diff --git a/app/Http/Requests/Admin/Api/StoreApplicationApiKeyRequest.php b/app/Http/Requests/Admin/Api/StoreApplicationApiKeyRequest.php index a29496280..40aa732f2 100644 --- a/app/Http/Requests/Admin/Api/StoreApplicationApiKeyRequest.php +++ b/app/Http/Requests/Admin/Api/StoreApplicationApiKeyRequest.php @@ -10,6 +10,7 @@ class StoreApplicationApiKeyRequest extends AdminFormRequest { /** * @return array + * * @throws \ReflectionException * @throws \ReflectionException */ diff --git a/app/Http/Requests/Admin/DatabaseHostFormRequest.php b/app/Http/Requests/Admin/DatabaseHostFormRequest.php index c6b2468a7..7fdd0cdc3 100644 --- a/app/Http/Requests/Admin/DatabaseHostFormRequest.php +++ b/app/Http/Requests/Admin/DatabaseHostFormRequest.php @@ -25,7 +25,7 @@ class DatabaseHostFormRequest extends AdminFormRequest */ protected function getValidatorInstance() { - if (! $this->filled('node_id')) { + if (!$this->filled('node_id')) { $this->merge(['node_id' => null]); } diff --git a/app/Http/Requests/Admin/Egg/EggFormRequest.php b/app/Http/Requests/Admin/Egg/EggFormRequest.php index 92e4a6541..4cc44f630 100644 --- a/app/Http/Requests/Admin/Egg/EggFormRequest.php +++ b/app/Http/Requests/Admin/Egg/EggFormRequest.php @@ -44,7 +44,7 @@ class EggFormRequest extends AdminFormRequest public function withValidator($validator) { $validator->sometimes('config_from', 'exists:eggs,id', function () { - return (int)$this->input('config_from') !== 0; + return (int) $this->input('config_from') !== 0; }); } } diff --git a/app/Http/Requests/Admin/Node/NodeFormRequest.php b/app/Http/Requests/Admin/Node/NodeFormRequest.php index caef04f9e..a12246783 100644 --- a/app/Http/Requests/Admin/Node/NodeFormRequest.php +++ b/app/Http/Requests/Admin/Node/NodeFormRequest.php @@ -35,7 +35,7 @@ class NodeFormRequest extends AdminFormRequest { $validator->after(function ($validator) { // Check that the FQDN is a valid IP address. - if (! filter_var(gethostbyname($this->input('fqdn')), FILTER_VALIDATE_IP)) { + if (!filter_var(gethostbyname($this->input('fqdn')), FILTER_VALIDATE_IP)) { $validator->errors()->add('fqdn', trans('admin/node.validation.fqdn_not_resolvable')); } diff --git a/app/Http/Requests/Admin/ServerFormRequest.php b/app/Http/Requests/Admin/ServerFormRequest.php index 585834224..e20210b35 100644 --- a/app/Http/Requests/Admin/ServerFormRequest.php +++ b/app/Http/Requests/Admin/ServerFormRequest.php @@ -30,7 +30,7 @@ class ServerFormRequest extends AdminFormRequest { $validator->after(function ($validator) { $validator->sometimes('node_id', 'required|numeric|bail|exists:nodes,id', function ($input) { - return ! ($input->auto_deploy); + return !($input->auto_deploy); }); $validator->sometimes('allocation_id', [ @@ -42,7 +42,7 @@ class ServerFormRequest extends AdminFormRequest $query->whereNull('server_id'); }), ], function ($input) { - return ! ($input->auto_deploy); + return !($input->auto_deploy); }); $validator->sometimes('allocation_additional.*', [ @@ -54,7 +54,7 @@ class ServerFormRequest extends AdminFormRequest $query->whereNull('server_id'); }), ], function ($input) { - return ! ($input->auto_deploy); + return !($input->auto_deploy); }); }); } diff --git a/app/Http/Requests/Admin/Servers/Databases/StoreServerDatabaseRequest.php b/app/Http/Requests/Admin/Servers/Databases/StoreServerDatabaseRequest.php index 40a4b06bc..144755d2b 100644 --- a/app/Http/Requests/Admin/Servers/Databases/StoreServerDatabaseRequest.php +++ b/app/Http/Requests/Admin/Servers/Databases/StoreServerDatabaseRequest.php @@ -10,8 +10,6 @@ class StoreServerDatabaseRequest extends AdminFormRequest { /** * Validation rules for database creation. - * - * @return array */ public function rules(): array { diff --git a/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php b/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php index 728283af4..0ad24181a 100644 --- a/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php +++ b/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php @@ -30,6 +30,7 @@ class MailSettingsFormRequest extends AdminFormRequest * as we need to accept empty values on the keys. * * @param array $only + * * @return array */ public function normalize(array $only = null) diff --git a/app/Http/Requests/Api/Application/Allocations/DeleteAllocationRequest.php b/app/Http/Requests/Api/Application/Allocations/DeleteAllocationRequest.php index 21da6bfb3..9fab4e2c3 100644 --- a/app/Http/Requests/Api/Application/Allocations/DeleteAllocationRequest.php +++ b/app/Http/Requests/Api/Application/Allocations/DeleteAllocationRequest.php @@ -22,8 +22,6 @@ class DeleteAllocationRequest extends ApplicationApiRequest /** * Determine if the requested allocation exists and belongs to the node that * is being passed in the URL. - * - * @return bool */ public function resourceExists(): bool { diff --git a/app/Http/Requests/Api/Application/Allocations/GetAllocationsRequest.php b/app/Http/Requests/Api/Application/Allocations/GetAllocationsRequest.php index 150bdb95e..524e201e1 100644 --- a/app/Http/Requests/Api/Application/Allocations/GetAllocationsRequest.php +++ b/app/Http/Requests/Api/Application/Allocations/GetAllocationsRequest.php @@ -21,8 +21,6 @@ class GetAllocationsRequest extends ApplicationApiRequest /** * Determine if the node that we are requesting the allocations * for exists on the Panel. - * - * @return bool */ public function resourceExists(): bool { diff --git a/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php b/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php index 1e68b82e5..d1f5415a6 100644 --- a/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php +++ b/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php @@ -17,9 +17,6 @@ class StoreAllocationRequest extends ApplicationApiRequest */ protected $permission = AdminAcl::WRITE; - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Application/ApplicationApiRequest.php b/app/Http/Requests/Api/Application/ApplicationApiRequest.php index 133532718..11deab45b 100644 --- a/app/Http/Requests/Api/Application/ApplicationApiRequest.php +++ b/app/Http/Requests/Api/Application/ApplicationApiRequest.php @@ -40,8 +40,6 @@ abstract class ApplicationApiRequest extends FormRequest * Determine if the current user is authorized to perform * the requested action against the API. * - * @return bool - * * @throws \Pterodactyl\Exceptions\PterodactylException */ public function authorize(): bool @@ -55,8 +53,6 @@ abstract class ApplicationApiRequest extends FormRequest /** * Determine if the requested resource exists on the server. - * - * @return bool */ public function resourceExists(): bool { @@ -65,8 +61,6 @@ abstract class ApplicationApiRequest extends FormRequest /** * Default set of rules to apply to API requests. - * - * @return array */ public function rules(): array { @@ -75,8 +69,6 @@ abstract class ApplicationApiRequest extends FormRequest /** * Return the API key being used for the request. - * - * @return \Pterodactyl\Models\ApiKey */ public function key(): ApiKey { @@ -87,8 +79,8 @@ abstract class ApplicationApiRequest extends FormRequest * Grab a model from the route parameters. If no model is found in the * binding mappings an exception will be thrown. * - * @param string $model * @return mixed + * * @deprecated * * @throws \Symfony\Component\Routing\Exception\InvalidParameterException @@ -98,7 +90,7 @@ abstract class ApplicationApiRequest extends FormRequest $parameterKey = array_get(array_flip(ApiSubstituteBindings::getMappings()), $model); if (is_null($parameterKey)) { - throw new InvalidParameterException; + throw new InvalidParameterException(); } return $this->route()->parameter($parameterKey); @@ -112,7 +104,7 @@ abstract class ApplicationApiRequest extends FormRequest */ protected function prepareForValidation() { - if (! $this->passesAuthorization()) { + if (!$this->passesAuthorization()) { $this->failedAuthorization(); } @@ -137,7 +129,7 @@ abstract class ApplicationApiRequest extends FormRequest return true; } - if (! parent::passesAuthorization()) { + if (!parent::passesAuthorization()) { return false; } @@ -145,7 +137,7 @@ abstract class ApplicationApiRequest extends FormRequest // authenticated to access the endpoint. This avoids exposing that // an item exists (or does not exist) to the user until they can prove // that they have permission to know about it. - if ($this->attributes->get('is_missing_model', false) || ! $this->resourceExists()) { + if ($this->attributes->get('is_missing_model', false) || !$this->resourceExists()) { throw new NotFoundHttpException(trans('exceptions.api.resource_not_found')); } diff --git a/app/Http/Requests/Api/Application/Locations/DeleteLocationRequest.php b/app/Http/Requests/Api/Application/Locations/DeleteLocationRequest.php index d1863eea7..ac58314f9 100644 --- a/app/Http/Requests/Api/Application/Locations/DeleteLocationRequest.php +++ b/app/Http/Requests/Api/Application/Locations/DeleteLocationRequest.php @@ -20,8 +20,6 @@ class DeleteLocationRequest extends ApplicationApiRequest /** * Determine if the requested location exists on the Panel. - * - * @return bool */ public function resourceExists(): bool { diff --git a/app/Http/Requests/Api/Application/Locations/GetLocationRequest.php b/app/Http/Requests/Api/Application/Locations/GetLocationRequest.php index d49fb266f..f7c10e0c0 100644 --- a/app/Http/Requests/Api/Application/Locations/GetLocationRequest.php +++ b/app/Http/Requests/Api/Application/Locations/GetLocationRequest.php @@ -8,8 +8,6 @@ class GetLocationRequest extends GetLocationsRequest { /** * Determine if the requested location exists on the Panel. - * - * @return bool */ public function resourceExists(): bool { diff --git a/app/Http/Requests/Api/Application/Locations/StoreLocationRequest.php b/app/Http/Requests/Api/Application/Locations/StoreLocationRequest.php index a02a38cac..c5586ead1 100644 --- a/app/Http/Requests/Api/Application/Locations/StoreLocationRequest.php +++ b/app/Http/Requests/Api/Application/Locations/StoreLocationRequest.php @@ -20,8 +20,6 @@ class StoreLocationRequest extends ApplicationApiRequest /** * Rules to validate the request against. - * - * @return array */ public function rules(): array { diff --git a/app/Http/Requests/Api/Application/Locations/UpdateLocationRequest.php b/app/Http/Requests/Api/Application/Locations/UpdateLocationRequest.php index 0877fa454..c775e2b1b 100644 --- a/app/Http/Requests/Api/Application/Locations/UpdateLocationRequest.php +++ b/app/Http/Requests/Api/Application/Locations/UpdateLocationRequest.php @@ -8,8 +8,6 @@ class UpdateLocationRequest extends StoreLocationRequest { /** * Determine if the requested location exists on the Panel. - * - * @return bool */ public function resourceExists(): bool { @@ -20,8 +18,6 @@ class UpdateLocationRequest extends StoreLocationRequest /** * Rules to validate this request against. - * - * @return array */ public function rules(): array { diff --git a/app/Http/Requests/Api/Application/Nests/Eggs/GetEggRequest.php b/app/Http/Requests/Api/Application/Nests/Eggs/GetEggRequest.php index fb364d1ae..80304ab27 100644 --- a/app/Http/Requests/Api/Application/Nests/Eggs/GetEggRequest.php +++ b/app/Http/Requests/Api/Application/Nests/Eggs/GetEggRequest.php @@ -21,8 +21,6 @@ class GetEggRequest extends ApplicationApiRequest /** * Determine if the requested egg exists for the selected nest. - * - * @return bool */ public function resourceExists(): bool { diff --git a/app/Http/Requests/Api/Application/Nodes/DeleteNodeRequest.php b/app/Http/Requests/Api/Application/Nodes/DeleteNodeRequest.php index 77dd24eac..eb1d1d9a5 100644 --- a/app/Http/Requests/Api/Application/Nodes/DeleteNodeRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/DeleteNodeRequest.php @@ -21,8 +21,6 @@ class DeleteNodeRequest extends ApplicationApiRequest /** * Determine if the node being requested for editing exists * on the Panel before validating the data. - * - * @return bool */ public function resourceExists(): bool { diff --git a/app/Http/Requests/Api/Application/Nodes/GetNodeRequest.php b/app/Http/Requests/Api/Application/Nodes/GetNodeRequest.php index fbf957edd..bbb157035 100644 --- a/app/Http/Requests/Api/Application/Nodes/GetNodeRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/GetNodeRequest.php @@ -8,8 +8,6 @@ class GetNodeRequest extends GetNodesRequest { /** * Determine if the requested node exists on the Panel. - * - * @return bool */ public function resourceExists(): bool { diff --git a/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php b/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php index 8e23db439..8c05c5a37 100644 --- a/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php @@ -20,9 +20,6 @@ class StoreNodeRequest extends ApplicationApiRequest /** * Validation rules to apply to this request. - * - * @param array|null $rules - * @return array */ public function rules(array $rules = null): array { @@ -74,7 +71,7 @@ class StoreNodeRequest extends ApplicationApiRequest $response = parent::validated(); $response['daemonListen'] = $response['daemon_listen']; $response['daemonSFTP'] = $response['daemon_sftp']; - $response['daemonBase'] = $response['daemon_base'] ?? (new Node)->getAttribute('daemonBase'); + $response['daemonBase'] = $response['daemon_base'] ?? (new Node())->getAttribute('daemonBase'); unset($response['daemon_base'], $response['daemon_listen'], $response['daemon_sftp']); diff --git a/app/Http/Requests/Api/Application/Nodes/UpdateNodeRequest.php b/app/Http/Requests/Api/Application/Nodes/UpdateNodeRequest.php index bf228049f..2da2d4061 100644 --- a/app/Http/Requests/Api/Application/Nodes/UpdateNodeRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/UpdateNodeRequest.php @@ -9,9 +9,6 @@ class UpdateNodeRequest extends StoreNodeRequest /** * Apply validation rules to this request. Uses the parent class rules() * function but passes in the rules for updating rather than creating. - * - * @param array|null $rules - * @return array */ public function rules(array $rules = null): array { diff --git a/app/Http/Requests/Api/Application/Servers/Databases/GetServerDatabaseRequest.php b/app/Http/Requests/Api/Application/Servers/Databases/GetServerDatabaseRequest.php index e398a5bbf..2dff1374e 100644 --- a/app/Http/Requests/Api/Application/Servers/Databases/GetServerDatabaseRequest.php +++ b/app/Http/Requests/Api/Application/Servers/Databases/GetServerDatabaseRequest.php @@ -19,8 +19,6 @@ class GetServerDatabaseRequest extends ApplicationApiRequest /** * Determine if the requested server database exists. - * - * @return bool */ public function resourceExists(): bool { diff --git a/app/Http/Requests/Api/Application/Servers/Databases/StoreServerDatabaseRequest.php b/app/Http/Requests/Api/Application/Servers/Databases/StoreServerDatabaseRequest.php index 4ca019410..c37de870d 100644 --- a/app/Http/Requests/Api/Application/Servers/Databases/StoreServerDatabaseRequest.php +++ b/app/Http/Requests/Api/Application/Servers/Databases/StoreServerDatabaseRequest.php @@ -24,8 +24,6 @@ class StoreServerDatabaseRequest extends ApplicationApiRequest /** * Validation rules for database creation. - * - * @return array */ public function rules(): array { @@ -76,8 +74,6 @@ class StoreServerDatabaseRequest extends ApplicationApiRequest /** * Returns the database name in the expected format. - * - * @return string */ public function databaseName(): string { diff --git a/app/Http/Requests/Api/Application/Servers/GetExternalServerRequest.php b/app/Http/Requests/Api/Application/Servers/GetExternalServerRequest.php index f783dc715..902bc60c5 100644 --- a/app/Http/Requests/Api/Application/Servers/GetExternalServerRequest.php +++ b/app/Http/Requests/Api/Application/Servers/GetExternalServerRequest.php @@ -27,8 +27,6 @@ class GetExternalServerRequest extends ApplicationApiRequest /** * Determine if the requested external user exists. - * - * @return bool */ public function resourceExists(): bool { @@ -47,8 +45,6 @@ class GetExternalServerRequest extends ApplicationApiRequest /** * Return the server model for the requested external server. - * - * @return \Pterodactyl\Models\Server */ public function getServerModel(): Server { diff --git a/app/Http/Requests/Api/Application/Servers/GetServersRequest.php b/app/Http/Requests/Api/Application/Servers/GetServersRequest.php index 8a0a30535..ece977662 100644 --- a/app/Http/Requests/Api/Application/Servers/GetServersRequest.php +++ b/app/Http/Requests/Api/Application/Servers/GetServersRequest.php @@ -4,9 +4,6 @@ namespace Pterodactyl\Http\Requests\Api\Application\Servers; class GetServersRequest extends GetServerRequest { - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Application/Servers/StoreServerRequest.php b/app/Http/Requests/Api/Application/Servers/StoreServerRequest.php index 5e4f9c200..dd24e1efc 100644 --- a/app/Http/Requests/Api/Application/Servers/StoreServerRequest.php +++ b/app/Http/Requests/Api/Application/Servers/StoreServerRequest.php @@ -23,8 +23,6 @@ class StoreServerRequest extends ApplicationApiRequest /** * Rules to be applied to this request. - * - * @return array */ public function rules(): array { @@ -120,7 +118,7 @@ class StoreServerRequest extends ApplicationApiRequest $query->whereNull('server_id'); }), ], function ($input) { - return ! ($input->deploy); + return !($input->deploy); }); $validator->sometimes('allocation.additional.*', [ @@ -129,7 +127,7 @@ class StoreServerRequest extends ApplicationApiRequest $query->whereNull('server_id'); }), ], function ($input) { - return ! ($input->deploy); + return !($input->deploy); }); $validator->sometimes('deploy.locations', 'present', function ($input) { @@ -152,7 +150,7 @@ class StoreServerRequest extends ApplicationApiRequest return null; } - $object = new DeploymentObject; + $object = new DeploymentObject(); $object->setDedicated($this->input('deploy.dedicated_ip', false)); $object->setLocations($this->input('deploy.locations', [])); $object->setPorts($this->input('deploy.port_range', [])); diff --git a/app/Http/Requests/Api/Application/Servers/UpdateServerBuildConfigurationRequest.php b/app/Http/Requests/Api/Application/Servers/UpdateServerBuildConfigurationRequest.php index a387634c1..3f534b08a 100644 --- a/app/Http/Requests/Api/Application/Servers/UpdateServerBuildConfigurationRequest.php +++ b/app/Http/Requests/Api/Application/Servers/UpdateServerBuildConfigurationRequest.php @@ -9,8 +9,6 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest { /** * Return the rules to validate this request against. - * - * @return array */ public function rules(): array { @@ -67,7 +65,7 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest unset($data['allocation'], $data['feature_limits']); // Adjust the limits field to match what is expected by the model. - if (! empty($data['limits'])) { + if (!empty($data['limits'])) { foreach ($data['limits'] as $key => $value) { $data[$key] = $value; } @@ -101,16 +99,13 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest * compatability with the old API endpoint while also supporting a more correct API * call. * - * @param string $field - * @param array $rules - * @param bool $limits * @return array * * @see https://github.com/pterodactyl/panel/issues/1500 */ protected function requiredToOptional(string $field, array $rules, bool $limits = false) { - if (! in_array('required', $rules)) { + if (!in_array('required', $rules)) { return $rules; } diff --git a/app/Http/Requests/Api/Application/Servers/UpdateServerDetailsRequest.php b/app/Http/Requests/Api/Application/Servers/UpdateServerDetailsRequest.php index 172dd1e31..06bd22f5f 100644 --- a/app/Http/Requests/Api/Application/Servers/UpdateServerDetailsRequest.php +++ b/app/Http/Requests/Api/Application/Servers/UpdateServerDetailsRequest.php @@ -8,8 +8,6 @@ class UpdateServerDetailsRequest extends ServerWriteRequest { /** * Rules to apply to a server details update request. - * - * @return array */ public function rules(): array { @@ -26,8 +24,6 @@ class UpdateServerDetailsRequest extends ServerWriteRequest /** * Convert the posted data into the correct format that is expected * by the application. - * - * @return array */ public function validated(): array { @@ -42,8 +38,6 @@ class UpdateServerDetailsRequest extends ServerWriteRequest /** * Rename some of the attributes in error messages to clarify the field * being discussed. - * - * @return array */ public function attributes(): array { diff --git a/app/Http/Requests/Api/Application/Servers/UpdateServerStartupRequest.php b/app/Http/Requests/Api/Application/Servers/UpdateServerStartupRequest.php index fc367cdaf..a873e0198 100644 --- a/app/Http/Requests/Api/Application/Servers/UpdateServerStartupRequest.php +++ b/app/Http/Requests/Api/Application/Servers/UpdateServerStartupRequest.php @@ -20,8 +20,6 @@ class UpdateServerStartupRequest extends ApplicationApiRequest /** * Validation rules to run the input against. - * - * @return array */ public function rules(): array { diff --git a/app/Http/Requests/Api/Application/Users/DeleteUserRequest.php b/app/Http/Requests/Api/Application/Users/DeleteUserRequest.php index 571b29c63..56c028a6e 100644 --- a/app/Http/Requests/Api/Application/Users/DeleteUserRequest.php +++ b/app/Http/Requests/Api/Application/Users/DeleteUserRequest.php @@ -20,8 +20,6 @@ class DeleteUserRequest extends ApplicationApiRequest /** * Determine if the requested user exists on the Panel. - * - * @return bool */ public function resourceExists(): bool { diff --git a/app/Http/Requests/Api/Application/Users/GetExternalUserRequest.php b/app/Http/Requests/Api/Application/Users/GetExternalUserRequest.php index 4ad98c0fc..5f63d04ba 100644 --- a/app/Http/Requests/Api/Application/Users/GetExternalUserRequest.php +++ b/app/Http/Requests/Api/Application/Users/GetExternalUserRequest.php @@ -27,8 +27,6 @@ class GetExternalUserRequest extends ApplicationApiRequest /** * Determine if the requested external user exists. - * - * @return bool */ public function resourceExists(): bool { @@ -47,8 +45,6 @@ class GetExternalUserRequest extends ApplicationApiRequest /** * Return the user model for the requested external user. - * - * @return \Pterodactyl\Models\User */ public function getUserModel(): User { diff --git a/app/Http/Requests/Api/Application/Users/StoreUserRequest.php b/app/Http/Requests/Api/Application/Users/StoreUserRequest.php index 9cddad7e0..10a2d6b28 100644 --- a/app/Http/Requests/Api/Application/Users/StoreUserRequest.php +++ b/app/Http/Requests/Api/Application/Users/StoreUserRequest.php @@ -20,9 +20,6 @@ class StoreUserRequest extends ApplicationApiRequest /** * Return the validation rules for this request. - * - * @param array|null $rules - * @return array */ public function rules(array $rules = null): array { diff --git a/app/Http/Requests/Api/Application/Users/UpdateUserRequest.php b/app/Http/Requests/Api/Application/Users/UpdateUserRequest.php index ce38348d8..b341eaa24 100644 --- a/app/Http/Requests/Api/Application/Users/UpdateUserRequest.php +++ b/app/Http/Requests/Api/Application/Users/UpdateUserRequest.php @@ -8,9 +8,6 @@ class UpdateUserRequest extends StoreUserRequest { /** * Return the validation rules for this request. - * - * @param array|null $rules - * @return array */ public function rules(array $rules = null): array { diff --git a/app/Http/Requests/Api/Client/Account/StoreApiKeyRequest.php b/app/Http/Requests/Api/Client/Account/StoreApiKeyRequest.php index 1a2632862..c2a21c4c0 100644 --- a/app/Http/Requests/Api/Client/Account/StoreApiKeyRequest.php +++ b/app/Http/Requests/Api/Client/Account/StoreApiKeyRequest.php @@ -7,9 +7,6 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class StoreApiKeyRequest extends ClientApiRequest { - /** - * @return array - */ public function rules(): array { $rules = ApiKey::getRules(); diff --git a/app/Http/Requests/Api/Client/Account/UpdateEmailRequest.php b/app/Http/Requests/Api/Client/Account/UpdateEmailRequest.php index c9936508c..193d2fd70 100644 --- a/app/Http/Requests/Api/Client/Account/UpdateEmailRequest.php +++ b/app/Http/Requests/Api/Client/Account/UpdateEmailRequest.php @@ -9,27 +9,22 @@ use Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException; class UpdateEmailRequest extends ClientApiRequest { /** - * @return bool - * * @throws \Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException */ public function authorize(): bool { - if (! parent::authorize()) { + if (!parent::authorize()) { return false; } // Verify password matches when changing password or email. - if (! password_verify($this->input('password'), $this->user()->password)) { + if (!password_verify($this->input('password'), $this->user()->password)) { throw new InvalidPasswordProvidedException(trans('validation.internal.invalid_password')); } return true; } - /** - * @return array - */ public function rules(): array { $rules = User::getRulesForUpdate($this->user()); diff --git a/app/Http/Requests/Api/Client/Account/UpdatePasswordRequest.php b/app/Http/Requests/Api/Client/Account/UpdatePasswordRequest.php index 3bbff3d48..c0e27bdb5 100644 --- a/app/Http/Requests/Api/Client/Account/UpdatePasswordRequest.php +++ b/app/Http/Requests/Api/Client/Account/UpdatePasswordRequest.php @@ -8,27 +8,22 @@ use Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException; class UpdatePasswordRequest extends ClientApiRequest { /** - * @return bool - * * @throws \Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException */ public function authorize(): bool { - if (! parent::authorize()) { + if (!parent::authorize()) { return false; } // Verify password matches when changing password or email. - if (! password_verify($this->input('current_password'), $this->user()->password)) { + if (!password_verify($this->input('current_password'), $this->user()->password)) { throw new InvalidPasswordProvidedException(trans('validation.internal.invalid_password')); } return true; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/ClientApiRequest.php b/app/Http/Requests/Api/Client/ClientApiRequest.php index 465d5a48d..5ae1680a4 100644 --- a/app/Http/Requests/Api/Client/ClientApiRequest.php +++ b/app/Http/Requests/Api/Client/ClientApiRequest.php @@ -13,8 +13,6 @@ class ClientApiRequest extends ApplicationApiRequest { /** * Determine if the current user is authorized to perform the requested action against the API. - * - * @return bool */ public function authorize(): bool { diff --git a/app/Http/Requests/Api/Client/GetServersRequest.php b/app/Http/Requests/Api/Client/GetServersRequest.php index 9b4601f25..28b4c2ded 100644 --- a/app/Http/Requests/Api/Client/GetServersRequest.php +++ b/app/Http/Requests/Api/Client/GetServersRequest.php @@ -4,9 +4,6 @@ namespace Pterodactyl\Http\Requests\Api\Client; class GetServersRequest extends ClientApiRequest { - /** - * @return bool - */ public function authorize(): bool { return true; diff --git a/app/Http/Requests/Api/Client/Servers/Backups/StoreBackupRequest.php b/app/Http/Requests/Api/Client/Servers/Backups/StoreBackupRequest.php index 4ca892155..538588ab0 100644 --- a/app/Http/Requests/Api/Client/Servers/Backups/StoreBackupRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Backups/StoreBackupRequest.php @@ -15,9 +15,6 @@ class StoreBackupRequest extends ClientApiRequest return Permission::ACTION_BACKUP_CREATE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Databases/DeleteDatabaseRequest.php b/app/Http/Requests/Api/Client/Servers/Databases/DeleteDatabaseRequest.php index c2161680a..92b14157a 100644 --- a/app/Http/Requests/Api/Client/Servers/Databases/DeleteDatabaseRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Databases/DeleteDatabaseRequest.php @@ -10,17 +10,11 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class DeleteDatabaseRequest extends ClientApiRequest implements ClientPermissionsRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_DATABASE_DELETE; } - /** - * @return bool - */ public function resourceExists(): bool { return $this->getModel(Server::class)->id === $this->getModel(Database::class)->server_id; diff --git a/app/Http/Requests/Api/Client/Servers/Databases/GetDatabasesRequest.php b/app/Http/Requests/Api/Client/Servers/Databases/GetDatabasesRequest.php index be78b5ebb..80eabf945 100644 --- a/app/Http/Requests/Api/Client/Servers/Databases/GetDatabasesRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Databases/GetDatabasesRequest.php @@ -8,9 +8,6 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class GetDatabasesRequest extends ClientApiRequest implements ClientPermissionsRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_DATABASE_READ; diff --git a/app/Http/Requests/Api/Client/Servers/Databases/RotatePasswordRequest.php b/app/Http/Requests/Api/Client/Servers/Databases/RotatePasswordRequest.php index 7869cbf35..b2a9163ad 100644 --- a/app/Http/Requests/Api/Client/Servers/Databases/RotatePasswordRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Databases/RotatePasswordRequest.php @@ -9,8 +9,6 @@ class RotatePasswordRequest extends ClientApiRequest { /** * Check that the user has permission to rotate the password. - * - * @return string */ public function permission(): string { diff --git a/app/Http/Requests/Api/Client/Servers/Databases/StoreDatabaseRequest.php b/app/Http/Requests/Api/Client/Servers/Databases/StoreDatabaseRequest.php index 42bc8587c..b8f12bd8a 100644 --- a/app/Http/Requests/Api/Client/Servers/Databases/StoreDatabaseRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Databases/StoreDatabaseRequest.php @@ -13,17 +13,11 @@ use Pterodactyl\Services\Databases\DatabaseManagementService; class StoreDatabaseRequest extends ClientApiRequest implements ClientPermissionsRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_DATABASE_CREATE; } - /** - * @return array - */ public function rules(): array { $server = $this->route()->parameter('server'); diff --git a/app/Http/Requests/Api/Client/Servers/Files/ChmodFilesRequest.php b/app/Http/Requests/Api/Client/Servers/Files/ChmodFilesRequest.php index 158a0a7fd..bf94cb6ba 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/ChmodFilesRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/ChmodFilesRequest.php @@ -8,17 +8,11 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class ChmodFilesRequest extends ClientApiRequest implements ClientPermissionsRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_FILE_UPDATE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Files/CompressFilesRequest.php b/app/Http/Requests/Api/Client/Servers/Files/CompressFilesRequest.php index bd574cf5b..3d6e96aac 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/CompressFilesRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/CompressFilesRequest.php @@ -9,17 +9,12 @@ class CompressFilesRequest extends ClientApiRequest { /** * Checks that the authenticated user is allowed to create archives for this server. - * - * @return string */ public function permission(): string { return Permission::ACTION_FILE_ARCHIVE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Files/CopyFileRequest.php b/app/Http/Requests/Api/Client/Servers/Files/CopyFileRequest.php index 97bfc3fba..686c23a23 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/CopyFileRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/CopyFileRequest.php @@ -8,17 +8,11 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class CopyFileRequest extends ClientApiRequest implements ClientPermissionsRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_FILE_CREATE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Files/CreateFolderRequest.php b/app/Http/Requests/Api/Client/Servers/Files/CreateFolderRequest.php index 10457ffea..e4655575d 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/CreateFolderRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/CreateFolderRequest.php @@ -9,17 +9,12 @@ class CreateFolderRequest extends ClientApiRequest { /** * Checks that the authenticated user is allowed to create files on the server. - * - * @return string */ public function permission(): string { return Permission::ACTION_FILE_CREATE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Files/DecompressFilesRequest.php b/app/Http/Requests/Api/Client/Servers/Files/DecompressFilesRequest.php index f8493ec4a..6e24682e4 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/DecompressFilesRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/DecompressFilesRequest.php @@ -11,17 +11,12 @@ class DecompressFilesRequest extends ClientApiRequest * Checks that the authenticated user is allowed to create new files for the server. We don't * rely on the archive permission here as it makes more sense to make sure the user can create * additional files rather than make an archive. - * - * @return string */ public function permission(): string { return Permission::ACTION_FILE_CREATE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Files/DeleteFileRequest.php b/app/Http/Requests/Api/Client/Servers/Files/DeleteFileRequest.php index 7f5ccbf72..10db32811 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/DeleteFileRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/DeleteFileRequest.php @@ -8,17 +8,11 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class DeleteFileRequest extends ClientApiRequest implements ClientPermissionsRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_FILE_DELETE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Files/DownloadFileRequest.php b/app/Http/Requests/Api/Client/Servers/Files/DownloadFileRequest.php index 0eb9791c8..0386b8555 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/DownloadFileRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/DownloadFileRequest.php @@ -10,8 +10,6 @@ class DownloadFileRequest extends ClientApiRequest /** * Ensure that the user making this request has permission to download files * from this server. - * - * @return bool */ public function authorize(): bool { diff --git a/app/Http/Requests/Api/Client/Servers/Files/GetFileContentsRequest.php b/app/Http/Requests/Api/Client/Servers/Files/GetFileContentsRequest.php index 008b44436..ea6ed7b69 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/GetFileContentsRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/GetFileContentsRequest.php @@ -12,17 +12,12 @@ class GetFileContentsRequest extends ClientApiRequest implements ClientPermissio * 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 { return Permission::ACTION_FILE_READ_CONTENT; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Files/ListFilesRequest.php b/app/Http/Requests/Api/Client/Servers/Files/ListFilesRequest.php index 4f71648c6..cc66d69b8 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/ListFilesRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/ListFilesRequest.php @@ -10,17 +10,12 @@ class ListFilesRequest extends ClientApiRequest /** * Check that the user making this request to the API is authorized to list all * of the files that exist for a given server. - * - * @return string */ public function permission(): string { return Permission::ACTION_FILE_READ; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Files/PullFileRequest.php b/app/Http/Requests/Api/Client/Servers/Files/PullFileRequest.php index 02a2fd376..ad3d57897 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/PullFileRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/PullFileRequest.php @@ -8,9 +8,6 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class PullFileRequest extends ClientApiRequest implements ClientPermissionsRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_FILE_CREATE; diff --git a/app/Http/Requests/Api/Client/Servers/Files/RenameFileRequest.php b/app/Http/Requests/Api/Client/Servers/Files/RenameFileRequest.php index c8529a35e..61c4a0c5f 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/RenameFileRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/RenameFileRequest.php @@ -11,17 +11,12 @@ class RenameFileRequest extends ClientApiRequest implements ClientPermissionsReq /** * The permission the user is required to have in order to perform this * request action. - * - * @return string */ public function permission(): string { return Permission::ACTION_FILE_UPDATE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Files/WriteFileContentRequest.php b/app/Http/Requests/Api/Client/Servers/Files/WriteFileContentRequest.php index d5db8c241..82a994c36 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/WriteFileContentRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/WriteFileContentRequest.php @@ -12,8 +12,6 @@ class WriteFileContentRequest extends ClientApiRequest implements ClientPermissi * 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 { @@ -24,8 +22,6 @@ class WriteFileContentRequest extends ClientApiRequest implements ClientPermissi * There is no rule here for the file contents since we just use the body content * on the request to set the file contents. If nothing is passed that is fine since * it just means we want to set the file to be empty. - * - * @return array */ public function rules(): array { diff --git a/app/Http/Requests/Api/Client/Servers/GetServerRequest.php b/app/Http/Requests/Api/Client/Servers/GetServerRequest.php index b69203fc1..3798d77ab 100644 --- a/app/Http/Requests/Api/Client/Servers/GetServerRequest.php +++ b/app/Http/Requests/Api/Client/Servers/GetServerRequest.php @@ -10,8 +10,6 @@ class GetServerRequest extends ClientApiRequest * Determine if a client has permission to view this server on the API. This * should never be false since this would be checking the same permission as * resourceExists(). - * - * @return bool */ public function authorize(): bool { diff --git a/app/Http/Requests/Api/Client/Servers/Network/DeleteAllocationRequest.php b/app/Http/Requests/Api/Client/Servers/Network/DeleteAllocationRequest.php index 9c0d911f0..b7f6ca7b2 100644 --- a/app/Http/Requests/Api/Client/Servers/Network/DeleteAllocationRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Network/DeleteAllocationRequest.php @@ -7,9 +7,6 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class DeleteAllocationRequest extends ClientApiRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_ALLOCATION_DELETE; diff --git a/app/Http/Requests/Api/Client/Servers/Network/GetNetworkRequest.php b/app/Http/Requests/Api/Client/Servers/Network/GetNetworkRequest.php index bf737de72..7304bbd97 100644 --- a/app/Http/Requests/Api/Client/Servers/Network/GetNetworkRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Network/GetNetworkRequest.php @@ -10,8 +10,6 @@ class GetNetworkRequest extends ClientApiRequest /** * Check that the user has permission to view the allocations for * this server. - * - * @return string */ public function permission(): string { diff --git a/app/Http/Requests/Api/Client/Servers/Network/NewAllocationRequest.php b/app/Http/Requests/Api/Client/Servers/Network/NewAllocationRequest.php index 4a29378dd..e6fc19b3f 100644 --- a/app/Http/Requests/Api/Client/Servers/Network/NewAllocationRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Network/NewAllocationRequest.php @@ -7,9 +7,6 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class NewAllocationRequest extends ClientApiRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_ALLOCATION_CREATE; diff --git a/app/Http/Requests/Api/Client/Servers/Network/SetPrimaryAllocationRequest.php b/app/Http/Requests/Api/Client/Servers/Network/SetPrimaryAllocationRequest.php index f698f18ee..30186d731 100644 --- a/app/Http/Requests/Api/Client/Servers/Network/SetPrimaryAllocationRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Network/SetPrimaryAllocationRequest.php @@ -4,9 +4,6 @@ namespace Pterodactyl\Http\Requests\Api\Client\Servers\Network; class SetPrimaryAllocationRequest extends UpdateAllocationRequest { - /** - * @return array - */ public function rules(): array { return []; diff --git a/app/Http/Requests/Api/Client/Servers/Network/UpdateAllocationRequest.php b/app/Http/Requests/Api/Client/Servers/Network/UpdateAllocationRequest.php index 766a66b78..570a8df98 100644 --- a/app/Http/Requests/Api/Client/Servers/Network/UpdateAllocationRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Network/UpdateAllocationRequest.php @@ -8,17 +8,11 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class UpdateAllocationRequest extends ClientApiRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_ALLOCATION_UPDATE; } - /** - * @return array - */ public function rules(): array { $rules = Allocation::getRules(); diff --git a/app/Http/Requests/Api/Client/Servers/Schedules/DeleteScheduleRequest.php b/app/Http/Requests/Api/Client/Servers/Schedules/DeleteScheduleRequest.php index 8ecc7af0e..19d972265 100644 --- a/app/Http/Requests/Api/Client/Servers/Schedules/DeleteScheduleRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Schedules/DeleteScheduleRequest.php @@ -6,9 +6,6 @@ use Pterodactyl\Models\Permission; class DeleteScheduleRequest extends ViewScheduleRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_SCHEDULE_DELETE; diff --git a/app/Http/Requests/Api/Client/Servers/Schedules/StoreScheduleRequest.php b/app/Http/Requests/Api/Client/Servers/Schedules/StoreScheduleRequest.php index a8dfbc3a4..771407f10 100644 --- a/app/Http/Requests/Api/Client/Servers/Schedules/StoreScheduleRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Schedules/StoreScheduleRequest.php @@ -7,17 +7,11 @@ use Pterodactyl\Models\Permission; class StoreScheduleRequest extends ViewScheduleRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_SCHEDULE_CREATE; } - /** - * @return array - */ public function rules(): array { $rules = Schedule::getRules(); diff --git a/app/Http/Requests/Api/Client/Servers/Schedules/StoreTaskRequest.php b/app/Http/Requests/Api/Client/Servers/Schedules/StoreTaskRequest.php index cd95bf5e8..811b87dfb 100644 --- a/app/Http/Requests/Api/Client/Servers/Schedules/StoreTaskRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Schedules/StoreTaskRequest.php @@ -10,17 +10,12 @@ class StoreTaskRequest extends ViewScheduleRequest * Determine if the user is allowed to create a new task for this schedule. We simply * check if they can modify a schedule to determine if they're able to do this. There * are no task specific permissions. - * - * @return string */ public function permission(): string { return Permission::ACTION_SCHEDULE_UPDATE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Schedules/TriggerScheduleRequest.php b/app/Http/Requests/Api/Client/Servers/Schedules/TriggerScheduleRequest.php index d89f5ed30..216274acf 100644 --- a/app/Http/Requests/Api/Client/Servers/Schedules/TriggerScheduleRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Schedules/TriggerScheduleRequest.php @@ -7,17 +7,11 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class TriggerScheduleRequest extends ClientApiRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_SCHEDULE_UPDATE; } - /** - * @return array - */ public function rules(): array { return []; diff --git a/app/Http/Requests/Api/Client/Servers/Schedules/UpdateScheduleRequest.php b/app/Http/Requests/Api/Client/Servers/Schedules/UpdateScheduleRequest.php index 844388e29..4b9fe431b 100644 --- a/app/Http/Requests/Api/Client/Servers/Schedules/UpdateScheduleRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Schedules/UpdateScheduleRequest.php @@ -6,9 +6,6 @@ use Pterodactyl\Models\Permission; class UpdateScheduleRequest extends StoreScheduleRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_SCHEDULE_UPDATE; diff --git a/app/Http/Requests/Api/Client/Servers/Schedules/ViewScheduleRequest.php b/app/Http/Requests/Api/Client/Servers/Schedules/ViewScheduleRequest.php index f57afef69..72674a354 100644 --- a/app/Http/Requests/Api/Client/Servers/Schedules/ViewScheduleRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Schedules/ViewScheduleRequest.php @@ -13,12 +13,10 @@ class ViewScheduleRequest extends ClientApiRequest { /** * Determine if this resource can be viewed. - * - * @return bool */ public function authorize(): bool { - if (! parent::authorize()) { + if (!parent::authorize()) { return false; } @@ -31,18 +29,13 @@ class ViewScheduleRequest extends ClientApiRequest $task = $this->route()->parameter('task'); if ($schedule->server_id !== $server->id || ($task instanceof Task && $task->schedule_id !== $schedule->id)) { - throw new NotFoundHttpException( - 'The requested resource does not exist on the system.' - ); + throw new NotFoundHttpException('The requested resource does not exist on the system.'); } } return true; } - /** - * @return string - */ public function permission(): string { return Permission::ACTION_SCHEDULE_READ; diff --git a/app/Http/Requests/Api/Client/Servers/SendCommandRequest.php b/app/Http/Requests/Api/Client/Servers/SendCommandRequest.php index 3f2f6c196..171cd19d9 100644 --- a/app/Http/Requests/Api/Client/Servers/SendCommandRequest.php +++ b/app/Http/Requests/Api/Client/Servers/SendCommandRequest.php @@ -9,8 +9,6 @@ class SendCommandRequest extends ClientApiRequest { /** * Determine if the API user has permission to perform this action. - * - * @return string */ public function permission(): string { @@ -19,8 +17,6 @@ class SendCommandRequest extends ClientApiRequest /** * Rules to validate this request against. - * - * @return array */ public function rules(): array { diff --git a/app/Http/Requests/Api/Client/Servers/SendPowerRequest.php b/app/Http/Requests/Api/Client/Servers/SendPowerRequest.php index ea7e00fcc..e071388cf 100644 --- a/app/Http/Requests/Api/Client/Servers/SendPowerRequest.php +++ b/app/Http/Requests/Api/Client/Servers/SendPowerRequest.php @@ -9,8 +9,6 @@ class SendPowerRequest extends ClientApiRequest { /** * Determine if the user has permission to send a power command to a server. - * - * @return string */ public function permission(): string { @@ -29,8 +27,6 @@ class SendPowerRequest extends ClientApiRequest /** * Rules to validate this request against. - * - * @return array */ public function rules(): array { diff --git a/app/Http/Requests/Api/Client/Servers/Settings/RenameServerRequest.php b/app/Http/Requests/Api/Client/Servers/Settings/RenameServerRequest.php index 14b117211..8cb5efa35 100644 --- a/app/Http/Requests/Api/Client/Servers/Settings/RenameServerRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Settings/RenameServerRequest.php @@ -13,8 +13,6 @@ class RenameServerRequest extends ClientApiRequest implements ClientPermissionsR * 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 { @@ -23,8 +21,6 @@ class RenameServerRequest extends ClientApiRequest implements ClientPermissionsR /** * The rules to apply when validating this request. - * - * @return array */ public function rules(): array { diff --git a/app/Http/Requests/Api/Client/Servers/Settings/SetDockerImageRequest.php b/app/Http/Requests/Api/Client/Servers/Settings/SetDockerImageRequest.php index be0b7213a..bd3a1e65f 100644 --- a/app/Http/Requests/Api/Client/Servers/Settings/SetDockerImageRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Settings/SetDockerImageRequest.php @@ -11,9 +11,6 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class SetDockerImageRequest extends ClientApiRequest implements ClientPermissionsRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_STARTUP_DOCKER_IMAGE; diff --git a/app/Http/Requests/Api/Client/Servers/Subusers/GetSubuserRequest.php b/app/Http/Requests/Api/Client/Servers/Subusers/GetSubuserRequest.php index 3affcbacb..ee43e0d62 100644 --- a/app/Http/Requests/Api/Client/Servers/Subusers/GetSubuserRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Subusers/GetSubuserRequest.php @@ -8,8 +8,6 @@ class GetSubuserRequest extends SubuserRequest { /** * Confirm that a user is able to view subusers for the specified server. - * - * @return string */ public function permission(): string { diff --git a/app/Http/Requests/Api/Client/Servers/Subusers/StoreSubuserRequest.php b/app/Http/Requests/Api/Client/Servers/Subusers/StoreSubuserRequest.php index 0848770f9..5bc93ab2f 100644 --- a/app/Http/Requests/Api/Client/Servers/Subusers/StoreSubuserRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Subusers/StoreSubuserRequest.php @@ -14,9 +14,6 @@ class StoreSubuserRequest extends SubuserRequest return Permission::ACTION_USER_CREATE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php b/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php index 98d0d9643..5a20084d3 100644 --- a/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php @@ -18,13 +18,11 @@ abstract class SubuserRequest extends ClientApiRequest /** * Authorize the request and ensure that a user is not trying to modify themselves. * - * @return bool - * * @throws \Illuminate\Contracts\Container\BindingResolutionException */ public function authorize(): bool { - if (! parent::authorize()) { + if (!parent::authorize()) { return false; } @@ -51,8 +49,6 @@ abstract class SubuserRequest extends ClientApiRequest * Validates that the permissions we are trying to assign can actually be assigned * by the user making the request. * - * @param array $permissions - * * @throws \Illuminate\Contracts\Container\BindingResolutionException */ protected function validatePermissionsCanBeAssigned(array $permissions) @@ -74,9 +70,7 @@ abstract class SubuserRequest extends ClientApiRequest $service = $this->container->make(GetUserPermissionsService::class); if (count(array_diff($permissions, $service->handle($server, $user))) > 0) { - throw new HttpForbiddenException( - 'Cannot assign permissions to a subuser that your account does not actively possess.' - ); + throw new HttpForbiddenException('Cannot assign permissions to a subuser that your account does not actively possess.'); } } } diff --git a/app/Http/Requests/Api/Client/Servers/Subusers/UpdateSubuserRequest.php b/app/Http/Requests/Api/Client/Servers/Subusers/UpdateSubuserRequest.php index 3a84a0278..997b2daee 100644 --- a/app/Http/Requests/Api/Client/Servers/Subusers/UpdateSubuserRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Subusers/UpdateSubuserRequest.php @@ -14,9 +14,6 @@ class UpdateSubuserRequest extends SubuserRequest return Permission::ACTION_USER_UPDATE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Auth/LoginCheckpointRequest.php b/app/Http/Requests/Auth/LoginCheckpointRequest.php index 87d84ce97..3c9392a63 100644 --- a/app/Http/Requests/Auth/LoginCheckpointRequest.php +++ b/app/Http/Requests/Auth/LoginCheckpointRequest.php @@ -9,8 +9,6 @@ class LoginCheckpointRequest extends FormRequest { /** * Determine if the request is authorized. - * - * @return bool */ public function authorize(): bool { @@ -19,8 +17,6 @@ class LoginCheckpointRequest extends FormRequest /** * Rules to apply to the request. - * - * @return array */ public function rules(): array { diff --git a/app/Http/Requests/Auth/LoginRequest.php b/app/Http/Requests/Auth/LoginRequest.php index 7fed20939..d08846929 100644 --- a/app/Http/Requests/Auth/LoginRequest.php +++ b/app/Http/Requests/Auth/LoginRequest.php @@ -6,17 +6,11 @@ use Illuminate\Foundation\Http\FormRequest; class LoginRequest extends FormRequest { - /** - * @return bool - */ public function authorized(): bool { return true; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Auth/ResetPasswordRequest.php b/app/Http/Requests/Auth/ResetPasswordRequest.php index e06883c2a..e5bb3299c 100644 --- a/app/Http/Requests/Auth/ResetPasswordRequest.php +++ b/app/Http/Requests/Auth/ResetPasswordRequest.php @@ -6,17 +6,11 @@ use Illuminate\Foundation\Http\FormRequest; class ResetPasswordRequest extends FormRequest { - /** - * @return bool - */ public function authorize(): bool { return true; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/FrontendUserFormRequest.php b/app/Http/Requests/FrontendUserFormRequest.php index 6be818e7b..b5553dc16 100644 --- a/app/Http/Requests/FrontendUserFormRequest.php +++ b/app/Http/Requests/FrontendUserFormRequest.php @@ -22,7 +22,7 @@ abstract class FrontendUserFormRequest extends FormRequest */ public function authorize() { - return ! is_null($this->user()); + return !is_null($this->user()); } /** diff --git a/app/Http/Resources/Wings/ServerConfigurationCollection.php b/app/Http/Resources/Wings/ServerConfigurationCollection.php index 5ee877a98..fe352301c 100644 --- a/app/Http/Resources/Wings/ServerConfigurationCollection.php +++ b/app/Http/Resources/Wings/ServerConfigurationCollection.php @@ -17,6 +17,7 @@ class ServerConfigurationCollection extends ResourceCollection * have some serious performance issues from all of the N+1 queries. * * @param \Illuminate\Http\Request $request + * * @return array */ public function toArray($request) @@ -24,7 +25,7 @@ class ServerConfigurationCollection extends ResourceCollection $egg = Container::getInstance()->make(EggConfigurationService::class); $configuration = Container::getInstance()->make(ServerConfigurationStructureService::class); - return $this->collection->map(function (Server $server) use ($configuration, $egg) { + return $this->collection->map(function (Server $server) use ($configuration, $egg) { return [ 'uuid' => $server->uuid, 'settings' => $configuration->handle($server), diff --git a/app/Http/ViewComposers/AssetComposer.php b/app/Http/ViewComposers/AssetComposer.php index 6da825ad4..32ec9fb88 100644 --- a/app/Http/ViewComposers/AssetComposer.php +++ b/app/Http/ViewComposers/AssetComposer.php @@ -14,8 +14,6 @@ class AssetComposer /** * AssetComposer constructor. - * - * @param \Pterodactyl\Services\Helpers\AssetHashService $assetHashService */ public function __construct(AssetHashService $assetHashService) { @@ -24,8 +22,6 @@ class AssetComposer /** * Provide access to the asset service in the views. - * - * @param \Illuminate\View\View $view */ public function compose(View $view) { diff --git a/app/Jobs/Schedule/RunTaskJob.php b/app/Jobs/Schedule/RunTaskJob.php index ee3c3e16d..3dd8e920d 100644 --- a/app/Jobs/Schedule/RunTaskJob.php +++ b/app/Jobs/Schedule/RunTaskJob.php @@ -8,7 +8,6 @@ use Carbon\CarbonImmutable; use Pterodactyl\Models\Task; use InvalidArgumentException; use Pterodactyl\Models\Schedule; -use Illuminate\Support\Facades\Log; use Illuminate\Queue\SerializesModels; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldQueue; @@ -19,7 +18,9 @@ use Pterodactyl\Repositories\Wings\DaemonCommandRepository; class RunTaskJob extends Job implements ShouldQueue { - use DispatchesJobs, InteractsWithQueue, SerializesModels; + use DispatchesJobs; + use InteractsWithQueue; + use SerializesModels; /** * @var \Pterodactyl\Models\Task @@ -28,8 +29,6 @@ class RunTaskJob extends Job implements ShouldQueue /** * RunTaskJob constructor. - * - * @param \Pterodactyl\Models\Task $task */ public function __construct(Task $task) { @@ -40,10 +39,6 @@ class RunTaskJob extends Job implements ShouldQueue /** * Run the job and send actions to the daemon running the server. * - * @param \Pterodactyl\Repositories\Wings\DaemonCommandRepository $commandRepository - * @param \Pterodactyl\Services\Backups\InitiateBackupService $backupService - * @param \Pterodactyl\Repositories\Wings\DaemonPowerRepository $powerRepository - * * @throws \Throwable */ public function handle( @@ -52,7 +47,7 @@ class RunTaskJob extends Job implements ShouldQueue DaemonPowerRepository $powerRepository ) { // Do not process a task that is not set to active. - if (! $this->task->schedule->is_active) { + if (!$this->task->schedule->is_active) { $this->markTaskNotQueued(); $this->markScheduleComplete(); @@ -81,8 +76,6 @@ class RunTaskJob extends Job implements ShouldQueue /** * Handle a failure while sending the action to the daemon or otherwise processing the job. - * - * @param \Exception|null $exception */ public function failed(Exception $exception = null) { diff --git a/app/Models/Allocation.php b/app/Models/Allocation.php index 81e596523..9d609ba24 100644 --- a/app/Models/Allocation.php +++ b/app/Models/Allocation.php @@ -3,21 +3,19 @@ namespace Pterodactyl\Models; /** - * @property int $id - * @property int $node_id - * @property string $ip - * @property string|null $ip_alias - * @property int $port - * @property int|null $server_id - * @property string|null $notes - * @property \Carbon\Carbon|null $created_at - * @property \Carbon\Carbon|null $updated_at - * - * @property string $alias - * @property bool $has_alias - * + * @property int $id + * @property int $node_id + * @property string $ip + * @property string|null $ip_alias + * @property int $port + * @property int|null $server_id + * @property string|null $notes + * @property \Carbon\Carbon|null $created_at + * @property \Carbon\Carbon|null $updated_at + * @property string $alias + * @property bool $has_alias * @property \Pterodactyl\Models\Server|null $server - * @property \Pterodactyl\Models\Node $node + * @property \Pterodactyl\Models\Node $node */ class Allocation extends Model { @@ -25,7 +23,7 @@ class Allocation extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'allocation'; + public const RESOURCE_NAME = 'allocation'; /** * The table associated with the model. @@ -78,6 +76,7 @@ class Allocation extends Model * Accessor to automatically provide the IP alias if defined. * * @param string|null $value + * * @return string */ public function getAliasAttribute($value) @@ -89,11 +88,12 @@ class Allocation extends Model * Accessor to quickly determine if this allocation has an alias. * * @param string|null $value + * * @return bool */ public function getHasAliasAttribute($value) { - return ! is_null($this->ip_alias); + return !is_null($this->ip_alias); } /** diff --git a/app/Models/ApiKey.php b/app/Models/ApiKey.php index 072a74f9b..b05e22f3e 100644 --- a/app/Models/ApiKey.php +++ b/app/Models/ApiKey.php @@ -5,40 +5,44 @@ namespace Pterodactyl\Models; use Pterodactyl\Services\Acl\Api\AdminAcl; /** - * @property int $id - * @property int $user_id - * @property int $key_type - * @property string $identifier - * @property string $token - * @property array $allowed_ips - * @property string $memo + * @property int $id + * @property int $user_id + * @property int $key_type + * @property string $identifier + * @property string $token + * @property array $allowed_ips + * @property string $memo * @property \Carbon\Carbon|null $last_used_at - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at */ class ApiKey extends Model { - const RESOURCE_NAME = 'api_key'; + /** + * The resource name for this model when it is transformed into an + * API representation using fractal. + */ + public const RESOURCE_NAME = 'api_key'; /** * Different API keys that can exist on the system. */ - const TYPE_NONE = 0; - const TYPE_ACCOUNT = 1; - const TYPE_APPLICATION = 2; - const TYPE_DAEMON_USER = 3; - const TYPE_DAEMON_APPLICATION = 4; + public const TYPE_NONE = 0; + public const TYPE_ACCOUNT = 1; + public const TYPE_APPLICATION = 2; + public const TYPE_DAEMON_USER = 3; + public const TYPE_DAEMON_APPLICATION = 4; /** * The length of API key identifiers. */ - const IDENTIFIER_LENGTH = 16; + public const IDENTIFIER_LENGTH = 16; /** * The length of the actual API key that is encrypted and stored * in the database. */ - const KEY_LENGTH = 32; + public const KEY_LENGTH = 32; /** * The table associated with the model. diff --git a/app/Models/Backup.php b/app/Models/Backup.php index 6569d9f30..5e3940a88 100644 --- a/app/Models/Backup.php +++ b/app/Models/Backup.php @@ -5,31 +5,30 @@ namespace Pterodactyl\Models; use Illuminate\Database\Eloquent\SoftDeletes; /** - * @property int $id - * @property int $server_id - * @property string $uuid - * @property bool $is_successful - * @property string $name - * @property string[] $ignored_files - * @property string $disk - * @property string|null $checksum - * @property int $bytes - * @property string|null $upload_id + * @property int $id + * @property int $server_id + * @property string $uuid + * @property bool $is_successful + * @property string $name + * @property string[] $ignored_files + * @property string $disk + * @property string|null $checksum + * @property int $bytes + * @property string|null $upload_id * @property \Carbon\CarbonImmutable|null $completed_at - * @property \Carbon\CarbonImmutable $created_at - * @property \Carbon\CarbonImmutable $updated_at + * @property \Carbon\CarbonImmutable $created_at + * @property \Carbon\CarbonImmutable $updated_at * @property \Carbon\CarbonImmutable|null $deleted_at - * - * @property \Pterodactyl\Models\Server $server + * @property \Pterodactyl\Models\Server $server */ class Backup extends Model { use SoftDeletes; - const RESOURCE_NAME = 'backup'; + public const RESOURCE_NAME = 'backup'; - const ADAPTER_WINGS = 'wings'; - const ADAPTER_AWS_S3 = 's3'; + public const ADAPTER_WINGS = 'wings'; + public const ADAPTER_AWS_S3 = 's3'; /** * @var string diff --git a/app/Models/Database.php b/app/Models/Database.php index 8e66219f5..8fb121d1b 100644 --- a/app/Models/Database.php +++ b/app/Models/Database.php @@ -3,18 +3,17 @@ namespace Pterodactyl\Models; /** - * @property int $id - * @property int $server_id - * @property int $database_host_id - * @property string $database - * @property string $username - * @property string $remote - * @property string $password - * @property int $max_connections - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at - * - * @property \Pterodactyl\Models\Server $server + * @property int $id + * @property int $server_id + * @property int $database_host_id + * @property string $database + * @property string $username + * @property string $remote + * @property string $password + * @property int $max_connections + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at + * @property \Pterodactyl\Models\Server $server * @property \Pterodactyl\Models\DatabaseHost $host */ class Database extends Model @@ -23,7 +22,7 @@ class Database extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'server_database'; + public const RESOURCE_NAME = 'server_database'; /** * The table associated with the model. diff --git a/app/Models/DatabaseHost.php b/app/Models/DatabaseHost.php index 750ca0de9..1fb8a5c77 100644 --- a/app/Models/DatabaseHost.php +++ b/app/Models/DatabaseHost.php @@ -2,13 +2,30 @@ namespace Pterodactyl\Models; +/** + * @property int $id + * @property string $name + * @property string $host + * @property int $port + * @property string $username + * @property string $password + * @property int|null $max_databases + * @property int|null $node_id + * @property \Carbon\CarbonImmutable $created_at + * @property \Carbon\CarbonImmutable $updated_at + */ class DatabaseHost extends Model { /** * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'database_host'; + public const RESOURCE_NAME = 'database_host'; + + /** + * @var bool + */ + protected $immutableDates = true; /** * The table associated with the model. diff --git a/app/Models/Egg.php b/app/Models/Egg.php index 03d5fa5f8..70e7b305c 100644 --- a/app/Models/Egg.php +++ b/app/Models/Egg.php @@ -3,46 +3,44 @@ namespace Pterodactyl\Models; /** - * @property int $id - * @property string $uuid - * @property int $nest_id - * @property string $author - * @property string $name - * @property string|null $description - * @property array|null $features - * @property string $docker_image -- deprecated, use $docker_images - * @property string $update_url - * @property array $docker_images - * @property string $file_denylist - * @property string|null $config_files - * @property string|null $config_startup - * @property string|null $config_logs - * @property string|null $config_stop - * @property int|null $config_from - * @property string|null $startup - * @property bool $script_is_privileged - * @property string|null $script_install - * @property string $script_entry - * @property string $script_container - * @property int|null $copy_script_from - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at - * - * @property string|null $copy_script_install - * @property string $copy_script_entry - * @property string $copy_script_container - * @property string|null $inherit_config_files - * @property string|null $inherit_config_startup - * @property string|null $inherit_config_logs - * @property string|null $inherit_config_stop - * @property string $inherit_file_denylist - * @property array|null $inherit_features - * - * @property \Pterodactyl\Models\Nest $nest - * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Server[] $servers + * @property int $id + * @property string $uuid + * @property int $nest_id + * @property string $author + * @property string $name + * @property string|null $description + * @property array|null $features + * @property string $docker_image -- deprecated, use $docker_images + * @property string $update_url + * @property array $docker_images + * @property string $file_denylist + * @property string|null $config_files + * @property string|null $config_startup + * @property string|null $config_logs + * @property string|null $config_stop + * @property int|null $config_from + * @property string|null $startup + * @property bool $script_is_privileged + * @property string|null $script_install + * @property string $script_entry + * @property string $script_container + * @property int|null $copy_script_from + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at + * @property string|null $copy_script_install + * @property string $copy_script_entry + * @property string $copy_script_container + * @property string|null $inherit_config_files + * @property string|null $inherit_config_startup + * @property string|null $inherit_config_logs + * @property string|null $inherit_config_stop + * @property string $inherit_file_denylist + * @property array|null $inherit_features + * @property \Pterodactyl\Models\Nest $nest + * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Server[] $servers * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\EggVariable[] $variables - * @property \Pterodactyl\Models\Egg|null $scriptFrom - * @property \Pterodactyl\Models\Egg|null $configFrom + * @property \Pterodactyl\Models\Egg|null $scriptFrom + * @property \Pterodactyl\Models\Egg|null $configFrom */ class Egg extends Model { @@ -50,7 +48,7 @@ class Egg extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'egg'; + public const RESOURCE_NAME = 'egg'; /** * Different features that can be enabled on any given egg. These are used internally @@ -61,8 +59,8 @@ class Egg extends Model * To skip copying the features, an empty array value should be passed in ("[]") rather * than leaving it null. */ - const FEATURE_EULA_POPUP = 'eula'; - const FEATURE_FASTDL = 'fastdl'; + public const FEATURE_EULA_POPUP = 'eula'; + public const FEATURE_FASTDL = 'fastdl'; /** * The table associated with the model. @@ -150,7 +148,7 @@ class Egg extends Model */ public function getCopyScriptInstallAttribute() { - if (! is_null($this->script_install) || is_null($this->copy_script_from)) { + if (!is_null($this->script_install) || is_null($this->copy_script_from)) { return $this->script_install; } @@ -165,7 +163,7 @@ class Egg extends Model */ public function getCopyScriptEntryAttribute() { - if (! is_null($this->script_entry) || is_null($this->copy_script_from)) { + if (!is_null($this->script_entry) || is_null($this->copy_script_from)) { return $this->script_entry; } @@ -180,7 +178,7 @@ class Egg extends Model */ public function getCopyScriptContainerAttribute() { - if (! is_null($this->script_container) || is_null($this->copy_script_from)) { + if (!is_null($this->script_container) || is_null($this->copy_script_from)) { return $this->script_container; } @@ -194,7 +192,7 @@ class Egg extends Model */ public function getInheritConfigFilesAttribute() { - if (! is_null($this->config_files) || is_null($this->config_from)) { + if (!is_null($this->config_files) || is_null($this->config_from)) { return $this->config_files; } @@ -208,7 +206,7 @@ class Egg extends Model */ public function getInheritConfigStartupAttribute() { - if (! is_null($this->config_startup) || is_null($this->config_from)) { + if (!is_null($this->config_startup) || is_null($this->config_from)) { return $this->config_startup; } @@ -222,7 +220,7 @@ class Egg extends Model */ public function getInheritConfigLogsAttribute() { - if (! is_null($this->config_logs) || is_null($this->config_from)) { + if (!is_null($this->config_logs) || is_null($this->config_from)) { return $this->config_logs; } @@ -236,7 +234,7 @@ class Egg extends Model */ public function getInheritConfigStopAttribute() { - if (! is_null($this->config_stop) || is_null($this->config_from)) { + if (!is_null($this->config_stop) || is_null($this->config_from)) { return $this->config_stop; } @@ -251,7 +249,7 @@ class Egg extends Model */ public function getInheritFeaturesAttribute() { - if (! is_null($this->features) || is_null($this->config_from)) { + if (!is_null($this->features) || is_null($this->config_from)) { return $this->features; } diff --git a/app/Models/EggVariable.php b/app/Models/EggVariable.php index 2adc35134..aaddf121a 100644 --- a/app/Models/EggVariable.php +++ b/app/Models/EggVariable.php @@ -3,20 +3,19 @@ namespace Pterodactyl\Models; /** - * @property int $id - * @property int $egg_id - * @property string $name - * @property string $description - * @property string $env_variable - * @property string $default_value - * @property bool $user_viewable - * @property bool $user_editable - * @property string $rules - * @property \Carbon\CarbonImmutable $created_at - * @property \Carbon\CarbonImmutable $updated_at - * - * @property bool $required - * @property \Pterodactyl\Models\Egg $egg + * @property int $id + * @property int $egg_id + * @property string $name + * @property string $description + * @property string $env_variable + * @property string $default_value + * @property bool $user_viewable + * @property bool $user_editable + * @property string $rules + * @property \Carbon\CarbonImmutable $created_at + * @property \Carbon\CarbonImmutable $updated_at + * @property bool $required + * @property \Pterodactyl\Models\Egg $egg * @property \Pterodactyl\Models\ServerVariable $serverVariable * * The "server_value" variable is only present on the object if you've loaded this model @@ -29,14 +28,14 @@ class EggVariable extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'egg_variable'; + public const RESOURCE_NAME = 'egg_variable'; /** * Reserved environment variable names. * * @var string */ - const RESERVED_ENV_NAMES = 'SERVER_MEMORY,SERVER_IP,SERVER_PORT,ENV,HOME,USER,STARTUP,SERVER_UUID,UUID'; + public const RESERVED_ENV_NAMES = 'SERVER_MEMORY,SERVER_IP,SERVER_PORT,ENV,HOME,USER,STARTUP,SERVER_UUID,UUID'; /** * @var bool diff --git a/app/Models/Filters/AdminServerFilter.php b/app/Models/Filters/AdminServerFilter.php index d523e48e0..32580ea51 100644 --- a/app/Models/Filters/AdminServerFilter.php +++ b/app/Models/Filters/AdminServerFilter.php @@ -12,16 +12,12 @@ class AdminServerFilter implements Filter * A multi-column filter for the servers table that allows an administrative user to search * across UUID, name, owner username, and owner email. * - * @param \Illuminate\Database\Eloquent\Builder $query * @param string $value - * @param string $property */ public function __invoke(Builder $query, $value, string $property) { if ($query->getQuery()->from !== 'servers') { - throw new BadMethodCallException( - 'Cannot use the AdminServerFilter against a non-server model.' - ); + throw new BadMethodCallException('Cannot use the AdminServerFilter against a non-server model.'); } $query ->select('servers.*') diff --git a/app/Models/Filters/MultiFieldServerFilter.php b/app/Models/Filters/MultiFieldServerFilter.php index 21c45b779..2aac64e81 100644 --- a/app/Models/Filters/MultiFieldServerFilter.php +++ b/app/Models/Filters/MultiFieldServerFilter.php @@ -20,16 +20,12 @@ class MultiFieldServerFilter implements Filter * search across multiple columns. This allows us to provide a very generic search ability for * the frontend. * - * @param \Illuminate\Database\Eloquent\Builder $query * @param string $value - * @param string $property */ public function __invoke(Builder $query, $value, string $property) { if ($query->getQuery()->from !== 'servers') { - throw new BadMethodCallException( - 'Cannot use the MultiFieldServerFilter against a non-server model.' - ); + throw new BadMethodCallException('Cannot use the MultiFieldServerFilter against a non-server model.'); } if (preg_match(self::IPV4_REGEX, $value) || preg_match('/^:\d{1,5}$/', $value)) { diff --git a/app/Models/Location.php b/app/Models/Location.php index 74fed1812..5e497fc99 100644 --- a/app/Models/Location.php +++ b/app/Models/Location.php @@ -3,13 +3,12 @@ namespace Pterodactyl\Models; /** - * @property int $id - * @property string $short - * @property string $long - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at - * - * @property \Pterodactyl\Models\Node[] $nodes + * @property int $id + * @property string $short + * @property string $long + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at + * @property \Pterodactyl\Models\Node[] $nodes * @property \Pterodactyl\Models\Server[] $servers */ class Location extends Model @@ -18,7 +17,7 @@ class Location extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'location'; + public const RESOURCE_NAME = 'location'; /** * The table associated with the model. diff --git a/app/Models/Model.php b/app/Models/Model.php index f6b94a3ab..e5e7fb976 100644 --- a/app/Models/Model.php +++ b/app/Models/Model.php @@ -6,11 +6,14 @@ use Illuminate\Support\Str; use Illuminate\Validation\Rule; use Illuminate\Container\Container; use Illuminate\Contracts\Validation\Factory; -use Illuminate\Database\Eloquent\Model as IlluminateModel; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Pterodactyl\Exceptions\Model\DataValidationException; +use Illuminate\Database\Eloquent\Model as IlluminateModel; abstract class Model extends IlluminateModel { + use HasFactory; + /** * Set to true to return immutable Carbon date instances from the model. * @@ -56,7 +59,7 @@ abstract class Model extends IlluminateModel static::$validatorFactory = Container::getInstance()->make(Factory::class); static::saving(function (Model $model) { - if (! $model->validate()) { + if (!$model->validate()) { throw new DataValidationException($model->getValidator()); } @@ -86,7 +89,10 @@ abstract class Model extends IlluminateModel $rules = $this->getKey() ? static::getRulesForUpdate($this) : static::getRules(); return $this->validator ?: $this->validator = static::$validatorFactory->make( - [], $rules, [], [] + [], + $rules, + [], + [] ); } @@ -110,7 +116,7 @@ abstract class Model extends IlluminateModel * rather than just creating it. * * @param \Illuminate\Database\Eloquent\Model|int|string $id - * @param string $primaryKey + * * @return array */ public static function getRulesForUpdate($id, string $primaryKey = 'id') @@ -126,7 +132,7 @@ abstract class Model extends IlluminateModel // working model so we don't run into errors due to the way that field validation // works. foreach ($data as &$datum) { - if (! is_string($datum) || ! Str::startsWith($datum, 'unique')) { + if (!is_string($datum) || !Str::startsWith($datum, 'unique')) { continue; } @@ -156,7 +162,8 @@ abstract class Model extends IlluminateModel // for that model. Doing this will return all of the attributes in a format that can // properly be validated. $this->addCastAttributesToArray( - $this->getAttributes(), $this->getMutatedAttributes() + $this->getAttributes(), + $this->getMutatedAttributes() ) )->passes(); } @@ -165,11 +172,12 @@ abstract class Model extends IlluminateModel * Return a timestamp as DateTime object. * * @param mixed $value + * * @return \Illuminate\Support\Carbon|\Carbon\CarbonImmutable */ protected function asDateTime($value) { - if (! $this->immutableDates) { + if (!$this->immutableDates) { return parent::asDateTime($value); } diff --git a/app/Models/Mount.php b/app/Models/Mount.php index ee9879b19..fb4f511e8 100644 --- a/app/Models/Mount.php +++ b/app/Models/Mount.php @@ -5,17 +5,16 @@ namespace Pterodactyl\Models; use Illuminate\Validation\Rules\NotIn; /** - * @property int $id - * @property string $uuid - * @property string $name - * @property string $description - * @property string $source - * @property string $target - * @property bool $read_only - * @property bool $user_mountable - * - * @property \Pterodactyl\Models\Egg[]|\Illuminate\Database\Eloquent\Collection $eggs - * @property \Pterodactyl\Models\Node[]|\Illuminate\Database\Eloquent\Collection $nodes + * @property int $id + * @property string $uuid + * @property string $name + * @property string $description + * @property string $source + * @property string $target + * @property bool $read_only + * @property bool $user_mountable + * @property \Pterodactyl\Models\Egg[]|\Illuminate\Database\Eloquent\Collection $eggs + * @property \Pterodactyl\Models\Node[]|\Illuminate\Database\Eloquent\Collection $nodes * @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers */ class Mount extends Model @@ -24,7 +23,7 @@ class Mount extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'mount'; + public const RESOURCE_NAME = 'mount'; /** * The table associated with the model. @@ -87,7 +86,7 @@ class Mount extends Model public $timestamps = false; /** - * Blacklisted source paths + * Blacklisted source paths. * * @var string[] */ @@ -98,7 +97,7 @@ class Mount extends Model ]; /** - * Blacklisted target paths + * Blacklisted target paths. * * @var string[] */ diff --git a/app/Models/Nest.php b/app/Models/Nest.php index 770c5baf7..0c460bfd1 100644 --- a/app/Models/Nest.php +++ b/app/Models/Nest.php @@ -3,16 +3,15 @@ namespace Pterodactyl\Models; /** - * @property int $id - * @property string $uuid - * @property string $author - * @property string $name - * @property string|null $description - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at - * + * @property int $id + * @property string $uuid + * @property string $author + * @property string $name + * @property string|null $description + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Server[] $servers - * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Egg[] $eggs + * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Egg[] $eggs */ class Nest extends Model { @@ -20,7 +19,7 @@ class Nest extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'nest'; + public const RESOURCE_NAME = 'nest'; /** * The table associated with the model. diff --git a/app/Models/Node.php b/app/Models/Node.php index 8258ae863..b267a6692 100644 --- a/app/Models/Node.php +++ b/app/Models/Node.php @@ -8,32 +8,31 @@ use Illuminate\Notifications\Notifiable; use Illuminate\Contracts\Encryption\Encrypter; /** - * @property int $id - * @property string $uuid - * @property bool $public - * @property string $name - * @property string|null $description - * @property int $location_id - * @property string $fqdn - * @property string $scheme - * @property bool $behind_proxy - * @property bool $maintenance_mode - * @property int $memory - * @property int $memory_overallocate - * @property int $disk - * @property int $disk_overallocate - * @property int $upload_size - * @property string $daemon_token_id - * @property string $daemon_token - * @property int $daemonListen - * @property int $daemonSFTP - * @property string $daemonBase - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at - * - * @property \Pterodactyl\Models\Location $location - * @property \Pterodactyl\Models\Mount[]|\Illuminate\Database\Eloquent\Collection $mounts - * @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers + * @property int $id + * @property string $uuid + * @property bool $public + * @property string $name + * @property string|null $description + * @property int $location_id + * @property string $fqdn + * @property string $scheme + * @property bool $behind_proxy + * @property bool $maintenance_mode + * @property int $memory + * @property int $memory_overallocate + * @property int $disk + * @property int $disk_overallocate + * @property int $upload_size + * @property string $daemon_token_id + * @property string $daemon_token + * @property int $daemonListen + * @property int $daemonSFTP + * @property string $daemonBase + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at + * @property \Pterodactyl\Models\Location $location + * @property \Pterodactyl\Models\Mount[]|\Illuminate\Database\Eloquent\Collection $mounts + * @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers * @property \Pterodactyl\Models\Allocation[]|\Illuminate\Database\Eloquent\Collection $allocations */ class Node extends Model @@ -44,10 +43,10 @@ class Node extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'node'; + public const RESOURCE_NAME = 'node'; - const DAEMON_TOKEN_ID_LENGTH = 16; - const DAEMON_TOKEN_LENGTH = 64; + public const DAEMON_TOKEN_ID_LENGTH = 16; + public const DAEMON_TOKEN_LENGTH = 64; /** * The table associated with the model. @@ -133,8 +132,6 @@ class Node extends Model /** * Get the connection address to use when making calls to this node. - * - * @return string */ public function getConnectionAddress(): string { @@ -157,7 +154,7 @@ class Node extends Model 'host' => '0.0.0.0', 'port' => $this->daemonListen, 'ssl' => [ - 'enabled' => (! $this->behind_proxy && $this->scheme === 'https'), + 'enabled' => (!$this->behind_proxy && $this->scheme === 'https'), 'cert' => '/etc/letsencrypt/live/' . $this->fqdn . '/fullchain.pem', 'key' => '/etc/letsencrypt/live/' . $this->fqdn . '/privkey.pem', ], @@ -187,7 +184,6 @@ class Node extends Model /** * Returns the configuration in JSON format. * - * @param bool $pretty * @return string */ public function getJsonConfiguration(bool $pretty = false) @@ -197,12 +193,10 @@ class Node extends Model /** * Helper function to return the decrypted key for a node. - * - * @return string */ public function getDecryptedKey(): string { - return (string)Container::getInstance()->make(Encrypter::class)->decrypt( + return (string) Container::getInstance()->make(Encrypter::class)->decrypt( $this->daemon_token ); } @@ -247,10 +241,6 @@ class Node extends Model /** * Returns a boolean if the node is viable for an additional server to be placed on it. - * - * @param int $memory - * @param int $disk - * @return bool */ public function isViable(int $memory, int $disk): bool { diff --git a/app/Models/Objects/DeploymentObject.php b/app/Models/Objects/DeploymentObject.php index 52857410f..3c62f0bae 100644 --- a/app/Models/Objects/DeploymentObject.php +++ b/app/Models/Objects/DeploymentObject.php @@ -19,16 +19,12 @@ class DeploymentObject */ private $ports = []; - /** - * @return bool - */ public function isDedicated(): bool { return $this->dedicated; } /** - * @param bool $dedicated * @return $this */ public function setDedicated(bool $dedicated) @@ -38,16 +34,12 @@ class DeploymentObject return $this; } - /** - * @return array - */ public function getLocations(): array { return $this->locations; } /** - * @param array $locations * @return $this */ public function setLocations(array $locations) @@ -57,16 +49,12 @@ class DeploymentObject return $this; } - /** - * @return array - */ public function getPorts(): array { return $this->ports; } /** - * @param array $ports * @return $this */ public function setPorts(array $ports) diff --git a/app/Models/Permission.php b/app/Models/Permission.php index 490924bc4..723679d3e 100644 --- a/app/Models/Permission.php +++ b/app/Models/Permission.php @@ -10,58 +10,58 @@ class Permission extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'subuser_permission'; + public const RESOURCE_NAME = 'subuser_permission'; /** * Constants defining different permissions available. */ - const ACTION_WEBSOCKET_CONNECT = 'websocket.connect'; - const ACTION_CONTROL_CONSOLE = 'control.console'; - const ACTION_CONTROL_START = 'control.start'; - const ACTION_CONTROL_STOP = 'control.stop'; - const ACTION_CONTROL_RESTART = 'control.restart'; + public const ACTION_WEBSOCKET_CONNECT = 'websocket.connect'; + public const ACTION_CONTROL_CONSOLE = 'control.console'; + public const ACTION_CONTROL_START = 'control.start'; + public const ACTION_CONTROL_STOP = 'control.stop'; + public const ACTION_CONTROL_RESTART = 'control.restart'; - const ACTION_DATABASE_READ = 'database.read'; - const ACTION_DATABASE_CREATE = 'database.create'; - const ACTION_DATABASE_UPDATE = 'database.update'; - const ACTION_DATABASE_DELETE = 'database.delete'; - const ACTION_DATABASE_VIEW_PASSWORD = 'database.view_password'; + public const ACTION_DATABASE_READ = 'database.read'; + public const ACTION_DATABASE_CREATE = 'database.create'; + public const ACTION_DATABASE_UPDATE = 'database.update'; + public const ACTION_DATABASE_DELETE = 'database.delete'; + public const ACTION_DATABASE_VIEW_PASSWORD = 'database.view_password'; - const ACTION_SCHEDULE_READ = 'schedule.read'; - const ACTION_SCHEDULE_CREATE = 'schedule.create'; - const ACTION_SCHEDULE_UPDATE = 'schedule.update'; - const ACTION_SCHEDULE_DELETE = 'schedule.delete'; + public const ACTION_SCHEDULE_READ = 'schedule.read'; + public const ACTION_SCHEDULE_CREATE = 'schedule.create'; + public const ACTION_SCHEDULE_UPDATE = 'schedule.update'; + public const ACTION_SCHEDULE_DELETE = 'schedule.delete'; - const ACTION_USER_READ = 'user.read'; - const ACTION_USER_CREATE = 'user.create'; - const ACTION_USER_UPDATE = 'user.update'; - const ACTION_USER_DELETE = 'user.delete'; + public const ACTION_USER_READ = 'user.read'; + public const ACTION_USER_CREATE = 'user.create'; + public const ACTION_USER_UPDATE = 'user.update'; + public const ACTION_USER_DELETE = 'user.delete'; - const ACTION_BACKUP_READ = 'backup.read'; - const ACTION_BACKUP_CREATE = 'backup.create'; - const ACTION_BACKUP_DELETE = 'backup.delete'; - const ACTION_BACKUP_DOWNLOAD = 'backup.download'; - const ACTION_BACKUP_RESTORE = 'backup.restore'; + public const ACTION_BACKUP_READ = 'backup.read'; + public const ACTION_BACKUP_CREATE = 'backup.create'; + public const ACTION_BACKUP_DELETE = 'backup.delete'; + public const ACTION_BACKUP_DOWNLOAD = 'backup.download'; + public const ACTION_BACKUP_RESTORE = 'backup.restore'; - const ACTION_ALLOCATION_READ = 'allocation.read'; - const ACTION_ALLOCATION_CREATE = 'allocation.create'; - const ACTION_ALLOCATION_UPDATE = 'allocation.update'; - const ACTION_ALLOCATION_DELETE = 'allocation.delete'; + public const ACTION_ALLOCATION_READ = 'allocation.read'; + public const ACTION_ALLOCATION_CREATE = 'allocation.create'; + public const ACTION_ALLOCATION_UPDATE = 'allocation.update'; + public const ACTION_ALLOCATION_DELETE = 'allocation.delete'; - const ACTION_FILE_READ = 'file.read'; - const ACTION_FILE_READ_CONTENT = 'file.read-content'; - const ACTION_FILE_CREATE = 'file.create'; - const ACTION_FILE_UPDATE = 'file.update'; - const ACTION_FILE_DELETE = 'file.delete'; - const ACTION_FILE_ARCHIVE = 'file.archive'; - const ACTION_FILE_SFTP = 'file.sftp'; + public const ACTION_FILE_READ = 'file.read'; + public const ACTION_FILE_READ_CONTENT = 'file.read-content'; + public const ACTION_FILE_CREATE = 'file.create'; + public const ACTION_FILE_UPDATE = 'file.update'; + public const ACTION_FILE_DELETE = 'file.delete'; + public const ACTION_FILE_ARCHIVE = 'file.archive'; + public const ACTION_FILE_SFTP = 'file.sftp'; - const ACTION_STARTUP_READ = 'startup.read'; - const ACTION_STARTUP_UPDATE = 'startup.update'; - const ACTION_STARTUP_DOCKER_IMAGE = 'startup.docker-image'; + public const ACTION_STARTUP_READ = 'startup.read'; + public const ACTION_STARTUP_UPDATE = 'startup.update'; + public const ACTION_STARTUP_DOCKER_IMAGE = 'startup.docker-image'; - const ACTION_SETTINGS_RENAME = 'settings.rename'; - const ACTION_SETTINGS_REINSTALL = 'settings.reinstall'; + public const ACTION_SETTINGS_RENAME = 'settings.rename'; + public const ACTION_SETTINGS_REINSTALL = 'settings.reinstall'; /** * Should timestamps be used on this model. @@ -106,6 +106,7 @@ class Permission extends Model * to retrieve them, and not directly access this array as it is subject to change. * * @var array + * * @see \Pterodactyl\Models\Permission::permissions() */ protected static $permissions = [ diff --git a/app/Models/RecoveryToken.php b/app/Models/RecoveryToken.php index 5cd00a9d0..d4ef5a7a0 100644 --- a/app/Models/RecoveryToken.php +++ b/app/Models/RecoveryToken.php @@ -3,11 +3,10 @@ namespace Pterodactyl\Models; /** - * @property int $id - * @property int $user_id - * @property string $token - * @property \Carbon\CarbonImmutable $created_at - * + * @property int $id + * @property int $user_id + * @property string $token + * @property \Carbon\CarbonImmutable $created_at * @property \Pterodactyl\Models\User $user */ class RecoveryToken extends Model @@ -15,7 +14,7 @@ class RecoveryToken extends Model /** * There are no updates to this model, only inserts and deletes. */ - const UPDATED_AT = null; + public const UPDATED_AT = null; /** * @var bool diff --git a/app/Models/Schedule.php b/app/Models/Schedule.php index de0475639..31eec5a6b 100644 --- a/app/Models/Schedule.php +++ b/app/Models/Schedule.php @@ -8,23 +8,22 @@ use Illuminate\Container\Container; use Pterodactyl\Contracts\Extensions\HashidsInterface; /** - * @property int $id - * @property int $server_id - * @property string $name - * @property string $cron_day_of_week - * @property string $cron_day_of_month - * @property string $cron_hour - * @property string $cron_minute - * @property bool $is_active - * @property bool $is_processing - * @property \Carbon\Carbon|null $last_run_at - * @property \Carbon\Carbon|null $next_run_at - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at - * - * @property string $hashid - * - * @property \Pterodactyl\Models\Server $server + * @property int $id + * @property int $server_id + * @property string $name + * @property string $cron_day_of_week + * @property string $cron_month + * @property string $cron_day_of_month + * @property string $cron_hour + * @property string $cron_minute + * @property bool $is_active + * @property bool $is_processing + * @property \Carbon\Carbon|null $last_run_at + * @property \Carbon\Carbon|null $next_run_at + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at + * @property string $hashid + * @property \Pterodactyl\Models\Server $server * @property \Pterodactyl\Models\Task[]|\Illuminate\Support\Collection $tasks */ class Schedule extends Model @@ -33,7 +32,7 @@ class Schedule extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'server_schedule'; + public const RESOURCE_NAME = 'server_schedule'; /** * The table associated with the model. @@ -58,6 +57,7 @@ class Schedule extends Model 'server_id', 'name', 'cron_day_of_week', + 'cron_month', 'cron_day_of_month', 'cron_hour', 'cron_minute', @@ -93,6 +93,7 @@ class Schedule extends Model protected $attributes = [ 'name' => null, 'cron_day_of_week' => '*', + 'cron_month' => '*', 'cron_day_of_month' => '*', 'cron_hour' => '*', 'cron_minute' => '*', @@ -107,6 +108,7 @@ class Schedule extends Model 'server_id' => 'required|exists:servers,id', 'name' => 'required|string|max:191', 'cron_day_of_week' => 'required|string', + 'cron_month' => 'required|string', 'cron_day_of_month' => 'required|string', 'cron_hour' => 'required|string', 'cron_minute' => 'required|string', @@ -123,7 +125,7 @@ class Schedule extends Model */ public function getNextRunDate() { - $formatted = sprintf('%s %s %s * %s', $this->cron_minute, $this->cron_hour, $this->cron_day_of_month, $this->cron_day_of_week); + $formatted = sprintf('%s %s %s %s %s', $this->cron_minute, $this->cron_hour, $this->cron_day_of_month, $this->cron_month, $this->cron_day_of_week); return CarbonImmutable::createFromTimestamp( CronExpression::factory($formatted)->getNextRunDate()->getTimestamp() diff --git a/app/Models/Server.php b/app/Models/Server.php index fe653d174..a4f189dc4 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -61,7 +61,7 @@ class Server extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'server'; + public const RESOURCE_NAME = 'server'; const STATUS_INSTALLING = 'installing'; const STATUS_INSTALL_FAILED = 'install_failed'; @@ -160,8 +160,6 @@ class Server extends Model /** * Returns the format for server allocations when communicating with the Daemon. - * - * @return array */ public function getAllocationMappings(): array { @@ -170,9 +168,6 @@ class Server extends Model })->toArray(); } - /** - * @return bool - */ public function isInstalled(): bool { return $this->status !== self::STATUS_INSTALLING && $this->status !== self::STATUS_INSTALL_FAILED; diff --git a/app/Models/ServerTransfer.php b/app/Models/ServerTransfer.php index 1af9ab7e4..d2b497712 100644 --- a/app/Models/ServerTransfer.php +++ b/app/Models/ServerTransfer.php @@ -3,22 +3,21 @@ namespace Pterodactyl\Models; /** - * @property int $id - * @property int $server_id - * @property int $old_node - * @property int $new_node - * @property int $old_allocation - * @property int $new_allocation - * @property array|null $old_additional_allocations - * @property array|null $new_additional_allocations - * @property bool|null $successful - * @property bool $archived - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at - * + * @property int $id + * @property int $server_id + * @property int $old_node + * @property int $new_node + * @property int $old_allocation + * @property int $new_allocation + * @property array|null $old_additional_allocations + * @property array|null $new_additional_allocations + * @property bool|null $successful + * @property bool $archived + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at * @property \Pterodactyl\Models\Server $server - * @property \Pterodactyl\Models\Node $oldNode - * @property \Pterodactyl\Models\Node $newNode + * @property \Pterodactyl\Models\Node $oldNode + * @property \Pterodactyl\Models\Node $newNode */ class ServerTransfer extends Model { @@ -26,7 +25,7 @@ class ServerTransfer extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'server_transfer'; + public const RESOURCE_NAME = 'server_transfer'; /** * The table associated with the model. diff --git a/app/Models/ServerVariable.php b/app/Models/ServerVariable.php index b2bb4b7d5..7fdfbb1ab 100644 --- a/app/Models/ServerVariable.php +++ b/app/Models/ServerVariable.php @@ -10,7 +10,7 @@ class ServerVariable extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'server_variable'; + public const RESOURCE_NAME = 'server_variable'; /** * The table associated with the model. diff --git a/app/Models/Subuser.php b/app/Models/Subuser.php index ab85b85dd..87417cea0 100644 --- a/app/Models/Subuser.php +++ b/app/Models/Subuser.php @@ -5,14 +5,13 @@ namespace Pterodactyl\Models; use Illuminate\Notifications\Notifiable; /** - * @property int $id - * @property int $user_id - * @property int $server_id - * @property array $permissions - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at - * - * @property \Pterodactyl\Models\User $user + * @property int $id + * @property int $user_id + * @property int $server_id + * @property array $permissions + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at + * @property \Pterodactyl\Models\User $user * @property \Pterodactyl\Models\Server $server */ class Subuser extends Model @@ -23,7 +22,7 @@ class Subuser extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'server_subuser'; + public const RESOURCE_NAME = 'server_subuser'; /** * The table associated with the model. diff --git a/app/Models/Task.php b/app/Models/Task.php index f241b0717..d88999184 100644 --- a/app/Models/Task.php +++ b/app/Models/Task.php @@ -7,20 +7,18 @@ use Znck\Eloquent\Traits\BelongsToThrough; use Pterodactyl\Contracts\Extensions\HashidsInterface; /** - * @property int $id - * @property int $schedule_id - * @property int $sequence_id - * @property string $action - * @property string $payload - * @property int $time_offset - * @property bool $is_queued - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at - * - * @property string $hashid - * + * @property int $id + * @property int $schedule_id + * @property int $sequence_id + * @property string $action + * @property string $payload + * @property int $time_offset + * @property bool $is_queued + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at + * @property string $hashid * @property \Pterodactyl\Models\Schedule $schedule - * @property \Pterodactyl\Models\Server $server + * @property \Pterodactyl\Models\Server $server */ class Task extends Model { @@ -30,7 +28,7 @@ class Task extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'schedule_task'; + public const RESOURCE_NAME = 'schedule_task'; /** * The table associated with the model. @@ -119,6 +117,7 @@ class Task extends Model * Return the server a task is assigned to, acts as a belongsToThrough. * * @return \Znck\Eloquent\Relations\BelongsToThrough + * * @throws \Exception */ public function server() diff --git a/app/Models/User.php b/app/Models/User.php index 24ef981f4..1797d3783 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -17,27 +17,26 @@ use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; use Pterodactyl\Notifications\SendPasswordReset as ResetPasswordNotification; /** - * @property int $id - * @property string|null $external_id - * @property string $uuid - * @property string $username - * @property string $email - * @property string|null $name_first - * @property string|null $name_last - * @property string $password - * @property string|null $remeber_token - * @property string $language - * @property bool $root_admin - * @property bool $use_totp - * @property string|null $totp_secret - * @property \Carbon\Carbon|null $totp_authenticated_at - * @property bool $gravatar - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at - * - * @property string $name - * @property \Pterodactyl\Models\ApiKey[]|\Illuminate\Database\Eloquent\Collection $apiKeys - * @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers + * @property int $id + * @property string|null $external_id + * @property string $uuid + * @property string $username + * @property string $email + * @property string|null $name_first + * @property string|null $name_last + * @property string $password + * @property string|null $remeber_token + * @property string $language + * @property bool $root_admin + * @property bool $use_totp + * @property string|null $totp_secret + * @property \Carbon\Carbon|null $totp_authenticated_at + * @property bool $gravatar + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at + * @property string $name + * @property \Pterodactyl\Models\ApiKey[]|\Illuminate\Database\Eloquent\Collection $apiKeys + * @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers * @property \Pterodactyl\Models\RecoveryToken[]|\Illuminate\Database\Eloquent\Collection $recoveryTokens */ class User extends Model implements @@ -51,14 +50,14 @@ class User extends Model implements use CanResetPassword; use Notifiable; - const USER_LEVEL_USER = 0; - const USER_LEVEL_ADMIN = 1; + public const USER_LEVEL_USER = 0; + public const USER_LEVEL_ADMIN = 1; /** * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'user'; + public const RESOURCE_NAME = 'user'; /** * Level of servers to display when using access() on a user. @@ -157,16 +156,14 @@ class User extends Model implements { $rules = parent::getRules(); - $rules['language'][] = new In(array_keys((new self)->getAvailableLanguages())); - $rules['username'][] = new Username; + $rules['language'][] = new In(array_keys((new self())->getAvailableLanguages())); + $rules['username'][] = new Username(); return $rules; } /** * Return the user model in a format that can be passed over to Vue templates. - * - * @return array */ public function toVueObject(): array { @@ -185,8 +182,6 @@ class User extends Model implements /** * Store the username as a lowercase string. - * - * @param string $value */ public function setUsernameAttribute(string $value) { diff --git a/app/Notifications/AccountCreated.php b/app/Notifications/AccountCreated.php index 304978048..e52bed5fe 100644 --- a/app/Notifications/AccountCreated.php +++ b/app/Notifications/AccountCreated.php @@ -29,9 +29,6 @@ class AccountCreated extends Notification implements ShouldQueue /** * Create a new notification instance. - * - * @param \Pterodactyl\Models\User $user - * @param string|null $token */ public function __construct(User $user, string $token = null) { @@ -43,6 +40,7 @@ class AccountCreated extends Notification implements ShouldQueue * Get the notification's delivery channels. * * @param mixed $notifiable + * * @return array */ public function via($notifiable) @@ -54,17 +52,18 @@ class AccountCreated extends Notification implements ShouldQueue * Get the mail representation of the notification. * * @param mixed $notifiable + * * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { - $message = (new MailMessage) + $message = (new MailMessage()) ->greeting('Hello ' . $this->user->name . '!') ->line('You are receiving this email because an account has been created for you on ' . config('app.name') . '.') ->line('Username: ' . $this->user->username) ->line('Email: ' . $this->user->email); - if (! is_null($this->token)) { + if (!is_null($this->token)) { return $message->action('Setup Your Account', url('/auth/password/reset/' . $this->token . '?email=' . urlencode($this->user->email))); } diff --git a/app/Notifications/AddedToServer.php b/app/Notifications/AddedToServer.php index 7b6cac8ca..c116a2e29 100644 --- a/app/Notifications/AddedToServer.php +++ b/app/Notifications/AddedToServer.php @@ -25,8 +25,6 @@ class AddedToServer extends Notification implements ShouldQueue /** * Create a new notification instance. - * - * @param array $server */ public function __construct(array $server) { @@ -37,6 +35,7 @@ class AddedToServer extends Notification implements ShouldQueue * Get the notification's delivery channels. * * @param mixed $notifiable + * * @return array */ public function via($notifiable) @@ -48,11 +47,12 @@ class AddedToServer extends Notification implements ShouldQueue * Get the mail representation of the notification. * * @param mixed $notifiable + * * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { - return (new MailMessage) + return (new MailMessage()) ->greeting('Hello ' . $this->server->user . '!') ->line('You have been added as a subuser for the following server, allowing you certain control over the server.') ->line('Server Name: ' . $this->server->name) diff --git a/app/Notifications/MailTested.php b/app/Notifications/MailTested.php index fdb95f5cb..d0f083acc 100644 --- a/app/Notifications/MailTested.php +++ b/app/Notifications/MailTested.php @@ -25,7 +25,7 @@ class MailTested extends Notification public function toMail() { - return (new MailMessage) + return (new MailMessage()) ->subject('Pterodactyl Test Message') ->greeting('Hello ' . $this->user->name . '!') ->line('This is a test of the Pterodactyl mail system. You\'re good to go!'); diff --git a/app/Notifications/RemovedFromServer.php b/app/Notifications/RemovedFromServer.php index d23aae54a..24418e51c 100644 --- a/app/Notifications/RemovedFromServer.php +++ b/app/Notifications/RemovedFromServer.php @@ -25,8 +25,6 @@ class RemovedFromServer extends Notification implements ShouldQueue /** * Create a new notification instance. - * - * @param array $server */ public function __construct(array $server) { @@ -37,6 +35,7 @@ class RemovedFromServer extends Notification implements ShouldQueue * Get the notification's delivery channels. * * @param mixed $notifiable + * * @return array */ public function via($notifiable) @@ -48,11 +47,12 @@ class RemovedFromServer extends Notification implements ShouldQueue * Get the mail representation of the notification. * * @param mixed $notifiable + * * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { - return (new MailMessage) + return (new MailMessage()) ->error() ->greeting('Hello ' . $this->server->user . '.') ->line('You have been removed as a subuser for the following server.') diff --git a/app/Notifications/SendPasswordReset.php b/app/Notifications/SendPasswordReset.php index 83d88216c..cd6d46050 100644 --- a/app/Notifications/SendPasswordReset.php +++ b/app/Notifications/SendPasswordReset.php @@ -39,6 +39,7 @@ class SendPasswordReset extends Notification implements ShouldQueue * Get the notification's delivery channels. * * @param mixed $notifiable + * * @return array */ public function via($notifiable) @@ -50,11 +51,12 @@ class SendPasswordReset extends Notification implements ShouldQueue * Get the mail representation of the notification. * * @param mixed $notifiable + * * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { - return (new MailMessage) + return (new MailMessage()) ->subject('Reset Password') ->line('You are receiving this email because we received a password reset request for your account.') ->action('Reset Password', url('/auth/password/reset/' . $this->token . '?email=' . urlencode($notifiable->email))) diff --git a/app/Notifications/ServerInstalled.php b/app/Notifications/ServerInstalled.php index fe9747223..cc5a94313 100644 --- a/app/Notifications/ServerInstalled.php +++ b/app/Notifications/ServerInstalled.php @@ -60,7 +60,7 @@ class ServerInstalled extends Notification implements ShouldQueue, ReceivesEvent */ public function toMail() { - return (new MailMessage) + return (new MailMessage()) ->greeting('Hello ' . $this->user->username . '.') ->line('Your server has finished installing and is now ready for you to use.') ->line('Server Name: ' . $this->server->name) diff --git a/app/Observers/ServerObserver.php b/app/Observers/ServerObserver.php index 00db4b334..c6a621204 100644 --- a/app/Observers/ServerObserver.php +++ b/app/Observers/ServerObserver.php @@ -19,8 +19,6 @@ class ServerObserver /** * Listen to the Server creating event. - * - * @param \Pterodactyl\Models\Server $server */ public function creating(Server $server) { @@ -29,8 +27,6 @@ class ServerObserver /** * Listen to the Server created event. - * - * @param \Pterodactyl\Models\Server $server */ public function created(Server $server) { @@ -39,8 +35,6 @@ class ServerObserver /** * Listen to the Server deleting event. - * - * @param \Pterodactyl\Models\Server $server */ public function deleting(Server $server) { @@ -49,8 +43,6 @@ class ServerObserver /** * Listen to the Server deleted event. - * - * @param \Pterodactyl\Models\Server $server */ public function deleted(Server $server) { @@ -59,8 +51,6 @@ class ServerObserver /** * Listen to the Server saving event. - * - * @param \Pterodactyl\Models\Server $server */ public function saving(Server $server) { @@ -69,8 +59,6 @@ class ServerObserver /** * Listen to the Server saved event. - * - * @param \Pterodactyl\Models\Server $server */ public function saved(Server $server) { @@ -79,8 +67,6 @@ class ServerObserver /** * Listen to the Server updating event. - * - * @param \Pterodactyl\Models\Server $server */ public function updating(Server $server) { @@ -89,8 +75,6 @@ class ServerObserver /** * Listen to the Server saved event. - * - * @param \Pterodactyl\Models\Server $server */ public function updated(Server $server) { diff --git a/app/Observers/SubuserObserver.php b/app/Observers/SubuserObserver.php index 009e65290..128de77fb 100644 --- a/app/Observers/SubuserObserver.php +++ b/app/Observers/SubuserObserver.php @@ -18,8 +18,6 @@ class SubuserObserver { /** * Listen to the Subuser creating event. - * - * @param \Pterodactyl\Models\Subuser $subuser */ public function creating(Subuser $subuser) { @@ -28,8 +26,6 @@ class SubuserObserver /** * Listen to the Subuser created event. - * - * @param \Pterodactyl\Models\Subuser $subuser */ public function created(Subuser $subuser) { @@ -44,8 +40,6 @@ class SubuserObserver /** * Listen to the Subuser deleting event. - * - * @param \Pterodactyl\Models\Subuser $subuser */ public function deleting(Subuser $subuser) { @@ -54,8 +48,6 @@ class SubuserObserver /** * Listen to the Subuser deleted event. - * - * @param \Pterodactyl\Models\Subuser $subuser */ public function deleted(Subuser $subuser) { diff --git a/app/Observers/UserObserver.php b/app/Observers/UserObserver.php index dd29d908b..18d73bc10 100644 --- a/app/Observers/UserObserver.php +++ b/app/Observers/UserObserver.php @@ -11,8 +11,6 @@ class UserObserver /** * Listen to the User creating event. - * - * @param \Pterodactyl\Models\User $user */ public function creating(User $user) { @@ -21,8 +19,6 @@ class UserObserver /** * Listen to the User created event. - * - * @param \Pterodactyl\Models\User $user */ public function created(User $user) { @@ -31,8 +27,6 @@ class UserObserver /** * Listen to the User deleting event. - * - * @param \Pterodactyl\Models\User $user */ public function deleting(User $user) { @@ -41,8 +35,6 @@ class UserObserver /** * Listen to the User deleted event. - * - * @param \Pterodactyl\Models\User $user */ public function deleted(User $user) { diff --git a/app/Policies/ServerPolicy.php b/app/Policies/ServerPolicy.php index bc3fa7aca..311f0a4a8 100644 --- a/app/Policies/ServerPolicy.php +++ b/app/Policies/ServerPolicy.php @@ -16,8 +16,6 @@ class ServerPolicy /** * ServerPolicy constructor. - * - * @param \Illuminate\Contracts\Cache\Repository $cache */ public function __construct(CacheRepository $cache) { @@ -27,9 +25,8 @@ class ServerPolicy /** * Checks if the user has the given permission on/for the server. * - * @param \Pterodactyl\Models\User $user - * @param \Pterodactyl\Models\Server $server * @param string $permission + * * @return bool */ protected function checkPermission(User $user, Server $server, $permission) @@ -49,9 +46,8 @@ class ServerPolicy /** * Runs before any of the functions are called. Used to determine if user is root admin, if so, ignore permissions. * - * @param \Pterodactyl\Models\User $user * @param string $ability - * @param \Pterodactyl\Models\Server $server + * * @return bool */ public function before(User $user, $ability, Server $server) @@ -69,7 +65,7 @@ class ServerPolicy * policy permission. * * @param string $name - * @param mixed $arguments + * @param mixed $arguments */ public function __call($name, $arguments) { diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 929de15fc..11baa730b 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -7,6 +7,7 @@ use Cache; use Pterodactyl\Models\User; use Pterodactyl\Models\Server; use Pterodactyl\Models\Subuser; +use Illuminate\Pagination\Paginator; use Illuminate\Support\Facades\Schema; use Illuminate\Support\ServiceProvider; use Pterodactyl\Observers\UserObserver; @@ -29,6 +30,8 @@ class AppServiceProvider extends ServiceProvider View::share('appVersion', $this->versionData()['version'] ?? 'undefined'); View::share('appIsGit', $this->versionData()['is_git'] ?? false); + + Paginator::useBootstrap(); } /** @@ -38,12 +41,12 @@ class AppServiceProvider extends ServiceProvider { // Only load the settings service provider if the environment // is configured to allow it. - if (! config('pterodactyl.load_environment_only', false) && $this->app->environment() !== 'testing') { + if (!config('pterodactyl.load_environment_only', false) && $this->app->environment() !== 'testing') { $this->app->register(SettingsServiceProvider::class); } $this->app->singleton('extensions.themes', function () { - return new Theme; + return new Theme(); }); } diff --git a/app/Providers/BladeServiceProvider.php b/app/Providers/BladeServiceProvider.php index 97b0df48e..16a17a373 100644 --- a/app/Providers/BladeServiceProvider.php +++ b/app/Providers/BladeServiceProvider.php @@ -13,7 +13,7 @@ class BladeServiceProvider extends ServiceProvider { $this->app->make('blade.compiler') ->directive('datetimeHuman', function ($expression) { - return "setTimezone(config('app.timezone'))->toDateTimeString(); ?>"; + return "setTimezone(config('app.timezone'))->toDateTimeString(); ?>"; }); } } diff --git a/app/Providers/SettingsServiceProvider.php b/app/Providers/SettingsServiceProvider.php index 5cbcec105..71fda215e 100644 --- a/app/Providers/SettingsServiceProvider.php +++ b/app/Providers/SettingsServiceProvider.php @@ -63,11 +63,6 @@ class SettingsServiceProvider extends ServiceProvider /** * Boot the service provider. - * - * @param \Illuminate\Contracts\Config\Repository $config - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter - * @param \Psr\Log\LoggerInterface $log - * @param \Pterodactyl\Contracts\Repository\SettingsRepositoryInterface $settings */ public function boot(ConfigRepository $config, Encrypter $encrypter, Log $log, SettingsRepositoryInterface $settings) { @@ -118,9 +113,6 @@ class SettingsServiceProvider extends ServiceProvider } } - /** - * @return array - */ public static function getEncryptedKeys(): array { return self::$encrypted; diff --git a/app/Repositories/Eloquent/AllocationRepository.php b/app/Repositories/Eloquent/AllocationRepository.php index 15a5db81b..3723c1d1f 100644 --- a/app/Repositories/Eloquent/AllocationRepository.php +++ b/app/Repositories/Eloquent/AllocationRepository.php @@ -21,9 +21,6 @@ class AllocationRepository extends EloquentRepository implements AllocationRepos /** * 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 { @@ -42,15 +39,12 @@ class AllocationRepository extends EloquentRepository implements AllocationRepos * * If an array of nodes is passed the results will be limited to allocations * in those nodes. - * - * @param array $nodes - * @return array */ protected function getDiscardableDedicatedAllocations(array $nodes = []): array { $query = Allocation::query()->selectRaw('CONCAT_WS("-", node_id, ip) as result'); - if (! empty($nodes)) { + if (!empty($nodes)) { $query->whereIn('node_id', $nodes); } @@ -64,20 +58,17 @@ class AllocationRepository extends EloquentRepository implements AllocationRepos /** * 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) { $query = Allocation::query()->whereNull('server_id'); - if (! empty($nodes)) { + if (!empty($nodes)) { $query->whereIn('node_id', $nodes); } - if (! empty($ports)) { + if (!empty($ports)) { $query->where(function (Builder $inner) use ($ports) { $whereIn = []; foreach ($ports as $port) { @@ -89,7 +80,7 @@ class AllocationRepository extends EloquentRepository implements AllocationRepos $whereIn[] = $port; } - if (! empty($whereIn)) { + if (!empty($whereIn)) { $inner->orWhereIn('port', $whereIn); } }); @@ -100,9 +91,10 @@ class AllocationRepository extends EloquentRepository implements AllocationRepos if ($dedicated) { $discard = $this->getDiscardableDedicatedAllocations($nodes); - if (! empty($discard)) { + if (!empty($discard)) { $query->whereNotIn( - $this->getBuilder()->raw('CONCAT_WS("-", node_id, ip)'), $discard + $this->getBuilder()->raw('CONCAT_WS("-", node_id, ip)'), + $discard ); } } diff --git a/app/Repositories/Eloquent/ApiKeyRepository.php b/app/Repositories/Eloquent/ApiKeyRepository.php index 55d559544..67a7e6e6e 100644 --- a/app/Repositories/Eloquent/ApiKeyRepository.php +++ b/app/Repositories/Eloquent/ApiKeyRepository.php @@ -21,9 +21,6 @@ class ApiKeyRepository extends EloquentRepository implements ApiKeyRepositoryInt /** * 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 { @@ -34,9 +31,6 @@ class ApiKeyRepository extends EloquentRepository implements ApiKeyRepositoryInt /** * 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 { @@ -47,10 +41,6 @@ class ApiKeyRepository extends EloquentRepository implements ApiKeyRepositoryInt /** * 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 { @@ -62,10 +52,6 @@ class ApiKeyRepository extends EloquentRepository implements ApiKeyRepositoryInt /** * 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 { diff --git a/app/Repositories/Eloquent/BackupRepository.php b/app/Repositories/Eloquent/BackupRepository.php index 46e400142..b53547e44 100644 --- a/app/Repositories/Eloquent/BackupRepository.php +++ b/app/Repositories/Eloquent/BackupRepository.php @@ -18,8 +18,6 @@ class BackupRepository extends EloquentRepository /** * Determines if too many backups have been generated by the server. * - * @param int $server - * @param int $seconds * @return \Pterodactyl\Models\Backup[]|\Illuminate\Support\Collection */ public function getBackupsGeneratedDuringTimespan(int $server, int $seconds = 600) diff --git a/app/Repositories/Eloquent/DatabaseHostRepository.php b/app/Repositories/Eloquent/DatabaseHostRepository.php index 4ed4d411e..c55b03232 100644 --- a/app/Repositories/Eloquent/DatabaseHostRepository.php +++ b/app/Repositories/Eloquent/DatabaseHostRepository.php @@ -21,8 +21,6 @@ class DatabaseHostRepository extends EloquentRepository implements DatabaseHostR /** * 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 { diff --git a/app/Repositories/Eloquent/DatabaseRepository.php b/app/Repositories/Eloquent/DatabaseRepository.php index 46b3916da..4e421df4d 100644 --- a/app/Repositories/Eloquent/DatabaseRepository.php +++ b/app/Repositories/Eloquent/DatabaseRepository.php @@ -8,7 +8,6 @@ use Illuminate\Foundation\Application; use Illuminate\Database\DatabaseManager; use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface; -use Pterodactyl\Exceptions\Repository\DuplicateDatabaseNameException; class DatabaseRepository extends EloquentRepository implements DatabaseRepositoryInterface { @@ -24,9 +23,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * DatabaseRepository constructor. - * - * @param \Illuminate\Foundation\Application $application - * @param \Illuminate\Database\DatabaseManager $database */ public function __construct(Application $application, DatabaseManager $database) { @@ -48,7 +44,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * Set the connection name to execute statements against. * - * @param string $connection * @return $this */ public function setConnection(string $connection) @@ -60,8 +55,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * Return the connection to execute statements against. - * - * @return string */ public function getConnection(): string { @@ -70,9 +63,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * Return all of the databases belonging to a server. - * - * @param int $server - * @return \Illuminate\Support\Collection */ public function getDatabasesForServer(int $server): Collection { @@ -81,10 +71,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * 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 { @@ -95,9 +81,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * Create a new database on a given connection. - * - * @param string $database - * @return bool */ public function createDatabase(string $database): bool { @@ -107,15 +90,11 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * 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, $max_connections): bool { - if (! $max_connections) { + if (!$max_connections) { return $this->run(sprintf('CREATE USER `%s`@`%s` IDENTIFIED BY \'%s\'', $username, $remote, $password)); } else { return $this->run(sprintf('CREATE USER `%s`@`%s` IDENTIFIED BY \'%s\' WITH MAX_USER_CONNECTIONS %s', $username, $remote, $password, $max_connections)); @@ -124,11 +103,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * 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 { @@ -142,8 +116,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * Flush the privileges for a given connection. - * - * @return bool */ public function flush(): bool { @@ -152,9 +124,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * Drop a given database on a specific connection. - * - * @param string $database - * @return bool */ public function dropDatabase(string $database): bool { @@ -164,8 +133,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * Drop a given user on a specific connection. * - * @param string $username - * @param string $remote * @return mixed */ public function dropUser(string $username, string $remote): bool @@ -175,9 +142,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * Run the provided statement against the database on a given connection. - * - * @param string $statement - * @return bool */ private function run(string $statement): bool { diff --git a/app/Repositories/Eloquent/EggRepository.php b/app/Repositories/Eloquent/EggRepository.php index a716a5ec9..98b7db453 100644 --- a/app/Repositories/Eloquent/EggRepository.php +++ b/app/Repositories/Eloquent/EggRepository.php @@ -24,9 +24,6 @@ class EggRepository extends EloquentRepository implements EggRepositoryInterface /** * 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 @@ -34,14 +31,12 @@ class EggRepository extends EloquentRepository implements EggRepositoryInterface try { return $this->getBuilder()->with('variables')->findOrFail($id, $this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } /** * Return all eggs and their relations to be used in the daemon API. - * - * @return \Illuminate\Database\Eloquent\Collection */ public function getAllWithCopyAttributes(): Collection { @@ -52,8 +47,6 @@ class EggRepository extends EloquentRepository implements EggRepositoryInterface * Return an egg with the scriptFrom and configFrom relations loaded onto the model. * * @param int|string $value - * @param string $column - * @return \Pterodactyl\Models\Egg * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -64,16 +57,13 @@ class EggRepository extends EloquentRepository implements EggRepositoryInterface try { return $this->getBuilder()->with('scriptFrom', 'configFrom')->where($column, '=', $value)->firstOrFail($this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } /** * 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 @@ -81,16 +71,12 @@ class EggRepository extends EloquentRepository implements EggRepositoryInterface try { return $this->getBuilder()->with('scriptFrom', 'configFrom', 'variables')->findOrFail($id, $this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } /** * 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 { diff --git a/app/Repositories/Eloquent/EggVariableRepository.php b/app/Repositories/Eloquent/EggVariableRepository.php index 9d84b9db1..ce79a65f6 100644 --- a/app/Repositories/Eloquent/EggVariableRepository.php +++ b/app/Repositories/Eloquent/EggVariableRepository.php @@ -21,9 +21,6 @@ class EggVariableRepository extends EloquentRepository implements EggVariableRep /** * 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 { diff --git a/app/Repositories/Eloquent/EloquentRepository.php b/app/Repositories/Eloquent/EloquentRepository.php index bd8133022..3d3e09cdc 100644 --- a/app/Repositories/Eloquent/EloquentRepository.php +++ b/app/Repositories/Eloquent/EloquentRepository.php @@ -13,7 +13,6 @@ use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Pterodactyl\Contracts\Repository\RepositoryInterface; use Pterodactyl\Exceptions\Model\DataValidationException; use Pterodactyl\Exceptions\Repository\RecordNotFoundException; -use Pterodactyl\Contracts\Repository\Attributes\SearchableInterface; abstract class EloquentRepository extends Repository implements RepositoryInterface { @@ -28,6 +27,7 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf * context's such that we can pass through ?filter[name]=Dane&sort=desc for example. * * @param bool $usingFilters + * * @return $this */ public function usingRequestFilters($usingFilters = true) @@ -50,14 +50,11 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Paginate the response data based on the page para. * - * @param \Illuminate\Database\Eloquent\Builder $instance - * @param int $default - * * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator */ protected function paginate(Builder $instance, int $default = 50) { - if (! $this->useRequestFilters) { + if (!$this->useRequestFilters) { return $instance->paginate($default); } @@ -88,9 +85,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Create a new record in the database and return the associated model. * - * @param array $fields - * @param bool $validate - * @param bool $force * @return \Illuminate\Database\Eloquent\Model|bool * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -100,10 +94,10 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf $instance = $this->getBuilder()->newModelInstance(); ($force) ? $instance->forceFill($fields) : $instance->fill($fields); - if (! $validate) { + if (!$validate) { $saved = $instance->skipValidation()->save(); } else { - if (! $saved = $instance->save()) { + if (!$saved = $instance->save()) { throw new DataValidationException($instance->getValidator()); } } @@ -114,7 +108,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Find a model that has the specific ID passed. * - * @param int $id * @return \Illuminate\Database\Eloquent\Model * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -124,15 +117,12 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf try { return $this->getBuilder()->findOrFail($id, $this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } /** * Find a model matching an array of where clauses. - * - * @param array $fields - * @return \Illuminate\Support\Collection */ public function findWhere(array $fields): Collection { @@ -142,7 +132,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Find and return the first matching instance for the given fields. * - * @param array $fields * @return \Illuminate\Database\Eloquent\Model * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -152,15 +141,12 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf try { return $this->getBuilder()->where($fields)->firstOrFail($this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } /** * Return a count of records matching the passed arguments. - * - * @param array $fields - * @return int */ public function findCountWhere(array $fields): int { @@ -169,10 +155,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Delete a given record from the database. - * - * @param int $id - * @param bool $destroy - * @return int */ public function delete(int $id, bool $destroy = false): int { @@ -181,10 +163,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Delete records matching the given attributes. - * - * @param array $attributes - * @param bool $force - * @return int */ public function deleteWhere(array $attributes, bool $force = false): int { @@ -197,9 +175,7 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf * Update a given ID with the passed array of fields. * * @param int $id - * @param array $fields - * @param bool $validate - * @param bool $force + * * @return \Illuminate\Database\Eloquent\Model|bool * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -210,15 +186,15 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf try { $instance = $this->getBuilder()->where('id', $id)->firstOrFail(); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } ($force) ? $instance->forceFill($fields) : $instance->fill($fields); - if (! $validate) { + if (!$validate) { $saved = $instance->skipValidation()->save(); } else { - if (! $saved = $instance->save()) { + if (!$saved = $instance->save()) { throw new DataValidationException($instance->getValidator()); } } @@ -230,7 +206,7 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf * Update a model using the attributes passed. * * @param array|\Closure $attributes - * @param array $values + * * @return int */ public function updateWhere($attributes, array $values) @@ -241,11 +217,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * 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 { @@ -257,10 +228,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * 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 \Illuminate\Database\Eloquent\Model * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -284,7 +251,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Return all records associated with the given model. * - * @return \Illuminate\Support\Collection * @deprecated Just use the model */ public function all(): Collection @@ -294,9 +260,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * 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 { @@ -306,9 +269,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * 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 { @@ -317,9 +277,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Insert multiple records into the database and ignore duplicates. - * - * @param array $values - * @return bool */ public function insertIgnore(array $values): bool { @@ -333,7 +290,7 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf } $bindings = array_values(array_filter(array_flatten($values, 1), function ($binding) { - return ! $binding instanceof Expression; + return !$binding instanceof Expression; })); $grammar = $this->getBuilder()->toBase()->getGrammar(); @@ -352,7 +309,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Get the amount of entries in the database. * - * @return int * @deprecated just use the count method off a model */ public function count(): int diff --git a/app/Repositories/Eloquent/LocationRepository.php b/app/Repositories/Eloquent/LocationRepository.php index 6d14d5aa6..c06d10a9f 100644 --- a/app/Repositories/Eloquent/LocationRepository.php +++ b/app/Repositories/Eloquent/LocationRepository.php @@ -22,8 +22,6 @@ class LocationRepository extends EloquentRepository implements LocationRepositor /** * Return locations with a count of nodes and servers attached to it. - * - * @return \Illuminate\Support\Collection */ public function getAllWithDetails(): Collection { @@ -32,8 +30,6 @@ class LocationRepository extends EloquentRepository implements LocationRepositor /** * Return all of the available locations with the nodes as a relationship. - * - * @return \Illuminate\Support\Collection */ public function getAllWithNodes(): Collection { @@ -43,7 +39,6 @@ class LocationRepository extends EloquentRepository implements LocationRepositor /** * Return all of the nodes and their respective count of servers for a location. * - * @param int $id * @return mixed * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -53,14 +48,13 @@ class LocationRepository extends EloquentRepository implements LocationRepositor try { return $this->getBuilder()->with('nodes.servers')->findOrFail($id, $this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } /** * Return a location and the count of nodes in that location. * - * @param int $id * @return mixed * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -70,7 +64,7 @@ class LocationRepository extends EloquentRepository implements LocationRepositor try { return $this->getBuilder()->withCount('nodes')->findOrFail($id, $this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } } diff --git a/app/Repositories/Eloquent/MountRepository.php b/app/Repositories/Eloquent/MountRepository.php index 286e07913..490f76b64 100644 --- a/app/Repositories/Eloquent/MountRepository.php +++ b/app/Repositories/Eloquent/MountRepository.php @@ -22,8 +22,6 @@ class MountRepository extends EloquentRepository /** * Return mounts with a count of eggs, nodes, and servers attached to it. - * - * @return \Illuminate\Support\Collection */ public function getAllWithDetails(): Collection { @@ -33,7 +31,6 @@ class MountRepository extends EloquentRepository /** * Return all of the mounts and their respective relations. * - * @param string $id * @return mixed * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -43,15 +40,12 @@ class MountRepository extends EloquentRepository try { return $this->getBuilder()->with('eggs', 'nodes')->findOrFail($id, $this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } /** * Return mounts available to a server (ignoring if they are or are not mounted). - * - * @param Server $server - * @return \Illuminate\Support\Collection */ public function getMountListForServer(Server $server): Collection { diff --git a/app/Repositories/Eloquent/NestRepository.php b/app/Repositories/Eloquent/NestRepository.php index 96b3df36f..6d4992e45 100644 --- a/app/Repositories/Eloquent/NestRepository.php +++ b/app/Repositories/Eloquent/NestRepository.php @@ -29,6 +29,7 @@ class NestRepository extends EloquentRepository implements NestRepositoryInterfa * 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 @@ -37,10 +38,10 @@ class NestRepository extends EloquentRepository implements NestRepositoryInterfa { $instance = $this->getBuilder()->with('eggs', 'eggs.variables'); - if (! is_null($id)) { + if (!is_null($id)) { $instance = $instance->find($id, $this->getColumns()); - if (! $instance) { - throw new RecordNotFoundException; + if (!$instance) { + throw new RecordNotFoundException(); } return $instance; @@ -52,7 +53,6 @@ class NestRepository extends EloquentRepository implements NestRepositoryInterfa /** * 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 @@ -61,10 +61,10 @@ class NestRepository extends EloquentRepository implements NestRepositoryInterfa { $instance = $this->getBuilder()->withCount(['eggs', 'servers']); - if (! is_null($id)) { + if (!is_null($id)) { $instance = $instance->find($id, $this->getColumns()); - if (! $instance) { - throw new RecordNotFoundException; + if (!$instance) { + throw new RecordNotFoundException(); } return $instance; @@ -76,16 +76,13 @@ class NestRepository extends EloquentRepository implements NestRepositoryInterfa /** * 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 { $instance = $this->getBuilder()->with('eggs.servers')->find($id, $this->getColumns()); - if (! $instance) { - throw new RecordNotFoundException; + if (!$instance) { + throw new RecordNotFoundException(); } /* @var Nest $instance */ diff --git a/app/Repositories/Eloquent/NodeRepository.php b/app/Repositories/Eloquent/NodeRepository.php index 9c852fb56..5d1a8bcac 100644 --- a/app/Repositories/Eloquent/NodeRepository.php +++ b/app/Repositories/Eloquent/NodeRepository.php @@ -4,8 +4,6 @@ namespace Pterodactyl\Repositories\Eloquent; use Pterodactyl\Models\Node; use Illuminate\Support\Collection; -use Illuminate\Support\LazyCollection; -use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Pterodactyl\Contracts\Repository\NodeRepositoryInterface; class NodeRepository extends EloquentRepository implements NodeRepositoryInterface @@ -22,9 +20,6 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa /** * Return the usage stats for a single node. - * - * @param \Pterodactyl\Models\Node $node - * @return array */ public function getUsageStats(Node $node): array { @@ -57,9 +52,6 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa /** * Return the usage stats for a single node. - * - * @param \Pterodactyl\Models\Node $node - * @return array */ public function getUsageStatsRaw(Node $node): array { @@ -84,14 +76,10 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa /** * 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 { - if (! $node->relationLoaded('location') || $refresh) { + if (!$node->relationLoaded('location') || $refresh) { $node->load('location'); } @@ -109,14 +97,11 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa /** * 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 { - $node->setRelation('allocations', + $node->setRelation( + 'allocations', $node->allocations() ->orderByRaw('server_id IS NOT NULL DESC, server_id IS NULL') ->orderByRaw('INET_ATON(ip) ASC') @@ -130,8 +115,6 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa /** * Return a collection of nodes for all locations to use in server creation UI. - * - * @return \Illuminate\Support\Collection */ public function getNodesForServerCreation(): Collection { @@ -157,9 +140,6 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa /** * Returns a node with the given id with the Node's resource usage. - * - * @param int $node_id - * @return Node */ public function getNodeWithResourceUsage(int $node_id): Node { diff --git a/app/Repositories/Eloquent/PermissionRepository.php b/app/Repositories/Eloquent/PermissionRepository.php index e2d0b8cb5..bcd971408 100644 --- a/app/Repositories/Eloquent/PermissionRepository.php +++ b/app/Repositories/Eloquent/PermissionRepository.php @@ -11,6 +11,7 @@ class PermissionRepository extends EloquentRepository implements PermissionRepos * Return the model backing this repository. * * @return string + * * @throws \Exception */ public function model() diff --git a/app/Repositories/Eloquent/ScheduleRepository.php b/app/Repositories/Eloquent/ScheduleRepository.php index cb1b2cbf0..5c999df87 100644 --- a/app/Repositories/Eloquent/ScheduleRepository.php +++ b/app/Repositories/Eloquent/ScheduleRepository.php @@ -22,9 +22,6 @@ class ScheduleRepository extends EloquentRepository implements ScheduleRepositor /** * Return all of the schedules for a given server. - * - * @param int $server - * @return \Illuminate\Support\Collection */ public function findServerSchedules(int $server): Collection { @@ -34,9 +31,6 @@ class ScheduleRepository extends EloquentRepository implements ScheduleRepositor /** * 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 @@ -44,7 +38,7 @@ class ScheduleRepository extends EloquentRepository implements ScheduleRepositor try { return $this->getBuilder()->with('tasks')->findOrFail($schedule, $this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } } diff --git a/app/Repositories/Eloquent/ServerRepository.php b/app/Repositories/Eloquent/ServerRepository.php index 5c16664b6..2e308ce17 100644 --- a/app/Repositories/Eloquent/ServerRepository.php +++ b/app/Repositories/Eloquent/ServerRepository.php @@ -24,14 +24,10 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt /** * 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 { - if (! $server->relationLoaded('egg') || $refresh) { + if (!$server->relationLoaded('egg') || $refresh) { $server->load('egg.scriptFrom'); } @@ -40,18 +36,14 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt /** * 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 { $instance = $this->getBuilder()->with(['allocation', 'allocations', 'egg', 'node']); - if (! is_null($server) && is_null($node)) { + if (!is_null($server) && is_null($node)) { $instance = $instance->where('id', '=', $server); - } else if (is_null($server) && ! is_null($node)) { + } elseif (is_null($server) && !is_null($node)) { $instance = $instance->where('node_id', '=', $node); } @@ -60,18 +52,14 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt /** * 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 { $instance = $this->getBuilder()->with(['allocation', 'allocations', 'egg', 'node']); - if (! is_null($server) && is_null($node)) { + if (!is_null($server) && is_null($node)) { $instance = $instance->where('id', '=', $server); - } else if (is_null($server) && ! is_null($node)) { + } elseif (is_null($server) && !is_null($node)) { $instance = $instance->where('node_id', '=', $node); } @@ -81,9 +69,6 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt /** * 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 @@ -93,7 +78,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt ->where($this->getModel()->getKeyName(), '=', $id) ->firstOrFail($this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } @@ -101,14 +86,10 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt * 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 { - if (! $server->relationLoaded('allocation') || $refresh) { + if (!$server->relationLoaded('allocation') || $refresh) { $server->load('allocation'); } @@ -117,15 +98,11 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt /** * 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 { foreach (['allocation', 'allocations', 'egg'] as $relation) { - if (! $server->relationLoaded($relation) || $refresh) { + if (!$server->relationLoaded($relation) || $refresh) { $server->load($relation); } } @@ -135,14 +112,10 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt /** * 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 { - if (! $server->relationLoaded('databases') || $refresh) { + if (!$server->relationLoaded('databases') || $refresh) { $server->load('databases.host'); } @@ -153,14 +126,10 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt * 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 { - if (! $server->relationLoaded('egg') || $refresh) { + if (!$server->relationLoaded('egg') || $refresh) { $server->load('egg'); } @@ -172,9 +141,6 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt /** * Return a server by UUID. * - * @param string $uuid - * @return \Pterodactyl\Models\Server - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function getByUuid(string $uuid): Server @@ -190,26 +156,20 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt return $model; } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } /** * 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 { - return ! $this->getBuilder()->where('uuid', '=', $uuid)->orWhere('uuidShort', '=', $short)->exists(); + return !$this->getBuilder()->where('uuid', '=', $uuid)->orWhere('uuidShort', '=', $short)->exists(); } /** * Get the amount of servers that are suspended. - * - * @return int */ public function getSuspendedServersCount(): int { @@ -218,11 +178,6 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt /** * 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 { diff --git a/app/Repositories/Eloquent/SessionRepository.php b/app/Repositories/Eloquent/SessionRepository.php index 54c4ff629..ad069abb8 100644 --- a/app/Repositories/Eloquent/SessionRepository.php +++ b/app/Repositories/Eloquent/SessionRepository.php @@ -20,9 +20,6 @@ class SessionRepository extends EloquentRepository implements SessionRepositoryI /** * Return all of the active sessions for a user. - * - * @param int $user - * @return \Illuminate\Support\Collection */ public function getUserSessions(int $user): Collection { @@ -32,8 +29,6 @@ class SessionRepository extends EloquentRepository implements SessionRepositoryI /** * Delete a session for a given user. * - * @param int $user - * @param string $session * @return int|null */ public function deleteUserSession(int $user, string $session) diff --git a/app/Repositories/Eloquent/SettingsRepository.php b/app/Repositories/Eloquent/SettingsRepository.php index 42cc7efed..b39d3a2e1 100644 --- a/app/Repositories/Eloquent/SettingsRepository.php +++ b/app/Repositories/Eloquent/SettingsRepository.php @@ -30,9 +30,6 @@ class SettingsRepository extends EloquentRepository implements SettingsRepositor /** * 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 */ @@ -48,8 +45,8 @@ class SettingsRepository extends EloquentRepository implements SettingsRepositor /** * Retrieve a persistent setting from the database. * - * @param string $key * @param mixed $default + * * @return mixed */ public function get(string $key, $default = null) @@ -74,8 +71,6 @@ class SettingsRepository extends EloquentRepository implements SettingsRepositor /** * Remove a key from the database cache. - * - * @param string $key */ public function forget(string $key) { @@ -85,8 +80,6 @@ class SettingsRepository extends EloquentRepository implements SettingsRepositor /** * Remove a key from the cache. - * - * @param string $key */ private function clearCache(string $key) { diff --git a/app/Repositories/Eloquent/SubuserRepository.php b/app/Repositories/Eloquent/SubuserRepository.php index c0fb930a6..d40ed9fda 100644 --- a/app/Repositories/Eloquent/SubuserRepository.php +++ b/app/Repositories/Eloquent/SubuserRepository.php @@ -20,18 +20,14 @@ class SubuserRepository extends EloquentRepository implements SubuserRepositoryI /** * 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 { - if (! $subuser->relationLoaded('server') || $refresh) { + if (!$subuser->relationLoaded('server') || $refresh) { $subuser->load('server'); } - if (! $subuser->relationLoaded('user') || $refresh) { + if (!$subuser->relationLoaded('user') || $refresh) { $subuser->load('user'); } @@ -40,18 +36,14 @@ class SubuserRepository extends EloquentRepository implements SubuserRepositoryI /** * 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 { - if (! $subuser->relationLoaded('permissions') || $refresh) { + if (!$subuser->relationLoaded('permissions') || $refresh) { $subuser->load('permissions'); } - if (! $subuser->relationLoaded('user') || $refresh) { + if (!$subuser->relationLoaded('user') || $refresh) { $subuser->load('user'); } @@ -61,10 +53,6 @@ class SubuserRepository extends EloquentRepository implements SubuserRepositoryI /** * 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 @@ -75,7 +63,7 @@ class SubuserRepository extends EloquentRepository implements SubuserRepositoryI ])->first(); if (is_null($instance)) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } return $instance; diff --git a/app/Repositories/Eloquent/TaskRepository.php b/app/Repositories/Eloquent/TaskRepository.php index 3b43221e8..718f99490 100644 --- a/app/Repositories/Eloquent/TaskRepository.php +++ b/app/Repositories/Eloquent/TaskRepository.php @@ -22,9 +22,6 @@ class TaskRepository extends EloquentRepository implements TaskRepositoryInterfa /** * 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 @@ -32,15 +29,13 @@ class TaskRepository extends EloquentRepository implements TaskRepositoryInterfa try { return $this->getBuilder()->with('server.user', 'schedule')->findOrFail($id, $this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } /** * 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) diff --git a/app/Repositories/Repository.php b/app/Repositories/Repository.php index c209e33ba..a80051942 100644 --- a/app/Repositories/Repository.php +++ b/app/Repositories/Repository.php @@ -30,8 +30,6 @@ abstract class Repository implements RepositoryInterface /** * Repository constructor. - * - * @param \Illuminate\Foundation\Application $application */ public function __construct(Application $application) { @@ -61,6 +59,7 @@ abstract class Repository implements RepositoryInterface * Setup column selection functionality. * * @param array|string $columns + * * @return $this */ public function setColumns($columns = ['*']) @@ -106,7 +105,6 @@ abstract class Repository implements 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) @@ -121,6 +119,7 @@ abstract class Repository implements RepositoryInterface * Take the provided model and make it accessible to the rest of the repository. * * @param array $model + * * @return mixed */ protected function initializeModel(...$model) diff --git a/app/Repositories/Wings/DaemonBackupRepository.php b/app/Repositories/Wings/DaemonBackupRepository.php index 782f39d62..603fb2156 100644 --- a/app/Repositories/Wings/DaemonBackupRepository.php +++ b/app/Repositories/Wings/DaemonBackupRepository.php @@ -19,7 +19,6 @@ class DaemonBackupRepository extends DaemonRepository /** * Sets the backup adapter for this execution instance. * - * @param string $adapter * @return $this */ public function setBackupAdapter(string $adapter) @@ -32,9 +31,6 @@ class DaemonBackupRepository extends DaemonRepository /** * Tells the remote Daemon to begin generating a backup for the server. * - * @param \Pterodactyl\Models\Backup $backup - * @return \Psr\Http\Message\ResponseInterface - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function backup(Backup $backup): ResponseInterface @@ -90,8 +86,6 @@ class DaemonBackupRepository extends DaemonRepository /** * Deletes a backup from the daemon. * - * @param \Pterodactyl\Models\Backup $backup - * @return \Psr\Http\Message\ResponseInterface * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function delete(Backup $backup): ResponseInterface diff --git a/app/Repositories/Wings/DaemonCommandRepository.php b/app/Repositories/Wings/DaemonCommandRepository.php index 38f2fb475..390434bff 100644 --- a/app/Repositories/Wings/DaemonCommandRepository.php +++ b/app/Repositories/Wings/DaemonCommandRepository.php @@ -14,7 +14,6 @@ class DaemonCommandRepository extends DaemonRepository * Sends a command or multiple commands to a running server instance. * * @param string|string[] $command - * @return \Psr\Http\Message\ResponseInterface * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ diff --git a/app/Repositories/Wings/DaemonConfigurationRepository.php b/app/Repositories/Wings/DaemonConfigurationRepository.php index ffd498cbc..f2672ddfa 100644 --- a/app/Repositories/Wings/DaemonConfigurationRepository.php +++ b/app/Repositories/Wings/DaemonConfigurationRepository.php @@ -11,7 +11,6 @@ class DaemonConfigurationRepository extends DaemonRepository /** * Returns system information from the wings instance. * - * @return array * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function getSystemInformation(): array @@ -30,15 +29,16 @@ class DaemonConfigurationRepository extends DaemonRepository * this instance using a passed-in model. This allows us to change plenty of information * in the model, and still use the old, pre-update model to actually make the HTTP request. * - * @param \Pterodactyl\Models\Node $node * @return \Psr\Http\Message\ResponseInterface + * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function update(Node $node) { try { return $this->getHttpClient()->post( - '/api/update', ['json' => $node->getConfiguration()] + '/api/update', + ['json' => $node->getConfiguration()] ); } catch (TransferException $exception) { throw new DaemonConnectionException($exception); diff --git a/app/Repositories/Wings/DaemonFileRepository.php b/app/Repositories/Wings/DaemonFileRepository.php index da6cb7ae2..f1acdc7de 100644 --- a/app/Repositories/Wings/DaemonFileRepository.php +++ b/app/Repositories/Wings/DaemonFileRepository.php @@ -14,9 +14,7 @@ class DaemonFileRepository extends DaemonRepository /** * Return the contents of a given file. * - * @param string $path * @param int|null $notLargerThan the maximum content length in bytes - * @return string * * @throws \GuzzleHttp\Exception\TransferException * @throws \Pterodactyl\Exceptions\Http\Server\FileSizeTooLargeException @@ -37,10 +35,10 @@ class DaemonFileRepository extends DaemonRepository throw new DaemonConnectionException($exception); } - $length = (int)$response->getHeader('Content-Length')[0] ?? 0; + $length = (int) $response->getHeader('Content-Length')[0] ?? 0; if ($notLargerThan && $length > $notLargerThan) { - throw new FileSizeTooLargeException; + throw new FileSizeTooLargeException(); } return $response->getBody()->__toString(); @@ -50,10 +48,6 @@ class DaemonFileRepository extends DaemonRepository * Save new contents to a given file. This works for both creating and updating * a file. * - * @param string $path - * @param string $content - * @return \Psr\Http\Message\ResponseInterface - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function putContent(string $path, string $content): ResponseInterface @@ -76,9 +70,6 @@ class DaemonFileRepository extends DaemonRepository /** * Return a directory listing for a given path. * - * @param string $path - * @return array - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function getDirectory(string $path): array @@ -102,10 +93,6 @@ class DaemonFileRepository extends DaemonRepository /** * Creates a new directory for the server in the given $path. * - * @param string $name - * @param string $path - * @return \Psr\Http\Message\ResponseInterface - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function createDirectory(string $name, string $path): ResponseInterface @@ -130,10 +117,6 @@ class DaemonFileRepository extends DaemonRepository /** * Renames or moves a file on the remote machine. * - * @param string|null $root - * @param array $files - * @return \Psr\Http\Message\ResponseInterface - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function renameFiles(?string $root, array $files): ResponseInterface @@ -158,9 +141,6 @@ class DaemonFileRepository extends DaemonRepository /** * Copy a given file and give it a unique name. * - * @param string $location - * @return \Psr\Http\Message\ResponseInterface - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function copyFile(string $location): ResponseInterface @@ -184,10 +164,6 @@ class DaemonFileRepository extends DaemonRepository /** * Delete a file or folder for the server. * - * @param string|null $root - * @param array $files - * @return \Psr\Http\Message\ResponseInterface - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function deleteFiles(?string $root, array $files): ResponseInterface @@ -212,10 +188,6 @@ class DaemonFileRepository extends DaemonRepository /** * Compress the given files or folders in the given root. * - * @param string|null $root - * @param array $files - * @return array - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function compressFiles(?string $root, array $files): array @@ -245,10 +217,6 @@ class DaemonFileRepository extends DaemonRepository /** * Decompresses a given archive file. * - * @param string|null $root - * @param string $file - * @return \Psr\Http\Message\ResponseInterface - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function decompressFile(?string $root, string $file): ResponseInterface @@ -273,10 +241,6 @@ class DaemonFileRepository extends DaemonRepository /** * Chmods the given files. * - * @param string|null $root - * @param array $files - * @return \Psr\Http\Message\ResponseInterface - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function chmodFiles(?string $root, array $files): ResponseInterface @@ -301,10 +265,6 @@ class DaemonFileRepository extends DaemonRepository /** * Pulls a file from the given URL and saves it to the disk. * - * @param string $url - * @param string|null $directory - * @return \Psr\Http\Message\ResponseInterface - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function pull(string $url, ?string $directory): ResponseInterface diff --git a/app/Repositories/Wings/DaemonPowerRepository.php b/app/Repositories/Wings/DaemonPowerRepository.php index ccbf169ff..4e290cfc9 100644 --- a/app/Repositories/Wings/DaemonPowerRepository.php +++ b/app/Repositories/Wings/DaemonPowerRepository.php @@ -13,9 +13,6 @@ class DaemonPowerRepository extends DaemonRepository /** * Sends a power action to the server instance. * - * @param string $action - * @return \Psr\Http\Message\ResponseInterface - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function send(string $action): ResponseInterface diff --git a/app/Repositories/Wings/DaemonRepository.php b/app/Repositories/Wings/DaemonRepository.php index 4ebe249cf..268a4a213 100644 --- a/app/Repositories/Wings/DaemonRepository.php +++ b/app/Repositories/Wings/DaemonRepository.php @@ -27,8 +27,6 @@ abstract class DaemonRepository /** * BaseWingsRepository constructor. - * - * @param \Illuminate\Contracts\Foundation\Application $application */ public function __construct(Application $application) { @@ -38,7 +36,6 @@ abstract class DaemonRepository /** * Set the server model this request is stemming from. * - * @param \Pterodactyl\Models\Server $server * @return $this */ public function setServer(Server $server) @@ -53,7 +50,6 @@ abstract class DaemonRepository /** * Set the node model this request is stemming from. * - * @param \Pterodactyl\Models\Node $node * @return $this */ public function setNode(Node $node) @@ -65,9 +61,6 @@ abstract class DaemonRepository /** * Return an instance of the Guzzle HTTP Client to be used for requests. - * - * @param array $headers - * @return \GuzzleHttp\Client */ public function getHttpClient(array $headers = []): Client { diff --git a/app/Repositories/Wings/DaemonServerRepository.php b/app/Repositories/Wings/DaemonServerRepository.php index f8af0c034..35df86d84 100644 --- a/app/Repositories/Wings/DaemonServerRepository.php +++ b/app/Repositories/Wings/DaemonServerRepository.php @@ -3,7 +3,6 @@ namespace Pterodactyl\Repositories\Wings; use Webmozart\Assert\Assert; -use Pterodactyl\Models\User; use Pterodactyl\Models\Server; use GuzzleHttp\Exception\TransferException; use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; @@ -33,8 +32,6 @@ class DaemonServerRepository extends DaemonRepository /** * Creates a new server on the Wings daemon. * - * @param array $data - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function create(array $data): void @@ -43,7 +40,8 @@ class DaemonServerRepository extends DaemonRepository try { $this->getHttpClient()->post( - '/api/servers', [ + '/api/servers', + [ 'json' => $data, ] ); @@ -55,8 +53,6 @@ class DaemonServerRepository extends DaemonRepository /** * Updates details about a server on the Daemon. * - * @param array $data - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function update(array $data): void @@ -97,7 +93,8 @@ class DaemonServerRepository extends DaemonRepository try { $this->getHttpClient()->post(sprintf( - '/api/servers/%s/reinstall', $this->server->uuid + '/api/servers/%s/reinstall', + $this->server->uuid )); } catch (TransferException $exception) { throw new DaemonConnectionException($exception); @@ -108,8 +105,6 @@ class DaemonServerRepository extends DaemonRepository * By default this function will suspend a server instance on the daemon. However, passing * "true" as the first argument will unsuspend the server. * - * @param bool $unsuspend - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function suspend(bool $unsuspend = false): void @@ -119,7 +114,7 @@ class DaemonServerRepository extends DaemonRepository try { $this->getHttpClient()->patch( '/api/servers/' . $this->server->uuid, - ['json' => ['suspended' => ! $unsuspend]] + ['json' => ['suspended' => !$unsuspend]] ); } catch (TransferException $exception) { throw new DaemonConnectionException($exception); @@ -138,7 +133,8 @@ class DaemonServerRepository extends DaemonRepository try { $this->getHttpClient()->post(sprintf( - '/api/servers/%s/archive', $this->server->uuid + '/api/servers/%s/archive', + $this->server->uuid )); } catch (TransferException $exception) { throw new DaemonConnectionException($exception); @@ -150,21 +146,19 @@ class DaemonServerRepository extends DaemonRepository * make it easier to revoke tokens on the fly. This ensures that the JTI key is formatted * correctly and avoids any costly mistakes in the codebase. * - * @param int $id * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function revokeUserJTI(int $id): void { Assert::isInstanceOf($this->server, Server::class); - $this->revokeJTIs([ md5($id . $this->server->uuid) ]); + $this->revokeJTIs([md5($id . $this->server->uuid)]); } /** * Revokes an array of JWT JTI's by marking any token generated before the current time on * the Wings instance as being invalid. * - * @param array $jtis * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ protected function revokeJTIs(array $jtis): void diff --git a/app/Repositories/Wings/DaemonTransferRepository.php b/app/Repositories/Wings/DaemonTransferRepository.php index e8a514196..74a1e3dc7 100644 --- a/app/Repositories/Wings/DaemonTransferRepository.php +++ b/app/Repositories/Wings/DaemonTransferRepository.php @@ -10,11 +10,6 @@ use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; class DaemonTransferRepository extends DaemonRepository { /** - * @param Server $server - * @param array $data - * @param Node $node - * @param string $token - * * @throws DaemonConnectionException */ public function notify(Server $server, array $data, Node $node, string $token): void diff --git a/app/Rules/Username.php b/app/Rules/Username.php index 1cceae5f9..8d1373ea0 100644 --- a/app/Rules/Username.php +++ b/app/Rules/Username.php @@ -18,8 +18,7 @@ class Username implements Rule * Allowed characters: a-z0-9_-. * * @param string $attribute - * @param mixed $value - * @return bool + * @param mixed $value */ public function passes($attribute, $value): bool { @@ -28,8 +27,6 @@ class Username implements Rule /** * Return a validation message for use when this rule fails. - * - * @return string */ public function message(): string { diff --git a/app/Services/Acl/Api/AdminAcl.php b/app/Services/Acl/Api/AdminAcl.php index 96085e152..880794adc 100644 --- a/app/Services/Acl/Api/AdminAcl.php +++ b/app/Services/Acl/Api/AdminAcl.php @@ -11,35 +11,33 @@ class AdminAcl * Resource permission columns in the api_keys table begin * with this identifier. */ - const COLUMN_IDENTIFIER = 'r_'; + public const COLUMN_IDENTIFIER = 'r_'; /** * The different types of permissions available for API keys. This * implements a read/write/none permissions scheme for all endpoints. */ - const NONE = 0; - const READ = 1; - const WRITE = 2; + public const NONE = 0; + public const READ = 1; + public const WRITE = 2; /** * Resources that are available on the API and can contain a permissions * set for each key. These are stored in the database as r_{resource}. */ - const RESOURCE_SERVERS = 'servers'; - const RESOURCE_NODES = 'nodes'; - const RESOURCE_ALLOCATIONS = 'allocations'; - const RESOURCE_USERS = 'users'; - const RESOURCE_LOCATIONS = 'locations'; - const RESOURCE_NESTS = 'nests'; - const RESOURCE_EGGS = 'eggs'; - const RESOURCE_DATABASE_HOSTS = 'database_hosts'; - const RESOURCE_SERVER_DATABASES = 'server_databases'; + public const RESOURCE_SERVERS = 'servers'; + public const RESOURCE_NODES = 'nodes'; + public const RESOURCE_ALLOCATIONS = 'allocations'; + public const RESOURCE_USERS = 'users'; + public const RESOURCE_LOCATIONS = 'locations'; + public const RESOURCE_NESTS = 'nests'; + public const RESOURCE_EGGS = 'eggs'; + public const RESOURCE_DATABASE_HOSTS = 'database_hosts'; + public const RESOURCE_SERVER_DATABASES = 'server_databases'; /** * Determine if an API key has permission to perform a specific read/write operation. * - * @param int $permission - * @param int $action * @return bool */ public static function can(int $permission, int $action = self::READ) @@ -55,9 +53,6 @@ class AdminAcl * Determine if an API Key model has permission to access a given resource * at a specific action level. * - * @param \Pterodactyl\Models\ApiKey $key - * @param string $resource - * @param int $action * @return bool */ public static function check(ApiKey $key, string $resource, int $action = self::READ) @@ -68,7 +63,6 @@ class AdminAcl /** * Return a list of all resource constants defined in this ACL. * - * @return array * @throws \ReflectionException */ public static function getResourceList(): array diff --git a/app/Services/Allocations/AllocationDeletionService.php b/app/Services/Allocations/AllocationDeletionService.php index 5e81a1d2f..4b1bfec3b 100644 --- a/app/Services/Allocations/AllocationDeletionService.php +++ b/app/Services/Allocations/AllocationDeletionService.php @@ -15,8 +15,6 @@ class AllocationDeletionService /** * AllocationDeletionService constructor. - * - * @param \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface $repository */ public function __construct(AllocationRepositoryInterface $repository) { @@ -27,14 +25,13 @@ class AllocationDeletionService * Delete an allocation from the database only if it does not have a server * that is actively attached to it. * - * @param \Pterodactyl\Models\Allocation $allocation * @return int * * @throws \Pterodactyl\Exceptions\Service\Allocation\ServerUsingAllocationException */ public function handle(Allocation $allocation) { - if (! is_null($allocation->server_id)) { + if (!is_null($allocation->server_id)) { throw new ServerUsingAllocationException(trans('exceptions.allocations.server_using')); } diff --git a/app/Services/Allocations/AssignmentService.php b/app/Services/Allocations/AssignmentService.php index 99ae40f29..09313e4c9 100644 --- a/app/Services/Allocations/AssignmentService.php +++ b/app/Services/Allocations/AssignmentService.php @@ -13,12 +13,12 @@ use Pterodactyl\Exceptions\Service\Allocation\TooManyPortsInRangeException; class AssignmentService { - const CIDR_MAX_BITS = 27; - const CIDR_MIN_BITS = 32; - const PORT_FLOOR = 1024; - const PORT_CEIL = 65535; - const PORT_RANGE_LIMIT = 1000; - const PORT_RANGE_REGEX = '/^(\d{4,5})-(\d{4,5})$/'; + public const CIDR_MAX_BITS = 27; + public const CIDR_MIN_BITS = 32; + public const PORT_FLOOR = 1024; + public const PORT_CEIL = 65535; + public const PORT_RANGE_LIMIT = 1000; + public const PORT_RANGE_REGEX = '/^(\d{4,5})-(\d{4,5})$/'; /** * @var \Illuminate\Database\ConnectionInterface @@ -32,9 +32,6 @@ class AssignmentService /** * AssignmentService constructor. - * - * @param \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface $repository - * @param \Illuminate\Database\ConnectionInterface $connection */ public function __construct(AllocationRepositoryInterface $repository, ConnectionInterface $connection) { @@ -45,9 +42,6 @@ class AssignmentService /** * Insert allocations into the database and link them to a specific node. * - * @param \Pterodactyl\Models\Node $node - * @param array $data - * * @throws \Pterodactyl\Exceptions\Service\Allocation\CidrOutOfRangeException * @throws \Pterodactyl\Exceptions\Service\Allocation\PortOutOfRangeException * @throws \Pterodactyl\Exceptions\Service\Allocation\InvalidPortMappingException @@ -57,15 +51,15 @@ class AssignmentService { $explode = explode('/', $data['allocation_ip']); if (count($explode) !== 1) { - if (! ctype_digit($explode[1]) || ($explode[1] > self::CIDR_MIN_BITS || $explode[1] < self::CIDR_MAX_BITS)) { - throw new CidrOutOfRangeException; + if (!ctype_digit($explode[1]) || ($explode[1] > self::CIDR_MIN_BITS || $explode[1] < self::CIDR_MAX_BITS)) { + throw new CidrOutOfRangeException(); } } $this->connection->beginTransaction(); foreach (Network::parse(gethostbyname($data['allocation_ip'])) as $ip) { foreach ($data['allocation_ports'] as $port) { - if (! is_digit($port) && ! preg_match(self::PORT_RANGE_REGEX, $port)) { + if (!is_digit($port) && !preg_match(self::PORT_RANGE_REGEX, $port)) { throw new InvalidPortMappingException($port); } @@ -74,11 +68,11 @@ class AssignmentService $block = range($matches[1], $matches[2]); if (count($block) > self::PORT_RANGE_LIMIT) { - throw new TooManyPortsInRangeException; + throw new TooManyPortsInRangeException(); } if ((int) $matches[1] <= self::PORT_FLOOR || (int) $matches[2] > self::PORT_CEIL) { - throw new PortOutOfRangeException; + throw new PortOutOfRangeException(); } foreach ($block as $unit) { @@ -92,7 +86,7 @@ class AssignmentService } } else { if ((int) $port <= self::PORT_FLOOR || (int) $port > self::PORT_CEIL) { - throw new PortOutOfRangeException; + throw new PortOutOfRangeException(); } $insertData[] = [ diff --git a/app/Services/Allocations/FindAssignableAllocationService.php b/app/Services/Allocations/FindAssignableAllocationService.php index 6f523663a..29c37123f 100644 --- a/app/Services/Allocations/FindAssignableAllocationService.php +++ b/app/Services/Allocations/FindAssignableAllocationService.php @@ -30,7 +30,6 @@ class FindAssignableAllocationService * no allocation can be found, a new one will be created with a random port between the defined * range from the configuration. * - * @param \Pterodactyl\Models\Server $server * @return \Pterodactyl\Models\Allocation * * @throws \Pterodactyl\Exceptions\DisplayException @@ -41,8 +40,8 @@ class FindAssignableAllocationService */ public function handle(Server $server) { - if (! config('pterodactyl.client_features.allocations.enabled')) { - throw new AutoAllocationNotEnabledException; + if (!config('pterodactyl.client_features.allocations.enabled')) { + throw new AutoAllocationNotEnabledException(); } // Attempt to find a given available allocation for a server. If one cannot be found @@ -67,9 +66,6 @@ class FindAssignableAllocationService * in the settings. If there are no matches in that range, or something is wrong with the * range information provided an exception will be raised. * - * @param \Pterodactyl\Models\Server $server - * @return \Pterodactyl\Models\Allocation - * * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Service\Allocation\CidrOutOfRangeException * @throws \Pterodactyl\Exceptions\Service\Allocation\InvalidPortMappingException @@ -81,8 +77,8 @@ class FindAssignableAllocationService $start = config('pterodactyl.client_features.allocations.range_start', null); $end = config('pterodactyl.client_features.allocations.range_end', null); - if (! $start || ! $end) { - throw new NoAutoAllocationSpaceAvailableException; + if (!$start || !$end) { + throw new NoAutoAllocationSpaceAvailableException(); } Assert::integerish($start); @@ -102,7 +98,7 @@ class FindAssignableAllocationService // If we've already allocated all of the ports, just abort. if (empty($available)) { - throw new NoAutoAllocationSpaceAvailableException; + throw new NoAutoAllocationSpaceAvailableException(); } // Pick a random port out of the remaining available ports. diff --git a/app/Services/Api/KeyCreationService.php b/app/Services/Api/KeyCreationService.php index a1547897e..20a11add0 100644 --- a/app/Services/Api/KeyCreationService.php +++ b/app/Services/Api/KeyCreationService.php @@ -25,9 +25,6 @@ class KeyCreationService /** * ApiKeyService constructor. - * - * @param \Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface $repository - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter */ public function __construct(ApiKeyRepositoryInterface $repository, Encrypter $encrypter) { @@ -39,7 +36,6 @@ class KeyCreationService * Set the type of key that should be created. By default an orphaned key will be * created. These keys cannot be used for anything, and will not render in the UI. * - * @param int $type * @return \Pterodactyl\Services\Api\KeyCreationService */ public function setKeyType(int $type) @@ -54,10 +50,6 @@ class KeyCreationService * This will automatically generate an identifier and an encrypted token that are * stored in the database. * - * @param array $data - * @param array $permissions - * @return \Pterodactyl\Models\ApiKey - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ public function handle(array $data, array $permissions = []): ApiKey diff --git a/app/Services/Backups/DeleteBackupService.php b/app/Services/Backups/DeleteBackupService.php index cdb61844b..6c612e048 100644 --- a/app/Services/Backups/DeleteBackupService.php +++ b/app/Services/Backups/DeleteBackupService.php @@ -35,11 +35,6 @@ class DeleteBackupService /** * DeleteBackupService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Repositories\Eloquent\BackupRepository $repository - * @param \Pterodactyl\Extensions\Backups\BackupManager $manager - * @param \Pterodactyl\Repositories\Wings\DaemonBackupRepository $daemonBackupRepository */ public function __construct( ConnectionInterface $connection, @@ -56,7 +51,6 @@ class DeleteBackupService /** * Deletes a backup from the system. * - * @param \Pterodactyl\Models\Backup $backup * @throws \Throwable */ public function handle(Backup $backup) @@ -74,7 +68,7 @@ class DeleteBackupService $previous = $exception->getPrevious(); // Don't fail the request if the Daemon responds with a 404, just assume the backup // doesn't actually exist and remove it's reference from the Panel as well. - if (! $previous instanceof ClientException || $previous->getResponse()->getStatusCode() !== Response::HTTP_NOT_FOUND) { + if (!$previous instanceof ClientException || $previous->getResponse()->getStatusCode() !== Response::HTTP_NOT_FOUND) { throw $exception; } } @@ -86,7 +80,6 @@ class DeleteBackupService /** * Deletes a backup from an S3 disk. * - * @param \Pterodactyl\Models\Backup $backup * @throws \Throwable */ protected function deleteFromS3(Backup $backup) diff --git a/app/Services/Backups/InitiateBackupService.php b/app/Services/Backups/InitiateBackupService.php index 0aa7ae4ed..b55f0f8ce 100644 --- a/app/Services/Backups/InitiateBackupService.php +++ b/app/Services/Backups/InitiateBackupService.php @@ -49,11 +49,7 @@ class InitiateBackupService /** * InitiateBackupService constructor. * - * @param \Pterodactyl\Repositories\Eloquent\BackupRepository $repository - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Repositories\Wings\DaemonBackupRepository $daemonBackupRepository * @param \Pterodactyl\Services\Backups\DeleteBackupService $deleteBackupService - * @param \Pterodactyl\Extensions\Backups\BackupManager $backupManager */ public function __construct( BackupRepository $repository, @@ -73,6 +69,7 @@ class InitiateBackupService * Sets the files to be ignored by this backup. * * @param string[]|null $ignored + * * @return $this */ public function setIgnoredFiles(?array $ignored) @@ -96,12 +93,6 @@ class InitiateBackupService /** * Initiates the backup process for a server on the daemon. * - * @param \Pterodactyl\Models\Server $server - * @param string|null $name - * @param bool $override - * - * @return \Pterodactyl\Models\Backup - * * @throws \Throwable * @throws \Pterodactyl\Exceptions\Service\Backup\TooManyBackupsException * @throws \Symfony\Component\HttpKernel\Exception\TooManyRequestsHttpException @@ -113,17 +104,14 @@ class InitiateBackupService if ($period > 0) { $previous = $this->repository->getBackupsGeneratedDuringTimespan($server->id, $period); if ($previous->count() >= $limit) { - throw new TooManyRequestsHttpException( - CarbonImmutable::now()->diffInSeconds($previous->last()->created_at->addSeconds($period)), - sprintf('Only %d backups may be generated within a %d second span of time.', $limit, $period) - ); + throw new TooManyRequestsHttpException(CarbonImmutable::now()->diffInSeconds($previous->last()->created_at->addSeconds($period)), sprintf('Only %d backups may be generated within a %d second span of time.', $limit, $period)); } } // Check if the server has reached or exceeded it's backup limit - if (! $server->backup_limit || $server->backups()->where('is_successful', true)->count() >= $server->backup_limit) { + if (!$server->backup_limit || $server->backups()->where('is_successful', true)->count() >= $server->backup_limit) { // Do not allow the user to continue if this server is already at its limit and can't override. - if (! $override || $server->backup_limit <= 0) { + if (!$override || $server->backup_limit <= 0) { throw new TooManyBackupsException($server->backup_limit); } diff --git a/app/Services/Databases/DatabaseManagementService.php b/app/Services/Databases/DatabaseManagementService.php index 832e4bdf1..a10b22719 100644 --- a/app/Services/Databases/DatabaseManagementService.php +++ b/app/Services/Databases/DatabaseManagementService.php @@ -8,7 +8,6 @@ use Pterodactyl\Models\Server; use Pterodactyl\Models\Database; use Pterodactyl\Helpers\Utilities; use Illuminate\Database\ConnectionInterface; -use Symfony\Component\VarDumper\Cloner\Data; use Illuminate\Contracts\Encryption\Encrypter; use Pterodactyl\Extensions\DynamicDatabaseConnection; use Pterodactyl\Repositories\Eloquent\DatabaseRepository; @@ -58,11 +57,6 @@ class DatabaseManagementService /** * CreationService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Extensions\DynamicDatabaseConnection $dynamic - * @param \Pterodactyl\Repositories\Eloquent\DatabaseRepository $repository - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter */ public function __construct( ConnectionInterface $connection, @@ -80,10 +74,6 @@ class DatabaseManagementService * Generates a unique database name for the given server. This name should be passed through when * calling this handle function for this service, otherwise the database will be created with * whatever name is provided. - * - * @param string $name - * @param int $serverId - * @return string */ public static function generateUniqueDatabaseName(string $name, int $serverId): string { @@ -95,7 +85,6 @@ class DatabaseManagementService * Set wether or not this class should validate that the server has enough slots * left before creating the new database. * - * @param bool $validate * @return $this */ public function setValidateDatabaseLimit(bool $validate): self @@ -108,8 +97,6 @@ class DatabaseManagementService /** * Create a new database that is linked to a specific host. * - * @param \Pterodactyl\Models\Server $server - * @param array $data * @return \Pterodactyl\Models\Database * * @throws \Throwable @@ -118,23 +105,21 @@ class DatabaseManagementService */ public function create(Server $server, array $data) { - if (! config('pterodactyl.client_features.databases.enabled')) { - throw new DatabaseClientFeatureNotEnabledException; + if (!config('pterodactyl.client_features.databases.enabled')) { + throw new DatabaseClientFeatureNotEnabledException(); } if ($this->validateDatabaseLimit) { // If the server has a limit assigned and we've already reached that limit, throw back // an exception and kill the process. - if (! is_null($server->database_limit) && $server->databases()->count() >= $server->database_limit) { - throw new TooManyDatabasesException; + if (!is_null($server->database_limit) && $server->databases()->count() >= $server->database_limit) { + throw new TooManyDatabasesException(); } } // Protect against developer mistakes... - if (empty($data['database']) || ! preg_match(self::MATCH_NAME_REGEX, $data['database'])) { - throw new InvalidArgumentException( - 'The database name passed to DatabaseManagementService::handle MUST be prefixed with "s{server_id}_".' - ); + if (empty($data['database']) || !preg_match(self::MATCH_NAME_REGEX, $data['database'])) { + throw new InvalidArgumentException('The database name passed to DatabaseManagementService::handle MUST be prefixed with "s{server_id}_".'); } $data = array_merge($data, [ @@ -155,7 +140,10 @@ class DatabaseManagementService $this->repository->createDatabase($database->database); $this->repository->createUser( - $database->username, $database->remote, $this->encrypter->decrypt($database->password), $database->max_connections + $database->username, + $database->remote, + $this->encrypter->decrypt($database->password), + $database->max_connections ); $this->repository->assignUserToDatabase($database->database, $database->username, $database->remote); $this->repository->flush(); @@ -181,7 +169,6 @@ class DatabaseManagementService /** * Delete a database from the given host server. * - * @param \Pterodactyl\Models\Database $database * @return bool|null * * @throws \Exception @@ -202,9 +189,6 @@ class DatabaseManagementService * have the same name across multiple hosts, for the sake of keeping this logic easy to understand * and avoiding user confusion we will ignore the specific host and just look across all hosts. * - * @param array $data - * @return \Pterodactyl\Models\Database - * * @throws \Pterodactyl\Exceptions\Repository\DuplicateDatabaseNameException * @throws \Throwable */ @@ -215,12 +199,10 @@ class DatabaseManagementService ->exists(); if ($exists) { - throw new DuplicateDatabaseNameException( - 'A database with that name already exists for this server.' - ); + throw new DuplicateDatabaseNameException('A database with that name already exists for this server.'); } - $database = (new Database)->forceFill($data); + $database = (new Database())->forceFill($data); $database->saveOrFail(); return $database; diff --git a/app/Services/Databases/DatabasePasswordService.php b/app/Services/Databases/DatabasePasswordService.php index 2a9ebcabe..aabe98388 100644 --- a/app/Services/Databases/DatabasePasswordService.php +++ b/app/Services/Databases/DatabasePasswordService.php @@ -33,11 +33,6 @@ class DatabasePasswordService /** * DatabasePasswordService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface $repository - * @param \Pterodactyl\Extensions\DynamicDatabaseConnection $dynamic - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter */ public function __construct( ConnectionInterface $connection, @@ -55,7 +50,6 @@ class DatabasePasswordService * Updates a password for a given database. * * @param \Pterodactyl\Models\Database|int $database - * @return string * * @throws \Throwable */ diff --git a/app/Services/Databases/DeployServerDatabaseService.php b/app/Services/Databases/DeployServerDatabaseService.php index 4bc72a1fd..3946cb83f 100644 --- a/app/Services/Databases/DeployServerDatabaseService.php +++ b/app/Services/Databases/DeployServerDatabaseService.php @@ -26,10 +26,6 @@ class DeployServerDatabaseService } /** - * @param \Pterodactyl\Models\Server $server - * @param array $data - * @return \Pterodactyl\Models\Database - * * @throws \Throwable * @throws \Pterodactyl\Exceptions\Service\Database\TooManyDatabasesException * @throws \Pterodactyl\Exceptions\Service\Database\DatabaseClientFeatureNotEnabledException @@ -41,12 +37,12 @@ class DeployServerDatabaseService $hosts = DatabaseHost::query()->get()->toBase(); if ($hosts->isEmpty()) { - throw new NoSuitableDatabaseHostException; + throw new NoSuitableDatabaseHostException(); } else { $nodeHosts = $hosts->where('node_id', $server->node_id)->toBase(); - if ($nodeHosts->isEmpty() && ! config('pterodactyl.client_features.databases.allow_random')) { - throw new NoSuitableDatabaseHostException; + if ($nodeHosts->isEmpty() && !config('pterodactyl.client_features.databases.allow_random')) { + throw new NoSuitableDatabaseHostException(); } } diff --git a/app/Services/Databases/Hosts/HostCreationService.php b/app/Services/Databases/Hosts/HostCreationService.php index cbe3024f6..275f4d294 100644 --- a/app/Services/Databases/Hosts/HostCreationService.php +++ b/app/Services/Databases/Hosts/HostCreationService.php @@ -38,12 +38,6 @@ class HostCreationService /** * HostCreationService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Illuminate\Database\DatabaseManager $databaseManager - * @param \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface $repository - * @param \Pterodactyl\Extensions\DynamicDatabaseConnection $dynamic - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter */ public function __construct( ConnectionInterface $connection, @@ -62,9 +56,6 @@ class HostCreationService /** * Create a new database host on the Panel. * - * @param array $data - * @return \Pterodactyl\Models\DatabaseHost - * * @throws \Throwable */ public function handle(array $data): DatabaseHost diff --git a/app/Services/Databases/Hosts/HostDeletionService.php b/app/Services/Databases/Hosts/HostDeletionService.php index f366305cb..1538d4823 100644 --- a/app/Services/Databases/Hosts/HostDeletionService.php +++ b/app/Services/Databases/Hosts/HostDeletionService.php @@ -20,9 +20,6 @@ class HostDeletionService /** * HostDeletionService constructor. - * - * @param \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface $databaseRepository - * @param \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface $repository */ public function __construct( DatabaseRepositoryInterface $databaseRepository, @@ -36,9 +33,6 @@ class HostDeletionService * Delete a specified host from the Panel if no databases are * attached to it. * - * @param int $host - * @return int - * * @throws \Pterodactyl\Exceptions\Service\HasActiveServersException */ public function handle(int $host): int diff --git a/app/Services/Databases/Hosts/HostUpdateService.php b/app/Services/Databases/Hosts/HostUpdateService.php index 9965abd9c..4a281b851 100644 --- a/app/Services/Databases/Hosts/HostUpdateService.php +++ b/app/Services/Databases/Hosts/HostUpdateService.php @@ -45,12 +45,6 @@ class HostUpdateService /** * DatabaseHostService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Illuminate\Database\DatabaseManager $databaseManager - * @param \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface $repository - * @param \Pterodactyl\Extensions\DynamicDatabaseConnection $dynamic - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter */ public function __construct( ConnectionInterface $connection, @@ -69,15 +63,11 @@ class HostUpdateService /** * Update a database host and persist to the database. * - * @param int $hostId - * @param array $data - * @return \Pterodactyl\Models\DatabaseHost - * * @throws \Throwable */ public function handle(int $hostId, array $data): DatabaseHost { - if (! empty(array_get($data, 'password'))) { + if (!empty(array_get($data, 'password'))) { $data['password'] = $this->encrypter->encrypt($data['password']); } else { unset($data['password']); diff --git a/app/Services/Deployment/AllocationSelectionService.php b/app/Services/Deployment/AllocationSelectionService.php index 633ba1f5e..d714700b5 100644 --- a/app/Services/Deployment/AllocationSelectionService.php +++ b/app/Services/Deployment/AllocationSelectionService.php @@ -32,8 +32,6 @@ class AllocationSelectionService /** * AllocationSelectionService constructor. - * - * @param \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface $repository */ public function __construct(AllocationRepositoryInterface $repository) { @@ -45,7 +43,6 @@ class AllocationSelectionService * to the given IP address. If true an allocation will not be selected if an IP * already has another server set to use on if its allocations. * - * @param bool $dedicated * @return $this */ public function setDedicated(bool $dedicated) @@ -59,7 +56,6 @@ class AllocationSelectionService * A list of node IDs that should be used when selecting an allocation. If empty, all * nodes will be used to filter with. * - * @param array $nodes * @return $this */ public function setNodes(array $nodes) @@ -74,7 +70,6 @@ class AllocationSelectionService * empty, all ports will be considered when finding an allocation. If set, only ports appearing * in the array or range will be used. * - * @param array $ports * @return $this * * @throws \Pterodactyl\Exceptions\DisplayException @@ -106,8 +101,6 @@ class AllocationSelectionService /** * Return a single allocation that should be used as the default allocation for a server. * - * @return \Pterodactyl\Models\Allocation - * * @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableAllocationException */ public function handle(): Allocation diff --git a/app/Services/Deployment/FindViableNodesService.php b/app/Services/Deployment/FindViableNodesService.php index 0963d88ea..76cb89abf 100644 --- a/app/Services/Deployment/FindViableNodesService.php +++ b/app/Services/Deployment/FindViableNodesService.php @@ -2,8 +2,8 @@ namespace Pterodactyl\Services\Deployment; -use Webmozart\Assert\Assert; use Pterodactyl\Models\Node; +use Webmozart\Assert\Assert; use Pterodactyl\Exceptions\Service\Deployment\NoViableNodeException; class FindViableNodesService @@ -26,7 +26,6 @@ class FindViableNodesService /** * Set the locations that should be searched through to locate available nodes. * - * @param array $locations * @return $this */ public function setLocations(array $locations): self @@ -43,7 +42,6 @@ class FindViableNodesService * filtered out if they do not have enough available free disk space for this server * to be placed on. * - * @param int $disk * @return $this */ public function setDisk(int $disk): self @@ -57,7 +55,6 @@ class FindViableNodesService * Set the amount of memory that this server will be using. As with disk space, nodes that * do not have enough free memory will be filtered out. * - * @param int $memory * @return $this */ public function setMemory(int $memory): self @@ -81,6 +78,7 @@ class FindViableNodesService * up to 50 nodes at a time starting at the provided page. * If "null" is provided as the value no pagination will * be used. + * * @return \Illuminate\Support\Collection|\Illuminate\Contracts\Pagination\LengthAwarePaginator * * @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableNodeException @@ -96,7 +94,7 @@ class FindViableNodesService ->leftJoin('servers', 'servers.node_id', '=', 'nodes.id') ->where('nodes.public', 1); - if (! empty($this->locations)) { + if (!empty($this->locations)) { $query = $query->whereIn('nodes.location_id', $this->locations); } @@ -104,7 +102,7 @@ class FindViableNodesService ->havingRaw('(IFNULL(SUM(servers.memory), 0) + ?) <= (nodes.memory * (1 + (nodes.memory_overallocate / 100)))', [$this->memory]) ->havingRaw('(IFNULL(SUM(servers.disk), 0) + ?) <= (nodes.disk * (1 + (nodes.disk_overallocate / 100)))', [$this->disk]); - if (! is_null($page)) { + if (!is_null($page)) { $results = $results->paginate(50, ['*'], 'page', $page); } else { $results = $results->get()->toBase(); diff --git a/app/Services/Eggs/EggConfigurationService.php b/app/Services/Eggs/EggConfigurationService.php index 4d1db4e2e..3b3ca2d11 100644 --- a/app/Services/Eggs/EggConfigurationService.php +++ b/app/Services/Eggs/EggConfigurationService.php @@ -16,8 +16,6 @@ class EggConfigurationService /** * EggConfigurationService constructor. - * - * @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $configurationStructureService */ public function __construct(ServerConfigurationStructureService $configurationStructureService) { @@ -26,14 +24,12 @@ class EggConfigurationService /** * Return an Egg file to be used by the Daemon. - * - * @param \Pterodactyl\Models\Server $server - * @return array */ public function handle(Server $server): array { $configs = $this->replacePlaceholders( - $server, json_decode($server->egg->inherit_config_files) + $server, + json_decode($server->egg->inherit_config_files) ); return [ @@ -46,7 +42,6 @@ class EggConfigurationService /** * Convert the "done" variable into an array if it is not currently one. * - * @param array $startup * @return array */ protected function convertStartupToNewFormat(array $startup) @@ -66,13 +61,10 @@ class EggConfigurationService * For most eggs, this ends up just being a command sent to the server console, but * if the stop command is something starting with a caret (^), it will be converted * into the associated kill signal for the instance. - * - * @param string $stop - * @return array */ protected function convertStopToNewFormat(string $stop): array { - if (! Str::startsWith($stop, '^')) { + if (!Str::startsWith($stop, '^')) { return [ 'type' => 'command', 'value' => $stop, @@ -94,8 +86,6 @@ class EggConfigurationService } /** - * @param \Pterodactyl\Models\Server $server - * @param object $configs * @return array */ protected function replacePlaceholders(Server $server, object $configs) @@ -108,7 +98,7 @@ class EggConfigurationService // Normalize the output of the configuration for the new Wings Daemon to more // easily ingest, as well as make things more flexible down the road. foreach ($configs as $file => $data) { - $append = array_merge((array)$data, ['file' => $file, 'replace' => []]); + $append = array_merge((array) $data, ['file' => $file, 'replace' => []]); foreach ($this->iterate($data->find, $structure) as $find => $replace) { if (is_object($replace)) { @@ -142,10 +132,6 @@ class EggConfigurationService * set SERVER_MEMORY, SERVER_IP, and SERVER_PORT with their respective values on the Daemon * side. Ensure that anything referencing those properly replaces them with the matching config * value. - * - * @param string $key - * @param string $value - * @return string */ protected function replaceLegacyModifiers(string $key, string $value): string { @@ -175,7 +161,7 @@ class EggConfigurationService /** * @param mixed $value - * @param array $structure + * * @return mixed|null */ protected function matchAndReplaceKeys($value, array $structure) @@ -187,13 +173,13 @@ class EggConfigurationService // value from the server properties. // // The Daemon supports server.X, env.X, and config.X placeholders. - if (! Str::startsWith($key, ['server.', 'env.', 'config.'])) { + if (!Str::startsWith($key, ['server.', 'env.', 'config.'])) { continue; } // Don't do a replacement on anything that is not a string, we don't want to unintentionally // modify the resulting output. - if (! is_string($value)) { + if (!is_string($value)) { continue; } @@ -218,7 +204,9 @@ class EggConfigurationService // Finally, replace anything starting with env. with the expected environment // variable from the server configuration. $plucked = Arr::get( - $structure, preg_replace('/^env\./', 'build.env.', $key), '' + $structure, + preg_replace('/^env\./', 'build.env.', $key), + '' ); $value = str_replace("{{{$key}}}", $plucked, $value); @@ -233,12 +221,12 @@ class EggConfigurationService * a match & replace. * * @param mixed $data - * @param array $structure + * * @return mixed */ private function iterate($data, array $structure) { - if (! is_iterable($data) && ! is_object($data)) { + if (!is_iterable($data) && !is_object($data)) { return $data; } diff --git a/app/Services/Eggs/EggCreationService.php b/app/Services/Eggs/EggCreationService.php index 33a0a919d..d7b5bb42b 100644 --- a/app/Services/Eggs/EggCreationService.php +++ b/app/Services/Eggs/EggCreationService.php @@ -30,9 +30,6 @@ class EggCreationService /** * EggCreationService constructor. - * - * @param \Illuminate\Contracts\Config\Repository $config - * @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository */ public function __construct(ConfigRepository $config, EggRepositoryInterface $repository) { @@ -43,16 +40,13 @@ class EggCreationService /** * Create a new service option and assign it to the given service. * - * @param array $data - * @return \Pterodactyl\Models\Egg - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Service\Egg\NoParentConfigurationFoundException */ public function handle(array $data): Egg { $data['config_from'] = array_get($data, 'config_from'); - if (! is_null($data['config_from'])) { + if (!is_null($data['config_from'])) { $results = $this->repository->findCountWhere([ ['nest_id', '=', array_get($data, 'nest_id')], ['id', '=', array_get($data, 'config_from')], diff --git a/app/Services/Eggs/EggDeletionService.php b/app/Services/Eggs/EggDeletionService.php index 7b30e4426..1c8f8cf66 100644 --- a/app/Services/Eggs/EggDeletionService.php +++ b/app/Services/Eggs/EggDeletionService.php @@ -28,9 +28,6 @@ class EggDeletionService /** * EggDeletionService constructor. - * - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $serverRepository - * @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository */ public function __construct( ServerRepositoryInterface $serverRepository, @@ -43,9 +40,6 @@ class EggDeletionService /** * Delete an Egg from the database if it has no active servers attached to it. * - * @param int $egg - * @return int - * * @throws \Pterodactyl\Exceptions\Service\HasActiveServersException * @throws \Pterodactyl\Exceptions\Service\Egg\HasChildrenException */ diff --git a/app/Services/Eggs/EggUpdateService.php b/app/Services/Eggs/EggUpdateService.php index 697ed0599..e0cabbb05 100644 --- a/app/Services/Eggs/EggUpdateService.php +++ b/app/Services/Eggs/EggUpdateService.php @@ -22,8 +22,6 @@ class EggUpdateService /** * EggUpdateService constructor. - * - * @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository */ public function __construct(EggRepositoryInterface $repository) { @@ -33,16 +31,13 @@ class EggUpdateService /** * Update a service option. * - * @param \Pterodactyl\Models\Egg $egg - * @param array $data - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Service\Egg\NoParentConfigurationFoundException */ public function handle(Egg $egg, array $data) { - if (! is_null(array_get($data, 'config_from'))) { + if (!is_null(array_get($data, 'config_from'))) { $results = $this->repository->findCountWhere([ ['nest_id', '=', $egg->nest_id], ['id', '=', array_get($data, 'config_from')], diff --git a/app/Services/Eggs/Scripts/InstallScriptService.php b/app/Services/Eggs/Scripts/InstallScriptService.php index 70621c32b..ecd1dc1f3 100644 --- a/app/Services/Eggs/Scripts/InstallScriptService.php +++ b/app/Services/Eggs/Scripts/InstallScriptService.php @@ -15,8 +15,6 @@ class InstallScriptService /** * InstallScriptService constructor. - * - * @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository */ public function __construct(EggRepositoryInterface $repository) { @@ -27,7 +25,6 @@ class InstallScriptService * Modify the install script for a given Egg. * * @param int|\Pterodactyl\Models\Egg $egg - * @param array $data * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -35,8 +32,8 @@ class InstallScriptService */ public function handle(Egg $egg, array $data) { - if (! is_null(array_get($data, 'copy_script_from'))) { - if (! $this->repository->isCopyableScript(array_get($data, 'copy_script_from'), $egg->nest_id)) { + if (!is_null(array_get($data, 'copy_script_from'))) { + if (!$this->repository->isCopyableScript(array_get($data, 'copy_script_from'), $egg->nest_id)) { throw new InvalidCopyFromException(trans('exceptions.nest.egg.invalid_copy_id')); } } diff --git a/app/Services/Eggs/Sharing/EggExporterService.php b/app/Services/Eggs/Sharing/EggExporterService.php index 7b0cb3a49..2cdbd9850 100644 --- a/app/Services/Eggs/Sharing/EggExporterService.php +++ b/app/Services/Eggs/Sharing/EggExporterService.php @@ -14,8 +14,6 @@ class EggExporterService /** * EggExporterService constructor. - * - * @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository */ public function __construct(EggRepositoryInterface $repository) { @@ -25,9 +23,6 @@ class EggExporterService /** * Return a JSON representation of an egg and its variables. * - * @param int $egg - * @return string - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function handle(int $egg): string diff --git a/app/Services/Eggs/Sharing/EggImporterService.php b/app/Services/Eggs/Sharing/EggImporterService.php index 19d1c7d2a..b3ea33c90 100644 --- a/app/Services/Eggs/Sharing/EggImporterService.php +++ b/app/Services/Eggs/Sharing/EggImporterService.php @@ -36,11 +36,6 @@ class EggImporterService /** * EggImporterService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository - * @param \Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface $eggVariableRepository - * @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $nestRepository */ public function __construct( ConnectionInterface $connection, @@ -57,10 +52,6 @@ class EggImporterService /** * Take an uploaded JSON file and parse it into a new egg. * - * @param \Illuminate\Http\UploadedFile $file - * @param int $nest - * @return \Pterodactyl\Models\Egg - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Service\Egg\BadJsonFormatException @@ -68,24 +59,13 @@ class EggImporterService */ public function handle(UploadedFile $file, int $nest): Egg { - if ($file->getError() !== UPLOAD_ERR_OK || ! $file->isFile()) { - throw new InvalidFileUploadException( - sprintf( - 'The selected file ["%s"] was not in a valid format to import. (is_file: %s is_valid: %s err_code: %s err: %s)', - $file->getFilename(), - $file->isFile() ? 'true' : 'false', - $file->isValid() ? 'true' : 'false', - $file->getError(), - $file->getErrorMessage() - ) - ); + if ($file->getError() !== UPLOAD_ERR_OK || !$file->isFile()) { + throw new InvalidFileUploadException(sprintf('The selected file ["%s"] was not in a valid format to import. (is_file: %s is_valid: %s err_code: %s err: %s)', $file->getFilename(), $file->isFile() ? 'true' : 'false', $file->isValid() ? 'true' : 'false', $file->getError(), $file->getErrorMessage())); } $parsed = json_decode($file->openFile()->fread($file->getSize())); if (json_last_error() !== 0) { - throw new BadJsonFormatException(trans('exceptions.nest.importer.json_error', [ - 'error' => json_last_error_msg(), - ])); + throw new BadJsonFormatException(trans('exceptions.nest.importer.json_error', ['error' => json_last_error_msg()])); } if (object_get($parsed, 'meta.version') !== 'PTDL_v1') { @@ -119,7 +99,7 @@ class EggImporterService ], true, true); collect($parsed->variables)->each(function ($variable) use ($egg) { - $this->eggVariableRepository->create(array_merge((array)$variable, [ + $this->eggVariableRepository->create(array_merge((array) $variable, [ 'egg_id' => $egg->id, ])); }); diff --git a/app/Services/Eggs/Sharing/EggUpdateImporterService.php b/app/Services/Eggs/Sharing/EggUpdateImporterService.php index b4705d25e..205314314 100644 --- a/app/Services/Eggs/Sharing/EggUpdateImporterService.php +++ b/app/Services/Eggs/Sharing/EggUpdateImporterService.php @@ -29,10 +29,6 @@ class EggUpdateImporterService /** * EggUpdateImporterService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository - * @param \Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface $variableRepository */ public function __construct( ConnectionInterface $connection, @@ -47,9 +43,6 @@ class EggUpdateImporterService /** * Update an existing Egg using an uploaded JSON file. * - * @param \Pterodactyl\Models\Egg $egg - * @param \Illuminate\Http\UploadedFile $file - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Service\Egg\BadJsonFormatException @@ -57,24 +50,13 @@ class EggUpdateImporterService */ public function handle(Egg $egg, UploadedFile $file) { - if ($file->getError() !== UPLOAD_ERR_OK || ! $file->isFile()) { - throw new InvalidFileUploadException( - sprintf( - 'The selected file ["%s"] was not in a valid format to import. (is_file: %s is_valid: %s err_code: %s err: %s)', - $file->getFilename(), - $file->isFile() ? 'true' : 'false', - $file->isValid() ? 'true' : 'false', - $file->getError(), - $file->getErrorMessage() - ) - ); + if ($file->getError() !== UPLOAD_ERR_OK || !$file->isFile()) { + throw new InvalidFileUploadException(sprintf('The selected file ["%s"] was not in a valid format to import. (is_file: %s is_valid: %s err_code: %s err: %s)', $file->getFilename(), $file->isFile() ? 'true' : 'false', $file->isValid() ? 'true' : 'false', $file->getError(), $file->getErrorMessage())); } $parsed = json_decode($file->openFile()->fread($file->getSize())); if (json_last_error() !== 0) { - throw new BadJsonFormatException(trans('exceptions.nest.importer.json_error', [ - 'error' => json_last_error_msg(), - ])); + throw new BadJsonFormatException(trans('exceptions.nest.importer.json_error', ['error' => json_last_error_msg()])); } if (object_get($parsed, 'meta.version') !== 'PTDL_v1') { @@ -113,7 +95,7 @@ class EggUpdateImporterService // Delete variables not present in the import. collect($existing)->each(function ($variable) use ($egg, $imported) { - if (! in_array($variable->env_variable, $imported)) { + if (!in_array($variable->env_variable, $imported)) { $this->variableRepository->deleteWhere([ ['egg_id', '=', $egg->id], ['env_variable', '=', $variable->env_variable], diff --git a/app/Services/Eggs/Variables/VariableCreationService.php b/app/Services/Eggs/Variables/VariableCreationService.php index ed7e72a4f..fa758265b 100644 --- a/app/Services/Eggs/Variables/VariableCreationService.php +++ b/app/Services/Eggs/Variables/VariableCreationService.php @@ -24,9 +24,6 @@ class VariableCreationService /** * VariableCreationService constructor. - * - * @param \Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface $repository - * @param \Illuminate\Contracts\Validation\Factory $validator */ public function __construct(EggVariableRepositoryInterface $repository, Factory $validator) { @@ -37,8 +34,6 @@ class VariableCreationService /** * Return the validation factory instance to be used by rule validation * checking in the trait. - * - * @return \Illuminate\Contracts\Validation\Factory */ protected function getValidator(): Factory { @@ -48,10 +43,6 @@ class VariableCreationService /** * Create a new variable for a given Egg. * - * @param int $egg - * @param array $data - * @return \Pterodactyl\Models\EggVariable - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Service\Egg\Variable\BadValidationRuleException * @throws \Pterodactyl\Exceptions\Service\Egg\Variable\ReservedVariableNameException @@ -59,13 +50,10 @@ class VariableCreationService public function handle(int $egg, array $data): EggVariable { if (in_array(strtoupper(array_get($data, 'env_variable')), explode(',', EggVariable::RESERVED_ENV_NAMES))) { - throw new ReservedVariableNameException(sprintf( - 'Cannot use the protected name %s for this environment variable.', - array_get($data, 'env_variable') - )); + throw new ReservedVariableNameException(sprintf('Cannot use the protected name %s for this environment variable.', array_get($data, 'env_variable'))); } - if (! empty($data['rules'] ?? '')) { + if (!empty($data['rules'] ?? '')) { $this->validateRules($data['rules']); } diff --git a/app/Services/Eggs/Variables/VariableUpdateService.php b/app/Services/Eggs/Variables/VariableUpdateService.php index da1a9e987..da4426c33 100644 --- a/app/Services/Eggs/Variables/VariableUpdateService.php +++ b/app/Services/Eggs/Variables/VariableUpdateService.php @@ -26,9 +26,6 @@ class VariableUpdateService /** * VariableUpdateService constructor. - * - * @param \Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface $repository - * @param \Illuminate\Contracts\Validation\Factory $validator */ public function __construct(EggVariableRepositoryInterface $repository, Factory $validator) { @@ -39,8 +36,6 @@ class VariableUpdateService /** * Return the validation factory instance to be used by rule validation * checking in the trait. - * - * @return \Illuminate\Contracts\Validation\Factory */ protected function getValidator(): Factory { @@ -50,8 +45,6 @@ class VariableUpdateService /** * Update a specific egg variable. * - * @param \Pterodactyl\Models\EggVariable $variable - * @param array $data * @return mixed * * @throws \Pterodactyl\Exceptions\DisplayException @@ -61,11 +54,9 @@ class VariableUpdateService */ public function handle(EggVariable $variable, array $data) { - if (! is_null(array_get($data, 'env_variable'))) { + if (!is_null(array_get($data, 'env_variable'))) { if (in_array(strtoupper(array_get($data, 'env_variable')), explode(',', EggVariable::RESERVED_ENV_NAMES))) { - throw new ReservedVariableNameException(trans('exceptions.service.variables.reserved_name', [ - 'name' => array_get($data, 'env_variable'), - ])); + throw new ReservedVariableNameException(trans('exceptions.service.variables.reserved_name', ['name' => array_get($data, 'env_variable')])); } $search = $this->repository->setColumns('id')->findCountWhere([ @@ -75,13 +66,11 @@ class VariableUpdateService ]); if ($search > 0) { - throw new DisplayException(trans('exceptions.service.variables.env_not_unique', [ - 'name' => array_get($data, 'env_variable'), - ])); + throw new DisplayException(trans('exceptions.service.variables.env_not_unique', ['name' => array_get($data, 'env_variable')])); } } - if (! empty($data['rules'] ?? '')) { + if (!empty($data['rules'] ?? '')) { $this->validateRules( (is_string($data['rules']) && Str::contains($data['rules'], ';;')) ? explode(';;', $data['rules']) diff --git a/app/Services/Helpers/AssetHashService.php b/app/Services/Helpers/AssetHashService.php index 25aa3318b..4b1bf7e0b 100644 --- a/app/Services/Helpers/AssetHashService.php +++ b/app/Services/Helpers/AssetHashService.php @@ -30,9 +30,6 @@ class AssetHashService /** * AssetHashService constructor. - * - * @param \Illuminate\Contracts\Foundation\Application $application - * @param \Illuminate\Filesystem\FilesystemManager $filesystem */ public function __construct(Application $application, FilesystemManager $filesystem) { @@ -43,9 +40,6 @@ class AssetHashService /** * Modify a URL to append the asset hash. * - * @param string $resource - * @return string - * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ public function url(string $resource): string @@ -59,9 +53,6 @@ class AssetHashService /** * Return the data integrity hash for a resource. * - * @param string $resource - * @return string - * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ public function integrity(string $resource): string @@ -75,9 +66,6 @@ class AssetHashService /** * Return a built CSS import using the provided URL. * - * @param string $resource - * @return string - * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ public function css(string $resource): string @@ -105,9 +93,6 @@ class AssetHashService /** * Return a built JS import using the provided URL. * - * @param string $resource - * @return string - * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ public function js(string $resource): string @@ -132,14 +117,13 @@ class AssetHashService /** * Get the asset manifest and store it in the cache for quicker lookups. * - * @return array - * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ protected function manifest(): array { return self::$manifest ?: self::$manifest = json_decode( - $this->filesystem->get(self::MANIFEST_PATH), true + $this->filesystem->get(self::MANIFEST_PATH), + true ); } } diff --git a/app/Services/Helpers/SoftwareVersionService.php b/app/Services/Helpers/SoftwareVersionService.php index 893c097d0..14a2b437d 100644 --- a/app/Services/Helpers/SoftwareVersionService.php +++ b/app/Services/Helpers/SoftwareVersionService.php @@ -11,7 +11,7 @@ use Pterodactyl\Exceptions\Service\Helper\CdnVersionFetchingException; class SoftwareVersionService { - const VERSION_CACHE_KEY = 'pterodactyl:versioning_data'; + public const VERSION_CACHE_KEY = 'pterodactyl:versioning_data'; /** * @var array @@ -30,9 +30,6 @@ class SoftwareVersionService /** * SoftwareVersionService constructor. - * - * @param \Illuminate\Contracts\Cache\Repository $cache - * @param \GuzzleHttp\Client $client */ public function __construct( CacheRepository $cache, @@ -102,6 +99,7 @@ class SoftwareVersionService * Determine if a passed daemon version string is the latest. * * @param string $version + * * @return bool */ public function isLatestDaemon($version) @@ -128,7 +126,7 @@ class SoftwareVersionService return json_decode($response->getBody(), true); } - throw new CdnVersionFetchingException; + throw new CdnVersionFetchingException(); } catch (Exception $exception) { return []; } diff --git a/app/Services/Locations/LocationCreationService.php b/app/Services/Locations/LocationCreationService.php index cd2a97572..cff493a8b 100644 --- a/app/Services/Locations/LocationCreationService.php +++ b/app/Services/Locations/LocationCreationService.php @@ -20,8 +20,6 @@ class LocationCreationService /** * LocationCreationService constructor. - * - * @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $repository */ public function __construct(LocationRepositoryInterface $repository) { @@ -31,7 +29,6 @@ class LocationCreationService /** * Create a new location. * - * @param array $data * @return \Pterodactyl\Models\Location * * @throws \Pterodactyl\Exceptions\Model\DataValidationException diff --git a/app/Services/Locations/LocationDeletionService.php b/app/Services/Locations/LocationDeletionService.php index 5fc528ead..2ffd38187 100644 --- a/app/Services/Locations/LocationDeletionService.php +++ b/app/Services/Locations/LocationDeletionService.php @@ -29,9 +29,6 @@ class LocationDeletionService /** * LocationDeletionService constructor. - * - * @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $repository - * @param \Pterodactyl\Contracts\Repository\NodeRepositoryInterface $nodeRepository */ public function __construct( LocationRepositoryInterface $repository, @@ -45,6 +42,7 @@ class LocationDeletionService * Delete an existing location. * * @param int|\Pterodactyl\Models\Location $location + * * @return int|null * * @throws \Pterodactyl\Exceptions\Service\Location\HasActiveNodesException diff --git a/app/Services/Locations/LocationUpdateService.php b/app/Services/Locations/LocationUpdateService.php index dfb5bcc5f..87399201f 100644 --- a/app/Services/Locations/LocationUpdateService.php +++ b/app/Services/Locations/LocationUpdateService.php @@ -21,8 +21,6 @@ class LocationUpdateService /** * LocationUpdateService constructor. - * - * @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $repository */ public function __construct(LocationRepositoryInterface $repository) { @@ -33,7 +31,7 @@ class LocationUpdateService * Update an existing location. * * @param int|\Pterodactyl\Models\Location $location - * @param array $data + * * @return \Pterodactyl\Models\Location * * @throws \Pterodactyl\Exceptions\Model\DataValidationException diff --git a/app/Services/Nests/NestCreationService.php b/app/Services/Nests/NestCreationService.php index 5cac1c11a..af56496d1 100644 --- a/app/Services/Nests/NestCreationService.php +++ b/app/Services/Nests/NestCreationService.php @@ -21,9 +21,6 @@ class NestCreationService /** * NestCreationService constructor. - * - * @param \Illuminate\Contracts\Config\Repository $config - * @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $repository */ public function __construct(ConfigRepository $config, NestRepositoryInterface $repository) { @@ -34,9 +31,6 @@ class NestCreationService /** * Create a new nest on the system. * - * @param array $data - * @param string|null $author - * @return \Pterodactyl\Models\Nest * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ public function handle(array $data, string $author = null): Nest diff --git a/app/Services/Nests/NestDeletionService.php b/app/Services/Nests/NestDeletionService.php index 990bbc595..777a41b68 100644 --- a/app/Services/Nests/NestDeletionService.php +++ b/app/Services/Nests/NestDeletionService.php @@ -27,9 +27,6 @@ class NestDeletionService /** * NestDeletionService constructor. - * - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $serverRepository - * @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $repository */ public function __construct( ServerRepositoryInterface $serverRepository, @@ -42,9 +39,6 @@ class NestDeletionService /** * Delete a nest from the system only if there are no servers attached to it. * - * @param int $nest - * @return int - * * @throws \Pterodactyl\Exceptions\Service\HasActiveServersException */ public function handle(int $nest): int diff --git a/app/Services/Nests/NestUpdateService.php b/app/Services/Nests/NestUpdateService.php index de04e7e2f..7772ff380 100644 --- a/app/Services/Nests/NestUpdateService.php +++ b/app/Services/Nests/NestUpdateService.php @@ -20,8 +20,6 @@ class NestUpdateService /** * NestUpdateService constructor. - * - * @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $repository */ public function __construct(NestRepositoryInterface $repository) { @@ -31,14 +29,12 @@ class NestUpdateService /** * Update a nest and prevent changing the author once it is set. * - * @param int $nest - * @param array $data * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function handle(int $nest, array $data) { - if (! is_null(array_get($data, 'author'))) { + if (!is_null(array_get($data, 'author'))) { unset($data['author']); } diff --git a/app/Services/Nodes/NodeCreationService.php b/app/Services/Nodes/NodeCreationService.php index a44c036bd..e8ea5b0d8 100644 --- a/app/Services/Nodes/NodeCreationService.php +++ b/app/Services/Nodes/NodeCreationService.php @@ -22,9 +22,6 @@ class NodeCreationService /** * CreationService constructor. - * - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter - * @param \Pterodactyl\Contracts\Repository\NodeRepositoryInterface $repository */ public function __construct(Encrypter $encrypter, NodeRepositoryInterface $repository) { @@ -35,7 +32,6 @@ class NodeCreationService /** * Create a new node on the panel. * - * @param array $data * @return \Pterodactyl\Models\Node * * @throws \Pterodactyl\Exceptions\Model\DataValidationException diff --git a/app/Services/Nodes/NodeDeletionService.php b/app/Services/Nodes/NodeDeletionService.php index 75118fa30..30483a826 100644 --- a/app/Services/Nodes/NodeDeletionService.php +++ b/app/Services/Nodes/NodeDeletionService.php @@ -34,10 +34,6 @@ class NodeDeletionService /** * DeletionService constructor. - * - * @param \Pterodactyl\Contracts\Repository\NodeRepositoryInterface $repository - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $serverRepository - * @param \Illuminate\Contracts\Translation\Translator $translator */ public function __construct( NodeRepositoryInterface $repository, @@ -53,6 +49,7 @@ class NodeDeletionService * Delete a node from the panel if no servers are attached to it. * * @param int|\Pterodactyl\Models\Node $node + * * @return bool|null * * @throws \Pterodactyl\Exceptions\Service\HasActiveServersException diff --git a/app/Services/Nodes/NodeJWTService.php b/app/Services/Nodes/NodeJWTService.php index 7c359efe8..1b52479ba 100644 --- a/app/Services/Nodes/NodeJWTService.php +++ b/app/Services/Nodes/NodeJWTService.php @@ -2,13 +2,14 @@ namespace Pterodactyl\Services\Nodes; -use DateTimeInterface; -use Lcobucci\JWT\Builder; +use DateTimeImmutable; use Carbon\CarbonImmutable; use Illuminate\Support\Str; -use Lcobucci\JWT\Signer\Key; use Pterodactyl\Models\Node; +use Lcobucci\JWT\Configuration; use Lcobucci\JWT\Signer\Hmac\Sha256; +use Lcobucci\JWT\Signer\Key\InMemory; +use Pterodactyl\Extensions\Lcobucci\JWT\Encoding\TimestampDates; class NodeJWTService { @@ -18,7 +19,7 @@ class NodeJWTService private $claims = []; /** - * @var int|null + * @var \DateTimeImmutable|null */ private $expiresAt; @@ -30,7 +31,6 @@ class NodeJWTService /** * Set the claims to include in this JWT. * - * @param array $claims * @return $this */ public function setClaims(array $claims) @@ -41,18 +41,16 @@ class NodeJWTService } /** - * @param \DateTimeInterface $date * @return $this */ - public function setExpiresAt(DateTimeInterface $date) + public function setExpiresAt(DateTimeImmutable $date) { - $this->expiresAt = $date->getTimestamp(); + $this->expiresAt = $date; return $this; } /** - * @param string $subject * @return $this */ public function setSubject(string $subject) @@ -65,27 +63,29 @@ class NodeJWTService /** * Generate a new JWT for a given node. * - * @param \Pterodactyl\Models\Node $node * @param string|null $identifiedBy - * @param string $algo - * @return \Lcobucci\JWT\Token + * + * @return \Lcobucci\JWT\Token\Plain */ public function handle(Node $node, string $identifiedBy, string $algo = 'md5') { - $signer = new Sha256; + $identifier = hash($algo, $identifiedBy); + $config = Configuration::forSymmetricSigner(new Sha256(), InMemory::plainText($node->getDecryptedKey())); - $builder = (new Builder)->issuedBy(config('app.url')) + $builder = $config->builder(new TimestampDates()) + ->issuedBy(config('app.url')) ->permittedFor($node->getConnectionAddress()) - ->identifiedBy(hash($algo, $identifiedBy), true) - ->issuedAt(CarbonImmutable::now()->getTimestamp()) - ->canOnlyBeUsedAfter(CarbonImmutable::now()->subMinutes(5)->getTimestamp()); + ->identifiedBy($identifier) + ->withHeader('jti', $identifier) + ->issuedAt(CarbonImmutable::now()) + ->canOnlyBeUsedAfter(CarbonImmutable::now()->subMinutes(5)); if ($this->expiresAt) { $builder = $builder->expiresAt($this->expiresAt); } if (!empty($this->subject)) { - $builder = $builder->relatedTo($this->subject, true); + $builder = $builder->relatedTo($this->subject)->withHeader('sub', $this->subject); } foreach ($this->claims as $key => $value) { @@ -94,6 +94,6 @@ class NodeJWTService return $builder ->withClaim('unique_id', Str::random(16)) - ->getToken($signer, new Key($node->getDecryptedKey())); + ->getToken($config->signer(), $config->signingKey()); } } diff --git a/app/Services/Nodes/NodeUpdateService.php b/app/Services/Nodes/NodeUpdateService.php index f684d1064..9ba56fb4e 100644 --- a/app/Services/Nodes/NodeUpdateService.php +++ b/app/Services/Nodes/NodeUpdateService.php @@ -5,11 +5,9 @@ namespace Pterodactyl\Services\Nodes; use Illuminate\Support\Str; use Pterodactyl\Models\Node; use Illuminate\Support\Facades\Log; -use GuzzleHttp\Exception\ConnectException; use Illuminate\Database\ConnectionInterface; use Illuminate\Contracts\Encryption\Encrypter; use Pterodactyl\Repositories\Eloquent\NodeRepository; -use Pterodactyl\Repositories\Daemon\ConfigurationRepository; use Pterodactyl\Repositories\Wings\DaemonConfigurationRepository; use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; use Pterodactyl\Exceptions\Service\Node\ConfigurationNotPersistedException; @@ -38,11 +36,6 @@ class NodeUpdateService /** * UpdateService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter - * @param \Pterodactyl\Repositories\Wings\DaemonConfigurationRepository $configurationRepository - * @param \Pterodactyl\Repositories\Eloquent\NodeRepository $repository */ public function __construct( ConnectionInterface $connection, @@ -59,11 +52,8 @@ class NodeUpdateService /** * Update the configuration values for a given node on the machine. * - * @param \Pterodactyl\Models\Node $node - * @param array $data - * @param bool $resetToken - * * @return \Pterodactyl\Models\Node + * * @throws \Throwable */ public function handle(Node $node, array $data, bool $resetToken = false) @@ -101,7 +91,7 @@ class NodeUpdateService // inject their own response pages, causing this logic to get fucked up. // // @see https://github.com/pterodactyl/panel/issues/2712 - return [ $updated, true ]; + return [$updated, true]; } return [$updated, false]; diff --git a/app/Services/Schedules/ProcessScheduleService.php b/app/Services/Schedules/ProcessScheduleService.php index 86775430b..23c9ea5e8 100644 --- a/app/Services/Schedules/ProcessScheduleService.php +++ b/app/Services/Schedules/ProcessScheduleService.php @@ -23,9 +23,6 @@ class ProcessScheduleService /** * ProcessScheduleService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Illuminate\Contracts\Bus\Dispatcher $dispatcher */ public function __construct(ConnectionInterface $connection, Dispatcher $dispatcher) { @@ -36,9 +33,6 @@ class ProcessScheduleService /** * Process a schedule and push the first task onto the queue worker. * - * @param \Pterodactyl\Models\Schedule $schedule - * @param bool $now - * * @throws \Throwable */ public function handle(Schedule $schedule, bool $now = false) @@ -47,9 +41,7 @@ class ProcessScheduleService $task = $schedule->tasks()->orderBy('sequence_id', 'asc')->first(); if (is_null($task)) { - throw new DisplayException( - 'Cannot process schedule for task execution: no tasks are registered.' - ); + throw new DisplayException('Cannot process schedule for task execution: no tasks are registered.'); } $this->connection->transaction(function () use ($schedule, $task) { @@ -63,7 +55,7 @@ class ProcessScheduleService $job = new RunTaskJob($task); - if (! $now) { + if (!$now) { $this->dispatcher->dispatch($job->delay($task->time_offset)); } else { // When using dispatchNow the RunTaskJob::failed() function is not called automatically diff --git a/app/Services/Servers/BuildModificationService.php b/app/Services/Servers/BuildModificationService.php index 328e0e533..6a96075c5 100644 --- a/app/Services/Servers/BuildModificationService.php +++ b/app/Services/Servers/BuildModificationService.php @@ -31,8 +31,6 @@ class BuildModificationService * BuildModificationService constructor. * * @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $structureService - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonServerRepository */ public function __construct( ServerConfigurationStructureService $structureService, @@ -47,8 +45,6 @@ class BuildModificationService /** * Change the build details for a specified server. * - * @param \Pterodactyl\Models\Server $server - * @param array $data * @return \Pterodactyl\Models\Server * * @throws \Throwable @@ -96,9 +92,6 @@ class BuildModificationService /** * Process the allocations being assigned in the data and ensure they are available for a server. * - * @param \Pterodactyl\Models\Server $server - * @param array $data - * * @throws \Pterodactyl\Exceptions\DisplayException */ private function processAllocations(Server $server, array &$data) @@ -109,7 +102,7 @@ class BuildModificationService // Handle the addition of allocations to this server. Only assign allocations that are not currently // assigned to a different server, and only allocations on the same node as the server. - if (! empty($data['add_allocations'])) { + if (!empty($data['add_allocations'])) { $query = Allocation::query() ->where('node_id', $server->node_id) ->whereIn('id', $data['add_allocations']) @@ -122,16 +115,14 @@ class BuildModificationService $query->update(['server_id' => $server->id, 'notes' => null]); } - if (! empty($data['remove_allocations'])) { + if (!empty($data['remove_allocations'])) { foreach ($data['remove_allocations'] as $allocation) { // If we are attempting to remove the default allocation for the server, see if we can reassign // to the first provided value in add_allocations. If there is no new first allocation then we // will throw an exception back. if ($allocation === ($data['allocation_id'] ?? $server->allocation_id)) { if (empty($freshlyAllocated)) { - throw new DisplayException( - 'You are attempting to delete the default allocation for this server but there is no fallback allocation to use.' - ); + throw new DisplayException('You are attempting to delete the default allocation for this server but there is no fallback allocation to use.'); } // Update the default allocation to be the first allocation that we are creating. diff --git a/app/Services/Servers/DetailsModificationService.php b/app/Services/Servers/DetailsModificationService.php index aa480a06a..cbe2a6ed9 100644 --- a/app/Services/Servers/DetailsModificationService.php +++ b/app/Services/Servers/DetailsModificationService.php @@ -25,9 +25,6 @@ class DetailsModificationService /** * DetailsModificationService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $serverRepository */ public function __construct(ConnectionInterface $connection, DaemonServerRepository $serverRepository) { @@ -38,10 +35,6 @@ class DetailsModificationService /** * Update the details for a single server instance. * - * @param \Pterodactyl\Models\Server $server - * @param array $data - * @return \Pterodactyl\Models\Server - * * @throws \Throwable */ public function handle(Server $server, array $data): Server diff --git a/app/Services/Servers/EnvironmentService.php b/app/Services/Servers/EnvironmentService.php index 6f7b590f7..54b82bab3 100644 --- a/app/Services/Servers/EnvironmentService.php +++ b/app/Services/Servers/EnvironmentService.php @@ -15,9 +15,6 @@ class EnvironmentService /** * Dynamically configure additional environment variables to be assigned * with a specific server. - * - * @param string $key - * @param callable $closure */ public function setEnvironmentKey(string $key, callable $closure) { @@ -26,8 +23,6 @@ class EnvironmentService /** * Return the dynamically added additional keys. - * - * @return array */ public function getEnvironmentKeys(): array { @@ -37,9 +32,6 @@ class EnvironmentService /** * Take all of the environment variables configured for this server and return * them in an easy to process format. - * - * @param \Pterodactyl\Models\Server $server - * @return array */ public function handle(Server $server): array { @@ -57,7 +49,8 @@ class EnvironmentService // Process variables set in the configuration file. foreach (config('pterodactyl.environment_variables', []) as $key => $object) { $variables->put( - $key, is_callable($object) ? call_user_func($object, $server) : object_get($server, $object) + $key, + is_callable($object) ? call_user_func($object, $server) : object_get($server, $object) ); } @@ -71,8 +64,6 @@ class EnvironmentService /** * Return a mapping of Panel default environment variables. - * - * @return array */ private function getEnvironmentMappings(): array { diff --git a/app/Services/Servers/GetUserPermissionsService.php b/app/Services/Servers/GetUserPermissionsService.php index 80ce35b52..fdac03bfd 100644 --- a/app/Services/Servers/GetUserPermissionsService.php +++ b/app/Services/Servers/GetUserPermissionsService.php @@ -12,8 +12,6 @@ class GetUserPermissionsService * if they are an admin or a subuser for the server. If no permissions are * found, an empty array is returned. * - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\User $user * @return string[] */ public function handle(Server $server, User $user) diff --git a/app/Services/Servers/ReinstallServerService.php b/app/Services/Servers/ReinstallServerService.php index b922464ca..561512b37 100644 --- a/app/Services/Servers/ReinstallServerService.php +++ b/app/Services/Servers/ReinstallServerService.php @@ -4,7 +4,6 @@ namespace Pterodactyl\Services\Servers; use Pterodactyl\Models\Server; use Illuminate\Database\ConnectionInterface; -use Pterodactyl\Repositories\Eloquent\ServerRepository; use Pterodactyl\Repositories\Wings\DaemonServerRepository; class ReinstallServerService @@ -21,9 +20,6 @@ class ReinstallServerService /** * ReinstallService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonServerRepository */ public function __construct( ConnectionInterface $connection, @@ -36,7 +32,6 @@ class ReinstallServerService /** * Reinstall a server on the remote daemon. * - * @param \Pterodactyl\Models\Server $server * @return \Pterodactyl\Models\Server * * @throws \Throwable diff --git a/app/Services/Servers/ServerConfigurationStructureService.php b/app/Services/Servers/ServerConfigurationStructureService.php index 1bffdb547..90bd0ef27 100644 --- a/app/Services/Servers/ServerConfigurationStructureService.php +++ b/app/Services/Servers/ServerConfigurationStructureService.php @@ -7,15 +7,10 @@ use Pterodactyl\Models\Server; class ServerConfigurationStructureService { - /** - * @var \Pterodactyl\Services\Servers\EnvironmentService - */ - private $environment; + private EnvironmentService $environment; /** * ServerConfigurationStructureService constructor. - * - * @param \Pterodactyl\Services\Servers\EnvironmentService $environment */ public function __construct(EnvironmentService $environment) { @@ -27,11 +22,6 @@ class ServerConfigurationStructureService * * DO NOT MODIFY THIS FUNCTION. This powers legacy code handling for the new Wings * daemon, if you modify the structure eggs will break unexpectedly. - * - * @param \Pterodactyl\Models\Server $server - * @param array $override - * @param bool $legacy deprecated - * @return array */ public function handle(Server $server, array $override = [], bool $legacy = false): array { @@ -52,11 +42,8 @@ class ServerConfigurationStructureService /** * Returns the new data format used for the Wings daemon. - * - * @param \Pterodactyl\Models\Server $server - * @return array */ - protected function returnCurrentFormat(Server $server) + protected function returnCurrentFormat(Server $server): array { return [ 'uuid' => $server->uuid, @@ -93,12 +80,8 @@ class ServerConfigurationStructureService }), 'egg' => [ 'id' => $server->egg->uuid, - 'file_denylist' => [ - 'config.yml', - '**/*.json' - ] - // 'file_denylist' => explode(PHP_EOL, $server->egg->inherit_file_denylist), - ] + 'file_denylist' => explode(PHP_EOL, $server->egg->inherit_file_denylist), + ], ]; } @@ -106,11 +89,9 @@ class ServerConfigurationStructureService * Returns the legacy server data format to continue support for old egg configurations * that have not yet been updated. * - * @param \Pterodactyl\Models\Server $server - * @return array * @deprecated */ - protected function returnLegacyFormat(Server $server) + protected function returnLegacyFormat(Server $server): array { return [ 'uuid' => $server->uuid, @@ -124,12 +105,12 @@ class ServerConfigurationStructureService })->toArray(), 'env' => $this->environment->handle($server), 'oom_disabled' => $server->oom_disabled, - 'memory' => (int)$server->memory, - 'swap' => (int)$server->swap, - 'io' => (int)$server->io, - 'cpu' => (int)$server->cpu, + 'memory' => (int) $server->memory, + 'swap' => (int) $server->swap, + 'io' => (int) $server->io, + 'cpu' => (int) $server->cpu, 'threads' => $server->threads, - 'disk' => (int)$server->disk, + 'disk' => (int) $server->disk, 'image' => $server->image, ], 'service' => [ diff --git a/app/Services/Servers/ServerCreationService.php b/app/Services/Servers/ServerCreationService.php index 7c11dab9b..a9514e7ae 100644 --- a/app/Services/Servers/ServerCreationService.php +++ b/app/Services/Servers/ServerCreationService.php @@ -75,16 +75,9 @@ class ServerCreationService /** * CreationService constructor. * - * @param \Pterodactyl\Services\Deployment\AllocationSelectionService $allocationSelectionService - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonServerRepository - * @param \Pterodactyl\Repositories\Eloquent\EggRepository $eggRepository - * @param \Pterodactyl\Services\Deployment\FindViableNodesService $findViableNodesService * @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $configurationStructureService - * @param \Pterodactyl\Services\Servers\ServerDeletionService $serverDeletionService - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository - * @param \Pterodactyl\Repositories\Eloquent\ServerVariableRepository $serverVariableRepository - * @param \Pterodactyl\Services\Servers\VariableValidatorService $validatorService + * @param \Pterodactyl\Services\Servers\ServerDeletionService $serverDeletionService + * @param \Pterodactyl\Services\Servers\VariableValidatorService $validatorService */ public function __construct( AllocationSelectionService $allocationSelectionService, @@ -116,10 +109,6 @@ class ServerCreationService * as possible given the input data. For example, if an allocation_id is passed with * no node_id the node_is will be picked from the allocation. * - * @param array $data - * @param \Pterodactyl\Models\Objects\DeploymentObject|null $deployment - * @return \Pterodactyl\Models\Server - * * @throws \Throwable * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Illuminate\Validation\ValidationException @@ -187,10 +176,6 @@ class ServerCreationService /** * Gets an allocation to use for automatic deployment. * - * @param array $data - * @param \Pterodactyl\Models\Objects\DeploymentObject $deployment - * - * @return \Pterodactyl\Models\Allocation * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableAllocationException * @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableNodeException @@ -212,9 +197,6 @@ class ServerCreationService /** * Store the server in the database and return the model. * - * @param array $data - * @return \Pterodactyl\Models\Server - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ private function createModel(array $data): Server @@ -254,9 +236,6 @@ class ServerCreationService /** * Configure the allocations assigned to this server. - * - * @param \Pterodactyl\Models\Server $server - * @param array $data */ private function storeAssignedAllocations(Server $server, array $data) { @@ -272,9 +251,6 @@ class ServerCreationService /** * Process environment variables passed for this server and store them in the database. - * - * @param \Pterodactyl\Models\Server $server - * @param \Illuminate\Support\Collection $variables */ private function storeEggVariables(Server $server, Collection $variables) { @@ -286,21 +262,19 @@ class ServerCreationService ]; })->toArray(); - if (! empty($records)) { + if (!empty($records)) { $this->serverVariableRepository->insert($records); } } /** * Create a unique UUID and UUID-Short combo for a server. - * - * @return string */ private function generateUniqueUuidCombo(): string { $uuid = Uuid::uuid4()->toString(); - if (! $this->repository->isUniqueUuidCombo($uuid, substr($uuid, 0, 8))) { + if (!$this->repository->isUniqueUuidCombo($uuid, substr($uuid, 0, 8))) { return $this->generateUniqueUuidCombo(); } diff --git a/app/Services/Servers/ServerDeletionService.php b/app/Services/Servers/ServerDeletionService.php index 95585873b..cc973ff84 100644 --- a/app/Services/Servers/ServerDeletionService.php +++ b/app/Services/Servers/ServerDeletionService.php @@ -35,10 +35,6 @@ class ServerDeletionService /** * DeletionService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonServerRepository - * @param \Pterodactyl\Services\Databases\DatabaseManagementService $databaseManagementService */ public function __construct( ConnectionInterface $connection, @@ -54,6 +50,7 @@ class ServerDeletionService * Set if the server should be forcibly deleted from the panel (ignoring daemon errors) or not. * * @param bool $bool + * * @return $this */ public function withForce($bool = true) @@ -66,8 +63,6 @@ class ServerDeletionService /** * Delete a server from the panel and remove any associated databases from hosts. * - * @param \Pterodactyl\Models\Server $server - * * @throws \Throwable * @throws \Pterodactyl\Exceptions\DisplayException */ @@ -80,7 +75,7 @@ class ServerDeletionService // go ahead and bail out. We specifically ignore a 404 since that can be assumed // to be a safe error, meaning the server doesn't exist at all on Wings so there // is no reason we need to bail out from that. - if (! $this->force && $exception->getStatusCode() !== Response::HTTP_NOT_FOUND) { + if (!$this->force && $exception->getStatusCode() !== Response::HTTP_NOT_FOUND) { throw $exception; } diff --git a/app/Services/Servers/StartupCommandService.php b/app/Services/Servers/StartupCommandService.php index bf31763cc..efdbbc5c4 100644 --- a/app/Services/Servers/StartupCommandService.php +++ b/app/Services/Servers/StartupCommandService.php @@ -8,10 +8,6 @@ class StartupCommandService { /** * Generates a startup command for a given server instance. - * - * @param \Pterodactyl\Models\Server $server - * @param bool $hideAllValues - * @return string */ public function handle(Server $server, bool $hideAllValues = false): string { diff --git a/app/Services/Servers/StartupModificationService.php b/app/Services/Servers/StartupModificationService.php index f154c54bd..66645e4f2 100644 --- a/app/Services/Servers/StartupModificationService.php +++ b/app/Services/Servers/StartupModificationService.php @@ -27,7 +27,6 @@ class StartupModificationService /** * StartupModificationService constructor. * - * @param \Illuminate\Database\ConnectionInterface $connection * @param \Pterodactyl\Services\Servers\VariableValidatorService $validatorService */ public function __construct(ConnectionInterface $connection, VariableValidatorService $validatorService) @@ -39,16 +38,12 @@ class StartupModificationService /** * Process startup modification for a server. * - * @param \Pterodactyl\Models\Server $server - * @param array $data - * @return \Pterodactyl\Models\Server - * * @throws \Throwable */ public function handle(Server $server, array $data): Server { return $this->connection->transaction(function () use ($server, $data) { - if (! empty($data['environment'])) { + if (!empty($data['environment'])) { $egg = $this->isUserLevel(User::USER_LEVEL_ADMIN) ? ($data['egg_id'] ?? $server->egg_id) : $server->egg_id; $results = $this->validatorService @@ -83,15 +78,12 @@ class StartupModificationService /** * Update certain administrative settings for a server in the DB. - * - * @param array $data - * @param \Pterodactyl\Models\Server $server */ protected function updateAdministrativeSettings(array $data, Server &$server) { $eggId = Arr::get($data, 'egg_id'); - if (is_digit($eggId) && $server->egg_id !== (int)$eggId) { + if (is_digit($eggId) && $server->egg_id !== (int) $eggId) { /** @var \Pterodactyl\Models\Egg $egg */ $egg = Egg::query()->findOrFail($data['egg_id']); diff --git a/app/Services/Servers/SuspensionService.php b/app/Services/Servers/SuspensionService.php index 3f3035cb0..6b1c15541 100644 --- a/app/Services/Servers/SuspensionService.php +++ b/app/Services/Servers/SuspensionService.php @@ -10,8 +10,8 @@ use Pterodactyl\Exceptions\Http\Server\ServerTransferringException; class SuspensionService { - const ACTION_SUSPEND = 'suspend'; - const ACTION_UNSUSPEND = 'unsuspend'; + public const ACTION_SUSPEND = 'suspend'; + public const ACTION_UNSUSPEND = 'unsuspend'; /** * @var \Illuminate\Database\ConnectionInterface @@ -25,9 +25,6 @@ class SuspensionService /** * SuspensionService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonServerRepository */ public function __construct( ConnectionInterface $connection, @@ -40,7 +37,6 @@ class SuspensionService /** * Suspends a server on the system. * - * @param \Pterodactyl\Models\Server $server * @param string $action * * @throws \Throwable @@ -58,8 +54,8 @@ class SuspensionService } // Check if the server is currently being transferred. - if (! is_null($server->transfer)) { - throw new ServerTransferringException; + if (!is_null($server->transfer)) { + throw new ServerTransferringException(); } $this->connection->transaction(function () use ($action, $server, $isSuspending) { diff --git a/app/Services/Servers/TransferService.php b/app/Services/Servers/TransferService.php index b45a78dc8..35aed0659 100644 --- a/app/Services/Servers/TransferService.php +++ b/app/Services/Servers/TransferService.php @@ -20,9 +20,6 @@ class TransferService /** * TransferService constructor. - * - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonServerRepository - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository */ public function __construct( DaemonServerRepository $daemonServerRepository, diff --git a/app/Services/Servers/VariableValidatorService.php b/app/Services/Servers/VariableValidatorService.php index 7cb1aa427..2ac3879a5 100644 --- a/app/Services/Servers/VariableValidatorService.php +++ b/app/Services/Servers/VariableValidatorService.php @@ -27,8 +27,6 @@ class VariableValidatorService /** * VariableValidatorService constructor. - * - * @param \Illuminate\Contracts\Validation\Factory $validator */ public function __construct(ValidationFactory $validator) { @@ -38,15 +36,12 @@ class VariableValidatorService /** * Validate all of the passed data against the given service option variables. * - * @param int $egg - * @param array $fields - * @return \Illuminate\Support\Collection * @throws \Illuminate\Validation\ValidationException */ public function handle(int $egg, array $fields = []): Collection { $query = EggVariable::query()->where('egg_id', $egg); - if (! $this->isUserLevel(User::USER_LEVEL_ADMIN)) { + if (!$this->isUserLevel(User::USER_LEVEL_ADMIN)) { // Don't attempt to validate variables if they aren't user editable // and we're not running this at an admin level. $query = $query->where('user_editable', true)->where('user_viewable', true); @@ -68,7 +63,7 @@ class VariableValidatorService } return Collection::make($variables)->map(function ($item) use ($fields) { - return (object)[ + return (object) [ 'id' => $item->id, 'key' => $item->env_variable, 'value' => $fields[$item->env_variable] ?? null, diff --git a/app/Services/Subusers/SubuserCreationService.php b/app/Services/Subusers/SubuserCreationService.php index 5efc700fe..b1affd3f3 100644 --- a/app/Services/Subusers/SubuserCreationService.php +++ b/app/Services/Subusers/SubuserCreationService.php @@ -37,11 +37,6 @@ class SubuserCreationService /** * SubuserCreationService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Repositories\Eloquent\SubuserRepository $subuserRepository - * @param \Pterodactyl\Services\Users\UserCreationService $userCreationService - * @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $userRepository */ public function __construct( ConnectionInterface $connection, @@ -60,11 +55,6 @@ class SubuserCreationService * If the email address already belongs to a user on the system a new user will not * be created. * - * @param \Pterodactyl\Models\Server $server - * @param string $email - * @param array $permissions - * @return \Pterodactyl\Models\Subuser - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Service\Subuser\ServerSubuserExistsException * @throws \Pterodactyl\Exceptions\Service\Subuser\UserIsServerOwnerException diff --git a/app/Services/Users/ToggleTwoFactorService.php b/app/Services/Users/ToggleTwoFactorService.php index f8b41b454..908fc35d6 100644 --- a/app/Services/Users/ToggleTwoFactorService.php +++ b/app/Services/Users/ToggleTwoFactorService.php @@ -41,12 +41,6 @@ class ToggleTwoFactorService /** * ToggleTwoFactorService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter - * @param \PragmaRX\Google2FA\Google2FA $google2FA - * @param \Pterodactyl\Repositories\Eloquent\RecoveryTokenRepository $recoveryTokenRepository - * @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository */ public function __construct( ConnectionInterface $connection, @@ -65,9 +59,6 @@ class ToggleTwoFactorService /** * Toggle 2FA on an account only if the token provided is valid. * - * @param \Pterodactyl\Models\User $user - * @param string $token - * @param bool|null $toggleState * @return string[] * * @throws \Throwable @@ -82,7 +73,7 @@ class ToggleTwoFactorService $isValidToken = $this->google2FA->verifyKey($secret, $token, config()->get('pterodactyl.auth.2fa.window')); - if (! $isValidToken) { + if (!$isValidToken) { throw new TwoFactorAuthenticationTokenInvalid('The token provided is not valid.'); } @@ -95,9 +86,9 @@ class ToggleTwoFactorService // which will then be marked as deleted from the database and will also bypass 2FA protections // on their account. $tokens = []; - if ((! $toggleState && ! $user->use_totp) || $toggleState) { + if ((!$toggleState && !$user->use_totp) || $toggleState) { $inserts = []; - for ($i = 0; $i < 10; $i++) { + for ($i = 0; $i < 10; ++$i) { $token = Str::random(10); $inserts[] = [ @@ -118,7 +109,7 @@ class ToggleTwoFactorService $this->repository->withoutFreshModel()->update($user->id, [ 'totp_authenticated_at' => Carbon::now(), - 'use_totp' => (is_null($toggleState) ? ! $user->use_totp : $toggleState), + 'use_totp' => (is_null($toggleState) ? !$user->use_totp : $toggleState), ]); return $tokens; diff --git a/app/Services/Users/TwoFactorSetupService.php b/app/Services/Users/TwoFactorSetupService.php index 5dcb7879c..e3649634f 100644 --- a/app/Services/Users/TwoFactorSetupService.php +++ b/app/Services/Users/TwoFactorSetupService.php @@ -11,7 +11,7 @@ use Illuminate\Contracts\Config\Repository as ConfigRepository; class TwoFactorSetupService { - const VALID_BASE32_CHARACTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'; + public const VALID_BASE32_CHARACTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'; /** * @var \Illuminate\Contracts\Config\Repository @@ -30,10 +30,6 @@ class TwoFactorSetupService /** * TwoFactorSetupService constructor. - * - * @param \Illuminate\Contracts\Config\Repository $config - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter - * @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository */ public function __construct( ConfigRepository $config, @@ -50,9 +46,6 @@ class TwoFactorSetupService * QR code URL. This URL will need to be attached to a QR generating service in * order to function. * - * @param \Pterodactyl\Models\User $user - * @return string - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -60,7 +53,7 @@ class TwoFactorSetupService { $secret = ''; try { - for ($i = 0; $i < $this->config->get('pterodactyl.auth.2fa.bytes', 16); $i++) { + for ($i = 0; $i < $this->config->get('pterodactyl.auth.2fa.bytes', 16); ++$i) { $secret .= substr(self::VALID_BASE32_CHARACTERS, random_int(0, 31), 1); } } catch (Exception $exception) { diff --git a/app/Services/Users/UserCreationService.php b/app/Services/Users/UserCreationService.php index 5bc56dd40..2d0abcb9f 100644 --- a/app/Services/Users/UserCreationService.php +++ b/app/Services/Users/UserCreationService.php @@ -33,11 +33,6 @@ class UserCreationService /** * CreationService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Illuminate\Contracts\Hashing\Hasher $hasher - * @param \Illuminate\Contracts\Auth\PasswordBroker $passwordBroker - * @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository */ public function __construct( ConnectionInterface $connection, @@ -54,7 +49,6 @@ class UserCreationService /** * Create a new user on the system. * - * @param array $data * @return \Pterodactyl\Models\User * * @throws \Exception @@ -62,12 +56,12 @@ class UserCreationService */ public function handle(array $data) { - if (array_key_exists('password', $data) && ! empty($data['password'])) { + if (array_key_exists('password', $data) && !empty($data['password'])) { $data['password'] = $this->hasher->make($data['password']); } $this->connection->beginTransaction(); - if (! isset($data['password']) || empty($data['password'])) { + if (!isset($data['password']) || empty($data['password'])) { $generateResetToken = true; $data['password'] = $this->hasher->make(str_random(30)); } diff --git a/app/Services/Users/UserDeletionService.php b/app/Services/Users/UserDeletionService.php index fd5196821..87459773e 100644 --- a/app/Services/Users/UserDeletionService.php +++ b/app/Services/Users/UserDeletionService.php @@ -34,10 +34,6 @@ class UserDeletionService /** * DeletionService constructor. - * - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $serverRepository - * @param \Illuminate\Contracts\Translation\Translator $translator - * @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository */ public function __construct( ServerRepositoryInterface $serverRepository, @@ -53,6 +49,7 @@ class UserDeletionService * Delete a user from the panel only if they have no servers attached to their account. * * @param int|\Pterodactyl\Models\User $user + * * @return bool|null * * @throws \Pterodactyl\Exceptions\DisplayException diff --git a/app/Services/Users/UserUpdateService.php b/app/Services/Users/UserUpdateService.php index 4e1911a32..0c7e1c172 100644 --- a/app/Services/Users/UserUpdateService.php +++ b/app/Services/Users/UserUpdateService.php @@ -23,9 +23,6 @@ class UserUpdateService /** * UpdateService constructor. - * - * @param \Illuminate\Contracts\Hashing\Hasher $hasher - * @param \Pterodactyl\Repositories\Eloquent\UserRepository $repository */ public function __construct(Hasher $hasher, UserRepository $repository) { @@ -36,8 +33,6 @@ class UserUpdateService /** * Update the user model instance. * - * @param \Pterodactyl\Models\User $user - * @param array $data * @return \Pterodactyl\Models\User * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -45,7 +40,7 @@ class UserUpdateService */ public function handle(User $user, array $data) { - if (! empty(array_get($data, 'password'))) { + if (!empty(array_get($data, 'password'))) { $data['password'] = $this->hasher->make($data['password']); } else { unset($data['password']); diff --git a/app/Traits/Commands/EnvironmentWriterTrait.php b/app/Traits/Commands/EnvironmentWriterTrait.php index 6726e931f..10692a9a4 100644 --- a/app/Traits/Commands/EnvironmentWriterTrait.php +++ b/app/Traits/Commands/EnvironmentWriterTrait.php @@ -16,14 +16,12 @@ trait EnvironmentWriterTrait /** * Update the .env file for the application using the passed in values. * - * @param array $values - * * @throws \Pterodactyl\Exceptions\PterodactylException */ public function writeToEnvironment(array $values = []) { $path = base_path('.env'); - if (! file_exists($path)) { + if (!file_exists($path)) { throw new PterodactylException('Cannot locate .env file, was this software installed correctly?'); } @@ -33,7 +31,7 @@ trait EnvironmentWriterTrait // If the key value is not sorrounded by quotation marks, and contains anything that could reasonably // cause environment parsing issues, wrap it in quotes before writing it. This also adds slashes to the // value to ensure quotes within it don't cause us issues. - if (! preg_match('/^\"(.*)\"$/', $value) && preg_match('/([^\w.\-+\/])+/', $value)) { + if (!preg_match('/^\"(.*)\"$/', $value) && preg_match('/([^\w.\-+\/])+/', $value)) { $value = sprintf('"%s"', addslashes($value)); } diff --git a/app/Traits/Controllers/JavascriptInjection.php b/app/Traits/Controllers/JavascriptInjection.php index 556c99550..4e7e0a120 100644 --- a/app/Traits/Controllers/JavascriptInjection.php +++ b/app/Traits/Controllers/JavascriptInjection.php @@ -22,7 +22,6 @@ trait JavascriptInjection /** * Set the request object to use when injecting JS. * - * @param \Illuminate\Http\Request $request * @return $this */ public function setRequest(Request $request) @@ -36,6 +35,7 @@ trait JavascriptInjection * Injects the exact array passed in, nothing more. * * @param array $args + * * @return array */ public function plainInject($args = []) diff --git a/app/Traits/Helpers/AvailableLanguages.php b/app/Traits/Helpers/AvailableLanguages.php index f44771f6d..479722976 100644 --- a/app/Traits/Helpers/AvailableLanguages.php +++ b/app/Traits/Helpers/AvailableLanguages.php @@ -22,7 +22,6 @@ trait AvailableLanguages * that are present in the language folder. * * @param bool $localize - * @return array */ public function getAvailableLanguages($localize = false): array { @@ -36,8 +35,6 @@ trait AvailableLanguages /** * Return an instance of the filesystem for getting a folder listing. - * - * @return \Illuminate\Filesystem\Filesystem */ private function getFilesystemInstance(): Filesystem { @@ -46,8 +43,6 @@ trait AvailableLanguages /** * Return an instance of the ISO639 class for generating names. - * - * @return \Matriphe\ISO639\ISO639 */ private function getIsoInstance(): ISO639 { diff --git a/app/Traits/Services/HasUserLevels.php b/app/Traits/Services/HasUserLevels.php index 29e49e8e6..293e7fce7 100644 --- a/app/Traits/Services/HasUserLevels.php +++ b/app/Traits/Services/HasUserLevels.php @@ -14,7 +14,6 @@ trait HasUserLevels /** * Set the access level for running this function. * - * @param int $level * @return $this */ public function setUserLevel(int $level) @@ -26,8 +25,6 @@ trait HasUserLevels /** * Determine which level this function is running at. - * - * @return int */ public function getUserLevel(): int { @@ -36,9 +33,6 @@ trait HasUserLevels /** * Determine if the current user level is set to a specific level. - * - * @param int $level - * @return bool */ public function isUserLevel(int $level): bool { diff --git a/app/Traits/Services/ReturnsUpdatedModels.php b/app/Traits/Services/ReturnsUpdatedModels.php index 2d5ee64fd..07e4f4fde 100644 --- a/app/Traits/Services/ReturnsUpdatedModels.php +++ b/app/Traits/Services/ReturnsUpdatedModels.php @@ -22,8 +22,6 @@ trait ReturnsUpdatedModels * for API calls, but is unnecessary for UI based updates where the page is * being reloaded and a fresh model will be pulled anyways. * - * @param bool $toggle - * * @return $this */ public function returnUpdatedModel(bool $toggle = true) diff --git a/app/Traits/Services/ValidatesValidationRules.php b/app/Traits/Services/ValidatesValidationRules.php index d2010c828..f4c1ea188 100644 --- a/app/Traits/Services/ValidatesValidationRules.php +++ b/app/Traits/Services/ValidatesValidationRules.php @@ -9,9 +9,6 @@ use Pterodactyl\Exceptions\Service\Egg\Variable\BadValidationRuleException; trait ValidatesValidationRules { - /** - * @return \Illuminate\Contracts\Validation\Factory - */ abstract protected function getValidator(): Factory; /** @@ -29,9 +26,7 @@ trait ValidatesValidationRules } catch (BadMethodCallException $exception) { $matches = []; if (preg_match('/Method \[(.+)\] does not exist\./', $exception->getMessage(), $matches)) { - throw new BadValidationRuleException(trans('exceptions.nest.variables.bad_validation_rule', [ - 'rule' => Str::snake(str_replace('validate', '', array_get($matches, 1, 'unknownRule'))), - ]), $exception); + throw new BadValidationRuleException(trans('exceptions.nest.variables.bad_validation_rule', ['rule' => Str::snake(str_replace('validate', '', array_get($matches, 1, 'unknownRule')))]), $exception); } throw $exception; diff --git a/app/Transformers/Api/Application/AllocationTransformer.php b/app/Transformers/Api/Application/AllocationTransformer.php index d0c71e634..135294771 100644 --- a/app/Transformers/Api/Application/AllocationTransformer.php +++ b/app/Transformers/Api/Application/AllocationTransformer.php @@ -18,8 +18,6 @@ class AllocationTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -29,7 +27,6 @@ class AllocationTransformer extends BaseTransformer /** * Return a generic transformed allocation array. * - * @param \Pterodactyl\Models\Allocation $allocation * @return array */ public function transform(Allocation $allocation) @@ -40,43 +37,47 @@ class AllocationTransformer extends BaseTransformer 'alias' => $allocation->ip_alias, 'port' => $allocation->port, 'notes' => $allocation->notes, - 'assigned' => ! is_null($allocation->server_id), + 'assigned' => !is_null($allocation->server_id), ]; } /** * Load the node relationship onto a given transformation. * - * @param \Pterodactyl\Models\Allocation $allocation * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeNode(Allocation $allocation) { - if (! $this->authorize(AdminAcl::RESOURCE_NODES)) { + if (!$this->authorize(AdminAcl::RESOURCE_NODES)) { return $this->null(); } return $this->item( - $allocation->node, $this->makeTransformer(NodeTransformer::class), Node::RESOURCE_NAME + $allocation->node, + $this->makeTransformer(NodeTransformer::class), + Node::RESOURCE_NAME ); } /** * Load the server relationship onto a given transformation. * - * @param \Pterodactyl\Models\Allocation $allocation * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeServer(Allocation $allocation) { - if (! $this->authorize(AdminAcl::RESOURCE_SERVERS) || ! $allocation->server) { + if (!$this->authorize(AdminAcl::RESOURCE_SERVERS) || !$allocation->server) { return $this->null(); } return $this->item( - $allocation->server, $this->makeTransformer(ServerTransformer::class), Server::RESOURCE_NAME + $allocation->server, + $this->makeTransformer(ServerTransformer::class), + Server::RESOURCE_NAME ); } } diff --git a/app/Transformers/Api/Application/BaseTransformer.php b/app/Transformers/Api/Application/BaseTransformer.php index 563dd086c..3c5630366 100644 --- a/app/Transformers/Api/Application/BaseTransformer.php +++ b/app/Transformers/Api/Application/BaseTransformer.php @@ -2,7 +2,7 @@ namespace Pterodactyl\Transformers\Api\Application; -use Cake\Chronos\Chronos; +use Carbon\CarbonImmutable; use Pterodactyl\Models\ApiKey; use Illuminate\Container\Container; use Illuminate\Database\Eloquent\Model; @@ -15,7 +15,7 @@ use Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException; */ abstract class BaseTransformer extends TransformerAbstract { - const RESPONSE_TIMEZONE = 'UTC'; + public const RESPONSE_TIMEZONE = 'UTC'; /** * @var \Pterodactyl\Models\ApiKey @@ -24,8 +24,6 @@ abstract class BaseTransformer extends TransformerAbstract /** * Return the resource name for the JSONAPI output. - * - * @return string */ abstract public function getResourceName(): string; @@ -43,7 +41,6 @@ abstract class BaseTransformer extends TransformerAbstract /** * Set the HTTP request class being used for this request. * - * @param \Pterodactyl\Models\ApiKey $key * @return $this */ public function setKey(ApiKey $key) @@ -55,8 +52,6 @@ abstract class BaseTransformer extends TransformerAbstract /** * Return the request instance being used for this transformer. - * - * @return \Pterodactyl\Models\ApiKey */ public function getKey(): ApiKey { @@ -67,9 +62,6 @@ abstract class BaseTransformer extends TransformerAbstract * Determine if the API key loaded onto the transformer has permission * to access a different resource. This is used when including other * models on a transformation request. - * - * @param string $resource - * @return bool */ protected function authorize(string $resource): bool { @@ -80,8 +72,6 @@ abstract class BaseTransformer extends TransformerAbstract * Create a new instance of the transformer and pass along the currently * set API key. * - * @param string $abstract - * @param array $parameters * @return \Pterodactyl\Transformers\Api\Application\BaseTransformer * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException @@ -92,7 +82,7 @@ abstract class BaseTransformer extends TransformerAbstract $transformer = Container::getInstance()->makeWith($abstract, $parameters); $transformer->setKey($this->getKey()); - if (! $transformer instanceof self) { + if (!$transformer instanceof self) { throw new InvalidTransformerLevelException('Calls to ' . __METHOD__ . ' must return a transformer that is an instance of ' . __CLASS__); } @@ -101,13 +91,10 @@ abstract class BaseTransformer extends TransformerAbstract /** * Return an ISO-8601 formatted timestamp to use in the API response. - * - * @param string $timestamp - * @return string */ protected function formatTimestamp(string $timestamp): string { - return Chronos::createFromFormat(Chronos::DEFAULT_TO_STRING_FORMAT, $timestamp) + return CarbonImmutable::createFromFormat(CarbonImmutable::DEFAULT_TO_STRING_FORMAT, $timestamp) ->setTimezone(self::RESPONSE_TIMEZONE) ->toIso8601String(); } diff --git a/app/Transformers/Api/Application/DatabaseHostTransformer.php b/app/Transformers/Api/Application/DatabaseHostTransformer.php index 3ef10e8ad..be888df5c 100644 --- a/app/Transformers/Api/Application/DatabaseHostTransformer.php +++ b/app/Transformers/Api/Application/DatabaseHostTransformer.php @@ -2,7 +2,6 @@ namespace Pterodactyl\Transformers\Api\Application; -use Cake\Chronos\Chronos; use Pterodactyl\Models\Database; use Pterodactyl\Models\DatabaseHost; use Pterodactyl\Services\Acl\Api\AdminAcl; @@ -18,8 +17,6 @@ class DatabaseHostTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -29,7 +26,6 @@ class DatabaseHostTransformer extends BaseTransformer /** * Transform database host into a representation for the application API. * - * @param \Pterodactyl\Models\DatabaseHost $model * @return array */ public function transform(DatabaseHost $model) @@ -41,25 +37,21 @@ class DatabaseHostTransformer extends BaseTransformer 'port' => $model->port, 'username' => $model->username, 'node' => $model->node_id, - 'created_at' => Chronos::createFromFormat(Chronos::DEFAULT_TO_STRING_FORMAT, $model->created_at) - ->setTimezone(config('app.timezone')) - ->toIso8601String(), - 'updated_at' => Chronos::createFromFormat(Chronos::DEFAULT_TO_STRING_FORMAT, $model->updated_at) - ->setTimezone(config('app.timezone')) - ->toIso8601String(), + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), ]; } /** * Include the databases associated with this host. * - * @param \Pterodactyl\Models\DatabaseHost $model * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeDatabases(DatabaseHost $model) { - if (! $this->authorize(AdminAcl::RESOURCE_SERVER_DATABASES)) { + if (!$this->authorize(AdminAcl::RESOURCE_SERVER_DATABASES)) { return $this->null(); } diff --git a/app/Transformers/Api/Application/EggTransformer.php b/app/Transformers/Api/Application/EggTransformer.php index 5982d009f..a4d3d6985 100644 --- a/app/Transformers/Api/Application/EggTransformer.php +++ b/app/Transformers/Api/Application/EggTransformer.php @@ -21,8 +21,6 @@ class EggTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -33,7 +31,6 @@ class EggTransformer extends BaseTransformer * Transform an Egg model into a representation that can be consumed by * the application api. * - * @param \Pterodactyl\Models\Egg $model * @return array */ public function transform(Egg $model) @@ -74,13 +71,13 @@ class EggTransformer extends BaseTransformer /** * Include the Nest relationship for the given Egg in the transformation. * - * @param \Pterodactyl\Models\Egg $model * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeNest(Egg $model) { - if (! $this->authorize(AdminAcl::RESOURCE_NESTS)) { + if (!$this->authorize(AdminAcl::RESOURCE_NESTS)) { return $this->null(); } @@ -92,13 +89,13 @@ class EggTransformer extends BaseTransformer /** * Include the Servers relationship for the given Egg in the transformation. * - * @param \Pterodactyl\Models\Egg $model * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeServers(Egg $model) { - if (! $this->authorize(AdminAcl::RESOURCE_SERVERS)) { + if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) { return $this->null(); } @@ -111,7 +108,6 @@ class EggTransformer extends BaseTransformer * Include more detailed information about the configuration if this Egg is * extending another. * - * @param \Pterodactyl\Models\Egg $model * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource */ public function includeConfig(Egg $model) @@ -136,7 +132,6 @@ class EggTransformer extends BaseTransformer * Include more detailed information about the script configuration if the * Egg is extending another. * - * @param \Pterodactyl\Models\Egg $model * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource */ public function includeScript(Egg $model) @@ -160,13 +155,13 @@ class EggTransformer extends BaseTransformer /** * Include the variables that are defined for this Egg. * - * @param \Pterodactyl\Models\Egg $model * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeVariables(Egg $model) { - if (! $this->authorize(AdminAcl::RESOURCE_EGGS)) { + if (!$this->authorize(AdminAcl::RESOURCE_EGGS)) { return $this->null(); } diff --git a/app/Transformers/Api/Application/EggVariableTransformer.php b/app/Transformers/Api/Application/EggVariableTransformer.php index decb038ab..2088806d5 100644 --- a/app/Transformers/Api/Application/EggVariableTransformer.php +++ b/app/Transformers/Api/Application/EggVariableTransformer.php @@ -9,8 +9,6 @@ class EggVariableTransformer extends BaseTransformer { /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { diff --git a/app/Transformers/Api/Application/LocationTransformer.php b/app/Transformers/Api/Application/LocationTransformer.php index 7d24cc974..dfa8315ec 100644 --- a/app/Transformers/Api/Application/LocationTransformer.php +++ b/app/Transformers/Api/Application/LocationTransformer.php @@ -16,8 +16,6 @@ class LocationTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -26,9 +24,6 @@ class LocationTransformer extends BaseTransformer /** * Return a generic transformed location array. - * - * @param \Pterodactyl\Models\Location $location - * @return array */ public function transform(Location $location): array { @@ -44,14 +39,13 @@ class LocationTransformer extends BaseTransformer /** * Return the nodes associated with this location. * - * @param \Pterodactyl\Models\Location $location * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeServers(Location $location) { - if (! $this->authorize(AdminAcl::RESOURCE_SERVERS)) { + if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) { return $this->null(); } @@ -63,14 +57,13 @@ class LocationTransformer extends BaseTransformer /** * Return the nodes associated with this location. * - * @param \Pterodactyl\Models\Location $location * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeNodes(Location $location) { - if (! $this->authorize(AdminAcl::RESOURCE_NODES)) { + if (!$this->authorize(AdminAcl::RESOURCE_NODES)) { return $this->null(); } diff --git a/app/Transformers/Api/Application/NestTransformer.php b/app/Transformers/Api/Application/NestTransformer.php index 80154a682..506b0276b 100644 --- a/app/Transformers/Api/Application/NestTransformer.php +++ b/app/Transformers/Api/Application/NestTransformer.php @@ -20,8 +20,6 @@ class NestTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -32,7 +30,6 @@ class NestTransformer extends BaseTransformer * Transform a Nest model into a representation that can be consumed by the * application API. * - * @param \Pterodactyl\Models\Nest $model * @return array */ public function transform(Nest $model) @@ -48,14 +45,13 @@ class NestTransformer extends BaseTransformer /** * Include the Eggs relationship on the given Nest model transformation. * - * @param \Pterodactyl\Models\Nest $model * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeEggs(Nest $model) { - if (! $this->authorize(AdminAcl::RESOURCE_EGGS)) { + if (!$this->authorize(AdminAcl::RESOURCE_EGGS)) { return $this->null(); } @@ -67,14 +63,13 @@ class NestTransformer extends BaseTransformer /** * Include the servers relationship on the given Nest model. * - * @param \Pterodactyl\Models\Nest $model * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeServers(Nest $model) { - if (! $this->authorize(AdminAcl::RESOURCE_SERVERS)) { + if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) { return $this->null(); } diff --git a/app/Transformers/Api/Application/NodeTransformer.php b/app/Transformers/Api/Application/NodeTransformer.php index c26d67cef..aaed68e9b 100644 --- a/app/Transformers/Api/Application/NodeTransformer.php +++ b/app/Transformers/Api/Application/NodeTransformer.php @@ -16,8 +16,6 @@ class NodeTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -27,9 +25,6 @@ class NodeTransformer extends BaseTransformer /** * Return a node transformed into a format that can be consumed by the * external administrative API. - * - * @param \Pterodactyl\Models\Node $node - * @return array */ public function transform(Node $node): array { @@ -57,60 +52,66 @@ class NodeTransformer extends BaseTransformer /** * Return the nodes associated with this location. * - * @param \Pterodactyl\Models\Node $node * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeAllocations(Node $node) { - if (! $this->authorize(AdminAcl::RESOURCE_ALLOCATIONS)) { + if (!$this->authorize(AdminAcl::RESOURCE_ALLOCATIONS)) { return $this->null(); } $node->loadMissing('allocations'); return $this->collection( - $node->getRelation('allocations'), $this->makeTransformer(AllocationTransformer::class), 'allocation' + $node->getRelation('allocations'), + $this->makeTransformer(AllocationTransformer::class), + 'allocation' ); } /** * Return the nodes associated with this location. * - * @param \Pterodactyl\Models\Node $node * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeLocation(Node $node) { - if (! $this->authorize(AdminAcl::RESOURCE_LOCATIONS)) { + if (!$this->authorize(AdminAcl::RESOURCE_LOCATIONS)) { return $this->null(); } $node->loadMissing('location'); return $this->item( - $node->getRelation('location'), $this->makeTransformer(LocationTransformer::class), 'location' + $node->getRelation('location'), + $this->makeTransformer(LocationTransformer::class), + 'location' ); } /** * Return the nodes associated with this location. * - * @param \Pterodactyl\Models\Node $node * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeServers(Node $node) { - if (! $this->authorize(AdminAcl::RESOURCE_SERVERS)) { + if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) { return $this->null(); } $node->loadMissing('servers'); return $this->collection( - $node->getRelation('servers'), $this->makeTransformer(ServerTransformer::class), 'server' + $node->getRelation('servers'), + $this->makeTransformer(ServerTransformer::class), + 'server' ); } } diff --git a/app/Transformers/Api/Application/ServerDatabaseTransformer.php b/app/Transformers/Api/Application/ServerDatabaseTransformer.php index dd238375d..95180e2d9 100644 --- a/app/Transformers/Api/Application/ServerDatabaseTransformer.php +++ b/app/Transformers/Api/Application/ServerDatabaseTransformer.php @@ -2,7 +2,6 @@ namespace Pterodactyl\Transformers\Api\Application; -use Cake\Chronos\Chronos; use Pterodactyl\Models\Database; use Pterodactyl\Models\DatabaseHost; use Pterodactyl\Services\Acl\Api\AdminAcl; @@ -22,8 +21,6 @@ class ServerDatabaseTransformer extends BaseTransformer /** * Perform dependency injection. - * - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter */ public function handle(Encrypter $encrypter) { @@ -32,8 +29,6 @@ class ServerDatabaseTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -42,9 +37,6 @@ class ServerDatabaseTransformer extends BaseTransformer /** * Transform a database model in a representation for the application API. - * - * @param \Pterodactyl\Models\Database $model - * @return array */ public function transform(Database $model): array { @@ -56,19 +48,14 @@ class ServerDatabaseTransformer extends BaseTransformer 'username' => $model->username, 'remote' => $model->remote, 'max_connections' => $model->max_connections, - 'created_at' => Chronos::createFromFormat(Chronos::DEFAULT_TO_STRING_FORMAT, $model->created_at) - ->setTimezone(config('app.timezone')) - ->toIso8601String(), - 'updated_at' => Chronos::createFromFormat(Chronos::DEFAULT_TO_STRING_FORMAT, $model->updated_at) - ->setTimezone(config('app.timezone')) - ->toIso8601String(), + 'created_at' => $model->created_at->toIso8601String(), + 'updated_at' => $model->updated_at->toIso8601String(), ]; } /** * Include the database password in the request. * - * @param \Pterodactyl\Models\Database $model * @return \League\Fractal\Resource\Item */ public function includePassword(Database $model) @@ -83,13 +70,13 @@ class ServerDatabaseTransformer extends BaseTransformer /** * Return the database host relationship for this server database. * - * @param \Pterodactyl\Models\Database $model * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeHost(Database $model) { - if (! $this->authorize(AdminAcl::RESOURCE_DATABASE_HOSTS)) { + if (!$this->authorize(AdminAcl::RESOURCE_DATABASE_HOSTS)) { return $this->null(); } diff --git a/app/Transformers/Api/Application/ServerTransformer.php b/app/Transformers/Api/Application/ServerTransformer.php index 08fdd9b1c..c1d33e06d 100644 --- a/app/Transformers/Api/Application/ServerTransformer.php +++ b/app/Transformers/Api/Application/ServerTransformer.php @@ -33,8 +33,6 @@ class ServerTransformer extends BaseTransformer /** * Perform dependency injection. - * - * @param \Pterodactyl\Services\Servers\EnvironmentService $environmentService */ public function handle(EnvironmentService $environmentService) { @@ -43,8 +41,6 @@ class ServerTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -53,9 +49,6 @@ class ServerTransformer extends BaseTransformer /** * Return a generic transformed server array. - * - * @param \Pterodactyl\Models\Server $server - * @return array */ public function transform(Server $server): array { @@ -102,14 +95,13 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array of allocations for this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeAllocations(Server $server) { - if (! $this->authorize(AdminAcl::RESOURCE_ALLOCATIONS)) { + if (!$this->authorize(AdminAcl::RESOURCE_ALLOCATIONS)) { return $this->null(); } @@ -121,14 +113,13 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array of data about subusers for this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeSubusers(Server $server) { - if (! $this->authorize(AdminAcl::RESOURCE_USERS)) { + if (!$this->authorize(AdminAcl::RESOURCE_USERS)) { return $this->null(); } @@ -140,14 +131,13 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array of data about subusers for this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeUser(Server $server) { - if (! $this->authorize(AdminAcl::RESOURCE_USERS)) { + if (!$this->authorize(AdminAcl::RESOURCE_USERS)) { return $this->null(); } @@ -159,14 +149,13 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array with nest information for this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeNest(Server $server) { - if (! $this->authorize(AdminAcl::RESOURCE_NESTS)) { + if (!$this->authorize(AdminAcl::RESOURCE_NESTS)) { return $this->null(); } @@ -178,14 +167,13 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array with egg information for this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeEgg(Server $server) { - if (! $this->authorize(AdminAcl::RESOURCE_EGGS)) { + if (!$this->authorize(AdminAcl::RESOURCE_EGGS)) { return $this->null(); } @@ -197,14 +185,13 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array of data about subusers for this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeVariables(Server $server) { - if (! $this->authorize(AdminAcl::RESOURCE_SERVERS)) { + if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) { return $this->null(); } @@ -216,14 +203,13 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array with location information for this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeLocation(Server $server) { - if (! $this->authorize(AdminAcl::RESOURCE_LOCATIONS)) { + if (!$this->authorize(AdminAcl::RESOURCE_LOCATIONS)) { return $this->null(); } @@ -235,14 +221,13 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array with node information for this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeNode(Server $server) { - if (! $this->authorize(AdminAcl::RESOURCE_NODES)) { + if (!$this->authorize(AdminAcl::RESOURCE_NODES)) { return $this->null(); } @@ -254,14 +239,13 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array with database information for this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeDatabases(Server $server) { - if (! $this->authorize(AdminAcl::RESOURCE_SERVER_DATABASES)) { + if (!$this->authorize(AdminAcl::RESOURCE_SERVER_DATABASES)) { return $this->null(); } diff --git a/app/Transformers/Api/Application/ServerVariableTransformer.php b/app/Transformers/Api/Application/ServerVariableTransformer.php index 3f7eeac49..aefa318e2 100644 --- a/app/Transformers/Api/Application/ServerVariableTransformer.php +++ b/app/Transformers/Api/Application/ServerVariableTransformer.php @@ -16,8 +16,6 @@ class ServerVariableTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -27,7 +25,6 @@ class ServerVariableTransformer extends BaseTransformer /** * Return a generic transformed server variable array. * - * @param \Pterodactyl\Models\EggVariable $variable * @return array */ public function transform(EggVariable $variable) @@ -38,13 +35,13 @@ class ServerVariableTransformer extends BaseTransformer /** * Return the parent service variable data. * - * @param \Pterodactyl\Models\EggVariable $variable * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeParent(EggVariable $variable) { - if (! $this->authorize(AdminAcl::RESOURCE_EGGS)) { + if (!$this->authorize(AdminAcl::RESOURCE_EGGS)) { return $this->null(); } diff --git a/app/Transformers/Api/Application/SubuserTransformer.php b/app/Transformers/Api/Application/SubuserTransformer.php index 265e2f9d0..08c622666 100644 --- a/app/Transformers/Api/Application/SubuserTransformer.php +++ b/app/Transformers/Api/Application/SubuserTransformer.php @@ -3,7 +3,6 @@ namespace Pterodactyl\Transformers\Api\Application; use Pterodactyl\Models\Subuser; -use Pterodactyl\Models\Permission; use Pterodactyl\Services\Acl\Api\AdminAcl; class SubuserTransformer extends BaseTransformer @@ -17,8 +16,6 @@ class SubuserTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -27,9 +24,6 @@ class SubuserTransformer extends BaseTransformer /** * Return a transformed Subuser model that can be consumed by external services. - * - * @param \Pterodactyl\Models\Subuser $subuser - * @return array */ public function transform(Subuser $subuser): array { @@ -46,14 +40,13 @@ class SubuserTransformer extends BaseTransformer /** * Return a generic item of user for this subuser. * - * @param \Pterodactyl\Models\Subuser $subuser * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeUser(Subuser $subuser) { - if (! $this->authorize(AdminAcl::RESOURCE_USERS)) { + if (!$this->authorize(AdminAcl::RESOURCE_USERS)) { return $this->null(); } @@ -65,14 +58,13 @@ class SubuserTransformer extends BaseTransformer /** * Return a generic item of server for this subuser. * - * @param \Pterodactyl\Models\Subuser $subuser * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeServer(Subuser $subuser) { - if (! $this->authorize(AdminAcl::RESOURCE_SERVERS)) { + if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) { return $this->null(); } diff --git a/app/Transformers/Api/Application/UserTransformer.php b/app/Transformers/Api/Application/UserTransformer.php index 2e55bbb1b..b3b423507 100644 --- a/app/Transformers/Api/Application/UserTransformer.php +++ b/app/Transformers/Api/Application/UserTransformer.php @@ -16,8 +16,6 @@ class UserTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -26,9 +24,6 @@ class UserTransformer extends BaseTransformer /** * Return a transformed User model that can be consumed by external services. - * - * @param \Pterodactyl\Models\User $user - * @return array */ public function transform(User $user): array { @@ -51,14 +46,13 @@ class UserTransformer extends BaseTransformer /** * Return the servers associated with this user. * - * @param \Pterodactyl\Models\User $user * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeServers(User $user) { - if (! $this->authorize(AdminAcl::RESOURCE_SERVERS)) { + if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) { return $this->null(); } diff --git a/app/Transformers/Api/Client/AccountTransformer.php b/app/Transformers/Api/Client/AccountTransformer.php index 2cdc92e34..405a4208a 100644 --- a/app/Transformers/Api/Client/AccountTransformer.php +++ b/app/Transformers/Api/Client/AccountTransformer.php @@ -8,8 +8,6 @@ class AccountTransformer extends BaseClientTransformer { /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -19,7 +17,6 @@ class AccountTransformer extends BaseClientTransformer /** * Return basic information about the currently logged in user. * - * @param \Pterodactyl\Models\User $model * @return array */ public function transform(User $model) diff --git a/app/Transformers/Api/Client/AllocationTransformer.php b/app/Transformers/Api/Client/AllocationTransformer.php index 57f72eaf3..0d9bfec7c 100644 --- a/app/Transformers/Api/Client/AllocationTransformer.php +++ b/app/Transformers/Api/Client/AllocationTransformer.php @@ -8,8 +8,6 @@ class AllocationTransformer extends BaseClientTransformer { /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -19,7 +17,6 @@ class AllocationTransformer extends BaseClientTransformer /** * Return basic information about the currently logged in user. * - * @param \Pterodactyl\Models\Allocation $model * @return array */ public function transform(Allocation $model) diff --git a/app/Transformers/Api/Client/ApiKeyTransformer.php b/app/Transformers/Api/Client/ApiKeyTransformer.php index 4c30ea3a6..c7c39c2b4 100644 --- a/app/Transformers/Api/Client/ApiKeyTransformer.php +++ b/app/Transformers/Api/Client/ApiKeyTransformer.php @@ -17,7 +17,6 @@ class ApiKeyTransformer extends BaseClientTransformer /** * Transform this model into a representation that can be consumed by a client. * - * @param \Pterodactyl\Models\ApiKey $model * @return array */ public function transform(ApiKey $model) diff --git a/app/Transformers/Api/Client/BackupTransformer.php b/app/Transformers/Api/Client/BackupTransformer.php index d5acd41fe..fe341ff16 100644 --- a/app/Transformers/Api/Client/BackupTransformer.php +++ b/app/Transformers/Api/Client/BackupTransformer.php @@ -6,16 +6,12 @@ use Pterodactyl\Models\Backup; class BackupTransformer extends BaseClientTransformer { - /** - * @return string - */ public function getResourceName(): string { return Backup::RESOURCE_NAME; } /** - * @param \Pterodactyl\Models\Backup $backup * @return array */ public function transform(Backup $backup) diff --git a/app/Transformers/Api/Client/BaseClientTransformer.php b/app/Transformers/Api/Client/BaseClientTransformer.php index c15e583ec..efe53276f 100644 --- a/app/Transformers/Api/Client/BaseClientTransformer.php +++ b/app/Transformers/Api/Client/BaseClientTransformer.php @@ -18,8 +18,6 @@ abstract class BaseClientTransformer extends BaseApplicationTransformer /** * Return the user model of the user requesting this transformation. - * - * @return \Pterodactyl\Models\User */ public function getUser(): User { @@ -28,8 +26,6 @@ abstract class BaseClientTransformer extends BaseApplicationTransformer /** * Set the user model of the user requesting this transformation. - * - * @param \Pterodactyl\Models\User $user */ public function setUser(User $user) { @@ -41,9 +37,7 @@ abstract class BaseClientTransformer extends BaseApplicationTransformer * to access a different resource. This is used when including other * models on a transformation request. * - * @param string $ability * @param \Pterodactyl\Models\Server $server - * @return bool */ protected function authorize(string $ability, Server $server = null): bool { @@ -56,8 +50,6 @@ abstract class BaseClientTransformer extends BaseApplicationTransformer * Create a new instance of the transformer and pass along the currently * set API key. * - * @param string $abstract - * @param array $parameters * @return self * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException @@ -68,7 +60,7 @@ abstract class BaseClientTransformer extends BaseApplicationTransformer $transformer = Container::getInstance()->makeWith($abstract, $parameters); $transformer->setKey($this->getKey()); - if (! $transformer instanceof self) { + if (!$transformer instanceof self) { throw new InvalidTransformerLevelException('Calls to ' . __METHOD__ . ' must return a transformer that is an instance of ' . __CLASS__); } diff --git a/app/Transformers/Api/Client/DatabaseTransformer.php b/app/Transformers/Api/Client/DatabaseTransformer.php index e63583deb..9c5bd86d4 100644 --- a/app/Transformers/Api/Client/DatabaseTransformer.php +++ b/app/Transformers/Api/Client/DatabaseTransformer.php @@ -23,9 +23,6 @@ class DatabaseTransformer extends BaseClientTransformer /** * Handle dependency injection. - * - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter - * @param \Pterodactyl\Contracts\Extensions\HashidsInterface $hashids */ public function handle(Encrypter $encrypter, HashidsInterface $hashids) { @@ -33,18 +30,11 @@ class DatabaseTransformer extends BaseClientTransformer $this->hashids = $hashids; } - /** - * @return string - */ public function getResourceName(): string { return Database::RESOURCE_NAME; } - /** - * @param \Pterodactyl\Models\Database $model - * @return array - */ public function transform(Database $model): array { $model->loadMissing('host'); @@ -65,12 +55,11 @@ class DatabaseTransformer extends BaseClientTransformer /** * Include the database password in the request. * - * @param \Pterodactyl\Models\Database $database * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource */ public function includePassword(Database $database) { - if (! $this->getUser()->can(Permission::ACTION_DATABASE_VIEW_PASSWORD, $database->server)) { + if (!$this->getUser()->can(Permission::ACTION_DATABASE_VIEW_PASSWORD, $database->server)) { return $this->null(); } diff --git a/app/Transformers/Api/Client/EggTransformer.php b/app/Transformers/Api/Client/EggTransformer.php index ed5b8c585..25e135007 100644 --- a/app/Transformers/Api/Client/EggTransformer.php +++ b/app/Transformers/Api/Client/EggTransformer.php @@ -8,8 +8,6 @@ class EggTransformer extends BaseClientTransformer { /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -17,7 +15,6 @@ class EggTransformer extends BaseClientTransformer } /** - * @param \Pterodactyl\Models\Egg $egg * @return array */ public function transform(Egg $egg) diff --git a/app/Transformers/Api/Client/EggVariableTransformer.php b/app/Transformers/Api/Client/EggVariableTransformer.php index 4f7e39658..c7725b978 100644 --- a/app/Transformers/Api/Client/EggVariableTransformer.php +++ b/app/Transformers/Api/Client/EggVariableTransformer.php @@ -3,21 +3,16 @@ namespace Pterodactyl\Transformers\Api\Client; use BadMethodCallException; -use InvalidArgumentException; use Pterodactyl\Models\EggVariable; class EggVariableTransformer extends BaseClientTransformer { - /** - * @return string - */ public function getResourceName(): string { return EggVariable::RESOURCE_NAME; } /** - * @param \Pterodactyl\Models\EggVariable $variable * @return array */ public function transform(EggVariable $variable) @@ -26,9 +21,7 @@ class EggVariableTransformer extends BaseClientTransformer // them into the transformer and along to the user. Just throw an exception and break the entire // pathway since you should never be exposing these types of variables to a client. if (!$variable->user_viewable) { - throw new BadMethodCallException( - 'Cannot transform a hidden egg variable in a client transformer.' - ); + throw new BadMethodCallException('Cannot transform a hidden egg variable in a client transformer.'); } return [ diff --git a/app/Transformers/Api/Client/ScheduleTransformer.php b/app/Transformers/Api/Client/ScheduleTransformer.php index 43e35ed42..44ea2c555 100644 --- a/app/Transformers/Api/Client/ScheduleTransformer.php +++ b/app/Transformers/Api/Client/ScheduleTransformer.php @@ -29,7 +29,6 @@ class ScheduleTransformer extends BaseClientTransformer /** * Returns a transformed schedule model such that a client can view the information. * - * @param \Pterodactyl\Models\Schedule $model * @return array */ public function transform(Schedule $model) @@ -40,6 +39,7 @@ class ScheduleTransformer extends BaseClientTransformer 'cron' => [ 'day_of_week' => $model->cron_day_of_week, 'day_of_month' => $model->cron_day_of_month, + 'month' => $model->cron_month, 'hour' => $model->cron_hour, 'minute' => $model->cron_minute, ], @@ -55,7 +55,6 @@ class ScheduleTransformer extends BaseClientTransformer /** * Allows attaching the tasks specific to the schedule in the response. * - * @param \Pterodactyl\Models\Schedule $model * @return \League\Fractal\Resource\Collection * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException @@ -63,7 +62,9 @@ class ScheduleTransformer extends BaseClientTransformer public function includeTasks(Schedule $model) { return $this->collection( - $model->tasks, $this->makeTransformer(TaskTransformer::class), Task::RESOURCE_NAME + $model->tasks, + $this->makeTransformer(TaskTransformer::class), + Task::RESOURCE_NAME ); } } diff --git a/app/Transformers/Api/Client/ServerTransformer.php b/app/Transformers/Api/Client/ServerTransformer.php index 18124325d..4bf9a8099 100644 --- a/app/Transformers/Api/Client/ServerTransformer.php +++ b/app/Transformers/Api/Client/ServerTransformer.php @@ -23,9 +23,6 @@ class ServerTransformer extends BaseClientTransformer */ protected $availableIncludes = ['egg', 'subusers']; - /** - * @return string - */ public function getResourceName(): string { return Server::RESOURCE_NAME; @@ -34,9 +31,6 @@ class ServerTransformer extends BaseClientTransformer /** * Transform a server model into a representation that can be returned * to a client. - * - * @param \Pterodactyl\Models\Server $server - * @return array */ public function transform(Server $server): array { @@ -62,7 +56,7 @@ class ServerTransformer extends BaseClientTransformer 'io' => $server->io, 'cpu' => $server->cpu, ], - 'invocation' => $service->handle($server, ! $this->getUser()->can(Permission::ACTION_STARTUP_READ, $server)), + 'invocation' => $service->handle($server, !$this->getUser()->can(Permission::ACTION_STARTUP_READ, $server)), 'docker_image' => $server->image, 'egg_features' => $server->egg->inherit_features, 'feature_limits' => [ @@ -82,7 +76,6 @@ class ServerTransformer extends BaseClientTransformer /** * Returns the allocations associated with this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException @@ -98,7 +91,7 @@ class ServerTransformer extends BaseClientTransformer // // This allows us to avoid too much permission regression, without also hiding information that // is generally needed for the frontend to make sense when browsing or searching results. - if (! $this->getUser()->can(Permission::ACTION_ALLOCATION_READ, $server)) { + if (!$this->getUser()->can(Permission::ACTION_ALLOCATION_READ, $server)) { $primary = clone $server->allocation; $primary->notes = null; @@ -109,14 +102,13 @@ class ServerTransformer extends BaseClientTransformer } /** - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeVariables(Server $server) { - if (! $this->getUser()->can(Permission::ACTION_STARTUP_READ, $server)) { + if (!$this->getUser()->can(Permission::ACTION_STARTUP_READ, $server)) { return $this->null(); } @@ -130,8 +122,8 @@ class ServerTransformer extends BaseClientTransformer /** * Returns the egg associated with this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Item + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeEgg(Server $server) @@ -142,14 +134,13 @@ class ServerTransformer extends BaseClientTransformer /** * Returns the subusers associated with this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeSubusers(Server $server) { - if (! $this->getUser()->can(Permission::ACTION_USER_READ, $server)) { + if (!$this->getUser()->can(Permission::ACTION_USER_READ, $server)) { return $this->null(); } diff --git a/app/Transformers/Api/Client/StatsTransformer.php b/app/Transformers/Api/Client/StatsTransformer.php index 97989cc3a..8ca7bea07 100644 --- a/app/Transformers/Api/Client/StatsTransformer.php +++ b/app/Transformers/Api/Client/StatsTransformer.php @@ -6,9 +6,6 @@ use Illuminate\Support\Arr; class StatsTransformer extends BaseClientTransformer { - /** - * @return string - */ public function getResourceName(): string { return 'stats'; @@ -18,7 +15,6 @@ class StatsTransformer extends BaseClientTransformer * Transform stats from the daemon into a result set that can be used in * the client API. * - * @param array $data * @return array */ public function transform(array $data) diff --git a/app/Transformers/Api/Client/SubuserTransformer.php b/app/Transformers/Api/Client/SubuserTransformer.php index d2e7ce0ff..7a8bfde0e 100644 --- a/app/Transformers/Api/Client/SubuserTransformer.php +++ b/app/Transformers/Api/Client/SubuserTransformer.php @@ -8,8 +8,6 @@ class SubuserTransformer extends BaseClientTransformer { /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -19,8 +17,8 @@ class SubuserTransformer extends BaseClientTransformer /** * Transforms a subuser into a model that can be shown to a front-end user. * - * @param \Pterodactyl\Models\Subuser $model * @return array|void + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function transform(Subuser $model) diff --git a/app/Transformers/Api/Client/TaskTransformer.php b/app/Transformers/Api/Client/TaskTransformer.php index c215479ac..0b2956262 100644 --- a/app/Transformers/Api/Client/TaskTransformer.php +++ b/app/Transformers/Api/Client/TaskTransformer.php @@ -17,7 +17,6 @@ class TaskTransformer extends BaseClientTransformer /** * Transforms a schedule's task into a client viewable format. * - * @param \Pterodactyl\Models\Task $model * @return array */ public function transform(Task $model) diff --git a/app/Transformers/Api/Client/UserTransformer.php b/app/Transformers/Api/Client/UserTransformer.php index 65849f06d..468232f8d 100644 --- a/app/Transformers/Api/Client/UserTransformer.php +++ b/app/Transformers/Api/Client/UserTransformer.php @@ -9,8 +9,6 @@ class UserTransformer extends BaseClientTransformer { /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -21,7 +19,6 @@ class UserTransformer extends BaseClientTransformer * Transforms a User model into a representation that can be shown to regular * users of the API. * - * @param \Pterodactyl\Models\User $model * @return array */ public function transform(User $model) diff --git a/app/Transformers/Daemon/FileObjectTransformer.php b/app/Transformers/Daemon/FileObjectTransformer.php index f19d9028c..1ad86dce8 100644 --- a/app/Transformers/Daemon/FileObjectTransformer.php +++ b/app/Transformers/Daemon/FileObjectTransformer.php @@ -17,7 +17,6 @@ class FileObjectTransformer extends BaseDaemonTransformer /** * Transform a file object response from the daemon into a standardized response. * - * @param array $item * @return array */ public function transform(array $item) @@ -35,9 +34,6 @@ class FileObjectTransformer extends BaseDaemonTransformer ]; } - /** - * @return string - */ public function getResourceName(): string { return 'file_object'; diff --git a/app/helpers.php b/app/helpers.php index 0716fd214..ac099f923 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -1,11 +1,12 @@ make(Kernel::class); */ $kernel->bootstrap(); -$output = new ConsoleOutput; +// Register the collision service provider so that errors during the test +// setup process are output nicely. +(new Provider())->register(); + +$output = new ConsoleOutput(); if (config('database.default') !== 'testing') { $output->writeln(PHP_EOL . 'Cannot run test process against non-testing database.'); @@ -27,7 +32,7 @@ if (config('database.default') !== 'testing') { * Perform database migrations and reseeding before continuing with * running the tests. */ -if (! env('SKIP_MIGRATIONS')) { +if (!env('SKIP_MIGRATIONS')) { $output->writeln(PHP_EOL . 'Refreshing database for Integration tests...'); $kernel->call('migrate:fresh', ['--database' => 'testing']); diff --git a/composer.json b/composer.json index a07a9ae85..ab9dd5a0c 100644 --- a/composer.json +++ b/composer.json @@ -11,67 +11,64 @@ } ], "require": { - "php": "^7.2", + "php": "^7.4 || ^8.0", + "ext-json": "*", "ext-mbstring": "*", "ext-pdo_mysql": "*", "ext-zip": "*", - "appstract/laravel-blade-directives": "^1.8", - "aws/aws-sdk-php": "^3.134", - "cakephp/chronos": "^1.3", - "doctrine/dbal": "^2.10", - "fideloper/proxy": "^4.2", - "guzzlehttp/guzzle": "^6.5", - "hashids/hashids": "^4.0", - "laracasts/utilities": "^3.1", - "laravel/framework": "^7.17", - "laravel/helpers": "^1.2", - "laravel/tinker": "^2.4", - "laravel/ui": "^2.0", - "lcobucci/jwt": "^3.3", + "aws/aws-sdk-php": "^3.171", + "doctrine/dbal": "^2.12", + "fideloper/proxy": "^4.4", + "guzzlehttp/guzzle": "^7.2", + "hashids/hashids": "^4.1", + "laracasts/utilities": "^3.2", + "laravel/framework": "^8.22", + "laravel/helpers": "^1.4", + "laravel/tinker": "^2.5", + "laravel/ui": "^3.0", + "lcobucci/jwt": "^4.0", "league/flysystem-aws-s3-v3": "^1.0", "league/flysystem-memory": "^1.0", "matriphe/iso-639": "^1.2", "pragmarx/google2fa": "^5.0", "predis/predis": "^1.1", "prologue/alerts": "^0.4", - "psy/psysh": "^0.10.4", "s1lentium/iptools": "^1.1", - "spatie/laravel-fractal": "^5.7", - "spatie/laravel-query-builder": "^2.8", - "staudenmeir/belongs-to-through": "^2.10", + "spatie/laravel-fractal": "^5.8", + "spatie/laravel-query-builder": "^3.3", + "staudenmeir/belongs-to-through": "^2.11", "symfony/yaml": "^4.4", "webmozart/assert": "^1.9" }, "require-dev": { - "barryvdh/laravel-debugbar": "^3.3", - "barryvdh/laravel-ide-helper": "^2.7", - "codedungeon/phpunit-result-printer": "^0.28.0", - "friendsofphp/php-cs-fixer": "2.16.1", - "fzaninotto/faker": "^1.9", - "laravel/dusk": "^6.3", + "barryvdh/laravel-debugbar": "^3.5", + "barryvdh/laravel-ide-helper": "^2.9", + "facade/ignition": "^2.5", + "fakerphp/faker": "^1.13", + "friendsofphp/php-cs-fixer": "^2.18", + "laravel/dusk": "^6.11", "mockery/mockery": "^1.4", + "nunomaduro/collision": "^5.2", "php-mock/php-mock-phpunit": "^2.6", - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "^9.0" }, "autoload": { - "classmap": [ - "database" - ], "files": [ "app/helpers.php" ], "psr-4": { - "Pterodactyl\\": "app/" + "Pterodactyl\\": "app/", + "Database\\Factories\\": "database/Factories/", + "Database\\Seeders\\": "database/Seeders/" } }, "autoload-dev": { "psr-4": { - "Pterodactyl\\Tests\\Browser\\": "tests/Browser", - "Pterodactyl\\Tests\\Integration\\": "tests/Integration", - "Tests\\": "tests/" + "Pterodactyl\\Tests\\": "tests/" } }, "scripts": { + "php-cs-fixer": "php-cs-fixer fix --diff --diff-format=udiff --config=./.php_cs.dist --rules=psr_autoloading", "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], @@ -80,7 +77,7 @@ ], "post-autoload-dump": [ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", - "@php artisan package:discover" + "@php artisan package:discover || true" ] }, "prefer-stable": true, diff --git a/composer.lock b/composer.lock index 6df479deb..b710b41f1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,74 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d05ab995e4aff4b847ff2a027924065c", + "content-hash": "ff65a88dee023a86598a10a5178c0165", "packages": [ - { - "name": "appstract/laravel-blade-directives", - "version": "1.9.0", - "source": { - "type": "git", - "url": "https://github.com/appstract/laravel-blade-directives.git", - "reference": "c569529da9bf4d87c85157061c5e86b5ee1f8ff4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/appstract/laravel-blade-directives/zipball/c569529da9bf4d87c85157061c5e86b5ee1f8ff4", - "reference": "c569529da9bf4d87c85157061c5e86b5ee1f8ff4", - "shasum": "" - }, - "require": { - "laravel/framework": "^5.7|^6.0|^7.0", - "php": "^7.1.3" - }, - "require-dev": { - "orchestra/testbench": "~3.7|^4.0|^5.0" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "Appstract\\BladeDirectives\\BladeDirectivesServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "Appstract\\BladeDirectives\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gijs Jorissen", - "email": "gijs@appstract.nl", - "homepage": "https://appstract.nl", - "role": "Developer" - } - ], - "description": "Handy Blade directives", - "homepage": "https://github.com/appstract/laravel-blade-directives", - "keywords": [ - "appstract", - "laravel-blade-directives" - ], - "time": "2020-04-14T08:41:18+00:00" - }, { "name": "aws/aws-sdk-php", - "version": "3.142.8", + "version": "3.172.0", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "a9cffb2442b63ca8a99ed3e68aef19df221e2a54" + "reference": "5a5e66c4d54c392042820703eeb8a6bd3d222924" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/a9cffb2442b63ca8a99ed3e68aef19df221e2a54", - "reference": "a9cffb2442b63ca8a99ed3e68aef19df221e2a54", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/5a5e66c4d54c392042820703eeb8a6bd3d222924", + "reference": "5a5e66c4d54c392042820703eeb8a6bd3d222924", "shasum": "" }, "require": { @@ -143,30 +89,35 @@ "s3", "sdk" ], - "time": "2020-06-23T18:46:28+00:00" + "support": { + "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", + "issues": "https://github.com/aws/aws-sdk-php/issues", + "source": "https://github.com/aws/aws-sdk-php/tree/3.172.0" + }, + "time": "2021-01-22T19:21:38+00:00" }, { "name": "brick/math", - "version": "0.8.15", + "version": "0.9.2", "source": { "type": "git", "url": "https://github.com/brick/math.git", - "reference": "9b08d412b9da9455b210459ff71414de7e6241cd" + "reference": "dff976c2f3487d42c1db75a3b180e2b9f0e72ce0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/9b08d412b9da9455b210459ff71414de7e6241cd", - "reference": "9b08d412b9da9455b210459ff71414de7e6241cd", + "url": "https://api.github.com/repos/brick/math/zipball/dff976c2f3487d42c1db75a3b180e2b9f0e72ce0", + "reference": "dff976c2f3487d42c1db75a3b180e2b9f0e72ce0", "shasum": "" }, "require": { "ext-json": "*", - "php": "^7.1|^8.0" + "php": "^7.1 || ^8.0" }, "require-dev": { "php-coveralls/php-coveralls": "^2.2", - "phpunit/phpunit": "^7.5.15|^8.5", - "vimeo/psalm": "^3.5" + "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.0", + "vimeo/psalm": "4.3.2" }, "type": "library", "autoload": { @@ -189,69 +140,17 @@ "brick", "math" ], + "support": { + "issues": "https://github.com/brick/math/issues", + "source": "https://github.com/brick/math/tree/0.9.2" + }, "funding": [ { "url": "https://tidelift.com/funding/github/packagist/brick/math", "type": "tidelift" } ], - "time": "2020-04-15T15:59:35+00:00" - }, - { - "name": "cakephp/chronos", - "version": "1.3.0", - "source": { - "type": "git", - "url": "https://github.com/cakephp/chronos.git", - "reference": "ba2bab98849e7bf29b02dd634ada49ab36472959" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/cakephp/chronos/zipball/ba2bab98849e7bf29b02dd634ada49ab36472959", - "reference": "ba2bab98849e7bf29b02dd634ada49ab36472959", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "athletic/athletic": "~0.1", - "cakephp/cakephp-codesniffer": "^3.0", - "phpbench/phpbench": "@dev", - "phpunit/phpunit": "<6.0 || ^7.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Cake\\Chronos\\": "src/" - }, - "files": [ - "src/carbon_compat.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Brian Nesbitt", - "email": "brian@nesbot.com", - "homepage": "http://nesbot.com" - }, - { - "name": "The CakePHP Team", - "homepage": "http://cakephp.org" - } - ], - "description": "A simple API extension for DateTime.", - "homepage": "http://cakephp.org", - "keywords": [ - "date", - "datetime", - "time" - ], - "time": "2019-11-30T02:33:19+00:00" + "time": "2021-01-20T22:51:39+00:00" }, { "name": "dnoegel/php-xdg-base-dir", @@ -284,20 +183,24 @@ "MIT" ], "description": "implementation of xdg base directory specification for php", + "support": { + "issues": "https://github.com/dnoegel/php-xdg-base-dir/issues", + "source": "https://github.com/dnoegel/php-xdg-base-dir/tree/v0.1.1" + }, "time": "2019-12-04T15:06:13+00:00" }, { "name": "doctrine/cache", - "version": "1.10.1", + "version": "1.10.2", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "35a4a70cd94e09e2259dfae7488afc6b474ecbd3" + "reference": "13e3381b25847283a91948d04640543941309727" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/35a4a70cd94e09e2259dfae7488afc6b474ecbd3", - "reference": "35a4a70cd94e09e2259dfae7488afc6b474ecbd3", + "url": "https://api.github.com/repos/doctrine/cache/zipball/13e3381b25847283a91948d04640543941309727", + "reference": "13e3381b25847283a91948d04640543941309727", "shasum": "" }, "require": { @@ -366,6 +269,10 @@ "redis", "xcache" ], + "support": { + "issues": "https://github.com/doctrine/cache/issues", + "source": "https://github.com/doctrine/cache/tree/1.10.x" + }, "funding": [ { "url": "https://www.doctrine-project.org/sponsorship.html", @@ -380,36 +287,36 @@ "type": "tidelift" } ], - "time": "2020-05-27T16:24:54+00:00" + "time": "2020-07-07T18:54:01+00:00" }, { "name": "doctrine/dbal", - "version": "2.10.2", + "version": "2.12.1", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "aab745e7b6b2de3b47019da81e7225e14dcfdac8" + "reference": "adce7a954a1c2f14f85e94aed90c8489af204086" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/aab745e7b6b2de3b47019da81e7225e14dcfdac8", - "reference": "aab745e7b6b2de3b47019da81e7225e14dcfdac8", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/adce7a954a1c2f14f85e94aed90c8489af204086", + "reference": "adce7a954a1c2f14f85e94aed90c8489af204086", "shasum": "" }, "require": { "doctrine/cache": "^1.0", "doctrine/event-manager": "^1.0", "ext-pdo": "*", - "php": "^7.2" + "php": "^7.3 || ^8" }, "require-dev": { - "doctrine/coding-standard": "^6.0", + "doctrine/coding-standard": "^8.1", "jetbrains/phpstorm-stubs": "^2019.1", - "nikic/php-parser": "^4.4", - "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^8.4.1", + "phpstan/phpstan": "^0.12.40", + "phpunit/phpunit": "^9.4", + "psalm/plugin-phpunit": "^0.10.0", "symfony/console": "^2.0.5|^3.0|^4.0|^5.0", - "vimeo/psalm": "^3.11" + "vimeo/psalm": "^3.17.2" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." @@ -420,8 +327,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.10.x-dev", - "dev-develop": "3.0.x-dev" + "dev-master": "4.0.x-dev" } }, "autoload": { @@ -474,6 +380,10 @@ "sqlserver", "sqlsrv" ], + "support": { + "issues": "https://github.com/doctrine/dbal/issues", + "source": "https://github.com/doctrine/dbal/tree/2.12.1" + }, "funding": [ { "url": "https://www.doctrine-project.org/sponsorship.html", @@ -488,24 +398,24 @@ "type": "tidelift" } ], - "time": "2020-04-20T17:19:26+00:00" + "time": "2020-11-14T20:26:58+00:00" }, { "name": "doctrine/event-manager", - "version": "1.1.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/doctrine/event-manager.git", - "reference": "629572819973f13486371cb611386eb17851e85c" + "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/event-manager/zipball/629572819973f13486371cb611386eb17851e85c", - "reference": "629572819973f13486371cb611386eb17851e85c", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/41370af6a30faa9dc0368c4a6814d596e81aba7f", + "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.1 || ^8.0" }, "conflict": { "doctrine/common": "<2.9@dev" @@ -564,7 +474,25 @@ "event system", "events" ], - "time": "2019-11-10T09:48:07+00:00" + "support": { + "issues": "https://github.com/doctrine/event-manager/issues", + "source": "https://github.com/doctrine/event-manager/tree/1.1.x" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fevent-manager", + "type": "tidelift" + } + ], + "time": "2020-05-29T18:28:51+00:00" }, { "name": "doctrine/inflector", @@ -641,6 +569,10 @@ "uppercase", "words" ], + "support": { + "issues": "https://github.com/doctrine/inflector/issues", + "source": "https://github.com/doctrine/inflector/tree/2.0.x" + }, "funding": [ { "url": "https://www.doctrine-project.org/sponsorship.html", @@ -717,6 +649,10 @@ "parser", "php" ], + "support": { + "issues": "https://github.com/doctrine/lexer/issues", + "source": "https://github.com/doctrine/lexer/tree/1.2.1" + }, "funding": [ { "url": "https://www.doctrine-project.org/sponsorship.html", @@ -735,30 +671,32 @@ }, { "name": "dragonmantank/cron-expression", - "version": "v2.3.0", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/dragonmantank/cron-expression.git", - "reference": "72b6fbf76adb3cf5bc0db68559b33d41219aba27" + "reference": "7a8c6e56ab3ffcc538d05e8155bb42269abf1a0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/72b6fbf76adb3cf5bc0db68559b33d41219aba27", - "reference": "72b6fbf76adb3cf5bc0db68559b33d41219aba27", + "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/7a8c6e56ab3ffcc538d05e8155bb42269abf1a0c", + "reference": "7a8c6e56ab3ffcc538d05e8155bb42269abf1a0c", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.2|^8.0", + "webmozart/assert": "^1.7.0" + }, + "replace": { + "mtdowling/cron-expression": "^1.0" }, "require-dev": { - "phpunit/phpunit": "^6.4|^7.0" + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-webmozart-assert": "^0.12.7", + "phpunit/phpunit": "^7.0|^8.0|^9.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3-dev" - } - }, "autoload": { "psr-4": { "Cron\\": "src/Cron/" @@ -769,11 +707,6 @@ "MIT" ], "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, { "name": "Chris Tankersley", "email": "chris@ctankersley.com", @@ -785,20 +718,30 @@ "cron", "schedule" ], - "time": "2019-03-31T00:38:28+00:00" + "support": { + "issues": "https://github.com/dragonmantank/cron-expression/issues", + "source": "https://github.com/dragonmantank/cron-expression/tree/v3.1.0" + }, + "funding": [ + { + "url": "https://github.com/dragonmantank", + "type": "github" + } + ], + "time": "2020-11-24T19:55:57+00:00" }, { "name": "egulias/email-validator", - "version": "2.1.18", + "version": "2.1.25", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "cfa3d44471c7f5bfb684ac2b0da7114283d78441" + "reference": "0dbf5d78455d4d6a41d186da50adc1122ec066f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/cfa3d44471c7f5bfb684ac2b0da7114283d78441", - "reference": "cfa3d44471c7f5bfb684ac2b0da7114283d78441", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0dbf5d78455d4d6a41d186da50adc1122ec066f4", + "reference": "0dbf5d78455d4d6a41d186da50adc1122ec066f4", "shasum": "" }, "require": { @@ -843,28 +786,38 @@ "validation", "validator" ], - "time": "2020-06-16T20:11:17+00:00" + "support": { + "issues": "https://github.com/egulias/EmailValidator/issues", + "source": "https://github.com/egulias/EmailValidator/tree/2.1.25" + }, + "funding": [ + { + "url": "https://github.com/egulias", + "type": "github" + } + ], + "time": "2020-12-29T14:50:06+00:00" }, { "name": "fideloper/proxy", - "version": "4.4.0", + "version": "4.4.1", "source": { "type": "git", "url": "https://github.com/fideloper/TrustedProxy.git", - "reference": "9beebf48a1c344ed67c1d36bb1b8709db7c3c1a8" + "reference": "c073b2bd04d1c90e04dc1b787662b558dd65ade0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fideloper/TrustedProxy/zipball/9beebf48a1c344ed67c1d36bb1b8709db7c3c1a8", - "reference": "9beebf48a1c344ed67c1d36bb1b8709db7c3c1a8", + "url": "https://api.github.com/repos/fideloper/TrustedProxy/zipball/c073b2bd04d1c90e04dc1b787662b558dd65ade0", + "reference": "c073b2bd04d1c90e04dc1b787662b558dd65ade0", "shasum": "" }, "require": { - "illuminate/contracts": "^5.0|^6.0|^7.0|^8.0", + "illuminate/contracts": "^5.0|^6.0|^7.0|^8.0|^9.0", "php": ">=5.4.0" }, "require-dev": { - "illuminate/http": "^5.0|^6.0|^7.0|^8.0", + "illuminate/http": "^5.0|^6.0|^7.0|^8.0|^9.0", "mockery/mockery": "^1.0", "phpunit/phpunit": "^6.0" }, @@ -897,41 +850,117 @@ "proxy", "trusted proxy" ], - "time": "2020-06-23T01:36:47+00:00" + "support": { + "issues": "https://github.com/fideloper/TrustedProxy/issues", + "source": "https://github.com/fideloper/TrustedProxy/tree/4.4.1" + }, + "time": "2020-10-22T13:48:01+00:00" }, { - "name": "guzzlehttp/guzzle", - "version": "6.5.5", + "name": "graham-campbell/result-type", + "version": "v1.0.1", "source": { "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e" + "url": "https://github.com/GrahamCampbell/Result-Type.git", + "reference": "7e279d2cd5d7fbb156ce46daada972355cea27bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/9d4290de1cfd701f38099ef7e183b64b4b7b0c5e", - "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/7e279d2cd5d7fbb156ce46daada972355cea27bb", + "reference": "7e279d2cd5d7fbb156ce46daada972355cea27bb", + "shasum": "" + }, + "require": { + "php": "^7.0|^8.0", + "phpoption/phpoption": "^1.7.3" + }, + "require-dev": { + "phpunit/phpunit": "^6.5|^7.5|^8.5|^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GrahamCampbell\\ResultType\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "graham@alt-three.com" + } + ], + "description": "An Implementation Of The Result Type", + "keywords": [ + "Graham Campbell", + "GrahamCampbell", + "Result Type", + "Result-Type", + "result" + ], + "support": { + "issues": "https://github.com/GrahamCampbell/Result-Type/issues", + "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.0.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type", + "type": "tidelift" + } + ], + "time": "2020-04-13T13:17:36+00:00" + }, + { + "name": "guzzlehttp/guzzle", + "version": "7.2.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/0aa74dfb41ae110835923ef10a9d803a22d50e79", + "reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.6.1", - "php": ">=5.5", - "symfony/polyfill-intl-idn": "^1.17.0" + "guzzlehttp/promises": "^1.4", + "guzzlehttp/psr7": "^1.7", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" }, "require-dev": { "ext-curl": "*", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "php-http/client-integration-tests": "^3.0", + "phpunit/phpunit": "^8.5.5 || ^9.3.5", "psr/log": "^1.1" }, "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", "psr/log": "Required for using the Log middleware" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.5-dev" + "dev-master": "7.1-dev" } }, "autoload": { @@ -951,6 +980,11 @@ "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" } ], "description": "Guzzle is a PHP HTTP client library", @@ -961,30 +995,54 @@ "framework", "http", "http client", + "psr-18", + "psr-7", "rest", "web service" ], - "time": "2020-06-16T21:01:06+00:00" + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/7.2.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://github.com/alexeyshockov", + "type": "github" + }, + { + "url": "https://github.com/gmponos", + "type": "github" + } + ], + "time": "2020-10-10T11:47:56+00:00" }, { "name": "guzzlehttp/promises", - "version": "v1.3.1", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + "reference": "60d379c243457e073cff02bc323a2a86cb355631" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "url": "https://api.github.com/repos/guzzle/promises/zipball/60d379c243457e073cff02bc323a2a86cb355631", + "reference": "60d379c243457e073cff02bc323a2a86cb355631", "shasum": "" }, "require": { - "php": ">=5.5.0" + "php": ">=5.5" }, "require-dev": { - "phpunit/phpunit": "^4.0" + "symfony/phpunit-bridge": "^4.4 || ^5.1" }, "type": "library", "extra": { @@ -1015,20 +1073,24 @@ "keywords": [ "promise" ], - "time": "2016-12-20T10:07:11+00:00" + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/1.4.0" + }, + "time": "2020-09-30T07:37:28+00:00" }, { "name": "guzzlehttp/psr7", - "version": "1.6.1", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a" + "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/53330f47520498c0ae1f61f7e2c90f55690c06a3", + "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3", "shasum": "" }, "require": { @@ -1041,15 +1103,15 @@ }, "require-dev": { "ext-zlib": "*", - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" }, "suggest": { - "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6-dev" + "dev-master": "1.7-dev" } }, "autoload": { @@ -1086,28 +1148,33 @@ "uri", "url" ], - "time": "2019-07-01T23:21:34+00:00" + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/1.7.0" + }, + "time": "2020-09-30T07:37:11+00:00" }, { "name": "hashids/hashids", - "version": "4.0.0", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/vinkla/hashids.git", - "reference": "43bb2407f16a631f0128f47bcb67ff986c63dde2" + "reference": "8cab111f78e0bd9c76953b082919fc9e251761be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vinkla/hashids/zipball/43bb2407f16a631f0128f47bcb67ff986c63dde2", - "reference": "43bb2407f16a631f0128f47bcb67ff986c63dde2", + "url": "https://api.github.com/repos/vinkla/hashids/zipball/8cab111f78e0bd9c76953b082919fc9e251761be", + "reference": "8cab111f78e0bd9c76953b082919fc9e251761be", "shasum": "" }, "require": { "ext-mbstring": "*", - "php": "^7.2" + "php": "^7.2 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^8.0" + "phpunit/phpunit": "^8.0 || ^9.4", + "squizlabs/php_codesniffer": "^3.5" }, "suggest": { "ext-bcmath": "Required to use BC Math arbitrary precision mathematics (*).", @@ -1116,7 +1183,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -1131,17 +1198,15 @@ "authors": [ { "name": "Ivan Akimov", - "email": "ivan@barreleye.com", - "homepage": "https://twitter.com/IvanAkimov" + "email": "ivan@barreleye.com" }, { "name": "Vincent Klaiber", - "email": "hello@doubledip.se", - "homepage": "https://doubledip.se" + "email": "hello@doubledip.se" } ], "description": "Generate short, unique, non-sequential ids (like YouTube and Bitly) from numbers", - "homepage": "http://hashids.org/php", + "homepage": "https://hashids.org/php", "keywords": [ "bitly", "decode", @@ -1153,24 +1218,28 @@ "obfuscate", "youtube" ], - "time": "2019-04-03T13:40:29+00:00" + "support": { + "issues": "https://github.com/vinkla/hashids/issues", + "source": "https://github.com/vinkla/hashids/tree/4.1.0" + }, + "time": "2020-11-26T19:24:33+00:00" }, { "name": "laracasts/utilities", - "version": "3.1", + "version": "3.2", "source": { "type": "git", "url": "https://github.com/laracasts/PHP-Vars-To-Js-Transformer.git", - "reference": "7c5eb11221de608eef8c70c2d3540c8cd80466e3" + "reference": "26b1712166a366e3f8a1fd1452d0c3b76cad612a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laracasts/PHP-Vars-To-Js-Transformer/zipball/7c5eb11221de608eef8c70c2d3540c8cd80466e3", - "reference": "7c5eb11221de608eef8c70c2d3540c8cd80466e3", + "url": "https://api.github.com/repos/laracasts/PHP-Vars-To-Js-Transformer/zipball/26b1712166a366e3f8a1fd1452d0c3b76cad612a", + "reference": "26b1712166a366e3f8a1fd1452d0c3b76cad612a", "shasum": "" }, "require": { - "illuminate/support": "^5.0|^6.0|^7.0", + "illuminate/support": "^5.0|^6.0|^7.0|^8.0", "php": ">=5.5.0|>=7.2.5" }, "require-dev": { @@ -1210,51 +1279,54 @@ "javascript", "laravel" ], - "time": "2020-03-03T16:07:08+00:00" + "support": { + "issues": "https://github.com/laracasts/PHP-Vars-To-Js-Transformer/issues", + "source": "https://github.com/laracasts/PHP-Vars-To-Js-Transformer/tree/3.2" + }, + "time": "2020-09-07T13:29:37+00:00" }, { "name": "laravel/framework", - "version": "v7.17.1", + "version": "v8.24.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "6633c4017b311d3aaae842edabd567c637afc39c" + "reference": "d16e9f875e4d7609a05d5007393e22ba95efd1fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/6633c4017b311d3aaae842edabd567c637afc39c", - "reference": "6633c4017b311d3aaae842edabd567c637afc39c", + "url": "https://api.github.com/repos/laravel/framework/zipball/d16e9f875e4d7609a05d5007393e22ba95efd1fc", + "reference": "d16e9f875e4d7609a05d5007393e22ba95efd1fc", "shasum": "" }, "require": { "doctrine/inflector": "^1.4|^2.0", - "dragonmantank/cron-expression": "^2.0", + "dragonmantank/cron-expression": "^3.0.2", "egulias/email-validator": "^2.1.10", "ext-json": "*", "ext-mbstring": "*", "ext-openssl": "*", "league/commonmark": "^1.3", - "league/flysystem": "^1.0.34", + "league/flysystem": "^1.1", "monolog/monolog": "^2.0", - "nesbot/carbon": "^2.17", - "opis/closure": "^3.1", - "php": "^7.2.5", + "nesbot/carbon": "^2.31", + "opis/closure": "^3.6", + "php": "^7.3|^8.0", "psr/container": "^1.0", "psr/simple-cache": "^1.0", - "ramsey/uuid": "^3.7|^4.0", + "ramsey/uuid": "^4.0", "swiftmailer/swiftmailer": "^6.0", - "symfony/console": "^5.0", - "symfony/error-handler": "^5.0", - "symfony/finder": "^5.0", - "symfony/http-foundation": "^5.0", - "symfony/http-kernel": "^5.0", - "symfony/mime": "^5.0", - "symfony/polyfill-php73": "^1.17", - "symfony/process": "^5.0", - "symfony/routing": "^5.0", - "symfony/var-dumper": "^5.0", + "symfony/console": "^5.1.4", + "symfony/error-handler": "^5.1.4", + "symfony/finder": "^5.1.4", + "symfony/http-foundation": "^5.1.4", + "symfony/http-kernel": "^5.1.4", + "symfony/mime": "^5.1.4", + "symfony/process": "^5.1.4", + "symfony/routing": "^5.1.4", + "symfony/var-dumper": "^5.1.4", "tijsverkoyen/css-to-inline-styles": "^2.2.2", - "vlucas/phpdotenv": "^4.0", + "vlucas/phpdotenv": "^5.2", "voku/portable-ascii": "^1.4.8" }, "conflict": { @@ -1268,6 +1340,7 @@ "illuminate/broadcasting": "self.version", "illuminate/bus": "self.version", "illuminate/cache": "self.version", + "illuminate/collections": "self.version", "illuminate/config": "self.version", "illuminate/console": "self.version", "illuminate/container": "self.version", @@ -1280,6 +1353,7 @@ "illuminate/hashing": "self.version", "illuminate/http": "self.version", "illuminate/log": "self.version", + "illuminate/macroable": "self.version", "illuminate/mail": "self.version", "illuminate/notifications": "self.version", "illuminate/pagination": "self.version", @@ -1295,60 +1369,65 @@ "illuminate/view": "self.version" }, "require-dev": { - "aws/aws-sdk-php": "^3.0", - "doctrine/dbal": "^2.6", - "filp/whoops": "^2.4", - "guzzlehttp/guzzle": "^6.3.1|^7.0", + "aws/aws-sdk-php": "^3.155", + "doctrine/dbal": "^2.6|^3.0", + "filp/whoops": "^2.8", + "guzzlehttp/guzzle": "^6.5.5|^7.0.1", "league/flysystem-cached-adapter": "^1.0", - "mockery/mockery": "^1.3.1", - "moontoast/math": "^1.1", - "orchestra/testbench-core": "^5.0", + "mockery/mockery": "^1.4.2", + "orchestra/testbench-core": "^6.8", "pda/pheanstalk": "^4.0", - "phpunit/phpunit": "^8.4|^9.0", + "phpunit/phpunit": "^8.5.8|^9.3.3", "predis/predis": "^1.1.1", - "symfony/cache": "^5.0" + "symfony/cache": "^5.1.4" }, "suggest": { - "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.0).", - "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).", + "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.155).", + "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6|^3.0).", "ext-ftp": "Required to use the Flysystem FTP driver.", "ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image().", "ext-memcached": "Required to use the memcache cache driver.", "ext-pcntl": "Required to use all features of the queue worker.", "ext-posix": "Required to use all features of the queue worker.", "ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).", - "filp/whoops": "Required for friendly error pages in development (^2.4).", - "fzaninotto/faker": "Required to use the eloquent factory builder (^1.9.1).", - "guzzlehttp/guzzle": "Required to use the HTTP Client, Mailgun mail driver and the ping methods on schedules (^6.3.1|^7.0).", + "fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).", + "filp/whoops": "Required for friendly error pages in development (^2.8).", + "guzzlehttp/guzzle": "Required to use the HTTP Client, Mailgun mail driver and the ping methods on schedules (^6.5.5|^7.0.1).", "laravel/tinker": "Required to use the tinker console command (^2.0).", "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).", "league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).", "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).", - "mockery/mockery": "Required to use mocking (^1.3.1).", - "moontoast/math": "Required to use ordered UUIDs (^1.1).", + "mockery/mockery": "Required to use mocking (^1.4.2).", "nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).", "pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).", - "phpunit/phpunit": "Required to use assertions and run tests (^8.4|^9.0).", + "phpunit/phpunit": "Required to use assertions and run tests (^8.5.8|^9.3.3).", + "predis/predis": "Required to use the predis connector (^1.1.2).", "psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).", "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^4.0).", - "symfony/cache": "Required to PSR-6 cache bridge (^5.0).", - "symfony/filesystem": "Required to create relative storage directory symbolic links (^5.0).", + "symfony/cache": "Required to PSR-6 cache bridge (^5.1.4).", + "symfony/filesystem": "Required to enable support for relative symbolic links (^5.1.4).", "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0).", "wildbit/swiftmailer-postmark": "Required to use Postmark mail driver (^3.0)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "7.x-dev" + "dev-master": "8.x-dev" } }, "autoload": { "files": [ + "src/Illuminate/Collections/helpers.php", + "src/Illuminate/Events/functions.php", "src/Illuminate/Foundation/helpers.php", "src/Illuminate/Support/helpers.php" ], "psr-4": { - "Illuminate\\": "src/Illuminate/" + "Illuminate\\": "src/Illuminate/", + "Illuminate\\Support\\": [ + "src/Illuminate/Macroable/", + "src/Illuminate/Collections/" + ] } }, "notification-url": "https://packagist.org/downloads/", @@ -1367,33 +1446,37 @@ "framework", "laravel" ], - "time": "2020-06-23T15:22:07+00:00" + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2021-01-21T14:19:29+00:00" }, { "name": "laravel/helpers", - "version": "v1.2.0", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/laravel/helpers.git", - "reference": "1f978fc5dad9f7f906b18242c654252615201de4" + "reference": "cde8ea2427db4f37d67729846b70452499210a21" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/helpers/zipball/1f978fc5dad9f7f906b18242c654252615201de4", - "reference": "1f978fc5dad9f7f906b18242c654252615201de4", + "url": "https://api.github.com/repos/laravel/helpers/zipball/cde8ea2427db4f37d67729846b70452499210a21", + "reference": "cde8ea2427db4f37d67729846b70452499210a21", "shasum": "" }, "require": { - "illuminate/support": "~5.8.0|^6.0|^7.0", - "php": ">=7.1.3" + "illuminate/support": "~5.8.0|^6.0|^7.0|^8.0", + "php": "^7.1.3|^8.0" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^7.0|^8.0|^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -1420,33 +1503,36 @@ "helpers", "laravel" ], - "time": "2020-03-03T13:52:16+00:00" + "support": { + "source": "https://github.com/laravel/helpers/tree/v1.4.0" + }, + "time": "2020-11-03T16:38:41+00:00" }, { "name": "laravel/tinker", - "version": "v2.4.0", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/laravel/tinker.git", - "reference": "cde90a7335a2130a4488beb68f4b2141869241db" + "reference": "45884b526e10a88a1b179fa1a1a24d5468c668c2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/tinker/zipball/cde90a7335a2130a4488beb68f4b2141869241db", - "reference": "cde90a7335a2130a4488beb68f4b2141869241db", + "url": "https://api.github.com/repos/laravel/tinker/zipball/45884b526e10a88a1b179fa1a1a24d5468c668c2", + "reference": "45884b526e10a88a1b179fa1a1a24d5468c668c2", "shasum": "" }, "require": { "illuminate/console": "^6.0|^7.0|^8.0", "illuminate/contracts": "^6.0|^7.0|^8.0", "illuminate/support": "^6.0|^7.0|^8.0", - "php": "^7.2", - "psy/psysh": "^0.10.3", - "symfony/var-dumper": "^4.3|^5.0" + "php": "^7.2.5|^8.0", + "psy/psysh": "^0.10.4", + "symfony/var-dumper": "^4.3.4|^5.0" }, "require-dev": { - "mockery/mockery": "^1.3.1", - "phpunit/phpunit": "^8.4|^9.0" + "mockery/mockery": "~1.3.3|^1.4.2", + "phpunit/phpunit": "^8.5.8|^9.3.3" }, "suggest": { "illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0)." @@ -1484,34 +1570,37 @@ "laravel", "psysh" ], - "time": "2020-04-07T15:01:31+00:00" + "support": { + "issues": "https://github.com/laravel/tinker/issues", + "source": "https://github.com/laravel/tinker/tree/v2.5.0" + }, + "time": "2020-10-29T13:07:12+00:00" }, { "name": "laravel/ui", - "version": "v2.0.3", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/laravel/ui.git", - "reference": "15368c5328efb7ce94f35ca750acde9b496ab1b1" + "reference": "a1f82c6283c8373ea1958b8a27c3d5c98cade351" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/ui/zipball/15368c5328efb7ce94f35ca750acde9b496ab1b1", - "reference": "15368c5328efb7ce94f35ca750acde9b496ab1b1", + "url": "https://api.github.com/repos/laravel/ui/zipball/a1f82c6283c8373ea1958b8a27c3d5c98cade351", + "reference": "a1f82c6283c8373ea1958b8a27c3d5c98cade351", "shasum": "" }, "require": { - "illuminate/console": "^7.0", - "illuminate/filesystem": "^7.0", - "illuminate/support": "^7.0", - "php": "^7.2.5" - }, - "require-dev": { - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^8.0" + "illuminate/console": "^8.0", + "illuminate/filesystem": "^8.0", + "illuminate/support": "^8.0", + "php": "^7.3|^8.0" }, "type": "library", "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + }, "laravel": { "providers": [ "Laravel\\Ui\\UiServiceProvider" @@ -1539,38 +1628,110 @@ "laravel", "ui" ], - "time": "2020-04-29T15:06:45+00:00" + "support": { + "issues": "https://github.com/laravel/ui/issues", + "source": "https://github.com/laravel/ui/tree/v3.2.0" + }, + "time": "2021-01-06T19:20:22+00:00" }, { - "name": "lcobucci/jwt", - "version": "3.3.2", + "name": "lcobucci/clock", + "version": "2.0.0", "source": { "type": "git", - "url": "https://github.com/lcobucci/jwt.git", - "reference": "56f10808089e38623345e28af2f2d5e4eb579455" + "url": "https://github.com/lcobucci/clock.git", + "reference": "353d83fe2e6ae95745b16b3d911813df6a05bfb3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lcobucci/jwt/zipball/56f10808089e38623345e28af2f2d5e4eb579455", - "reference": "56f10808089e38623345e28af2f2d5e4eb579455", + "url": "https://api.github.com/repos/lcobucci/clock/zipball/353d83fe2e6ae95745b16b3d911813df6a05bfb3", + "reference": "353d83fe2e6ae95745b16b3d911813df6a05bfb3", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "infection/infection": "^0.17", + "lcobucci/coding-standard": "^6.0", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-deprecation-rules": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan-strict-rules": "^0.12", + "phpunit/php-code-coverage": "9.1.4", + "phpunit/phpunit": "9.3.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Lcobucci\\Clock\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Luís Cobucci", + "email": "lcobucci@gmail.com" + } + ], + "description": "Yet another clock abstraction", + "support": { + "issues": "https://github.com/lcobucci/clock/issues", + "source": "https://github.com/lcobucci/clock/tree/2.0.x" + }, + "funding": [ + { + "url": "https://github.com/lcobucci", + "type": "github" + }, + { + "url": "https://www.patreon.com/lcobucci", + "type": "patreon" + } + ], + "time": "2020-08-27T18:56:02+00:00" + }, + { + "name": "lcobucci/jwt", + "version": "4.0.0", + "source": { + "type": "git", + "url": "https://github.com/lcobucci/jwt.git", + "reference": "6d8665ccd924dc076a9b65d1ea8abe21d68f6958" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/lcobucci/jwt/zipball/6d8665ccd924dc076a9b65d1ea8abe21d68f6958", + "reference": "6d8665ccd924dc076a9b65d1ea8abe21d68f6958", "shasum": "" }, "require": { "ext-mbstring": "*", "ext-openssl": "*", - "php": "^5.6 || ^7.0" + "lcobucci/clock": "^2.0", + "php": "^7.4 || ^8.0" }, "require-dev": { - "mikey179/vfsstream": "~1.5", - "phpmd/phpmd": "~2.2", - "phpunit/php-invoker": "~1.1", - "phpunit/phpunit": "^5.7 || ^7.3", - "squizlabs/php_codesniffer": "~2.3" + "infection/infection": "^0.20", + "lcobucci/coding-standard": "^6.0", + "mikey179/vfsstream": "^1.6", + "phpbench/phpbench": "^0.17", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-deprecation-rules": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan-strict-rules": "^0.12", + "phpunit/php-invoker": "^3.1", + "phpunit/phpunit": "^9.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1584,7 +1745,7 @@ ], "authors": [ { - "name": "Luís Otávio Cobucci Oblonczyk", + "name": "Luís Cobucci", "email": "lcobucci@gmail.com", "role": "Developer" } @@ -1594,6 +1755,10 @@ "JWS", "jwt" ], + "support": { + "issues": "https://github.com/lcobucci/jwt/issues", + "source": "https://github.com/lcobucci/jwt/tree/4.0.0" + }, "funding": [ { "url": "https://github.com/lcobucci", @@ -1604,20 +1769,20 @@ "type": "patreon" } ], - "time": "2020-05-22T08:21:12+00:00" + "time": "2020-11-25T02:06:12+00:00" }, { "name": "league/commonmark", - "version": "1.5.0", + "version": "1.5.7", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "fc33ca12575e98e57cdce7d5f38b2ca5335714b3" + "reference": "11df9b36fd4f1d2b727a73bf14931d81373b9a54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/fc33ca12575e98e57cdce7d5f38b2ca5335714b3", - "reference": "fc33ca12575e98e57cdce7d5f38b2ca5335714b3", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/11df9b36fd4f1d2b727a73bf14931d81373b9a54", + "reference": "11df9b36fd4f1d2b727a73bf14931d81373b9a54", "shasum": "" }, "require": { @@ -1629,14 +1794,14 @@ }, "require-dev": { "cebe/markdown": "~1.0", - "commonmark/commonmark.js": "0.29.1", + "commonmark/commonmark.js": "0.29.2", "erusev/parsedown": "~1.0", "ext-json": "*", "github/gfm": "0.29.0", "michelf/php-markdown": "~1.4", "mikehaertl/php-shellcommand": "^1.4", "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^7.5", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.2", "scrutinizer/ocular": "^1.5", "symfony/finder": "^4.2" }, @@ -1673,6 +1838,12 @@ "md", "parser" ], + "support": { + "docs": "https://commonmark.thephpleague.com/", + "issues": "https://github.com/thephpleague/commonmark/issues", + "rss": "https://github.com/thephpleague/commonmark/releases.atom", + "source": "https://github.com/thephpleague/commonmark" + }, "funding": [ { "url": "https://enjoy.gitstore.app/repositories/thephpleague/commonmark", @@ -1699,32 +1870,33 @@ "type": "tidelift" } ], - "time": "2020-06-21T20:50:13+00:00" + "time": "2020-10-31T13:49:32+00:00" }, { "name": "league/flysystem", - "version": "1.0.69", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "7106f78428a344bc4f643c233a94e48795f10967" + "reference": "9be3b16c877d477357c015cec057548cf9b2a14a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/7106f78428a344bc4f643c233a94e48795f10967", - "reference": "7106f78428a344bc4f643c233a94e48795f10967", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/9be3b16c877d477357c015cec057548cf9b2a14a", + "reference": "9be3b16c877d477357c015cec057548cf9b2a14a", "shasum": "" }, "require": { "ext-fileinfo": "*", - "php": ">=5.5.9" + "league/mime-type-detection": "^1.3", + "php": "^7.2.5 || ^8.0" }, "conflict": { "league/flysystem-sftp": "<1.0.6" }, "require-dev": { - "phpspec/phpspec": "^3.4", - "phpunit/phpunit": "^5.7.26" + "phpspec/prophecy": "^1.11.1", + "phpunit/phpunit": "^8.5.8" }, "suggest": { "ext-fileinfo": "Required for MimeType", @@ -1783,30 +1955,34 @@ "sftp", "storage" ], + "support": { + "issues": "https://github.com/thephpleague/flysystem/issues", + "source": "https://github.com/thephpleague/flysystem/tree/1.x" + }, "funding": [ { "url": "https://offset.earth/frankdejonge", "type": "other" } ], - "time": "2020-05-18T15:13:39+00:00" + "time": "2020-08-23T07:39:11+00:00" }, { "name": "league/flysystem-aws-s3-v3", - "version": "1.0.25", + "version": "1.0.29", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem-aws-s3-v3.git", - "reference": "d409b97a50bf85fbde30cbc9fc10237475e696ea" + "reference": "4e25cc0582a36a786c31115e419c6e40498f6972" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/d409b97a50bf85fbde30cbc9fc10237475e696ea", - "reference": "d409b97a50bf85fbde30cbc9fc10237475e696ea", + "url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/4e25cc0582a36a786c31115e419c6e40498f6972", + "reference": "4e25cc0582a36a786c31115e419c6e40498f6972", "shasum": "" }, "require": { - "aws/aws-sdk-php": "^3.0.0", + "aws/aws-sdk-php": "^3.20.0", "league/flysystem": "^1.0.40", "php": ">=5.5.0" }, @@ -1836,7 +2012,11 @@ } ], "description": "Flysystem adapter for the AWS S3 SDK v3.x", - "time": "2020-06-02T18:41:58+00:00" + "support": { + "issues": "https://github.com/thephpleague/flysystem-aws-s3-v3/issues", + "source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/1.0.29" + }, + "time": "2020-10-08T18:58:37+00:00" }, { "name": "league/flysystem-memory", @@ -1887,6 +2067,10 @@ "adapter", "memory" ], + "support": { + "issues": "https://github.com/thephpleague/flysystem-memory/issues", + "source": "https://github.com/thephpleague/flysystem-memory/tree/1.0.2" + }, "time": "2019-05-30T21:34:13+00:00" }, { @@ -1951,8 +2135,68 @@ "league", "rest" ], + "support": { + "issues": "https://github.com/thephpleague/fractal/issues", + "source": "https://github.com/thephpleague/fractal/tree/0.19.2" + }, "time": "2020-01-24T23:17:29+00:00" }, + { + "name": "league/mime-type-detection", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/mime-type-detection.git", + "reference": "3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3", + "reference": "3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.18", + "phpstan/phpstan": "^0.12.68", + "phpunit/phpunit": "^8.5.8 || ^9.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "League\\MimeTypeDetection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frankdejonge.nl" + } + ], + "description": "Mime-type detection for Flysystem", + "support": { + "issues": "https://github.com/thephpleague/mime-type-detection/issues", + "source": "https://github.com/thephpleague/mime-type-detection/tree/1.7.0" + }, + "funding": [ + { + "url": "https://github.com/frankdejonge", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/league/flysystem", + "type": "tidelift" + } + ], + "time": "2021-01-18T20:58:21+00:00" + }, { "name": "matriphe/iso-639", "version": "1.2", @@ -1995,20 +2239,24 @@ "language", "laravel" ], + "support": { + "issues": "https://github.com/matriphe/php-iso-639/issues", + "source": "https://github.com/matriphe/php-iso-639/tree/master" + }, "time": "2017-07-19T15:11:19+00:00" }, { "name": "monolog/monolog", - "version": "2.1.0", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "38914429aac460e8e4616c8cb486ecb40ec90bb1" + "reference": "1cb1cde8e8dd0f70cc0fe51354a59acad9302084" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/38914429aac460e8e4616c8cb486ecb40ec90bb1", - "reference": "38914429aac460e8e4616c8cb486ecb40ec90bb1", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1cb1cde8e8dd0f70cc0fe51354a59acad9302084", + "reference": "1cb1cde8e8dd0f70cc0fe51354a59acad9302084", "shasum": "" }, "require": { @@ -2021,16 +2269,17 @@ "require-dev": { "aws/aws-sdk-php": "^2.4.9 || ^3.0", "doctrine/couchdb": "~1.0@dev", - "elasticsearch/elasticsearch": "^6.0", + "elasticsearch/elasticsearch": "^7", "graylog2/gelf-php": "^1.4.2", + "mongodb/mongodb": "^1.8", "php-amqplib/php-amqplib": "~2.4", "php-console/php-console": "^3.1.3", - "php-parallel-lint/php-parallel-lint": "^1.0", "phpspec/prophecy": "^1.6.1", + "phpstan/phpstan": "^0.12.59", "phpunit/phpunit": "^8.5", "predis/predis": "^1.1", "rollbar/rollbar": "^1.3", - "ruflin/elastica": ">=0.90 <3.0", + "ruflin/elastica": ">=0.90 <7.0.1", "swiftmailer/swiftmailer": "^5.3|^6.0" }, "suggest": { @@ -2050,7 +2299,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-main": "2.x-dev" } }, "autoload": { @@ -2066,16 +2315,20 @@ { "name": "Jordi Boggiano", "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" + "homepage": "https://seld.be" } ], "description": "Sends your logs to files, sockets, inboxes, databases and various web services", - "homepage": "http://github.com/Seldaek/monolog", + "homepage": "https://github.com/Seldaek/monolog", "keywords": [ "log", "logging", "psr-3" ], + "support": { + "issues": "https://github.com/Seldaek/monolog/issues", + "source": "https://github.com/Seldaek/monolog/tree/2.2.0" + }, "funding": [ { "url": "https://github.com/Seldaek", @@ -2086,29 +2339,29 @@ "type": "tidelift" } ], - "time": "2020-05-22T08:12:19+00:00" + "time": "2020-12-14T13:15:25+00:00" }, { "name": "mtdowling/jmespath.php", - "version": "2.5.0", + "version": "2.6.0", "source": { "type": "git", "url": "https://github.com/jmespath/jmespath.php.git", - "reference": "52168cb9472de06979613d365c7f1ab8798be895" + "reference": "42dae2cbd13154083ca6d70099692fef8ca84bfb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/52168cb9472de06979613d365c7f1ab8798be895", - "reference": "52168cb9472de06979613d365c7f1ab8798be895", + "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/42dae2cbd13154083ca6d70099692fef8ca84bfb", + "reference": "42dae2cbd13154083ca6d70099692fef8ca84bfb", "shasum": "" }, "require": { - "php": ">=5.4.0", - "symfony/polyfill-mbstring": "^1.4" + "php": "^5.4 || ^7.0 || ^8.0", + "symfony/polyfill-mbstring": "^1.17" }, "require-dev": { - "composer/xdebug-handler": "^1.2", - "phpunit/phpunit": "^4.8.36|^7.5.15" + "composer/xdebug-handler": "^1.4", + "phpunit/phpunit": "^4.8.36 || ^7.5.15" }, "bin": [ "bin/jp.php" @@ -2116,7 +2369,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -2143,20 +2396,24 @@ "json", "jsonpath" ], - "time": "2019-12-30T18:03:34+00:00" + "support": { + "issues": "https://github.com/jmespath/jmespath.php/issues", + "source": "https://github.com/jmespath/jmespath.php/tree/2.6.0" + }, + "time": "2020-07-31T21:01:56+00:00" }, { "name": "nesbot/carbon", - "version": "2.35.0", + "version": "2.43.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "4b9bd835261ef23d36397a46a76b496a458305e5" + "reference": "d32c57d8389113742f4a88725a170236470012e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4b9bd835261ef23d36397a46a76b496a458305e5", - "reference": "4b9bd835261ef23d36397a46a76b496a458305e5", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/d32c57d8389113742f4a88725a170236470012e2", + "reference": "d32c57d8389113742f4a88725a170236470012e2", "shasum": "" }, "require": { @@ -2168,9 +2425,10 @@ "require-dev": { "doctrine/orm": "^2.7", "friendsofphp/php-cs-fixer": "^2.14 || ^3.0", - "kylekatarnls/multi-tester": "^1.1", - "phpmd/phpmd": "^2.8", - "phpstan/phpstan": "^0.11", + "kylekatarnls/multi-tester": "^2.0", + "phpmd/phpmd": "^2.9", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.12.54", "phpunit/phpunit": "^7.5 || ^8.0", "squizlabs/php_codesniffer": "^3.4" }, @@ -2187,6 +2445,11 @@ "providers": [ "Carbon\\Laravel\\ServiceProvider" ] + }, + "phpstan": { + "includes": [ + "extension.neon" + ] } }, "autoload": { @@ -2216,6 +2479,10 @@ "datetime", "time" ], + "support": { + "issues": "https://github.com/briannesbitt/Carbon/issues", + "source": "https://github.com/briannesbitt/Carbon" + }, "funding": [ { "url": "https://opencollective.com/Carbon", @@ -2226,20 +2493,20 @@ "type": "tidelift" } ], - "time": "2020-05-24T18:27:52+00:00" + "time": "2020-12-17T20:55:32+00:00" }, { "name": "nikic/php-parser", - "version": "v4.5.0", + "version": "v4.10.4", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "53c2753d756f5adb586dca79c2ec0e2654dd9463" + "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/53c2753d756f5adb586dca79c2ec0e2654dd9463", - "reference": "53c2753d756f5adb586dca79c2ec0e2654dd9463", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c6d052fc58cb876152f89f532b95a8d7907e7f0e", + "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e", "shasum": "" }, "require": { @@ -2247,8 +2514,8 @@ "php": ">=7.0" }, "require-dev": { - "ircmaxell/php-yacc": "0.0.5", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0" + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" }, "bin": [ "bin/php-parse" @@ -2256,7 +2523,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.9-dev" } }, "autoload": { @@ -2278,33 +2545,37 @@ "parser", "php" ], - "time": "2020-06-03T07:24:19+00:00" + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.10.4" + }, + "time": "2020-12-20T10:01:03+00:00" }, { "name": "opis/closure", - "version": "3.5.5", + "version": "3.6.1", "source": { "type": "git", "url": "https://github.com/opis/closure.git", - "reference": "dec9fc5ecfca93f45cd6121f8e6f14457dff372c" + "reference": "943b5d70cc5ae7483f6aff6ff43d7e34592ca0f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opis/closure/zipball/dec9fc5ecfca93f45cd6121f8e6f14457dff372c", - "reference": "dec9fc5ecfca93f45cd6121f8e6f14457dff372c", + "url": "https://api.github.com/repos/opis/closure/zipball/943b5d70cc5ae7483f6aff6ff43d7e34592ca0f5", + "reference": "943b5d70cc5ae7483f6aff6ff43d7e34592ca0f5", "shasum": "" }, "require": { - "php": "^5.4 || ^7.0" + "php": "^5.4 || ^7.0 || ^8.0" }, "require-dev": { "jeremeamia/superclosure": "^2.0", - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.5.x-dev" + "dev-master": "3.6.x-dev" } }, "autoload": { @@ -2339,28 +2610,32 @@ "serialization", "serialize" ], - "time": "2020-06-17T14:59:55+00:00" + "support": { + "issues": "https://github.com/opis/closure/issues", + "source": "https://github.com/opis/closure/tree/3.6.1" + }, + "time": "2020-11-07T02:01:34+00:00" }, { "name": "paragonie/constant_time_encoding", - "version": "v2.3.0", + "version": "v2.4.0", "source": { "type": "git", "url": "https://github.com/paragonie/constant_time_encoding.git", - "reference": "47a1cedd2e4d52688eb8c96469c05ebc8fd28fa2" + "reference": "f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/47a1cedd2e4d52688eb8c96469c05ebc8fd28fa2", - "reference": "47a1cedd2e4d52688eb8c96469c05ebc8fd28fa2", + "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c", + "reference": "f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c", "shasum": "" }, "require": { "php": "^7|^8" }, "require-dev": { - "phpunit/phpunit": "^6|^7", - "vimeo/psalm": "^1|^2|^3" + "phpunit/phpunit": "^6|^7|^8|^9", + "vimeo/psalm": "^1|^2|^3|^4" }, "type": "library", "autoload": { @@ -2401,24 +2676,29 @@ "hex2bin", "rfc4648" ], - "time": "2019-11-06T19:20:29+00:00" + "support": { + "email": "info@paragonie.com", + "issues": "https://github.com/paragonie/constant_time_encoding/issues", + "source": "https://github.com/paragonie/constant_time_encoding" + }, + "time": "2020-12-06T15:14:20+00:00" }, { "name": "paragonie/random_compat", - "version": "v9.99.99", + "version": "v9.99.100", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95" + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", - "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", "shasum": "" }, "require": { - "php": "^7" + "php": ">= 7" }, "require-dev": { "phpunit/phpunit": "4.*|5.*", @@ -2446,28 +2726,33 @@ "pseudorandom", "random" ], - "time": "2018-07-02T15:55:56+00:00" + "support": { + "email": "info@paragonie.com", + "issues": "https://github.com/paragonie/random_compat/issues", + "source": "https://github.com/paragonie/random_compat" + }, + "time": "2020-10-15T08:29:30+00:00" }, { "name": "phpoption/phpoption", - "version": "1.7.4", + "version": "1.7.5", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-option.git", - "reference": "b2ada2ad5d8a32b89088b8adc31ecd2e3a13baf3" + "reference": "994ecccd8f3283ecf5ac33254543eb0ac946d525" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/b2ada2ad5d8a32b89088b8adc31ecd2e3a13baf3", - "reference": "b2ada2ad5d8a32b89088b8adc31ecd2e3a13baf3", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/994ecccd8f3283ecf5ac33254543eb0ac946d525", + "reference": "994ecccd8f3283ecf5ac33254543eb0ac946d525", "shasum": "" }, "require": { "php": "^5.5.9 || ^7.0 || ^8.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.3", - "phpunit/phpunit": "^4.8.35 || ^5.0 || ^6.0 || ^7.0" + "bamarni/composer-bin-plugin": "^1.4.1", + "phpunit/phpunit": "^4.8.35 || ^5.7.27 || ^6.5.6 || ^7.0 || ^8.0 || ^9.0" }, "type": "library", "extra": { @@ -2501,6 +2786,10 @@ "php", "type" ], + "support": { + "issues": "https://github.com/schmittjoh/php-option/issues", + "source": "https://github.com/schmittjoh/php-option/tree/1.7.5" + }, "funding": [ { "url": "https://github.com/GrahamCampbell", @@ -2511,7 +2800,7 @@ "type": "tidelift" } ], - "time": "2020-06-07T10:40:07+00:00" + "time": "2020-07-20T17:29:33+00:00" }, { "name": "pragmarx/google2fa", @@ -2567,26 +2856,31 @@ "Two Factor Authentication", "google2fa" ], + "support": { + "issues": "https://github.com/antonioribeiro/google2fa/issues", + "source": "https://github.com/antonioribeiro/google2fa/tree/master" + }, "time": "2019-03-19T22:44:16+00:00" }, { "name": "predis/predis", - "version": "v1.1.1", + "version": "v1.1.6", "source": { "type": "git", - "url": "https://github.com/nrk/predis.git", - "reference": "f0210e38881631afeafb56ab43405a92cafd9fd1" + "url": "https://github.com/predis/predis.git", + "reference": "9930e933c67446962997b05201c69c2319bf26de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nrk/predis/zipball/f0210e38881631afeafb56ab43405a92cafd9fd1", - "reference": "f0210e38881631afeafb56ab43405a92cafd9fd1", + "url": "https://api.github.com/repos/predis/predis/zipball/9930e933c67446962997b05201c69c2319bf26de", + "reference": "9930e933c67446962997b05201c69c2319bf26de", "shasum": "" }, "require": { "php": ">=5.3.9" }, "require-dev": { + "cweagans/composer-patches": "^1.6", "phpunit/phpunit": "~4.8" }, "suggest": { @@ -2594,6 +2888,18 @@ "ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol" }, "type": "library", + "extra": { + "composer-exit-on-patch-failure": true, + "patches": { + "phpunit/phpunit-mock-objects": { + "Fix PHP 7 and 8 compatibility": "./tests/phpunit_mock_objects.patch" + }, + "phpunit/phpunit": { + "Fix PHP 7 compatibility": "./tests/phpunit_php7.patch", + "Fix PHP 8 compatibility": "./tests/phpunit_php8.patch" + } + } + }, "autoload": { "psr-4": { "Predis\\": "src/" @@ -2607,36 +2913,52 @@ { "name": "Daniele Alessandri", "email": "suppakilla@gmail.com", - "homepage": "http://clorophilla.net" + "homepage": "http://clorophilla.net", + "role": "Creator & Maintainer" + }, + { + "name": "Till Krüss", + "homepage": "https://till.im", + "role": "Maintainer" } ], "description": "Flexible and feature-complete Redis client for PHP and HHVM", - "homepage": "http://github.com/nrk/predis", + "homepage": "http://github.com/predis/predis", "keywords": [ "nosql", "predis", "redis" ], - "time": "2016-06-16T16:22:20+00:00" + "support": { + "issues": "https://github.com/predis/predis/issues", + "source": "https://github.com/predis/predis/tree/v1.1.6" + }, + "funding": [ + { + "url": "https://github.com/sponsors/tillkruss", + "type": "github" + } + ], + "time": "2020-09-11T19:18:05+00:00" }, { "name": "prologue/alerts", - "version": "0.4.7", + "version": "0.4.8", "source": { "type": "git", "url": "https://github.com/prologuephp/alerts.git", - "reference": "631896b583129b2873df09b5295809c1244eddb1" + "reference": "a6412e318c0171526bc8b25ef597f2cc61f5b800" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/prologuephp/alerts/zipball/631896b583129b2873df09b5295809c1244eddb1", - "reference": "631896b583129b2873df09b5295809c1244eddb1", + "url": "https://api.github.com/repos/prologuephp/alerts/zipball/a6412e318c0171526bc8b25ef597f2cc61f5b800", + "reference": "a6412e318c0171526bc8b25ef597f2cc61f5b800", "shasum": "" }, "require": { - "illuminate/config": "~5|~6|~7", - "illuminate/session": "~5|~6|~7", - "illuminate/support": "~5|~6|~7", + "illuminate/config": "~5|~6|~7|~8", + "illuminate/session": "~5|~6|~7|~8", + "illuminate/support": "~5|~6|~7|~8", "php": ">=5.4.0" }, "require-dev": { @@ -2683,7 +3005,11 @@ "laravel", "messages" ], - "time": "2020-04-24T06:00:16+00:00" + "support": { + "issues": "https://github.com/prologuephp/alerts/issues", + "source": "https://github.com/prologuephp/alerts/tree/master" + }, + "time": "2020-09-08T14:24:39+00:00" }, { "name": "psr/container", @@ -2732,6 +3058,10 @@ "container-interop", "psr" ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/master" + }, "time": "2017-02-14T16:28:37+00:00" }, { @@ -2778,8 +3108,64 @@ "psr", "psr-14" ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, "time": "2019-01-08T18:20:26+00:00" }, + { + "name": "psr/http-client", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client/tree/master" + }, + "time": "2020-06-29T06:28:15+00:00" + }, { "name": "psr/http-message", "version": "1.0.1", @@ -2828,6 +3214,9 @@ "request", "response" ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/master" + }, "time": "2016-08-06T14:39:51+00:00" }, { @@ -2875,6 +3264,9 @@ "psr", "psr-3" ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.3" + }, "time": "2020-03-23T09:12:05+00:00" }, { @@ -2923,20 +3315,23 @@ "psr-16", "simple-cache" ], + "support": { + "source": "https://github.com/php-fig/simple-cache/tree/master" + }, "time": "2017-10-23T01:57:42+00:00" }, { "name": "psy/psysh", - "version": "v0.10.4", + "version": "v0.10.6", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "a8aec1b2981ab66882a01cce36a49b6317dc3560" + "reference": "6f990c19f91729de8b31e639d6e204ea59f19cf3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/a8aec1b2981ab66882a01cce36a49b6317dc3560", - "reference": "a8aec1b2981ab66882a01cce36a49b6317dc3560", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/6f990c19f91729de8b31e639d6e204ea59f19cf3", + "reference": "6f990c19f91729de8b31e639d6e204ea59f19cf3", "shasum": "" }, "require": { @@ -2965,7 +3360,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "0.10.x-dev" + "dev-main": "0.10.x-dev" } }, "autoload": { @@ -2995,7 +3390,11 @@ "interactive", "shell" ], - "time": "2020-05-03T19:32:03+00:00" + "support": { + "issues": "https://github.com/bobthecow/psysh/issues", + "source": "https://github.com/bobthecow/psysh/tree/v0.10.6" + }, + "time": "2021-01-18T15:53:43+00:00" }, { "name": "ralouphie/getallheaders", @@ -3035,39 +3434,46 @@ } ], "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, "time": "2019-03-08T08:55:37+00:00" }, { "name": "ramsey/collection", - "version": "1.0.1", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/ramsey/collection.git", - "reference": "925ad8cf55ba7a3fc92e332c58fd0478ace3e1ca" + "reference": "28a5c4ab2f5111db6a60b2b4ec84057e0f43b9c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/collection/zipball/925ad8cf55ba7a3fc92e332c58fd0478ace3e1ca", - "reference": "925ad8cf55ba7a3fc92e332c58fd0478ace3e1ca", + "url": "https://api.github.com/repos/ramsey/collection/zipball/28a5c4ab2f5111db6a60b2b4ec84057e0f43b9c1", + "reference": "28a5c4ab2f5111db6a60b2b4ec84057e0f43b9c1", "shasum": "" }, "require": { - "php": "^7.2" + "php": "^7.2 || ^8" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", - "fzaninotto/faker": "^1.5", - "jakub-onderka/php-parallel-lint": "^1", - "jangregor/phpstan-prophecy": "^0.6", + "captainhook/captainhook": "^5.3", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", + "ergebnis/composer-normalize": "^2.6", + "fakerphp/faker": "^1.5", + "hamcrest/hamcrest-php": "^2", + "jangregor/phpstan-prophecy": "^0.8", "mockery/mockery": "^1.3", "phpstan/extension-installer": "^1", - "phpstan/phpdoc-parser": "0.4.1", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-mockery": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^8.5", - "slevomat/coding-standard": "^6.0", - "squizlabs/php_codesniffer": "^3.5" + "phpstan/phpstan": "^0.12.32", + "phpstan/phpstan-mockery": "^0.12.5", + "phpstan/phpstan-phpunit": "^0.12.11", + "phpunit/phpunit": "^8.5 || ^9", + "psy/psysh": "^0.10.4", + "slevomat/coding-standard": "^6.3", + "squizlabs/php_codesniffer": "^3.5", + "vimeo/psalm": "^4.4" }, "type": "library", "autoload": { @@ -3087,7 +3493,6 @@ } ], "description": "A PHP 7.2+ library for representing and manipulating collections.", - "homepage": "https://github.com/ramsey/collection", "keywords": [ "array", "collection", @@ -3096,24 +3501,38 @@ "queue", "set" ], - "time": "2020-01-05T00:22:59+00:00" + "support": { + "issues": "https://github.com/ramsey/collection/issues", + "source": "https://github.com/ramsey/collection/tree/1.1.3" + }, + "funding": [ + { + "url": "https://github.com/ramsey", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/ramsey/collection", + "type": "tidelift" + } + ], + "time": "2021-01-21T17:40:04+00:00" }, { "name": "ramsey/uuid", - "version": "4.0.1", + "version": "4.1.1", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "ba8fff1d3abb8bb4d35a135ed22a31c6ef3ede3d" + "reference": "cd4032040a750077205918c86049aa0f43d22947" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/ba8fff1d3abb8bb4d35a135ed22a31c6ef3ede3d", - "reference": "ba8fff1d3abb8bb4d35a135ed22a31c6ef3ede3d", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/cd4032040a750077205918c86049aa0f43d22947", + "reference": "cd4032040a750077205918c86049aa0f43d22947", "shasum": "" }, "require": { - "brick/math": "^0.8", + "brick/math": "^0.8 || ^0.9", "ext-json": "*", "php": "^7.2 || ^8", "ramsey/collection": "^1.0", @@ -3124,7 +3543,7 @@ }, "require-dev": { "codeception/aspect-mock": "^3", - "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2", + "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7.0", "doctrine/annotations": "^1.8", "goaop/framework": "^2", "mockery/mockery": "^1.3", @@ -3133,8 +3552,8 @@ "php-mock/php-mock-mockery": "^1.3", "php-mock/php-mock-phpunit": "^2.5", "php-parallel-lint/php-parallel-lint": "^1.1", + "phpbench/phpbench": "^0.17.1", "phpstan/extension-installer": "^1.0", - "phpstan/phpdoc-parser": "0.4.3", "phpstan/phpstan": "^0.12", "phpstan/phpstan-mockery": "^0.12", "phpstan/phpstan-phpunit": "^0.12", @@ -3177,13 +3596,18 @@ "identifier", "uuid" ], + "support": { + "issues": "https://github.com/ramsey/uuid/issues", + "rss": "https://github.com/ramsey/uuid/releases.atom", + "source": "https://github.com/ramsey/uuid" + }, "funding": [ { "url": "https://github.com/ramsey", "type": "github" } ], - "time": "2020-03-29T20:13:32+00:00" + "time": "2020-08-18T17:17:46+00:00" }, { "name": "s1lentium/iptools", @@ -3234,29 +3658,33 @@ "network", "subnet" ], + "support": { + "issues": "https://github.com/S1lentium/IPTools/issues", + "source": "https://github.com/S1lentium/IPTools/tree/master" + }, "time": "2018-09-19T06:15:53+00:00" }, { "name": "spatie/fractalistic", - "version": "2.9.0", + "version": "2.9.1", "source": { "type": "git", "url": "https://github.com/spatie/fractalistic.git", - "reference": "9d7594c4e9ed2657eb017db93ab6dbb58f56e049" + "reference": "c4fc2b223a8f7321ece449abc2c59cc5baf470fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/fractalistic/zipball/9d7594c4e9ed2657eb017db93ab6dbb58f56e049", - "reference": "9d7594c4e9ed2657eb017db93ab6dbb58f56e049", + "url": "https://api.github.com/repos/spatie/fractalistic/zipball/c4fc2b223a8f7321ece449abc2c59cc5baf470fd", + "reference": "c4fc2b223a8f7321ece449abc2c59cc5baf470fd", "shasum": "" }, "require": { "league/fractal": "^0.19.0", - "php": "^7.0" + "php": "^7.3|^8.0" }, "require-dev": { "illuminate/pagination": "~5.3.0|~5.4.0", - "phpunit/phpunit": "^5.7.21" + "phpunit/phpunit": "^9.0" }, "type": "library", "autoload": { @@ -3285,31 +3713,41 @@ "spatie", "transform" ], - "time": "2020-01-31T11:54:45+00:00" + "support": { + "issues": "https://github.com/spatie/fractalistic/issues", + "source": "https://github.com/spatie/fractalistic/tree/2.9.1" + }, + "funding": [ + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2020-11-12T18:19:10+00:00" }, { "name": "spatie/laravel-fractal", - "version": "5.7.0", + "version": "5.8.1", "source": { "type": "git", "url": "https://github.com/spatie/laravel-fractal.git", - "reference": "482b73a7942d14087167b32c6681351c81afaeb3" + "reference": "be3ccd54e26742cd05b3637fb732fd9addfa28df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-fractal/zipball/482b73a7942d14087167b32c6681351c81afaeb3", - "reference": "482b73a7942d14087167b32c6681351c81afaeb3", + "url": "https://api.github.com/repos/spatie/laravel-fractal/zipball/be3ccd54e26742cd05b3637fb732fd9addfa28df", + "reference": "be3ccd54e26742cd05b3637fb732fd9addfa28df", "shasum": "" }, "require": { - "illuminate/contracts": "~5.8.0|^6.0|^7.0", - "illuminate/support": "~5.8.0|^6.0|^7.0", - "php": "^7.2", + "illuminate/contracts": "^7.0|^8.0", + "illuminate/support": "^7.0|^8.0", + "php": "^7.2|^8.0", "spatie/fractalistic": "^2.5" }, "require-dev": { - "dms/phpunit-arraysubset-asserts": "^0.1.0", - "orchestra/testbench": "~3.8.0|^4.0|^5.0" + "ext-json": "*", + "orchestra/testbench": "^5.0|^6.0" }, "type": "library", "extra": { @@ -3353,38 +3791,44 @@ "spatie", "transform" ], + "support": { + "issues": "https://github.com/spatie/laravel-fractal/issues", + "source": "https://github.com/spatie/laravel-fractal/tree/5.8.1" + }, "funding": [ { "url": "https://spatie.be/open-source/support-us", "type": "custom" } ], - "time": "2020-03-02T18:40:49+00:00" + "time": "2020-11-12T18:46:53+00:00" }, { "name": "spatie/laravel-query-builder", - "version": "2.8.2", + "version": "3.3.4", "source": { "type": "git", "url": "https://github.com/spatie/laravel-query-builder.git", - "reference": "2737b2298e8bfeb632a80013646943307bf31775" + "reference": "2e131b0c8ae600b6e3aabb5a1501c721862a0b8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-query-builder/zipball/2737b2298e8bfeb632a80013646943307bf31775", - "reference": "2737b2298e8bfeb632a80013646943307bf31775", + "url": "https://api.github.com/repos/spatie/laravel-query-builder/zipball/2e131b0c8ae600b6e3aabb5a1501c721862a0b8f", + "reference": "2e131b0c8ae600b6e3aabb5a1501c721862a0b8f", "shasum": "" }, "require": { - "illuminate/database": "~5.6.34|~5.7.0|~5.8.0|^6.0|^7.0", - "illuminate/http": "~5.6.34|~5.7.0|~5.8.0|^6.0|^7.0", - "illuminate/support": "~5.6.34|~5.7.0|~5.8.0|^6.0|^7.0", - "php": "^7.1" + "illuminate/database": "^6.0|^7.0|^8.0", + "illuminate/http": "^6.0|^7.0|^8.0", + "illuminate/support": "^6.0|^7.0|^8.0", + "php": "^7.3|^8.0" }, "require-dev": { "ext-json": "*", - "orchestra/testbench": "~3.6.0|~3.7.0|~3.8.0|^4.0|^5.0", - "phpunit/phpunit": "^7.0|^8.0|^9.0" + "laravel/legacy-factories": "^1.0.4", + "mockery/mockery": "^1.4", + "orchestra/testbench": "^4.9|^5.8|^6.3", + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { @@ -3417,34 +3861,38 @@ "laravel-query-builder", "spatie" ], + "support": { + "issues": "https://github.com/spatie/laravel-query-builder/issues", + "source": "https://github.com/spatie/laravel-query-builder" + }, "funding": [ { "url": "https://spatie.be/open-source/support-us", "type": "custom" } ], - "time": "2020-05-25T09:36:37+00:00" + "time": "2020-11-26T14:51:30+00:00" }, { "name": "staudenmeir/belongs-to-through", - "version": "v2.10", + "version": "v2.11.1", "source": { "type": "git", "url": "https://github.com/staudenmeir/belongs-to-through.git", - "reference": "23be043a4885f696a0e5eb24da7221947e480cb5" + "reference": "d300afa1045e6541b79af2291336312613b5cd02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/staudenmeir/belongs-to-through/zipball/23be043a4885f696a0e5eb24da7221947e480cb5", - "reference": "23be043a4885f696a0e5eb24da7221947e480cb5", + "url": "https://api.github.com/repos/staudenmeir/belongs-to-through/zipball/d300afa1045e6541b79af2291336312613b5cd02", + "reference": "d300afa1045e6541b79af2291336312613b5cd02", "shasum": "" }, "require": { - "illuminate/database": "^7.0", - "php": "^7.2.5" + "illuminate/database": "^8.0", + "php": "^7.3|^8.0" }, "require-dev": { - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "^9.3" }, "type": "library", "autoload": { @@ -3467,36 +3915,45 @@ } ], "description": "Laravel Eloquent BelongsToThrough relationships", - "time": "2020-01-31T11:29:47+00:00" + "support": { + "issues": "https://github.com/staudenmeir/belongs-to-through/issues", + "source": "https://github.com/staudenmeir/belongs-to-through/tree/v2.11.1" + }, + "funding": [ + { + "url": "https://paypal.me/JonasStaudenmeir", + "type": "custom" + } + ], + "time": "2020-11-16T19:39:09+00:00" }, { "name": "swiftmailer/swiftmailer", - "version": "v6.2.3", + "version": "v6.2.5", "source": { "type": "git", "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "149cfdf118b169f7840bbe3ef0d4bc795d1780c9" + "reference": "698a6a9f54d7eb321274de3ad19863802c879fb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/149cfdf118b169f7840bbe3ef0d4bc795d1780c9", - "reference": "149cfdf118b169f7840bbe3ef0d4bc795d1780c9", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/698a6a9f54d7eb321274de3ad19863802c879fb7", + "reference": "698a6a9f54d7eb321274de3ad19863802c879fb7", "shasum": "" }, "require": { - "egulias/email-validator": "~2.0", + "egulias/email-validator": "^2.0", "php": ">=7.0.0", "symfony/polyfill-iconv": "^1.0", "symfony/polyfill-intl-idn": "^1.10", "symfony/polyfill-mbstring": "^1.0" }, "require-dev": { - "mockery/mockery": "~0.9.1", - "symfony/phpunit-bridge": "^3.4.19|^4.1.8" + "mockery/mockery": "^1.0", + "symfony/phpunit-bridge": "^4.4|^5.0" }, "suggest": { - "ext-intl": "Needed to support internationalized email addresses", - "true/punycode": "Needed to support internationalized email addresses, if ext-intl is not installed" + "ext-intl": "Needed to support internationalized email addresses" }, "type": "library", "extra": { @@ -3529,20 +3986,34 @@ "mail", "mailer" ], - "time": "2019-11-12T09:31:26+00:00" + "support": { + "issues": "https://github.com/swiftmailer/swiftmailer/issues", + "source": "https://github.com/swiftmailer/swiftmailer/tree/v6.2.5" + }, + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/swiftmailer/swiftmailer", + "type": "tidelift" + } + ], + "time": "2021-01-12T09:35:59+00:00" }, { "name": "symfony/console", - "version": "v5.1.2", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "34ac555a3627e324b660e318daa07572e1140123" + "reference": "47c02526c532fb381374dab26df05e7313978976" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/34ac555a3627e324b660e318daa07572e1140123", - "reference": "34ac555a3627e324b660e318daa07572e1140123", + "url": "https://api.github.com/repos/symfony/console/zipball/47c02526c532fb381374dab26df05e7313978976", + "reference": "47c02526c532fb381374dab26df05e7313978976", "shasum": "" }, "require": { @@ -3579,11 +4050,6 @@ "symfony/process": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Console\\": "" @@ -3608,6 +4074,15 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v5.2.1" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -3622,31 +4097,26 @@ "type": "tidelift" } ], - "time": "2020-06-15T12:59:21+00:00" + "time": "2020-12-18T08:03:05+00:00" }, { "name": "symfony/css-selector", - "version": "v5.1.2", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "e544e24472d4c97b2d11ade7caacd446727c6bf9" + "reference": "f789e7ead4c79e04ca9a6d6162fc629c89bd8054" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/e544e24472d4c97b2d11ade7caacd446727c6bf9", - "reference": "e544e24472d4c97b2d11ade7caacd446727c6bf9", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/f789e7ead4c79e04ca9a6d6162fc629c89bd8054", + "reference": "f789e7ead4c79e04ca9a6d6162fc629c89bd8054", "shasum": "" }, "require": { "php": ">=7.2.5" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\CssSelector\\": "" @@ -3675,6 +4145,9 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/css-selector/tree/v5.2.1" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -3689,20 +4162,20 @@ "type": "tidelift" } ], - "time": "2020-05-20T17:43:50+00:00" + "time": "2020-12-08T17:02:38+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.1.2", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "dd99cb3a0aff6cadd2a8d7d7ed72c2161e218337" + "reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/dd99cb3a0aff6cadd2a8d7d7ed72c2161e218337", - "reference": "dd99cb3a0aff6cadd2a8d7d7ed72c2161e218337", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5fa56b4074d1ae755beb55617ddafe6f5d78f665", + "reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665", "shasum": "" }, "require": { @@ -3711,7 +4184,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "2.2-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -3735,6 +4212,9 @@ ], "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/master" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -3749,20 +4229,20 @@ "type": "tidelift" } ], - "time": "2020-05-27T08:34:37+00:00" + "time": "2020-09-07T11:33:47+00:00" }, { "name": "symfony/error-handler", - "version": "v5.1.2", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "7d0b927b9d3dc41d7d46cda38cbfcd20cdcbb896" + "reference": "59b190ce16ddf32771a22087b60f6dafd3407147" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/7d0b927b9d3dc41d7d46cda38cbfcd20cdcbb896", - "reference": "7d0b927b9d3dc41d7d46cda38cbfcd20cdcbb896", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/59b190ce16ddf32771a22087b60f6dafd3407147", + "reference": "59b190ce16ddf32771a22087b60f6dafd3407147", "shasum": "" }, "require": { @@ -3777,11 +4257,6 @@ "symfony/serializer": "^4.4|^5.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\ErrorHandler\\": "" @@ -3806,6 +4281,9 @@ ], "description": "Symfony ErrorHandler Component", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/error-handler/tree/v5.2.1" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -3820,20 +4298,20 @@ "type": "tidelift" } ], - "time": "2020-05-30T20:35:19+00:00" + "time": "2020-12-09T18:54:12+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.1.2", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "cc0d059e2e997e79ca34125a52f3e33de4424ac7" + "reference": "1c93f7a1dff592c252574c79a8635a8a80856042" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/cc0d059e2e997e79ca34125a52f3e33de4424ac7", - "reference": "cc0d059e2e997e79ca34125a52f3e33de4424ac7", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/1c93f7a1dff592c252574c79a8635a8a80856042", + "reference": "1c93f7a1dff592c252574c79a8635a8a80856042", "shasum": "" }, "require": { @@ -3853,6 +4331,7 @@ "psr/log": "~1.0", "symfony/config": "^4.4|^5.0", "symfony/dependency-injection": "^4.4|^5.0", + "symfony/error-handler": "^4.4|^5.0", "symfony/expression-language": "^4.4|^5.0", "symfony/http-foundation": "^4.4|^5.0", "symfony/service-contracts": "^1.1|^2", @@ -3863,11 +4342,6 @@ "symfony/http-kernel": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\EventDispatcher\\": "" @@ -3892,6 +4366,9 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/event-dispatcher/tree/v5.2.1" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -3906,20 +4383,20 @@ "type": "tidelift" } ], - "time": "2020-05-20T17:43:50+00:00" + "time": "2020-12-18T08:03:05+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v2.1.2", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "405952c4e90941a17e52ef7489a2bd94870bb290" + "reference": "0ba7d54483095a198fa51781bc608d17e84dffa2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/405952c4e90941a17e52ef7489a2bd94870bb290", - "reference": "405952c4e90941a17e52ef7489a2bd94870bb290", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/0ba7d54483095a198fa51781bc608d17e84dffa2", + "reference": "0ba7d54483095a198fa51781bc608d17e84dffa2", "shasum": "" }, "require": { @@ -3932,7 +4409,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "2.2-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -3964,6 +4445,9 @@ "interoperability", "standards" ], + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.2.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -3978,31 +4462,26 @@ "type": "tidelift" } ], - "time": "2020-05-20T17:43:50+00:00" + "time": "2020-09-07T11:33:47+00:00" }, { "name": "symfony/finder", - "version": "v5.1.2", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "4298870062bfc667cb78d2b379be4bf5dec5f187" + "reference": "0b9231a5922fd7287ba5b411893c0ecd2733e5ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/4298870062bfc667cb78d2b379be4bf5dec5f187", - "reference": "4298870062bfc667cb78d2b379be4bf5dec5f187", + "url": "https://api.github.com/repos/symfony/finder/zipball/0b9231a5922fd7287ba5b411893c0ecd2733e5ba", + "reference": "0b9231a5922fd7287ba5b411893c0ecd2733e5ba", "shasum": "" }, "require": { "php": ">=7.2.5" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Finder\\": "" @@ -4027,6 +4506,9 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/v5.2.1" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4041,20 +4523,99 @@ "type": "tidelift" } ], - "time": "2020-05-20T17:43:50+00:00" + "time": "2020-12-08T17:02:38+00:00" }, { - "name": "symfony/http-foundation", - "version": "v5.1.2", + "name": "symfony/http-client-contracts", + "version": "v2.3.1", "source": { "type": "git", - "url": "https://github.com/symfony/http-foundation.git", - "reference": "f93055171b847915225bd5b0a5792888419d8d75" + "url": "https://github.com/symfony/http-client-contracts.git", + "reference": "41db680a15018f9c1d4b23516059633ce280ca33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/f93055171b847915225bd5b0a5792888419d8d75", - "reference": "f93055171b847915225bd5b0a5792888419d8d75", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/41db680a15018f9c1d4b23516059633ce280ca33", + "reference": "41db680a15018f9c1d4b23516059633ce280ca33", + "shasum": "" + }, + "require": { + "php": ">=7.2.5" + }, + "suggest": { + "symfony/http-client-implementation": "" + }, + "type": "library", + "extra": { + "branch-version": "2.3", + "branch-alias": { + "dev-main": "2.3-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\HttpClient\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to HTTP clients", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/http-client-contracts/tree/v2.3.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-14T17:08:19+00:00" + }, + { + "name": "symfony/http-foundation", + "version": "v5.2.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "a1f6218b29897ab52acba58cfa905b83625bef8d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/a1f6218b29897ab52acba58cfa905b83625bef8d", + "reference": "a1f6218b29897ab52acba58cfa905b83625bef8d", "shasum": "" }, "require": { @@ -4073,11 +4634,6 @@ "symfony/mime": "To use the file extension guesser" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\HttpFoundation\\": "" @@ -4102,6 +4658,9 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/http-foundation/tree/v5.2.1" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4116,20 +4675,20 @@ "type": "tidelift" } ], - "time": "2020-06-15T06:52:54+00:00" + "time": "2020-12-18T10:00:10+00:00" }, { "name": "symfony/http-kernel", - "version": "v5.1.2", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "a18c27ace1ef344ffcb129a5b089bad7643b387a" + "reference": "1feb619286d819180f7b8bc0dc44f516d9c62647" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/a18c27ace1ef344ffcb129a5b089bad7643b387a", - "reference": "a18c27ace1ef344ffcb129a5b089bad7643b387a", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/1feb619286d819180f7b8bc0dc44f516d9c62647", + "reference": "1feb619286d819180f7b8bc0dc44f516d9c62647", "shasum": "" }, "require": { @@ -4138,6 +4697,7 @@ "symfony/deprecation-contracts": "^2.1", "symfony/error-handler": "^4.4|^5.0", "symfony/event-dispatcher": "^5.0", + "symfony/http-client-contracts": "^1.1|^2", "symfony/http-foundation": "^4.4|^5.0", "symfony/polyfill-ctype": "^1.8", "symfony/polyfill-php73": "^1.9", @@ -4148,7 +4708,7 @@ "symfony/cache": "<5.0", "symfony/config": "<5.0", "symfony/console": "<4.4", - "symfony/dependency-injection": "<4.4", + "symfony/dependency-injection": "<5.1.8", "symfony/doctrine-bridge": "<5.0", "symfony/form": "<5.0", "symfony/http-client": "<5.0", @@ -4168,7 +4728,7 @@ "symfony/config": "^5.0", "symfony/console": "^4.4|^5.0", "symfony/css-selector": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", + "symfony/dependency-injection": "^5.1.8", "symfony/dom-crawler": "^4.4|^5.0", "symfony/expression-language": "^4.4|^5.0", "symfony/finder": "^4.4|^5.0", @@ -4186,11 +4746,6 @@ "symfony/dependency-injection": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\HttpKernel\\": "" @@ -4215,6 +4770,9 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/http-kernel/tree/v5.2.1" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4229,24 +4787,25 @@ "type": "tidelift" } ], - "time": "2020-06-15T13:51:38+00:00" + "time": "2020-12-18T13:49:39+00:00" }, { "name": "symfony/mime", - "version": "v5.1.2", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "c0c418f05e727606e85b482a8591519c4712cf45" + "reference": "de97005aef7426ba008c46ba840fc301df577ada" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/c0c418f05e727606e85b482a8591519c4712cf45", - "reference": "c0c418f05e727606e85b482a8591519c4712cf45", + "url": "https://api.github.com/repos/symfony/mime/zipball/de97005aef7426ba008c46ba840fc301df577ada", + "reference": "de97005aef7426ba008c46ba840fc301df577ada", "shasum": "" }, "require": { "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", "symfony/polyfill-intl-idn": "^1.10", "symfony/polyfill-mbstring": "^1.0", "symfony/polyfill-php80": "^1.15" @@ -4256,14 +4815,13 @@ }, "require-dev": { "egulias/email-validator": "^2.1.10", - "symfony/dependency-injection": "^4.4|^5.0" + "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/property-access": "^4.4|^5.1", + "symfony/property-info": "^4.4|^5.1", + "symfony/serializer": "^5.2" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Mime\\": "" @@ -4292,6 +4850,9 @@ "mime", "mime-type" ], + "support": { + "source": "https://github.com/symfony/mime/tree/v5.2.1" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4306,24 +4867,24 @@ "type": "tidelift" } ], - "time": "2020-06-09T15:07:35+00:00" + "time": "2020-12-09T18:54:12+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.17.1", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d" + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d", - "reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "suggest": { "ext-ctype": "For best performance" @@ -4331,7 +4892,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4368,6 +4929,9 @@ "polyfill", "portable" ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4382,24 +4946,24 @@ "type": "tidelift" } ], - "time": "2020-06-06T08:46:27+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/polyfill-iconv", - "version": "v1.17.1", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-iconv.git", - "reference": "ba6c9c18db36235b859cc29b8372d1c01298c035" + "reference": "b34bfb8c4c22650ac080d2662ae3502e5f2f4ae6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/ba6c9c18db36235b859cc29b8372d1c01298c035", - "reference": "ba6c9c18db36235b859cc29b8372d1c01298c035", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/b34bfb8c4c22650ac080d2662ae3502e5f2f4ae6", + "reference": "b34bfb8c4c22650ac080d2662ae3502e5f2f4ae6", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "suggest": { "ext-iconv": "For best performance" @@ -4407,7 +4971,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4445,6 +5009,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-iconv/tree/v1.22.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4459,24 +5026,24 @@ "type": "tidelift" } ], - "time": "2020-06-06T08:46:27+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.17.1", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "6e4dbcf5e81eba86e36731f94fe56b1726835846" + "reference": "267a9adeb8ecb8071040a740930e077cdfb987af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/6e4dbcf5e81eba86e36731f94fe56b1726835846", - "reference": "6e4dbcf5e81eba86e36731f94fe56b1726835846", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/267a9adeb8ecb8071040a740930e077cdfb987af", + "reference": "267a9adeb8ecb8071040a740930e077cdfb987af", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "suggest": { "ext-intl": "For best performance" @@ -4484,7 +5051,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4523,6 +5090,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.22.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4537,25 +5107,25 @@ "type": "tidelift" } ], - "time": "2020-06-06T08:46:27+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.17.1", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "a57f8161502549a742a63c09f0a604997bf47027" + "reference": "0eb8293dbbcd6ef6bf81404c9ce7d95bcdf34f44" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/a57f8161502549a742a63c09f0a604997bf47027", - "reference": "a57f8161502549a742a63c09f0a604997bf47027", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/0eb8293dbbcd6ef6bf81404c9ce7d95bcdf34f44", + "reference": "0eb8293dbbcd6ef6bf81404c9ce7d95bcdf34f44", "shasum": "" }, "require": { - "php": ">=5.3.3", - "symfony/polyfill-mbstring": "^1.3", + "php": ">=7.1", + "symfony/polyfill-intl-normalizer": "^1.10", "symfony/polyfill-php72": "^1.10" }, "suggest": { @@ -4564,7 +5134,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4588,6 +5158,10 @@ "name": "Laurent Bassin", "email": "laurent@bassin.info" }, + { + "name": "Trevor Rowbotham", + "email": "trevor.rowbotham@pm.me" + }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" @@ -4603,6 +5177,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.22.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4617,24 +5194,24 @@ "type": "tidelift" } ], - "time": "2020-06-06T08:46:27+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.17.1", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "40309d1700e8f72447bb9e7b54af756eeea35620" + "reference": "6e971c891537eb617a00bb07a43d182a6915faba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/40309d1700e8f72447bb9e7b54af756eeea35620", - "reference": "40309d1700e8f72447bb9e7b54af756eeea35620", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/6e971c891537eb617a00bb07a43d182a6915faba", + "reference": "6e971c891537eb617a00bb07a43d182a6915faba", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "suggest": { "ext-intl": "For best performance" @@ -4642,7 +5219,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4684,6 +5261,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.22.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4698,24 +5278,24 @@ "type": "tidelift" } ], - "time": "2020-06-14T14:40:37+00:00" + "time": "2021-01-07T17:09:11+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.17.1", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7110338d81ce1cbc3e273136e4574663627037a7" + "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7110338d81ce1cbc3e273136e4574663627037a7", - "reference": "7110338d81ce1cbc3e273136e4574663627037a7", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", + "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "suggest": { "ext-mbstring": "For best performance" @@ -4723,7 +5303,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4761,6 +5341,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.22.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4775,44 +5358,35 @@ "type": "tidelift" } ], - "time": "2020-06-06T08:46:27+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/polyfill-php56", - "version": "v1.17.1", + "version": "v1.20.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php56.git", - "reference": "a25861bb3c79b0ec2da9ede51de2ea573818b943" + "reference": "54b8cd7e6c1643d78d011f3be89f3ef1f9f4c675" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/a25861bb3c79b0ec2da9ede51de2ea573818b943", - "reference": "a25861bb3c79b0ec2da9ede51de2ea573818b943", + "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/54b8cd7e6c1643d78d011f3be89f3ef1f9f4c675", + "reference": "54b8cd7e6c1643d78d011f3be89f3ef1f9f4c675", "shasum": "" }, "require": { - "php": ">=5.3.3", - "symfony/polyfill-util": "~1.0" + "php": ">=7.1" }, - "type": "library", + "type": "metapackage", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.20-dev" }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" } }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php56\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" @@ -4835,6 +5409,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-php56/tree/v1.20.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4849,29 +5426,33 @@ "type": "tidelift" } ], - "time": "2020-06-06T08:46:27+00:00" + "time": "2020-10-23T14:02:19+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.17.0", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "f048e612a3905f34931127360bdd2def19a5e582" + "reference": "cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/f048e612a3905f34931127360bdd2def19a5e582", - "reference": "f048e612a3905f34931127360bdd2def19a5e582", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9", + "reference": "cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.22-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -4904,6 +5485,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-php72/tree/v1.22.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4918,29 +5502,29 @@ "type": "tidelift" } ], - "time": "2020-05-12T16:47:27+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.17.1", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fa0837fe02d617d31fbb25f990655861bb27bd1a" + "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fa0837fe02d617d31fbb25f990655861bb27bd1a", - "reference": "fa0837fe02d617d31fbb25f990655861bb27bd1a", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", + "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4980,6 +5564,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.22.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4994,29 +5581,29 @@ "type": "tidelift" } ], - "time": "2020-06-06T08:46:27+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.17.1", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "4a5b6bba3259902e386eb80dd1956181ee90b5b2" + "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4a5b6bba3259902e386eb80dd1956181ee90b5b2", - "reference": "4a5b6bba3259902e386eb80dd1956181ee90b5b2", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dc3063ba22c2a1fd2f45ed856374d79114998f91", + "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91", "shasum": "" }, "require": { - "php": ">=7.0.8" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5060,6 +5647,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.22.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -5074,90 +5664,20 @@ "type": "tidelift" } ], - "time": "2020-06-06T08:46:27+00:00" - }, - { - "name": "symfony/polyfill-util", - "version": "v1.17.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-util.git", - "reference": "6dd644eda43cd2f3daa883d728d8ab4120a05af6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/6dd644eda43cd2f3daa883d728d8ab4120a05af6", - "reference": "6dd644eda43cd2f3daa883d728d8ab4120a05af6", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.17-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Util\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony utilities for portability of PHP codes", - "homepage": "https://symfony.com", - "keywords": [ - "compat", - "compatibility", - "polyfill", - "shim" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-06-06T08:46:27+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/process", - "version": "v5.1.2", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "7f6378c1fa2147eeb1b4c385856ce9de0d46ebd1" + "reference": "bd8815b8b6705298beaa384f04fabd459c10bedd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/7f6378c1fa2147eeb1b4c385856ce9de0d46ebd1", - "reference": "7f6378c1fa2147eeb1b4c385856ce9de0d46ebd1", + "url": "https://api.github.com/repos/symfony/process/zipball/bd8815b8b6705298beaa384f04fabd459c10bedd", + "reference": "bd8815b8b6705298beaa384f04fabd459c10bedd", "shasum": "" }, "require": { @@ -5165,11 +5685,6 @@ "symfony/polyfill-php80": "^1.15" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Process\\": "" @@ -5194,6 +5709,9 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v5.2.1" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -5208,20 +5726,20 @@ "type": "tidelift" } ], - "time": "2020-05-30T20:35:19+00:00" + "time": "2020-12-08T17:03:37+00:00" }, { "name": "symfony/routing", - "version": "v5.1.2", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "bbd0ba121d623f66d165a55a108008968911f3eb" + "reference": "934ac2720dcc878a47a45c986b483a7ee7193620" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/bbd0ba121d623f66d165a55a108008968911f3eb", - "reference": "bbd0ba121d623f66d165a55a108008968911f3eb", + "url": "https://api.github.com/repos/symfony/routing/zipball/934ac2720dcc878a47a45c986b483a7ee7193620", + "reference": "934ac2720dcc878a47a45c986b483a7ee7193620", "shasum": "" }, "require": { @@ -5235,7 +5753,7 @@ "symfony/yaml": "<4.4" }, "require-dev": { - "doctrine/annotations": "~1.2", + "doctrine/annotations": "^1.7", "psr/log": "~1.0", "symfony/config": "^5.0", "symfony/dependency-injection": "^4.4|^5.0", @@ -5251,11 +5769,6 @@ "symfony/yaml": "For using the YAML loader" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Routing\\": "" @@ -5286,6 +5799,9 @@ "uri", "url" ], + "support": { + "source": "https://github.com/symfony/routing/tree/v5.2.1" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -5300,20 +5816,20 @@ "type": "tidelift" } ], - "time": "2020-06-10T11:49:58+00:00" + "time": "2020-12-08T17:03:37+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.1.2", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "66a8f0957a3ca54e4f724e49028ab19d75a8918b" + "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/66a8f0957a3ca54e4f724e49028ab19d75a8918b", - "reference": "66a8f0957a3ca54e4f724e49028ab19d75a8918b", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d15da7ba4957ffb8f1747218be9e1a121fd298a1", + "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1", "shasum": "" }, "require": { @@ -5326,7 +5842,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "2.2-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -5358,6 +5878,9 @@ "interoperability", "standards" ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/master" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -5372,20 +5895,20 @@ "type": "tidelift" } ], - "time": "2020-05-20T17:43:50+00:00" + "time": "2020-09-07T11:33:47+00:00" }, { "name": "symfony/string", - "version": "v5.1.2", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "ac70459db781108db7c6d8981dd31ce0e29e3298" + "reference": "5bd67751d2e3f7d6f770c9154b8fbcb2aa05f7ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/ac70459db781108db7c6d8981dd31ce0e29e3298", - "reference": "ac70459db781108db7c6d8981dd31ce0e29e3298", + "url": "https://api.github.com/repos/symfony/string/zipball/5bd67751d2e3f7d6f770c9154b8fbcb2aa05f7ed", + "reference": "5bd67751d2e3f7d6f770c9154b8fbcb2aa05f7ed", "shasum": "" }, "require": { @@ -5403,11 +5926,6 @@ "symfony/var-exporter": "^4.4|^5.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\String\\": "" @@ -5443,6 +5961,9 @@ "utf-8", "utf8" ], + "support": { + "source": "https://github.com/symfony/string/tree/v5.2.1" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -5457,27 +5978,27 @@ "type": "tidelift" } ], - "time": "2020-06-11T12:16:36+00:00" + "time": "2020-12-05T07:33:16+00:00" }, { "name": "symfony/translation", - "version": "v5.1.2", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "d387f07d4c15f9c09439cf3f13ddbe0b2c5e8be2" + "reference": "a04209ba0d1391c828e5b2373181dac63c52ee70" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/d387f07d4c15f9c09439cf3f13ddbe0b2c5e8be2", - "reference": "d387f07d4c15f9c09439cf3f13ddbe0b2c5e8be2", + "url": "https://api.github.com/repos/symfony/translation/zipball/a04209ba0d1391c828e5b2373181dac63c52ee70", + "reference": "a04209ba0d1391c828e5b2373181dac63c52ee70", "shasum": "" }, "require": { "php": ">=7.2.5", "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php80": "^1.15", - "symfony/translation-contracts": "^2" + "symfony/translation-contracts": "^2.3" }, "conflict": { "symfony/config": "<4.4", @@ -5506,12 +6027,10 @@ "symfony/yaml": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { + "files": [ + "Resources/functions.php" + ], "psr-4": { "Symfony\\Component\\Translation\\": "" }, @@ -5535,6 +6054,9 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/translation/tree/v5.2.1" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -5549,20 +6071,20 @@ "type": "tidelift" } ], - "time": "2020-05-30T20:35:19+00:00" + "time": "2020-12-08T17:03:37+00:00" }, { "name": "symfony/translation-contracts", - "version": "v2.1.2", + "version": "v2.3.0", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "e5ca07c8f817f865f618aa072c2fe8e0e637340e" + "reference": "e2eaa60b558f26a4b0354e1bbb25636efaaad105" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/e5ca07c8f817f865f618aa072c2fe8e0e637340e", - "reference": "e5ca07c8f817f865f618aa072c2fe8e0e637340e", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/e2eaa60b558f26a4b0354e1bbb25636efaaad105", + "reference": "e2eaa60b558f26a4b0354e1bbb25636efaaad105", "shasum": "" }, "require": { @@ -5574,7 +6096,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "2.3-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -5606,6 +6132,9 @@ "interoperability", "standards" ], + "support": { + "source": "https://github.com/symfony/translation-contracts/tree/v2.3.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -5620,20 +6149,20 @@ "type": "tidelift" } ], - "time": "2020-05-20T17:43:50+00:00" + "time": "2020-09-28T13:05:58+00:00" }, { "name": "symfony/var-dumper", - "version": "v5.1.2", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "46a942903059b0b05e601f00eb64179e05578c0f" + "reference": "13e7e882eaa55863faa7c4ad7c60f12f1a8b5089" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/46a942903059b0b05e601f00eb64179e05578c0f", - "reference": "46a942903059b0b05e601f00eb64179e05578c0f", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/13e7e882eaa55863faa7c4ad7c60f12f1a8b5089", + "reference": "13e7e882eaa55863faa7c4ad7c60f12f1a8b5089", "shasum": "" }, "require": { @@ -5660,11 +6189,6 @@ "Resources/bin/var-dump-server" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "files": [ "Resources/functions/dump.php" @@ -5696,6 +6220,9 @@ "debug", "dump" ], + "support": { + "source": "https://github.com/symfony/var-dumper/tree/v5.2.1" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -5710,20 +6237,20 @@ "type": "tidelift" } ], - "time": "2020-05-30T20:35:19+00:00" + "time": "2020-12-16T17:02:19+00:00" }, { "name": "symfony/yaml", - "version": "v4.4.10", + "version": "v4.4.18", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "c2d2cc66e892322cfcc03f8f12f8340dbd7a3f8a" + "reference": "bbce94f14d73732340740366fcbe63363663a403" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/c2d2cc66e892322cfcc03f8f12f8340dbd7a3f8a", - "reference": "c2d2cc66e892322cfcc03f8f12f8340dbd7a3f8a", + "url": "https://api.github.com/repos/symfony/yaml/zipball/bbce94f14d73732340740366fcbe63363663a403", + "reference": "bbce94f14d73732340740366fcbe63363663a403", "shasum": "" }, "require": { @@ -5740,11 +6267,6 @@ "symfony/console": "For validating YAML files using the lint command" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Yaml\\": "" @@ -5769,6 +6291,9 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/yaml/tree/v4.4.18" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -5783,30 +6308,30 @@ "type": "tidelift" } ], - "time": "2020-05-20T08:37:50+00:00" + "time": "2020-12-08T16:59:59+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", - "version": "2.2.2", + "version": "2.2.3", "source": { "type": "git", "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", - "reference": "dda2ee426acd6d801d5b7fd1001cde9b5f790e15" + "reference": "b43b05cf43c1b6d849478965062b6ef73e223bb5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/dda2ee426acd6d801d5b7fd1001cde9b5f790e15", - "reference": "dda2ee426acd6d801d5b7fd1001cde9b5f790e15", + "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/b43b05cf43c1b6d849478965062b6ef73e223bb5", + "reference": "b43b05cf43c1b6d849478965062b6ef73e223bb5", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", - "php": "^5.5 || ^7.0", + "php": "^5.5 || ^7.0 || ^8.0", "symfony/css-selector": "^2.7 || ^3.0 || ^4.0 || ^5.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^7.5" }, "type": "library", "extra": { @@ -5832,41 +6357,47 @@ ], "description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.", "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", - "time": "2019-10-24T08:53:34+00:00" + "support": { + "issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues", + "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/2.2.3" + }, + "time": "2020-07-13T06:12:54+00:00" }, { "name": "vlucas/phpdotenv", - "version": "v4.1.7", + "version": "v5.3.0", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "db63b2ea280fdcf13c4ca392121b0b2450b51193" + "reference": "b3eac5c7ac896e52deab4a99068e3f4ab12d9e56" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/db63b2ea280fdcf13c4ca392121b0b2450b51193", - "reference": "db63b2ea280fdcf13c4ca392121b0b2450b51193", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/b3eac5c7ac896e52deab4a99068e3f4ab12d9e56", + "reference": "b3eac5c7ac896e52deab4a99068e3f4ab12d9e56", "shasum": "" }, "require": { - "php": "^5.5.9 || ^7.0 || ^8.0", - "phpoption/phpoption": "^1.7.3", - "symfony/polyfill-ctype": "^1.16" + "ext-pcre": "*", + "graham-campbell/result-type": "^1.0.1", + "php": "^7.1.3 || ^8.0", + "phpoption/phpoption": "^1.7.4", + "symfony/polyfill-ctype": "^1.17", + "symfony/polyfill-mbstring": "^1.17", + "symfony/polyfill-php80": "^1.17" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.4.1", "ext-filter": "*", - "ext-pcre": "*", - "phpunit/phpunit": "^4.8.35 || ^5.7.27 || ^6.5.6 || ^7.0" + "phpunit/phpunit": "^7.5.20 || ^8.5.14 || ^9.5.1" }, "suggest": { - "ext-filter": "Required to use the boolean validator.", - "ext-pcre": "Required to use most of the library." + "ext-filter": "Required to use the boolean validator." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.1-dev" + "dev-master": "5.3-dev" } }, "autoload": { @@ -5896,6 +6427,10 @@ "env", "environment" ], + "support": { + "issues": "https://github.com/vlucas/phpdotenv/issues", + "source": "https://github.com/vlucas/phpdotenv/tree/v5.3.0" + }, "funding": [ { "url": "https://github.com/GrahamCampbell", @@ -5906,27 +6441,27 @@ "type": "tidelift" } ], - "time": "2020-06-07T18:25:35+00:00" + "time": "2021-01-20T15:23:13+00:00" }, { "name": "voku/portable-ascii", - "version": "1.5.2", + "version": "1.5.6", "source": { "type": "git", "url": "https://github.com/voku/portable-ascii.git", - "reference": "618631dc601d8eb6ea0a9fbf654ec82f066c4e97" + "reference": "80953678b19901e5165c56752d087fc11526017c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/voku/portable-ascii/zipball/618631dc601d8eb6ea0a9fbf654ec82f066c4e97", - "reference": "618631dc601d8eb6ea0a9fbf654ec82f066c4e97", + "url": "https://api.github.com/repos/voku/portable-ascii/zipball/80953678b19901e5165c56752d087fc11526017c", + "reference": "80953678b19901e5165c56752d087fc11526017c", "shasum": "" }, "require": { "php": ">=7.0.0" }, "require-dev": { - "phpunit/phpunit": "~6.0 || ~7.0" + "phpunit/phpunit": "~6.0 || ~7.0 || ~9.0" }, "suggest": { "ext-intl": "Use Intl for transliterator_transliterate() support" @@ -5954,6 +6489,10 @@ "clean", "php" ], + "support": { + "issues": "https://github.com/voku/portable-ascii/issues", + "source": "https://github.com/voku/portable-ascii/tree/1.5.6" + }, "funding": [ { "url": "https://www.paypal.me/moelleken", @@ -5963,6 +6502,10 @@ "url": "https://github.com/voku", "type": "github" }, + { + "url": "https://opencollective.com/portable-ascii", + "type": "open_collective" + }, { "url": "https://www.patreon.com/voku", "type": "patreon" @@ -5972,24 +6515,24 @@ "type": "tidelift" } ], - "time": "2020-06-15T23:49:30+00:00" + "time": "2020-11-12T00:07:28+00:00" }, { "name": "webmozart/assert", - "version": "1.9.0", + "version": "1.9.1", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "9dc4f203e36f2b486149058bade43c851dd97451" + "url": "https://github.com/webmozarts/assert.git", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/9dc4f203e36f2b486149058bade43c851dd97451", - "reference": "9dc4f203e36f2b486149058bade43c851dd97451", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0", + "php": "^5.3.3 || ^7.0 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { @@ -6021,85 +6564,47 @@ "check", "validate" ], - "time": "2020-06-16T10:16:42+00:00" + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.9.1" + }, + "time": "2020-07-08T17:02:28+00:00" } ], "packages-dev": [ - { - "name": "2bj/phanybar", - "version": "v1.0.0", - "source": { - "type": "git", - "url": "https://github.com/2bj/Phanybar.git", - "reference": "88ff671e18f30c2047a34f8cf2465a7ff93c819b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/2bj/Phanybar/zipball/88ff671e18f30c2047a34f8cf2465a7ff93c819b", - "reference": "88ff671e18f30c2047a34f8cf2465a7ff93c819b", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "bin": [ - "bin/phanybar" - ], - "type": "library", - "autoload": { - "psr-4": { - "Bakyt\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bakyt Turgumbaev", - "email": "dev2bj@gmail.com" - } - ], - "description": "Control AnyBar from your php", - "keywords": [ - "anybar", - "phanybar" - ], - "time": "2015-03-06T12:14:28+00:00" - }, { "name": "barryvdh/laravel-debugbar", - "version": "v3.3.3", + "version": "v3.5.2", "source": { "type": "git", "url": "https://github.com/barryvdh/laravel-debugbar.git", - "reference": "57f2219f6d9efe41ed1bc880d86701c52f261bf5" + "reference": "cae0a8d1cb89b0f0522f65e60465e16d738e069b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/57f2219f6d9efe41ed1bc880d86701c52f261bf5", - "reference": "57f2219f6d9efe41ed1bc880d86701c52f261bf5", + "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/cae0a8d1cb89b0f0522f65e60465e16d738e069b", + "reference": "cae0a8d1cb89b0f0522f65e60465e16d738e069b", "shasum": "" }, "require": { - "illuminate/routing": "^5.5|^6|^7", - "illuminate/session": "^5.5|^6|^7", - "illuminate/support": "^5.5|^6|^7", - "maximebf/debugbar": "^1.15.1", - "php": ">=7.0", - "symfony/debug": "^3|^4|^5", - "symfony/finder": "^3|^4|^5" + "illuminate/routing": "^6|^7|^8", + "illuminate/session": "^6|^7|^8", + "illuminate/support": "^6|^7|^8", + "maximebf/debugbar": "^1.16.3", + "php": ">=7.2", + "symfony/debug": "^4.3|^5", + "symfony/finder": "^4.3|^5" }, "require-dev": { - "laravel/framework": "5.5.x" + "mockery/mockery": "^1.3.3", + "orchestra/testbench-dusk": "^4|^5|^6", + "phpunit/phpunit": "^8.5|^9.0", + "squizlabs/php_codesniffer": "^3.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.5-dev" }, "laravel": { "providers": [ @@ -6136,49 +6641,58 @@ "profiler", "webprofiler" ], + "support": { + "issues": "https://github.com/barryvdh/laravel-debugbar/issues", + "source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.5.2" + }, "funding": [ { "url": "https://github.com/barryvdh", "type": "github" } ], - "time": "2020-05-05T10:53:32+00:00" + "time": "2021-01-06T14:21:44+00:00" }, { "name": "barryvdh/laravel-ide-helper", - "version": "v2.7.0", + "version": "v2.9.0", "source": { "type": "git", "url": "https://github.com/barryvdh/laravel-ide-helper.git", - "reference": "5f677edc14bdcfdcac36633e6eea71b2728a4dbc" + "reference": "64a6b902583802c162cdccf7e76dc8619368bf1a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/5f677edc14bdcfdcac36633e6eea71b2728a4dbc", - "reference": "5f677edc14bdcfdcac36633e6eea71b2728a4dbc", + "url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/64a6b902583802c162cdccf7e76dc8619368bf1a", + "reference": "64a6b902583802c162cdccf7e76dc8619368bf1a", "shasum": "" }, "require": { "barryvdh/reflection-docblock": "^2.0.6", - "composer/composer": "^1.6", - "doctrine/dbal": "~2.3", - "illuminate/console": "^5.5|^6|^7", - "illuminate/filesystem": "^5.5|^6|^7", - "illuminate/support": "^5.5|^6|^7", - "php": ">=7.2" + "composer/composer": "^1.6 || ^2", + "doctrine/dbal": "^2.6 || ^3", + "ext-json": "*", + "illuminate/console": "^8", + "illuminate/filesystem": "^8", + "illuminate/support": "^8", + "php": "^7.3 || ^8.0", + "phpdocumentor/type-resolver": "^1.1.0" }, "require-dev": { - "illuminate/config": "^5.5|^6|^7", - "illuminate/view": "^5.5|^6|^7", - "mockery/mockery": "^1.3", - "orchestra/testbench": "^3|^4|^5", - "phpro/grumphp": "^0.17.1", - "squizlabs/php_codesniffer": "^3" + "ext-pdo_sqlite": "*", + "friendsofphp/php-cs-fixer": "^2", + "illuminate/config": "^8", + "illuminate/view": "^8", + "mockery/mockery": "^1.4", + "orchestra/testbench": "^6", + "phpunit/phpunit": "^8.5 || ^9", + "spatie/phpunit-snapshot-assertions": "^3 || ^4", + "vimeo/psalm": "^3.12" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.9-dev" }, "laravel": { "providers": [ @@ -6213,13 +6727,17 @@ "phpstorm", "sublime" ], + "support": { + "issues": "https://github.com/barryvdh/laravel-ide-helper/issues", + "source": "https://github.com/barryvdh/laravel-ide-helper/tree/v2.9.0" + }, "funding": [ { "url": "https://github.com/barryvdh", "type": "github" } ], - "time": "2020-04-22T09:57:26+00:00" + "time": "2020-12-29T10:11:05+00:00" }, { "name": "barryvdh/reflection-docblock", @@ -6268,116 +6786,23 @@ "email": "mike.vanriel@naenius.com" } ], + "support": { + "source": "https://github.com/barryvdh/ReflectionDocBlock/tree/v2.0.6" + }, "time": "2018-12-13T10:34:14+00:00" }, - { - "name": "codedungeon/php-cli-colors", - "version": "1.11.0", - "source": { - "type": "git", - "url": "https://github.com/mikeerickson/php-cli-colors.git", - "reference": "9f60ac692cc790755dad47b01c1d607fe5f43b94" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mikeerickson/php-cli-colors/zipball/9f60ac692cc790755dad47b01c1d607fe5f43b94", - "reference": "9f60ac692cc790755dad47b01c1d607fe5f43b94", - "shasum": "" - }, - "require-dev": { - "phpunit/phpunit": ">=5.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "Codedungeon\\PHPCliColors\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike Erickson", - "email": "codedungeon@gmail.com" - } - ], - "description": "PHP Package for using color output in CLI commands", - "homepage": "https://github.com/mikeerickson/php-cli-colors", - "keywords": [ - "color", - "colors", - "composer", - "package", - "php" - ], - "time": "2019-12-29T22:29:29+00:00" - }, - { - "name": "codedungeon/phpunit-result-printer", - "version": "0.28.0", - "source": { - "type": "git", - "url": "https://github.com/mikeerickson/phpunit-pretty-result-printer.git", - "reference": "bc023b0311589bee19047425083163ffa3f0cf88" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mikeerickson/phpunit-pretty-result-printer/zipball/bc023b0311589bee19047425083163ffa3f0cf88", - "reference": "bc023b0311589bee19047425083163ffa3f0cf88", - "shasum": "" - }, - "require": { - "2bj/phanybar": "^1.0", - "codedungeon/php-cli-colors": "^1.10.2", - "hassankhan/config": "^0.11.2", - "php": "^7.1", - "symfony/yaml": "^2.7|^3.0|^4.0|^5.0" - }, - "require-dev": { - "spatie/phpunit-watcher": "^1.6" - }, - "type": "library", - "autoload": { - "psr-4": { - "Codedungeon\\PHPUnitPrettyResultPrinter\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike Erickson", - "email": "codedungeon@gmail.com" - } - ], - "description": "PHPUnit Pretty Result Printer", - "keywords": [ - "TDD", - "composer", - "package", - "phpunit", - "printer", - "result-printer", - "testing" - ], - "time": "2020-06-24T00:16:05+00:00" - }, { "name": "composer/ca-bundle", - "version": "1.2.7", + "version": "1.2.9", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "95c63ab2117a72f48f5a55da9740a3273d45b7fd" + "reference": "78a0e288fdcebf92aa2318a8d3656168da6ac1a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/95c63ab2117a72f48f5a55da9740a3273d45b7fd", - "reference": "95c63ab2117a72f48f5a55da9740a3273d45b7fd", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/78a0e288fdcebf92aa2318a8d3656168da6ac1a5", + "reference": "78a0e288fdcebf92aa2318a8d3656168da6ac1a5", "shasum": "" }, "require": { @@ -6386,14 +6811,15 @@ "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8", + "phpstan/phpstan": "^0.12.55", "psr/log": "^1.0", + "symfony/phpunit-bridge": "^4.2 || ^5", "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-main": "1.x-dev" } }, "autoload": { @@ -6420,54 +6846,60 @@ "ssl", "tls" ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/ca-bundle/issues", + "source": "https://github.com/composer/ca-bundle/tree/1.2.9" + }, "funding": [ { "url": "https://packagist.com", "type": "custom" }, + { + "url": "https://github.com/composer", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/composer/composer", "type": "tidelift" } ], - "time": "2020-04-08T08:27:21+00:00" + "time": "2021-01-12T12:10:35+00:00" }, { "name": "composer/composer", - "version": "1.10.7", + "version": "2.0.8", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "956608ea4f7de9e58c53dfb019d85ae62b193c39" + "reference": "62139b2806178adb979d76bd3437534a1a9fd490" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/956608ea4f7de9e58c53dfb019d85ae62b193c39", - "reference": "956608ea4f7de9e58c53dfb019d85ae62b193c39", + "url": "https://api.github.com/repos/composer/composer/zipball/62139b2806178adb979d76bd3437534a1a9fd490", + "reference": "62139b2806178adb979d76bd3437534a1a9fd490", "shasum": "" }, "require": { "composer/ca-bundle": "^1.0", - "composer/semver": "^1.0", + "composer/semver": "^3.0", "composer/spdx-licenses": "^1.2", "composer/xdebug-handler": "^1.1", "justinrainbow/json-schema": "^5.2.10", - "php": "^5.3.2 || ^7.0", + "php": "^5.3.2 || ^7.0 || ^8.0", "psr/log": "^1.0", + "react/promise": "^1.2 || ^2.7", "seld/jsonlint": "^1.4", "seld/phar-utils": "^1.0", - "symfony/console": "^2.7 || ^3.0 || ^4.0 || ^5.0", - "symfony/filesystem": "^2.7 || ^3.0 || ^4.0 || ^5.0", - "symfony/finder": "^2.7 || ^3.0 || ^4.0 || ^5.0", - "symfony/process": "^2.7 || ^3.0 || ^4.0 || ^5.0" - }, - "conflict": { - "symfony/console": "2.8.38", - "symfony/phpunit-bridge": "3.4.40" + "symfony/console": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0", + "symfony/filesystem": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0", + "symfony/finder": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0", + "symfony/process": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0" }, "require-dev": { "phpspec/prophecy": "^1.10", - "symfony/phpunit-bridge": "^3.4" + "symfony/phpunit-bridge": "^4.2 || ^5.0" }, "suggest": { "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", @@ -6480,7 +6912,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.10-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -6496,12 +6928,12 @@ { "name": "Nils Adermann", "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" + "homepage": "https://www.naderman.de" }, { "name": "Jordi Boggiano", "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" + "homepage": "https://seld.be" } ], "description": "Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.", @@ -6511,6 +6943,11 @@ "dependency", "package" ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/composer/issues", + "source": "https://github.com/composer/composer/tree/2.0.8" + }, "funding": [ { "url": "https://packagist.com", @@ -6525,32 +6962,33 @@ "type": "tidelift" } ], - "time": "2020-06-03T08:03:56+00:00" + "time": "2020-12-03T16:20:39+00:00" }, { "name": "composer/semver", - "version": "1.5.1", + "version": "3.2.4", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de" + "reference": "a02fdf930a3c1c3ed3a49b5f63859c0c20e10464" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/c6bea70230ef4dd483e6bbcab6005f682ed3a8de", - "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de", + "url": "https://api.github.com/repos/composer/semver/zipball/a02fdf930a3c1c3ed3a49b5f63859c0c20e10464", + "reference": "a02fdf930a3c1c3ed3a49b5f63859c0c20e10464", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0" + "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5" + "phpstan/phpstan": "^0.12.54", + "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-main": "3.x-dev" } }, "autoload": { @@ -6586,20 +7024,39 @@ "validation", "versioning" ], - "time": "2020-01-13T12:06:48+00:00" + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.2.4" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-11-13T08:59:24+00:00" }, { "name": "composer/spdx-licenses", - "version": "1.5.3", + "version": "1.5.5", "source": { "type": "git", "url": "https://github.com/composer/spdx-licenses.git", - "reference": "0c3e51e1880ca149682332770e25977c70cf9dae" + "reference": "de30328a7af8680efdc03e396aad24befd513200" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/0c3e51e1880ca149682332770e25977c70cf9dae", - "reference": "0c3e51e1880ca149682332770e25977c70cf9dae", + "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/de30328a7af8680efdc03e396aad24befd513200", + "reference": "de30328a7af8680efdc03e396aad24befd513200", "shasum": "" }, "require": { @@ -6611,7 +7068,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-main": "1.x-dev" } }, "autoload": { @@ -6646,20 +7103,39 @@ "spdx", "validator" ], - "time": "2020-02-14T07:44:31+00:00" + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/spdx-licenses/issues", + "source": "https://github.com/composer/spdx-licenses/tree/1.5.5" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-12-03T16:04:16+00:00" }, { "name": "composer/xdebug-handler", - "version": "1.4.2", + "version": "1.4.5", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51" + "reference": "f28d44c286812c714741478d968104c5e604a1d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51", - "reference": "fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/f28d44c286812c714741478d968104c5e604a1d4", + "reference": "f28d44c286812c714741478d968104c5e604a1d4", "shasum": "" }, "require": { @@ -6690,6 +7166,11 @@ "Xdebug", "performance" ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/1.4.5" + }, "funding": [ { "url": "https://packagist.com", @@ -6704,20 +7185,20 @@ "type": "tidelift" } ], - "time": "2020-06-04T11:16:35+00:00" + "time": "2020-11-13T08:04:11+00:00" }, { "name": "doctrine/annotations", - "version": "1.10.3", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "5db60a4969eba0e0c197a19c077780aadbc43c5d" + "reference": "ce77a7ba1770462cd705a91a151b6c3746f9c6ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/5db60a4969eba0e0c197a19c077780aadbc43c5d", - "reference": "5db60a4969eba0e0c197a19c077780aadbc43c5d", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/ce77a7ba1770462cd705a91a151b6c3746f9c6ad", + "reference": "ce77a7ba1770462cd705a91a151b6c3746f9c6ad", "shasum": "" }, "require": { @@ -6727,12 +7208,14 @@ }, "require-dev": { "doctrine/cache": "1.*", - "phpunit/phpunit": "^7.5" + "doctrine/coding-standard": "^6.0 || ^8.1", + "phpstan/phpstan": "^0.12.20", + "phpunit/phpunit": "^7.5 || ^9.1.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.9.x-dev" + "dev-master": "1.11.x-dev" } }, "autoload": { @@ -6767,46 +7250,45 @@ } ], "description": "Docblock Annotations Parser", - "homepage": "http://www.doctrine-project.org", + "homepage": "https://www.doctrine-project.org/projects/annotations.html", "keywords": [ "annotations", "docblock", "parser" ], - "time": "2020-05-25T17:24:27+00:00" + "support": { + "issues": "https://github.com/doctrine/annotations/issues", + "source": "https://github.com/doctrine/annotations/tree/1.11.1" + }, + "time": "2020-10-26T10:28:16+00:00" }, { "name": "doctrine/instantiator", - "version": "1.3.1", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "f350df0268e904597e3bd9c4685c53e0e333feea" + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f350df0268e904597e3bd9c4685c53e0e333feea", - "reference": "f350df0268e904597e3bd9c4685c53e0e333feea", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0", + "doctrine/coding-standard": "^8.0", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-shim": "^0.11", - "phpunit/phpunit": "^7.0" + "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" @@ -6820,7 +7302,7 @@ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" + "homepage": "https://ocramius.github.io/" } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", @@ -6829,6 +7311,10 @@ "constructor", "instantiate" ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + }, "funding": [ { "url": "https://www.doctrine-project.org/sponsorship.html", @@ -6843,31 +7329,343 @@ "type": "tidelift" } ], - "time": "2020-05-29T17:27:14+00:00" + "time": "2020-11-10T18:47:58+00:00" }, { - "name": "friendsofphp/php-cs-fixer", - "version": "v2.16.1", + "name": "facade/flare-client-php", + "version": "1.3.7", "source": { "type": "git", - "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "c8afb599858876e95e8ebfcd97812d383fa23f02" + "url": "https://github.com/facade/flare-client-php.git", + "reference": "fd688d3c06658f2b3b5f7bb19f051ee4ddf02492" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/c8afb599858876e95e8ebfcd97812d383fa23f02", - "reference": "c8afb599858876e95e8ebfcd97812d383fa23f02", + "url": "https://api.github.com/repos/facade/flare-client-php/zipball/fd688d3c06658f2b3b5f7bb19f051ee4ddf02492", + "reference": "fd688d3c06658f2b3b5f7bb19f051ee4ddf02492", "shasum": "" }, "require": { - "composer/semver": "^1.4", + "facade/ignition-contracts": "~1.0", + "illuminate/pipeline": "^5.5|^6.0|^7.0|^8.0", + "php": "^7.1|^8.0", + "symfony/http-foundation": "^3.3|^4.1|^5.0", + "symfony/mime": "^3.4|^4.0|^5.1", + "symfony/var-dumper": "^3.4|^4.0|^5.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.14", + "phpunit/phpunit": "^7.5.16", + "spatie/phpunit-snapshot-assertions": "^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Facade\\FlareClient\\": "src" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Send PHP errors to Flare", + "homepage": "https://github.com/facade/flare-client-php", + "keywords": [ + "exception", + "facade", + "flare", + "reporting" + ], + "support": { + "issues": "https://github.com/facade/flare-client-php/issues", + "source": "https://github.com/facade/flare-client-php/tree/1.3.7" + }, + "funding": [ + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2020-10-21T16:02:39+00:00" + }, + { + "name": "facade/ignition", + "version": "2.5.8", + "source": { + "type": "git", + "url": "https://github.com/facade/ignition.git", + "reference": "8e907d81244649c5ea746e2ec30c32c5f59df472" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facade/ignition/zipball/8e907d81244649c5ea746e2ec30c32c5f59df472", + "reference": "8e907d81244649c5ea746e2ec30c32c5f59df472", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "facade/flare-client-php": "^1.3.7", + "facade/ignition-contracts": "^1.0.2", + "filp/whoops": "^2.4", + "illuminate/support": "^7.0|^8.0", + "monolog/monolog": "^2.0", + "php": "^7.2.5|^8.0", + "symfony/console": "^5.0", + "symfony/var-dumper": "^5.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.14", + "mockery/mockery": "^1.3", + "orchestra/testbench": "^5.0|^6.0", + "psalm/plugin-laravel": "^1.2" + }, + "suggest": { + "laravel/telescope": "^3.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + }, + "laravel": { + "providers": [ + "Facade\\Ignition\\IgnitionServiceProvider" + ], + "aliases": { + "Flare": "Facade\\Ignition\\Facades\\Flare" + } + } + }, + "autoload": { + "psr-4": { + "Facade\\Ignition\\": "src" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A beautiful error page for Laravel applications.", + "homepage": "https://github.com/facade/ignition", + "keywords": [ + "error", + "flare", + "laravel", + "page" + ], + "support": { + "docs": "https://flareapp.io/docs/ignition-for-laravel/introduction", + "forum": "https://twitter.com/flareappio", + "issues": "https://github.com/facade/ignition/issues", + "source": "https://github.com/facade/ignition" + }, + "time": "2020-12-29T09:12:55+00:00" + }, + { + "name": "facade/ignition-contracts", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/facade/ignition-contracts.git", + "reference": "3c921a1cdba35b68a7f0ccffc6dffc1995b18267" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facade/ignition-contracts/zipball/3c921a1cdba35b68a7f0ccffc6dffc1995b18267", + "reference": "3c921a1cdba35b68a7f0ccffc6dffc1995b18267", + "shasum": "" + }, + "require": { + "php": "^7.3|^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^v2.15.8", + "phpunit/phpunit": "^9.3.11", + "vimeo/psalm": "^3.17.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Facade\\IgnitionContracts\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://flareapp.io", + "role": "Developer" + } + ], + "description": "Solution contracts for Ignition", + "homepage": "https://github.com/facade/ignition-contracts", + "keywords": [ + "contracts", + "flare", + "ignition" + ], + "support": { + "issues": "https://github.com/facade/ignition-contracts/issues", + "source": "https://github.com/facade/ignition-contracts/tree/1.0.2" + }, + "time": "2020-10-16T08:27:54+00:00" + }, + { + "name": "fakerphp/faker", + "version": "v1.13.0", + "source": { + "type": "git", + "url": "https://github.com/FakerPHP/Faker.git", + "reference": "ab3f5364d01f2c2c16113442fb987d26e4004913" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/ab3f5364d01f2c2c16113442fb987d26e4004913", + "reference": "ab3f5364d01f2c2c16113442fb987d26e4004913", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "fzaninotto/faker": "*" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "ext-intl": "*", + "phpunit/phpunit": "^7.5.20 || ^8.5.8 || ^9.4.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "support": { + "issues": "https://github.com/FakerPHP/Faker/issues", + "source": "https://github.com/FakerPHP/Faker/tree/v1.13.0" + }, + "time": "2020-12-18T16:50:48+00:00" + }, + { + "name": "filp/whoops", + "version": "2.9.1", + "source": { + "type": "git", + "url": "https://github.com/filp/whoops.git", + "reference": "307fb34a5ab697461ec4c9db865b20ff2fd40771" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/filp/whoops/zipball/307fb34a5ab697461ec4c9db865b20ff2fd40771", + "reference": "307fb34a5ab697461ec4c9db865b20ff2fd40771", + "shasum": "" + }, + "require": { + "php": "^5.5.9 || ^7.0 || ^8.0", + "psr/log": "^1.0.1" + }, + "require-dev": { + "mockery/mockery": "^0.9 || ^1.0", + "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.3", + "symfony/var-dumper": "^2.6 || ^3.0 || ^4.0 || ^5.0" + }, + "suggest": { + "symfony/var-dumper": "Pretty print complex values better with var-dumper available", + "whoops/soap": "Formats errors as SOAP responses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Whoops\\": "src/Whoops/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Filipe Dobreira", + "homepage": "https://github.com/filp", + "role": "Developer" + } + ], + "description": "php error handling for cool kids", + "homepage": "https://filp.github.io/whoops/", + "keywords": [ + "error", + "exception", + "handling", + "library", + "throwable", + "whoops" + ], + "support": { + "issues": "https://github.com/filp/whoops/issues", + "source": "https://github.com/filp/whoops/tree/2.9.1" + }, + "time": "2020-11-01T12:00:00+00:00" + }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v2.18.1", + "source": { + "type": "git", + "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", + "reference": "c68ff6231adb276857761e43b7ed082f164dce0b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/c68ff6231adb276857761e43b7ed082f164dce0b", + "reference": "c68ff6231adb276857761e43b7ed082f164dce0b", + "shasum": "" + }, + "require": { + "composer/semver": "^1.4 || ^2.0 || ^3.0", "composer/xdebug-handler": "^1.2", "doctrine/annotations": "^1.2", "ext-json": "*", "ext-tokenizer": "*", - "php": "^5.6 || ^7.0", + "php": "^5.6 || ^7.0 || ^8.0", "php-cs-fixer/diff": "^1.3", - "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0", + "symfony/console": "^3.4.43 || ^4.1.6 || ^5.0", "symfony/event-dispatcher": "^3.0 || ^4.0 || ^5.0", "symfony/filesystem": "^3.0 || ^4.0 || ^5.0", "symfony/finder": "^3.0 || ^4.0 || ^5.0", @@ -6878,21 +7676,24 @@ "symfony/stopwatch": "^3.0 || ^4.0 || ^5.0" }, "require-dev": { - "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", "justinrainbow/json-schema": "^5.0", - "keradus/cli-executor": "^1.2", + "keradus/cli-executor": "^1.4", "mikey179/vfsstream": "^1.6", - "php-coveralls/php-coveralls": "^2.1", + "php-coveralls/php-coveralls": "^2.4.2", "php-cs-fixer/accessible-object": "^1.0", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.1", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.1", - "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.1", - "phpunitgoodpractices/traits": "^1.8", - "symfony/phpunit-bridge": "^4.3 || ^5.0", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2.1", + "phpspec/prophecy-phpunit": "^1.1 || ^2.0", + "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.13 || ^9.5", + "phpunitgoodpractices/polyfill": "^1.5", + "phpunitgoodpractices/traits": "^1.9.1", + "sanmai/phpunit-legacy-adapter": "^6.4 || ^8.2.1", + "symfony/phpunit-bridge": "^5.2.1", "symfony/yaml": "^3.0 || ^4.0 || ^5.0" }, "suggest": { - "ext-mbstring": "For handling non-UTF8 characters in cache signature.", + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters.", "php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.", "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." @@ -6914,6 +7715,7 @@ "tests/Test/IntegrationCaseFactory.php", "tests/Test/IntegrationCaseFactoryInterface.php", "tests/Test/InternalIntegrationCaseFactory.php", + "tests/Test/IsIdenticalConstraint.php", "tests/TestCase.php" ] }, @@ -6932,74 +7734,34 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2019-11-25T22:10:32+00:00" - }, - { - "name": "fzaninotto/faker", - "version": "v1.9.1", - "source": { - "type": "git", - "url": "https://github.com/fzaninotto/Faker.git", - "reference": "fc10d778e4b84d5bd315dad194661e091d307c6f" + "support": { + "issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues", + "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v2.18.1" }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/fc10d778e4b84d5bd315dad194661e091d307c6f", - "reference": "fc10d778e4b84d5bd315dad194661e091d307c6f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "ext-intl": "*", - "phpunit/phpunit": "^4.8.35 || ^5.7", - "squizlabs/php_codesniffer": "^2.9.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } - }, - "autoload": { - "psr-4": { - "Faker\\": "src/Faker/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ + "funding": [ { - "name": "François Zaninotto" + "url": "https://github.com/keradus", + "type": "github" } ], - "description": "Faker is a PHP library that generates fake data for you.", - "keywords": [ - "data", - "faker", - "fixtures" - ], - "time": "2019-12-12T13:22:17+00:00" + "time": "2021-01-21T18:50:42+00:00" }, { "name": "hamcrest/hamcrest-php", - "version": "v2.0.0", + "version": "v2.0.1", "source": { "type": "git", "url": "https://github.com/hamcrest/hamcrest-php.git", - "reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad" + "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/776503d3a8e85d4f9a1148614f95b7a608b046ad", - "reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad", + "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", + "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", "shasum": "" }, "require": { - "php": "^5.3|^7.0" + "php": "^5.3|^7.0|^8.0" }, "replace": { "cordoval/hamcrest-php": "*", @@ -7007,14 +7769,13 @@ "kodova/hamcrest-php": "*" }, "require-dev": { - "phpunit/php-file-iterator": "1.3.3", - "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "^1.0" + "phpunit/php-file-iterator": "^1.4 || ^2.0", + "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "2.1-dev" } }, "autoload": { @@ -7024,70 +7785,17 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD" + "BSD-3-Clause" ], "description": "This is the PHP port of Hamcrest Matchers", "keywords": [ "test" ], - "time": "2016-01-20T08:20:44+00:00" - }, - { - "name": "hassankhan/config", - "version": "0.11.2", - "source": { - "type": "git", - "url": "https://github.com/hassankhan/config.git", - "reference": "7fbc236c32dc6cc53a7b00992a2739cf8b41c085" + "support": { + "issues": "https://github.com/hamcrest/hamcrest-php/issues", + "source": "https://github.com/hamcrest/hamcrest-php/tree/v2.0.1" }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hassankhan/config/zipball/7fbc236c32dc6cc53a7b00992a2739cf8b41c085", - "reference": "7fbc236c32dc6cc53a7b00992a2739cf8b41c085", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0", - "scrutinizer/ocular": "~1.1", - "squizlabs/php_codesniffer": "~2.2" - }, - "suggest": { - "symfony/yaml": "~2.5" - }, - "type": "library", - "autoload": { - "psr-4": { - "Noodlehaus\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Hassan Khan", - "homepage": "http://hassankhan.me/", - "role": "Developer" - } - ], - "description": "Lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files", - "homepage": "http://hassankhan.me/config/", - "keywords": [ - "config", - "configuration", - "ini", - "json", - "microphp", - "unframework", - "xml", - "yaml", - "yml" - ], - "time": "2017-11-07T22:49:43+00:00" + "time": "2020-07-09T08:09:16+00:00" }, { "name": "justinrainbow/json-schema", @@ -7153,34 +7861,38 @@ "json", "schema" ], + "support": { + "issues": "https://github.com/justinrainbow/json-schema/issues", + "source": "https://github.com/justinrainbow/json-schema/tree/5.2.10" + }, "time": "2020-05-27T16:41:55+00:00" }, { "name": "laravel/dusk", - "version": "v6.3.0", + "version": "v6.11.1", "source": { "type": "git", "url": "https://github.com/laravel/dusk.git", - "reference": "5481bfd50c80599d26529b7f2c9adeb2154a57fc" + "reference": "2fb73c87b5805ced07e8ab4487b3c1ace0b65ae9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/dusk/zipball/5481bfd50c80599d26529b7f2c9adeb2154a57fc", - "reference": "5481bfd50c80599d26529b7f2c9adeb2154a57fc", + "url": "https://api.github.com/repos/laravel/dusk/zipball/2fb73c87b5805ced07e8ab4487b3c1ace0b65ae9", + "reference": "2fb73c87b5805ced07e8ab4487b3c1ace0b65ae9", "shasum": "" }, "require": { "ext-json": "*", "ext-zip": "*", - "illuminate/console": "^6.0|^7.0", - "illuminate/support": "^6.0|^7.0", + "illuminate/console": "^6.0|^7.0|^8.0", + "illuminate/support": "^6.0|^7.0|^8.0", "nesbot/carbon": "^2.0", - "php": "^7.2", - "php-webdriver/webdriver": "^1.8.1", + "php": "^7.2|^8.0", + "php-webdriver/webdriver": "^1.9.0", "symfony/console": "^4.3|^5.0", "symfony/finder": "^4.3|^5.0", "symfony/process": "^4.3|^5.0", - "vlucas/phpdotenv": "^3.0|^4.0" + "vlucas/phpdotenv": "^3.0|^4.0|^5.0" }, "require-dev": { "mockery/mockery": "^1.0", @@ -7221,29 +7933,33 @@ "testing", "webdriver" ], - "time": "2020-06-16T19:05:20+00:00" + "support": { + "issues": "https://github.com/laravel/dusk/issues", + "source": "https://github.com/laravel/dusk/tree/v6.11.1" + }, + "time": "2021-01-19T14:58:07+00:00" }, { "name": "maximebf/debugbar", - "version": "v1.16.3", + "version": "v1.16.5", "source": { "type": "git", "url": "https://github.com/maximebf/php-debugbar.git", - "reference": "1a1605b8e9bacb34cc0c6278206d699772e1d372" + "reference": "6d51ee9e94cff14412783785e79a4e7ef97b9d62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/1a1605b8e9bacb34cc0c6278206d699772e1d372", - "reference": "1a1605b8e9bacb34cc0c6278206d699772e1d372", + "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/6d51ee9e94cff14412783785e79a4e7ef97b9d62", + "reference": "6d51ee9e94cff14412783785e79a4e7ef97b9d62", "shasum": "" }, "require": { - "php": "^7.1", + "php": "^7.1|^8", "psr/log": "^1.0", "symfony/var-dumper": "^2.6|^3|^4|^5" }, "require-dev": { - "phpunit/phpunit": "^5" + "phpunit/phpunit": "^7.5.20 || ^9.4.2" }, "suggest": { "kriswallsmith/assetic": "The best way to manage assets", @@ -7282,32 +7998,36 @@ "debug", "debugbar" ], - "time": "2020-05-06T07:06:27+00:00" + "support": { + "issues": "https://github.com/maximebf/php-debugbar/issues", + "source": "https://github.com/maximebf/php-debugbar/tree/v1.16.5" + }, + "time": "2020-12-07T11:07:24+00:00" }, { "name": "mockery/mockery", - "version": "1.4.0", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "6c6a7c533469873deacf998237e7649fc6b36223" + "reference": "20cab678faed06fac225193be281ea0fddb43b93" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/6c6a7c533469873deacf998237e7649fc6b36223", - "reference": "6c6a7c533469873deacf998237e7649fc6b36223", + "url": "https://api.github.com/repos/mockery/mockery/zipball/20cab678faed06fac225193be281ea0fddb43b93", + "reference": "20cab678faed06fac225193be281ea0fddb43b93", "shasum": "" }, "require": { - "hamcrest/hamcrest-php": "~2.0", + "hamcrest/hamcrest-php": "^2.0.1", "lib-pcre": ">=7.0", - "php": "^7.3.0" + "php": "^7.3 || ^8.0" }, "conflict": { "phpunit/phpunit": "<8.0" }, "require-dev": { - "phpunit/phpunit": "^8.0.0 || ^9.0.0" + "phpunit/phpunit": "^8.5 || ^9.3" }, "type": "library", "extra": { @@ -7350,24 +8070,28 @@ "test double", "testing" ], - "time": "2020-05-19T14:25:16+00:00" + "support": { + "issues": "https://github.com/mockery/mockery/issues", + "source": "https://github.com/mockery/mockery/tree/master" + }, + "time": "2020-08-11T18:10:13+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.9.5", + "version": "1.10.2", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef" + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef", - "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.1 || ^8.0" }, "replace": { "myclabs/deep-copy": "self.version" @@ -7398,32 +8122,131 @@ "object", "object graph" ], - "time": "2020-01-17T21:11:47+00:00" + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2020-11-13T09:40:50+00:00" }, { - "name": "phar-io/manifest", - "version": "1.0.3", + "name": "nunomaduro/collision", + "version": "v5.2.0", "source": { "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + "url": "https://github.com/nunomaduro/collision.git", + "reference": "aca954fd03414ba0dd85d7d8e42ba9b251893d1f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "url": "https://api.github.com/repos/nunomaduro/collision/zipball/aca954fd03414ba0dd85d7d8e42ba9b251893d1f", + "reference": "aca954fd03414ba0dd85d7d8e42ba9b251893d1f", + "shasum": "" + }, + "require": { + "facade/ignition-contracts": "^1.0", + "filp/whoops": "^2.7.2", + "php": "^7.3 || ^8.0", + "symfony/console": "^5.0" + }, + "require-dev": { + "brianium/paratest": "^6.1", + "fideloper/proxy": "^4.4.1", + "friendsofphp/php-cs-fixer": "^2.17.3", + "fruitcake/laravel-cors": "^2.0.3", + "laravel/framework": "^9.0", + "nunomaduro/larastan": "^0.6.2", + "nunomaduro/mock-final-classes": "^1.0", + "orchestra/testbench": "^7.0", + "phpstan/phpstan": "^0.12.64", + "phpunit/phpunit": "^9.5.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "NunoMaduro\\Collision\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "Cli error handling for console/command-line PHP applications.", + "keywords": [ + "artisan", + "cli", + "command-line", + "console", + "error", + "handling", + "laravel", + "laravel-zero", + "php", + "symfony" + ], + "support": { + "issues": "https://github.com/nunomaduro/collision/issues", + "source": "https://github.com/nunomaduro/collision" + }, + "funding": [ + { + "url": "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + }, + { + "url": "https://www.patreon.com/nunomaduro", + "type": "patreon" + } + ], + "time": "2021-01-13T10:00:08+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", + "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", "shasum": "" }, "require": { "ext-dom": "*", "ext-phar": "*", - "phar-io/version": "^2.0", - "php": "^5.6 || ^7.0" + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -7453,24 +8276,28 @@ } ], "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2018-07-08T19:23:20+00:00" + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/master" + }, + "time": "2020-06-27T14:33:11+00:00" }, { "name": "phar-io/version", - "version": "2.0.1", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + "reference": "e4782611070e50613683d2b9a57730e9a3ba5451" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "url": "https://api.github.com/repos/phar-io/version/zipball/e4782611070e50613683d2b9a57730e9a3ba5451", + "reference": "e4782611070e50613683d2b9a57730e9a3ba5451", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { @@ -7500,27 +8327,31 @@ } ], "description": "Library for handling version information and constraints", - "time": "2018-07-08T19:19:57+00:00" + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.0.4" + }, + "time": "2020-12-13T23:18:30+00:00" }, { "name": "php-cs-fixer/diff", - "version": "v1.3.0", + "version": "v1.3.1", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/diff.git", - "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756" + "reference": "dbd31aeb251639ac0b9e7e29405c1441907f5759" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/78bb099e9c16361126c86ce82ec4405ebab8e756", - "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756", + "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/dbd31aeb251639ac0b9e7e29405c1441907f5759", + "reference": "dbd31aeb251639ac0b9e7e29405c1441907f5759", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^5.6 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^5.7.23 || ^6.4.3", + "phpunit/phpunit": "^5.7.23 || ^6.4.3 || ^7.0", "symfony/process": "^3.3" }, "type": "library", @@ -7534,14 +8365,14 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, { "name": "SpacePossum" } @@ -7551,31 +8382,36 @@ "keywords": [ "diff" ], - "time": "2018-02-15T16:58:55+00:00" + "support": { + "issues": "https://github.com/PHP-CS-Fixer/diff/issues", + "source": "https://github.com/PHP-CS-Fixer/diff/tree/v1.3.1" + }, + "time": "2020-10-14T08:39:05+00:00" }, { "name": "php-mock/php-mock", - "version": "2.2.2", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/php-mock/php-mock.git", - "reference": "890d3e32e3a5f29715a8fd17debd87a0c9e614a0" + "reference": "a3142f257153b71c09bf9146ecf73430b3818b7c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-mock/php-mock/zipball/890d3e32e3a5f29715a8fd17debd87a0c9e614a0", - "reference": "890d3e32e3a5f29715a8fd17debd87a0c9e614a0", + "url": "https://api.github.com/repos/php-mock/php-mock/zipball/a3142f257153b71c09bf9146ecf73430b3818b7c", + "reference": "a3142f257153b71c09bf9146ecf73430b3818b7c", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0", + "php": "^5.6 || ^7.0 || ^8.0", "phpunit/php-text-template": "^1 || ^2" }, "replace": { "malkusch/php-mock": "*" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.0 || ^9.0" + "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.0 || ^9.0", + "squizlabs/php_codesniffer": "^3.5" }, "suggest": { "php-mock/php-mock-phpunit": "Allows integration into PHPUnit testcase with the trait PHPMock." @@ -7615,7 +8451,17 @@ "test", "test double" ], - "time": "2020-04-17T16:39:00+00:00" + "support": { + "issues": "https://github.com/php-mock/php-mock/issues", + "source": "https://github.com/php-mock/php-mock/tree/2.3.0" + }, + "funding": [ + { + "url": "https://github.com/michalbundyra", + "type": "github" + } + ], + "time": "2020-12-11T19:20:04+00:00" }, { "name": "php-mock/php-mock-integration", @@ -7668,6 +8514,10 @@ "test", "test double" ], + "support": { + "issues": "https://github.com/php-mock/php-mock-integration/issues", + "source": "https://github.com/php-mock/php-mock-integration/tree/2.1.0" + }, "time": "2020-02-08T14:40:25+00:00" }, { @@ -7722,38 +8572,44 @@ "test", "test double" ], + "support": { + "issues": "https://github.com/php-mock/php-mock-phpunit/issues", + "source": "https://github.com/php-mock/php-mock-phpunit/tree/2.6.0" + }, "time": "2020-02-08T15:44:47+00:00" }, { "name": "php-webdriver/webdriver", - "version": "1.8.2", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/php-webdriver/php-webdriver.git", - "reference": "3308a70be084d6d7fd1ee5787b4c2e6eb4b70aab" + "reference": "e3633154554605274cc9d59837f55a7427d72003" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/3308a70be084d6d7fd1ee5787b4c2e6eb4b70aab", - "reference": "3308a70be084d6d7fd1ee5787b4c2e6eb4b70aab", + "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/e3633154554605274cc9d59837f55a7427d72003", + "reference": "e3633154554605274cc9d59837f55a7427d72003", "shasum": "" }, "require": { "ext-curl": "*", "ext-json": "*", "ext-zip": "*", - "php": "^5.6 || ~7.0", + "php": "^5.6 || ~7.0 || ^8.0", "symfony/polyfill-mbstring": "^1.12", "symfony/process": "^2.8 || ^3.1 || ^4.0 || ^5.0" }, + "replace": { + "facebook/webdriver": "*" + }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.0", - "jakub-onderka/php-parallel-lint": "^1.0", - "php-coveralls/php-coveralls": "^2.0", - "php-mock/php-mock-phpunit": "^1.1", - "phpunit/phpunit": "^5.7", - "sebastian/environment": "^1.3.4 || ^2.0 || ^3.0", - "sminnee/phpunit-mock-objects": "^3.4", + "ondram/ci-detector": "^2.1 || ^3.5", + "php-coveralls/php-coveralls": "^2.4", + "php-mock/php-mock-phpunit": "^1.1 || ^2.0", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpunit/phpunit": "^5.7 || ^7 || ^8 || ^9", "squizlabs/php_codesniffer": "^3.5", "symfony/var-dumper": "^3.3 || ^4.0 || ^5.0" }, @@ -7763,7 +8619,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8.x-dev" + "dev-main": "1.8.x-dev" } }, "autoload": { @@ -7787,29 +8643,33 @@ "selenium", "webdriver" ], - "time": "2020-03-04T14:40:12+00:00" + "support": { + "issues": "https://github.com/php-webdriver/php-webdriver/issues", + "source": "https://github.com/php-webdriver/php-webdriver/tree/1.9.0" + }, + "time": "2020-11-19T15:21:05+00:00" }, { "name": "phpdocumentor/reflection-common", - "version": "2.1.0", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b" + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/6568f4687e5b41b054365f9ae03fcb1ed5f2069b", - "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", "shasum": "" }, "require": { - "php": ">=7.1" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-2.x": "2.x-dev" } }, "autoload": { @@ -7836,32 +8696,35 @@ "reflection", "static analysis" ], - "time": "2020-04-27T09:25:28+00:00" + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, + "time": "2020-06-27T09:03:43+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.1.0", + "version": "5.2.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", "shasum": "" }, "require": { - "ext-filter": "^7.1", - "php": "^7.2", - "phpdocumentor/reflection-common": "^2.0", - "phpdocumentor/type-resolver": "^1.0", - "webmozart/assert": "^1" + "ext-filter": "*", + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.3", + "webmozart/assert": "^1.9.1" }, "require-dev": { - "doctrine/instantiator": "^1", - "mockery/mockery": "^1" + "mockery/mockery": "~1.3.2" }, "type": "library", "extra": { @@ -7889,29 +8752,32 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-02-22T12:28:44+00:00" + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" + }, + "time": "2020-09-03T19:13:55+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.2.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "30441f2752e493c639526b215ed81d54f369d693" + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/30441f2752e493c639526b215ed81d54f369d693", - "reference": "30441f2752e493c639526b215ed81d54f369d693", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", "shasum": "" }, "require": { - "php": "^7.2", + "php": "^7.2 || ^8.0", "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "^7.2", - "mockery/mockery": "~1" + "ext-tokenizer": "*" }, "type": "library", "extra": { @@ -7935,37 +8801,41 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2020-06-19T20:22:09+00:00" + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" + }, + "time": "2020-09-17T18:55:26+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.10.3", + "version": "1.12.2", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "451c3cd1418cf640de218914901e51b064abb093" + "reference": "245710e971a030f42e08f4912863805570f23d39" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", - "reference": "451c3cd1418cf640de218914901e51b064abb093", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/245710e971a030f42e08f4912863805570f23d39", + "reference": "245710e971a030f42e08f4912863805570f23d39", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", - "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" + "doctrine/instantiator": "^1.2", + "php": "^7.2 || ~8.0, <8.1", + "phpdocumentor/reflection-docblock": "^5.2", + "sebastian/comparator": "^3.0 || ^4.0", + "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^2.5 || ^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + "phpspec/phpspec": "^6.0", + "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.10.x-dev" + "dev-master": "1.11.x-dev" } }, "autoload": { @@ -7998,44 +8868,52 @@ "spy", "stub" ], - "time": "2020-03-05T15:02:03+00:00" + "support": { + "issues": "https://github.com/phpspec/prophecy/issues", + "source": "https://github.com/phpspec/prophecy/tree/1.12.2" + }, + "time": "2020-12-19T10:15:11+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "7.0.10", + "version": "9.2.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f1884187926fbb755a9aaf0b3836ad3165b478bf" + "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f1884187926fbb755a9aaf0b3836ad3165b478bf", - "reference": "f1884187926fbb755a9aaf0b3836ad3165b478bf", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f3e026641cc91909d421802dd3ac7827ebfd97e1", + "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-xmlwriter": "*", - "php": "^7.2", - "phpunit/php-file-iterator": "^2.0.2", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.1.1", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^4.2.2", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1.3" + "nikic/php-parser": "^4.10.2", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0.3", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "phpunit/phpunit": "^8.2.2" + "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-xdebug": "^2.7.2" + "ext-pcov": "*", + "ext-xdebug": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "7.0-dev" + "dev-master": "9.2-dev" } }, "autoload": { @@ -8061,32 +8939,42 @@ "testing", "xunit" ], - "time": "2019-11-20T13:55:58+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-28T06:44:49+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "2.0.2", + "version": "3.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "050bedf145a257b1ff02746c31894800e5122946" + "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", - "reference": "050bedf145a257b1ff02746c31894800e5122946", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/aa4be8575f26070b100fccb67faabb28f21f66f8", + "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.1" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -8111,26 +8999,107 @@ "filesystem", "iterator" ], - "time": "2018-09-13T20:33:42+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:57:25+00:00" }, { - "name": "phpunit/php-text-template", - "version": "1.2.1", + "name": "phpunit/php-invoker", + "version": "3.1.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:58:55+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -8152,32 +9121,42 @@ "keywords": [ "template" ], - "time": "2015-06-21T13:50:34+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T05:33:50+00:00" }, { "name": "phpunit/php-timer", - "version": "2.1.2", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -8201,105 +9180,69 @@ "keywords": [ "timer" ], - "time": "2019-06-07T04:22:29+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ + "funding": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "url": "https://github.com/sebastianbergmann", + "type": "github" } ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2019-09-17T06:23:10+00:00" + "time": "2020-10-26T13:16:10+00:00" }, { "name": "phpunit/phpunit", - "version": "8.5.8", + "version": "9.5.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "34c18baa6a44f1d1fbf0338907139e9dce95b997" + "reference": "e7bdf4085de85a825f4424eae52c99a1cec2f360" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/34c18baa6a44f1d1fbf0338907139e9dce95b997", - "reference": "34c18baa6a44f1d1fbf0338907139e9dce95b997", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e7bdf4085de85a825f4424eae52c99a1cec2f360", + "reference": "e7bdf4085de85a825f4424eae52c99a1cec2f360", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.2.0", + "doctrine/instantiator": "^1.3.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.9.1", - "phar-io/manifest": "^1.0.3", - "phar-io/version": "^2.0.1", - "php": "^7.2", - "phpspec/prophecy": "^1.8.1", - "phpunit/php-code-coverage": "^7.0.7", - "phpunit/php-file-iterator": "^2.0.2", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1.2", - "sebastian/comparator": "^3.0.2", - "sebastian/diff": "^3.0.2", - "sebastian/environment": "^4.2.2", - "sebastian/exporter": "^3.1.1", - "sebastian/global-state": "^3.0.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0.1", - "sebastian/type": "^1.1.3", - "sebastian/version": "^2.0.1" + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.1", + "phar-io/version": "^3.0.2", + "php": ">=7.3", + "phpspec/prophecy": "^1.12.1", + "phpunit/php-code-coverage": "^9.2.3", + "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.3", + "phpunit/php-timer": "^5.0.2", + "sebastian/cli-parser": "^1.0.1", + "sebastian/code-unit": "^1.0.6", + "sebastian/comparator": "^4.0.5", + "sebastian/diff": "^4.0.3", + "sebastian/environment": "^5.1.3", + "sebastian/exporter": "^4.0.3", + "sebastian/global-state": "^5.0.1", + "sebastian/object-enumerator": "^4.0.3", + "sebastian/resource-operations": "^3.0.3", + "sebastian/type": "^2.3", + "sebastian/version": "^3.0.2" }, "require-dev": { - "ext-pdo": "*" + "ext-pdo": "*", + "phpspec/prophecy-phpunit": "^2.0.1" }, "suggest": { "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0.0" + "ext-xdebug": "*" }, "bin": [ "phpunit" @@ -8307,12 +9250,15 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "8.5-dev" + "dev-master": "9.5-dev" } }, "autoload": { "classmap": [ "src/" + ], + "files": [ + "src/Framework/Assert/Functions.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -8333,6 +9279,10 @@ "testing", "xunit" ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.1" + }, "funding": [ { "url": "https://phpunit.de/donate.html", @@ -8343,32 +9293,194 @@ "type": "github" } ], - "time": "2020-06-22T07:06:58+00:00" + "time": "2021-01-17T07:42:25+00:00" }, { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", + "name": "react/promise", + "version": "v2.8.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + "url": "https://github.com/reactphp/promise.git", + "reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "url": "https://api.github.com/repos/reactphp/promise/zipball/f3cff96a19736714524ca0dd1d4130de73dbbbc4", + "reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" + "phpunit/phpunit": "^7.0 || ^6.5 || ^5.7 || ^4.8.36" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "support": { + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v2.8.0" + }, + "time": "2020-05-12T15:16:56+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:08:49+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:08:54+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" } }, "autoload": { @@ -8388,34 +9500,44 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:30:19+00:00" }, { "name": "sebastian/comparator", - "version": "3.0.2", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" + "reference": "55f4261989e546dc112258c7a75935a81a7ce382" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", + "reference": "55f4261989e546dc112258c7a75935a81a7ce382", "shasum": "" }, "require": { - "php": "^7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^7.1" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -8428,6 +9550,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -8439,10 +9565,6 @@ { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", @@ -8452,33 +9574,43 @@ "compare", "equality" ], - "time": "2018-07-12T15:12:46+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:49:45+00:00" }, { - "name": "sebastian/diff", - "version": "3.0.2", + "name": "sebastian/complexity", + "version": "2.0.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", "shasum": "" }, "require": { - "php": "^7.1" + "nikic/php-parser": "^4.7", + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.0", - "symfony/process": "^2 || ^3.3 || ^4" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -8492,12 +9624,69 @@ ], "authors": [ { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:52:27+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" } ], "description": "Diff implementation", @@ -8508,27 +9697,37 @@ "unidiff", "unified diff" ], - "time": "2019-02-04T06:01:07+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:10:38+00:00" }, { "name": "sebastian/environment", - "version": "4.2.3", + "version": "5.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" + "reference": "388b6ced16caa751030f6a69e588299fa09200ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", + "reference": "388b6ced16caa751030f6a69e588299fa09200ac", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.5" + "phpunit/phpunit": "^9.3" }, "suggest": { "ext-posix": "*" @@ -8536,7 +9735,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -8561,34 +9760,44 @@ "environment", "hhvm" ], - "time": "2019-11-20T08:46:58+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:52:38+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.2", + "version": "4.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" + "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/recursion-context": "^3.0" + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -8628,30 +9837,40 @@ "export", "exporter" ], - "time": "2019-09-14T09:02:43+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:24:23+00:00" }, { "name": "sebastian/global-state", - "version": "3.0.0", + "version": "5.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4" + "reference": "a90ccbddffa067b51f574dea6eb25d5680839455" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", - "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/a90ccbddffa067b51f574dea6eb25d5680839455", + "reference": "a90ccbddffa067b51f574dea6eb25d5680839455", "shasum": "" }, "require": { - "php": "^7.2", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^8.0" + "phpunit/phpunit": "^9.3" }, "suggest": { "ext-uopz": "*" @@ -8659,7 +9878,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -8682,34 +9901,101 @@ "keywords": [ "global state" ], - "time": "2019-02-01T05:30:01+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:55:19+00:00" }, { - "name": "sebastian/object-enumerator", - "version": "3.0.3", + "name": "sebastian/lines-of-code", + "version": "1.0.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" + "nikic/php-parser": "^4.6", + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-28T06:42:11+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" } }, "autoload": { @@ -8729,122 +10015,37 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:12:34+00:00" }, { "name": "sebastian/object-reflector", - "version": "1.1.1", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "shasum": "" - }, - "require": { - "php": "^7.1" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { @@ -8867,34 +10068,162 @@ "email": "sebastian@phpunit.de" } ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2018-10-04T04:07:39+00:00" + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:14:26+00:00" }, { - "name": "sebastian/type", - "version": "1.1.3", + "name": "sebastian/recursion-context", + "version": "4.0.4", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/type.git", - "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3" + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/3aaaa15fa71d27650d62a948be022fe3b48541a3", - "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", "shasum": "" }, "require": { - "php": "^7.2" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^8.2" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:17:30+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:45:17+00:00" + }, + { + "name": "sebastian/type", + "version": "2.3.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/81cd61ab7bbf2de744aba0ea61fae32f721df3d2", + "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" } }, "autoload": { @@ -8915,29 +10244,39 @@ ], "description": "Collection of value objects that represent the types of the PHP type system", "homepage": "https://github.com/sebastianbergmann/type", - "time": "2019-07-02T08:10:15+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/2.3.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:18:59+00:00" }, { "name": "sebastian/version", - "version": "2.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + "reference": "c6c1022351a901512170118436c764e473f6de8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", "shasum": "" }, "require": { - "php": ">=5.6" + "php": ">=7.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -8958,20 +10297,30 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:39:44+00:00" }, { "name": "seld/jsonlint", - "version": "1.8.0", + "version": "1.8.3", "source": { "type": "git", "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "ff2aa5420bfbc296cf6a0bc785fa5b35736de7c1" + "reference": "9ad6ce79c342fbd44df10ea95511a1b24dee5b57" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/ff2aa5420bfbc296cf6a0bc785fa5b35736de7c1", - "reference": "ff2aa5420bfbc296cf6a0bc785fa5b35736de7c1", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/9ad6ce79c342fbd44df10ea95511a1b24dee5b57", + "reference": "9ad6ce79c342fbd44df10ea95511a1b24dee5b57", "shasum": "" }, "require": { @@ -9007,6 +10356,10 @@ "parser", "validator" ], + "support": { + "issues": "https://github.com/Seldaek/jsonlint/issues", + "source": "https://github.com/Seldaek/jsonlint/tree/1.8.3" + }, "funding": [ { "url": "https://github.com/Seldaek", @@ -9017,20 +10370,20 @@ "type": "tidelift" } ], - "time": "2020-04-30T19:05:18+00:00" + "time": "2020-11-11T09:19:24+00:00" }, { "name": "seld/phar-utils", - "version": "1.1.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/Seldaek/phar-utils.git", - "reference": "8800503d56b9867d43d9c303b9cbcc26016e82f0" + "reference": "8674b1d84ffb47cc59a101f5d5a3b61e87d23796" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/8800503d56b9867d43d9c303b9cbcc26016e82f0", - "reference": "8800503d56b9867d43d9c303b9cbcc26016e82f0", + "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/8674b1d84ffb47cc59a101f5d5a3b61e87d23796", + "reference": "8674b1d84ffb47cc59a101f5d5a3b61e87d23796", "shasum": "" }, "require": { @@ -9061,20 +10414,24 @@ "keywords": [ "phar" ], - "time": "2020-02-14T15:25:33+00:00" + "support": { + "issues": "https://github.com/Seldaek/phar-utils/issues", + "source": "https://github.com/Seldaek/phar-utils/tree/master" + }, + "time": "2020-07-07T18:42:57+00:00" }, { "name": "symfony/debug", - "version": "v4.4.10", + "version": "v4.4.18", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "28f92d08bb6d1fddf8158e02c194ad43870007e6" + "reference": "5dfc7825f3bfe9bb74b23d8b8ce0e0894e32b544" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/28f92d08bb6d1fddf8158e02c194ad43870007e6", - "reference": "28f92d08bb6d1fddf8158e02c194ad43870007e6", + "url": "https://api.github.com/repos/symfony/debug/zipball/5dfc7825f3bfe9bb74b23d8b8ce0e0894e32b544", + "reference": "5dfc7825f3bfe9bb74b23d8b8ce0e0894e32b544", "shasum": "" }, "require": { @@ -9089,11 +10446,6 @@ "symfony/http-kernel": "^3.4|^4.0|^5.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Debug\\": "" @@ -9118,6 +10470,9 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/debug/tree/v4.4.18" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -9132,20 +10487,20 @@ "type": "tidelift" } ], - "time": "2020-05-24T08:33:35+00:00" + "time": "2020-12-10T16:34:26+00:00" }, { "name": "symfony/filesystem", - "version": "v5.1.2", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "6e4320f06d5f2cce0d96530162491f4465179157" + "reference": "fa8f8cab6b65e2d99a118e082935344c5ba8c60d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/6e4320f06d5f2cce0d96530162491f4465179157", - "reference": "6e4320f06d5f2cce0d96530162491f4465179157", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/fa8f8cab6b65e2d99a118e082935344c5ba8c60d", + "reference": "fa8f8cab6b65e2d99a118e082935344c5ba8c60d", "shasum": "" }, "require": { @@ -9153,11 +10508,6 @@ "symfony/polyfill-ctype": "~1.8" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Filesystem\\": "" @@ -9182,6 +10532,9 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/filesystem/tree/v5.2.1" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -9196,33 +10549,29 @@ "type": "tidelift" } ], - "time": "2020-05-30T20:35:19+00:00" + "time": "2020-11-30T17:05:38+00:00" }, { "name": "symfony/options-resolver", - "version": "v5.1.2", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "663f5dd5e14057d1954fe721f9709d35837f2447" + "reference": "87a2a4a766244e796dd9cb9d6f58c123358cd986" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/663f5dd5e14057d1954fe721f9709d35837f2447", - "reference": "663f5dd5e14057d1954fe721f9709d35837f2447", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/87a2a4a766244e796dd9cb9d6f58c123358cd986", + "reference": "87a2a4a766244e796dd9cb9d6f58c123358cd986", "shasum": "" }, "require": { "php": ">=7.2.5", "symfony/deprecation-contracts": "^2.1", + "symfony/polyfill-php73": "~1.0", "symfony/polyfill-php80": "^1.15" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\OptionsResolver\\": "" @@ -9252,6 +10601,9 @@ "configuration", "options" ], + "support": { + "source": "https://github.com/symfony/options-resolver/tree/v5.2.1" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -9266,47 +10618,35 @@ "type": "tidelift" } ], - "time": "2020-05-23T13:08:13+00:00" + "time": "2020-10-24T12:08:07+00:00" }, { "name": "symfony/polyfill-php70", - "version": "v1.17.1", + "version": "v1.20.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "471b096aede7025bace8eb356b9ac801aaba7e2d" + "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/471b096aede7025bace8eb356b9ac801aaba7e2d", - "reference": "471b096aede7025bace8eb356b9ac801aaba7e2d", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/5f03a781d984aae42cebd18e7912fa80f02ee644", + "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644", "shasum": "" }, "require": { - "paragonie/random_compat": "~1.0|~2.0|~9.99", - "php": ">=5.3.3" + "php": ">=7.1" }, - "type": "library", + "type": "metapackage", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.20-dev" }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" } }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php70\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" @@ -9329,6 +10669,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-php70/tree/v1.20.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -9343,20 +10686,20 @@ "type": "tidelift" } ], - "time": "2020-06-06T08:46:27+00:00" + "time": "2020-10-23T14:02:19+00:00" }, { "name": "symfony/stopwatch", - "version": "v5.1.2", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "0f7c58cf81dbb5dd67d423a89d577524a2ec0323" + "reference": "2b105c0354f39a63038a1d8bf776ee92852813af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/0f7c58cf81dbb5dd67d423a89d577524a2ec0323", - "reference": "0f7c58cf81dbb5dd67d423a89d577524a2ec0323", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/2b105c0354f39a63038a1d8bf776ee92852813af", + "reference": "2b105c0354f39a63038a1d8bf776ee92852813af", "shasum": "" }, "require": { @@ -9364,11 +10707,6 @@ "symfony/service-contracts": "^1.0|^2" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Stopwatch\\": "" @@ -9393,6 +10731,9 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/stopwatch/tree/v5.2.1" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -9407,27 +10748,27 @@ "type": "tidelift" } ], - "time": "2020-05-20T17:43:50+00:00" + "time": "2020-11-01T16:14:45+00:00" }, { "name": "theseer/tokenizer", - "version": "1.1.3", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" + "reference": "75a63c33a8577608444246075ea0af0d052e452a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", - "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", + "reference": "75a63c33a8577608444246075ea0af0d052e452a", "shasum": "" }, "require": { "ext-dom": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "php": "^7.0" + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { @@ -9442,12 +10783,22 @@ "authors": [ { "name": "Arne Blankerts", - "role": "Developer", - "email": "arne@blankerts.de" + "email": "arne@blankerts.de", + "role": "Developer" } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2019-06-13T22:48:21+00:00" + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/master" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2020-07-12T23:59:07+00:00" } ], "aliases": [], @@ -9456,11 +10807,12 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "^7.2", + "php": "^7.4 || ^8.0", + "ext-json": "*", "ext-mbstring": "*", "ext-pdo_mysql": "*", "ext-zip": "*" }, "platform-dev": [], - "plugin-api-version": "1.1.0" + "plugin-api-version": "2.0.0" } diff --git a/config/database.php b/config/database.php index e69e19ed0..d404a37fe 100644 --- a/config/database.php +++ b/config/database.php @@ -45,7 +45,7 @@ return [ 'collation' => 'utf8mb4_unicode_ci', 'prefix' => env('DB_PREFIX', ''), 'strict' => env('DB_STRICT_MODE', false), - 'timezone' => env('DB_TIMEZONE', Time::getMySQLTimezoneOffset(env('APP_TIMEZONE', 'UTC'))) + 'timezone' => env('DB_TIMEZONE', Time::getMySQLTimezoneOffset(env('APP_TIMEZONE', 'UTC'))), ], /* @@ -68,7 +68,7 @@ return [ 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'strict' => false, - 'timezone' => env('DB_TIMEZONE', Time::getMySQLTimezoneOffset(env('APP_TIMEZONE', 'UTC'))) + 'timezone' => env('DB_TIMEZONE', Time::getMySQLTimezoneOffset(env('APP_TIMEZONE', 'UTC'))), ], ], diff --git a/config/pterodactyl.php b/config/pterodactyl.php index 404f7aa34..db08688d3 100644 --- a/config/pterodactyl.php +++ b/config/pterodactyl.php @@ -10,7 +10,7 @@ return [ | setup on the panel. When set to true, configurations stored in the | database will not be applied. */ - 'load_environment_only' => (bool)env('APP_ENVIRONMENT_ONLY', false), + 'load_environment_only' => (bool) env('APP_ENVIRONMENT_ONLY', false), /* |-------------------------------------------------------------------------- diff --git a/database/Factories/AllocationFactory.php b/database/Factories/AllocationFactory.php new file mode 100644 index 000000000..e7a5f7e67 --- /dev/null +++ b/database/Factories/AllocationFactory.php @@ -0,0 +1,27 @@ + $this->faker->ipv4, + 'port' => $this->faker->randomNumber(5), + ]; + } +} diff --git a/database/Factories/ApiKeyFactory.php b/database/Factories/ApiKeyFactory.php new file mode 100644 index 000000000..9da4bbf75 --- /dev/null +++ b/database/Factories/ApiKeyFactory.php @@ -0,0 +1,36 @@ + ApiKey::TYPE_APPLICATION, + 'identifier' => Str::random(\Pterodactyl\Models\ApiKey::IDENTIFIER_LENGTH), + 'token' => $token ?: $token = encrypt(Str::random(\Pterodactyl\Models\ApiKey::KEY_LENGTH)), + 'allowed_ips' => null, + 'memo' => 'Test Function Key', + 'created_at' => Carbon::now(), + 'updated_at' => Carbon::now(), + ]; + } +} diff --git a/database/Factories/BackupFactory.php b/database/Factories/BackupFactory.php new file mode 100644 index 000000000..de9a1d923 --- /dev/null +++ b/database/Factories/BackupFactory.php @@ -0,0 +1,30 @@ + Uuid::uuid4()->toString(), + 'is_successful' => true, + 'name' => $this->faker->sentence, + 'disk' => Backup::ADAPTER_WINGS, + ]; + } +} diff --git a/database/Factories/DatabaseFactory.php b/database/Factories/DatabaseFactory.php new file mode 100644 index 000000000..d3c6f2a57 --- /dev/null +++ b/database/Factories/DatabaseFactory.php @@ -0,0 +1,35 @@ + Str::random(10), + 'username' => Str::random(10), + 'remote' => '%', + 'password' => $password ?: encrypt('test123'), + 'created_at' => Carbon::now(), + 'updated_at' => Carbon::now(), + ]; + } +} diff --git a/database/Factories/DatabaseHostFactory.php b/database/Factories/DatabaseHostFactory.php new file mode 100644 index 000000000..b65e856ea --- /dev/null +++ b/database/Factories/DatabaseHostFactory.php @@ -0,0 +1,31 @@ + $this->faker->colorName, + 'host' => $this->faker->unique()->ipv4, + 'port' => 3306, + 'username' => $this->faker->colorName, + 'password' => Crypt::encrypt($this->faker->word), + ]; + } +} diff --git a/database/Factories/EggFactory.php b/database/Factories/EggFactory.php new file mode 100644 index 000000000..4085b70e5 --- /dev/null +++ b/database/Factories/EggFactory.php @@ -0,0 +1,30 @@ + Uuid::uuid4()->toString(), + 'name' => $this->faker->name, + 'description' => implode(' ', $this->faker->sentences()), + 'startup' => 'java -jar test.jar', + ]; + } +} diff --git a/database/Factories/EggVariableFactory.php b/database/Factories/EggVariableFactory.php new file mode 100644 index 000000000..d288b4ee9 --- /dev/null +++ b/database/Factories/EggVariableFactory.php @@ -0,0 +1,57 @@ + $this->faker->firstName, + 'description' => $this->faker->sentence(), + 'env_variable' => Str::upper(Str::replaceArray(' ', ['_'], $this->faker->words(2, true))), + 'default_value' => $this->faker->colorName, + 'user_viewable' => 0, + 'user_editable' => 0, + 'rules' => 'required|string', + ]; + } + + /** + * Indicate that the egg variable is viewable. + */ + public function viewable(): Factory + { + return $this->state(function (array $attributes) { + return [ + 'user_viewable' => 1, + ]; + }); + } + + /** + * Indicate that the egg variable is editable. + */ + public function editable(): Factory + { + return $this->state(function (array $attributes) { + return [ + 'user_editable' => 1, + ]; + }); + } +} diff --git a/database/Factories/LocationFactory.php b/database/Factories/LocationFactory.php new file mode 100644 index 000000000..9e0af5dca --- /dev/null +++ b/database/Factories/LocationFactory.php @@ -0,0 +1,28 @@ + Str::random(8), + 'long' => Str::random(32), + ]; + } +} diff --git a/database/Factories/NestFactory.php b/database/Factories/NestFactory.php new file mode 100644 index 000000000..9a5755ba1 --- /dev/null +++ b/database/Factories/NestFactory.php @@ -0,0 +1,30 @@ + Uuid::uuid4()->toString(), + 'author' => 'testauthor@example.com', + 'name' => $this->faker->word, + 'description' => null, + ]; + } +} diff --git a/database/Factories/NodeFactory.php b/database/Factories/NodeFactory.php new file mode 100644 index 000000000..683d8a482 --- /dev/null +++ b/database/Factories/NodeFactory.php @@ -0,0 +1,44 @@ + Uuid::uuid4()->toString(), + 'public' => true, + 'name' => $this->faker->firstName, + 'fqdn' => $this->faker->ipv4, + 'scheme' => 'http', + 'behind_proxy' => false, + 'memory' => 1024, + 'memory_overallocate' => 0, + 'disk' => 10240, + 'disk_overallocate' => 0, + 'upload_size' => 100, + 'daemon_token_id' => Str::random(Node::DAEMON_TOKEN_ID_LENGTH), + 'daemon_token' => Crypt::encrypt(Str::random(Node::DAEMON_TOKEN_LENGTH)), + 'daemonListen' => 8080, + 'daemonSFTP' => 2022, + 'daemonBase' => '/var/lib/pterodactyl/volumes', + ]; + } +} diff --git a/database/Factories/ScheduleFactory.php b/database/Factories/ScheduleFactory.php new file mode 100644 index 000000000..0a28f4c41 --- /dev/null +++ b/database/Factories/ScheduleFactory.php @@ -0,0 +1,26 @@ + $this->faker->firstName(), + ]; + } +} diff --git a/database/Factories/ServerFactory.php b/database/Factories/ServerFactory.php new file mode 100644 index 000000000..c56b66863 --- /dev/null +++ b/database/Factories/ServerFactory.php @@ -0,0 +1,48 @@ + Uuid::uuid4()->toString(), + 'uuidShort' => Str::lower(Str::random(8)), + 'name' => $this->faker->firstName, + 'description' => implode(' ', $this->faker->sentences()), + 'skip_scripts' => 0, + 'suspended' => 0, + 'memory' => 512, + 'swap' => 0, + 'disk' => 512, + 'io' => 500, + 'cpu' => 0, + 'threads' => null, + 'oom_disabled' => 0, + 'installed' => 1, + 'allocation_limit' => null, + 'database_limit' => null, + 'created_at' => Carbon::now(), + 'updated_at' => Carbon::now(), + ]; + } +} diff --git a/database/Factories/SubuserFactory.php b/database/Factories/SubuserFactory.php new file mode 100644 index 000000000..7db93d4d1 --- /dev/null +++ b/database/Factories/SubuserFactory.php @@ -0,0 +1,29 @@ + [ + Permission::ACTION_WEBSOCKET_CONNECT, + ], + ]; + } +} diff --git a/database/Factories/TaskFactory.php b/database/Factories/TaskFactory.php new file mode 100644 index 000000000..f04ebbe8b --- /dev/null +++ b/database/Factories/TaskFactory.php @@ -0,0 +1,30 @@ + $this->faker->randomNumber(1), + 'action' => 'command', + 'payload' => 'test command', + 'time_offset' => 120, + 'is_queued' => false, + ]; + } +} diff --git a/database/Factories/UserFactory.php b/database/Factories/UserFactory.php new file mode 100644 index 000000000..b9e6062f3 --- /dev/null +++ b/database/Factories/UserFactory.php @@ -0,0 +1,53 @@ + $this->faker->unique()->isbn10, + 'uuid' => Uuid::uuid4()->toString(), + 'username' => $this->faker->userName, + 'email' => $this->faker->safeEmail, + 'name_first' => $this->faker->firstName, + 'name_last' => $this->faker->lastName, + 'password' => $password ?: $password = bcrypt('password'), + 'language' => 'en', + 'root_admin' => false, + 'use_totp' => false, + 'created_at' => Carbon::now(), + 'updated_at' => Carbon::now(), + ]; + } + + /** + * Indicate that the user is an admin. + */ + public function admin(): Factory + { + return $this->state(function (array $attributes) { + return [ + 'root_admin' => true, + ]; + }); + } +} diff --git a/database/seeds/.gitkeep b/database/Seeders/.gitkeep similarity index 100% rename from database/seeds/.gitkeep rename to database/Seeders/.gitkeep diff --git a/database/seeds/DatabaseSeeder.php b/database/Seeders/DatabaseSeeder.php similarity index 89% rename from database/seeds/DatabaseSeeder.php rename to database/Seeders/DatabaseSeeder.php index fa426deae..ae534fe6a 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/Seeders/DatabaseSeeder.php @@ -1,5 +1,7 @@ filesystem->allFiles(database_path('seeds/eggs/' . kebab_case($nest->name))); + $files = $this->filesystem->allFiles(database_path('Seeders/eggs/' . kebab_case($nest->name))); $this->command->alert('Updating Eggs for Nest: ' . $nest->name); Collection::make($files)->each(function ($file) use ($nest) { diff --git a/database/seeds/NestSeeder.php b/database/Seeders/NestSeeder.php similarity index 90% rename from database/seeds/NestSeeder.php rename to database/Seeders/NestSeeder.php index fdd775645..eae7ae21b 100644 --- a/database/seeds/NestSeeder.php +++ b/database/Seeders/NestSeeder.php @@ -1,5 +1,7 @@ define(Pterodactyl\Models\Server::class, function (Faker $faker) { - return [ - 'uuid' => Uuid::uuid4()->toString(), - 'uuidShort' => str_random(8), - 'name' => $faker->firstName, - 'description' => implode(' ', $faker->sentences()), - 'skip_scripts' => 0, - 'status' => null, - 'memory' => 512, - 'swap' => 0, - 'disk' => 512, - 'io' => 500, - 'cpu' => 0, - 'oom_disabled' => 0, - 'database_limit' => null, - 'allocation_limit' => null, - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), - ]; -}); - -$factory->define(Pterodactyl\Models\User::class, function (Faker $faker) { - static $password; - - return [ - 'external_id' => $faker->unique()->isbn10, - 'uuid' => $faker->uuid, - 'username' => $faker->userName, - 'email' => $faker->safeEmail, - 'name_first' => $faker->firstName, - 'name_last' => $faker->lastName, - 'password' => $password ?: $password = bcrypt('password'), - 'language' => 'en', - 'root_admin' => false, - 'use_totp' => false, - 'created_at' => Chronos::now(), - 'updated_at' => Chronos::now(), - ]; -}); - -$factory->state(Pterodactyl\Models\User::class, 'admin', function () { - return [ - 'root_admin' => true, - ]; -}); - -$factory->define(Pterodactyl\Models\Location::class, function (Faker $faker) { - return [ - 'short' => Str::random(8), - 'long' => $faker->catchPhrase, - ]; -}); - -$factory->define(Pterodactyl\Models\Node::class, function (Faker $faker) { - return [ - 'uuid' => Uuid::uuid4()->toString(), - 'public' => true, - 'name' => $faker->firstName, - 'fqdn' => $faker->ipv4, - 'scheme' => 'http', - 'behind_proxy' => false, - 'memory' => 1024, - 'memory_overallocate' => 0, - 'disk' => 10240, - 'disk_overallocate' => 0, - 'upload_size' => 100, - 'daemon_token_id' => Str::random(Node::DAEMON_TOKEN_ID_LENGTH), - 'daemon_token' => encrypt(Str::random(Node::DAEMON_TOKEN_LENGTH)), - 'daemonListen' => 8080, - 'daemonSFTP' => 2022, - 'daemonBase' => '/var/lib/pterodactyl/volumes', - ]; -}); - -$factory->define(Pterodactyl\Models\Nest::class, function (Faker $faker) { - return [ - 'uuid' => $faker->unique()->uuid, - 'author' => 'testauthor@example.com', - 'name' => $faker->word, - 'description' => null, - ]; -}); - -$factory->define(Pterodactyl\Models\Egg::class, function (Faker $faker) { - return [ - 'uuid' => $faker->unique()->uuid, - 'name' => $faker->name, - 'description' => implode(' ', $faker->sentences(3)), - 'startup' => 'java -jar test.jar', - ]; -}); - -$factory->define(Pterodactyl\Models\EggVariable::class, function (Faker $faker) { - return [ - 'name' => $faker->firstName, - 'description' => $faker->sentence(), - 'env_variable' => strtoupper(str_replace(' ', '_', $faker->words(2, true))), - 'default_value' => $faker->colorName, - 'user_viewable' => 0, - 'user_editable' => 0, - 'rules' => 'required|string', - ]; -}); - -$factory->state(Pterodactyl\Models\EggVariable::class, 'viewable', function () { - return ['user_viewable' => 1]; -}); - -$factory->state(Pterodactyl\Models\EggVariable::class, 'editable', function () { - return ['user_editable' => 1]; -}); - -$factory->define(Pterodactyl\Models\Subuser::class, function (Faker $faker) { - return []; -}); - -$factory->define(Pterodactyl\Models\Allocation::class, function (Faker $faker) { - return [ - 'ip' => $faker->ipv4, - 'port' => $faker->randomNumber(5), - ]; -}); - -$factory->define(Pterodactyl\Models\DatabaseHost::class, function (Faker $faker) { - return [ - 'name' => $faker->colorName, - 'host' => $faker->unique()->ipv4, - 'port' => 3306, - 'username' => $faker->colorName, - 'password' => Crypt::encrypt($faker->word), - ]; -}); - -$factory->define(Pterodactyl\Models\Database::class, function (Faker $faker) { - static $password; - - return [ - 'database' => str_random(10), - 'username' => str_random(10), - 'remote' => '%', - 'password' => $password ?: bcrypt('test123'), - 'created_at' => Carbon::now()->toDateTimeString(), - 'updated_at' => Carbon::now()->toDateTimeString(), - ]; -}); - -$factory->define(Pterodactyl\Models\Schedule::class, function (Faker $faker) { - return [ - 'name' => $faker->firstName(), - ]; -}); - -$factory->define(Pterodactyl\Models\Task::class, function (Faker $faker) { - return [ - 'sequence_id' => $faker->randomNumber(1), - 'action' => 'command', - 'payload' => 'test command', - 'time_offset' => 120, - 'is_queued' => false, - ]; -}); - -$factory->define(Pterodactyl\Models\ApiKey::class, function (Faker $faker) { - static $token; - - return [ - 'key_type' => ApiKey::TYPE_APPLICATION, - 'identifier' => str_random(Pterodactyl\Models\ApiKey::IDENTIFIER_LENGTH), - 'token' => $token ?: $token = encrypt(str_random(Pterodactyl\Models\ApiKey::KEY_LENGTH)), - 'allowed_ips' => null, - 'memo' => 'Test Function Key', - 'created_at' => Carbon::now()->toDateTimeString(), - 'updated_at' => Carbon::now()->toDateTimeString(), - ]; -}); diff --git a/database/migrations/2016_11_04_000949_add_ark_service_option_fixed.php b/database/migrations/2016_11_04_000949_add_ark_service_option_fixed.php index 4383c11cd..1547e32cc 100644 --- a/database/migrations/2016_11_04_000949_add_ark_service_option_fixed.php +++ b/database/migrations/2016_11_04_000949_add_ark_service_option_fixed.php @@ -13,7 +13,7 @@ class AddArkServiceOptionFixed extends Migration $service = DB::table('services')->select('id')->where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('name', 'Source Engine')->first(); // No SRCDS Service, Skipping - if (! $service) { + if (!$service) { return; } diff --git a/database/migrations/2017_03_05_212803_DeleteServiceExecutableOption.php b/database/migrations/2017_03_05_212803_DeleteServiceExecutableOption.php index 2918e1afd..6792f265a 100644 --- a/database/migrations/2017_03_05_212803_DeleteServiceExecutableOption.php +++ b/database/migrations/2017_03_05_212803_DeleteServiceExecutableOption.php @@ -11,13 +11,11 @@ class DeleteServiceExecutableOption extends Migration */ public function up() { - DB::transaction(function () { - Schema::table('services', function (Blueprint $table) { - $table->renameColumn('file', 'folder'); - $table->dropColumn('executable'); - $table->text('description')->nullable()->change(); - $table->text('startup')->nullable()->change(); - }); + Schema::table('services', function (Blueprint $table) { + $table->renameColumn('file', 'folder'); + $table->dropColumn('executable'); + $table->text('description')->nullable()->change(); + $table->text('startup')->nullable()->change(); }); } diff --git a/database/migrations/2017_03_10_173607_MigrateToNewServiceSystem.php b/database/migrations/2017_03_10_173607_MigrateToNewServiceSystem.php index 039976352..c786ab468 100644 --- a/database/migrations/2017_03_10_173607_MigrateToNewServiceSystem.php +++ b/database/migrations/2017_03_10_173607_MigrateToNewServiceSystem.php @@ -17,12 +17,12 @@ class MigrateToNewServiceSystem extends Migration { DB::transaction(function () { $service = DB::table('services')->where('author', config('pterodactyl.service.core'))->where('folder', 'srcds')->first(); - if (! $service) { + if (!$service) { return; } $options = DB::table('service_options')->where('service_id', $service->id)->get(); - $options->each(function ($item) use ($options) { + $options->each(function ($item) { if ($item->tag === 'srcds' && $item->name === 'Insurgency') { $item->tag = 'insurgency'; } elseif ($item->tag === 'srcds' && $item->name === 'Team Fortress 2') { diff --git a/database/migrations/2017_09_13_211810_UpdateOldPermissionsToPointToNewScheduleSystem.php b/database/migrations/2017_09_13_211810_UpdateOldPermissionsToPointToNewScheduleSystem.php index b7c361f13..ba3a8bac0 100644 --- a/database/migrations/2017_09_13_211810_UpdateOldPermissionsToPointToNewScheduleSystem.php +++ b/database/migrations/2017_09_13_211810_UpdateOldPermissionsToPointToNewScheduleSystem.php @@ -13,7 +13,7 @@ class UpdateOldPermissionsToPointToNewScheduleSystem extends Migration $permissions = DB::table('permissions')->where('permission', 'like', '%-task%')->get(); foreach ($permissions as $record) { $parts = explode('-', $record->permission); - if (! in_array(array_get($parts, 1), ['tasks', 'task']) || count($parts) !== 2) { + if (!in_array(array_get($parts, 1), ['tasks', 'task']) || count($parts) !== 2) { continue; } @@ -31,7 +31,7 @@ class UpdateOldPermissionsToPointToNewScheduleSystem extends Migration $permissions = DB::table('permissions')->where('permission', 'like', '%-schedule%')->get(); foreach ($permissions as $record) { $parts = explode('-', $record->permission); - if (! in_array(array_get($parts, 1), ['schedules', 'schedule']) || count($parts) !== 2) { + if (!in_array(array_get($parts, 1), ['schedules', 'schedule']) || count($parts) !== 2) { continue; } diff --git a/database/migrations/2018_01_13_142012_SetupTableForKeyEncryption.php b/database/migrations/2018_01_13_142012_SetupTableForKeyEncryption.php index 5dba9c113..1d36b3648 100644 --- a/database/migrations/2018_01_13_142012_SetupTableForKeyEncryption.php +++ b/database/migrations/2018_01_13_142012_SetupTableForKeyEncryption.php @@ -10,6 +10,7 @@ class SetupTableForKeyEncryption extends Migration * Run the migrations. * * @return void + * * @throws \Exception * @throws \Throwable */ @@ -29,6 +30,7 @@ class SetupTableForKeyEncryption extends Migration * Reverse the migrations. * * @return void + * * @throws \Exception * @throws \Throwable */ diff --git a/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php b/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php index b40f4f55d..27d26674f 100644 --- a/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php +++ b/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php @@ -1,7 +1,7 @@ map(function ($value) { return self::$permissionsMap[$value] ?? null; })->filter(function ($value) { - return ! is_null($value) && $value !== Permission::ACTION_WEBSOCKET_CONNECT; + return !is_null($value) && $value !== Permission::ACTION_WEBSOCKET_CONNECT; }) // All subusers get this permission, so make sure it gets pushed into the array. ->merge([Permission::ACTION_WEBSOCKET_CONNECT]) @@ -109,13 +109,13 @@ class MergePermissionsTableIntoSubusers extends Migration $values = []; foreach (json_decode($datum->permissions, true) as $permission) { $v = $flipped[$permission] ?? null; - if (! empty($v)) { + if (!empty($v)) { $values[] = $datum->id; $values[] = $v; } } - if (! empty($values)) { + if (!empty($values)) { $string = 'VALUES ' . implode(', ', array_fill(0, count($values) / 2, '(?, ?)')); DB::insert('INSERT INTO permissions(`subuser_id`, `permission`) ' . $string, $values); diff --git a/database/migrations/2020_04_03_230614_create_backups_table.php b/database/migrations/2020_04_03_230614_create_backups_table.php index 68eeee2ce..daa35dd3b 100644 --- a/database/migrations/2020_04_03_230614_create_backups_table.php +++ b/database/migrations/2020_04_03_230614_create_backups_table.php @@ -20,13 +20,13 @@ class CreateBackupsTable extends Migration // to use. For now, just rename them to maintain the data. $results = DB::select('SELECT TABLE_NAME FROM information_schema.tables WHERE table_schema = ? AND table_name LIKE ? AND table_name NOT LIKE \'%_plugin_bak\'', [ config("database.connections.{$db}.database"), - 'backup%' + 'backup%', ]); // Take any of the results, most likely "backups" and "backup_logs" and rename them to have a // suffix so data isn't completely lost, but they're no longer in the way of this migration... foreach ($results as $result) { - Schema::rename($result->TABLE_NAME, $result->TABLE_NAME. '_plugin_bak'); + Schema::rename($result->TABLE_NAME, $result->TABLE_NAME . '_plugin_bak'); } Schema::create('backups', function (Blueprint $table) { diff --git a/database/migrations/2020_04_10_141024_store_node_tokens_as_encrypted_value.php b/database/migrations/2020_04_10_141024_store_node_tokens_as_encrypted_value.php index ff81f863d..b3d94af89 100644 --- a/database/migrations/2020_04_10_141024_store_node_tokens_as_encrypted_value.php +++ b/database/migrations/2020_04_10_141024_store_node_tokens_as_encrypted_value.php @@ -14,6 +14,7 @@ class StoreNodeTokensAsEncryptedValue extends Migration * Run the migrations. * * @return void + * * @throws \Exception */ public function up() diff --git a/database/migrations/2020_04_26_111208_add_backup_limit_to_servers.php b/database/migrations/2020_04_26_111208_add_backup_limit_to_servers.php index 92121b7df..b0f859c9f 100644 --- a/database/migrations/2020_04_26_111208_add_backup_limit_to_servers.php +++ b/database/migrations/2020_04_26_111208_add_backup_limit_to_servers.php @@ -19,7 +19,7 @@ class AddBackupLimitToServers extends Migration // here. If we find a result we'll actually keep the column around since we can maintain that backup // limit, but we need to correct the column definition a bit. $results = DB::select('SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = ? AND TABLE_NAME = \'servers\' AND COLUMN_NAME = \'backup_limit\'', [ - config("database.connections.{$db}.database") + config("database.connections.{$db}.database"), ]); if (count($results) === 1) { diff --git a/database/migrations/2020_07_02_213612_create_user_recovery_tokens_table.php b/database/migrations/2020_07_02_213612_create_user_recovery_tokens_table.php index df0f34919..9b0743af2 100644 --- a/database/migrations/2020_07_02_213612_create_user_recovery_tokens_table.php +++ b/database/migrations/2020_07_02_213612_create_user_recovery_tokens_table.php @@ -1,8 +1,8 @@ unique(['database_host_id', 'database']); }); - } } diff --git a/database/migrations/2020_10_26_194904_remove_nullable_from_schedule_name_field.php b/database/migrations/2020_10_26_194904_remove_nullable_from_schedule_name_field.php index fc1f01baa..69593e656 100644 --- a/database/migrations/2020_10_26_194904_remove_nullable_from_schedule_name_field.php +++ b/database/migrations/2020_10_26_194904_remove_nullable_from_schedule_name_field.php @@ -1,9 +1,9 @@ string('cron_month')->after('cron_day_of_week'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('schedules', function (Blueprint $table) { + $table->dropColumn('cron_month'); + }); + } +} diff --git a/phpunit.xml b/phpunit.xml index e4e18e417..227dadb9e 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,14 +1,23 @@ - + + + + ./app + + ./tests/Browser/Processes @@ -20,11 +29,6 @@ ./tests/Unit - - - ./app - - diff --git a/public/index.php b/public/index.php index 233cba743..796d29022 100644 --- a/public/index.php +++ b/public/index.php @@ -7,6 +7,21 @@ */ define('LARAVEL_START', microtime(true)); +/* +|-------------------------------------------------------------------------- +| Check If Application Is Under Maintenance +|-------------------------------------------------------------------------- +| +| If the application is maintenance / demo mode via the "down" command we +| will require this file so that any pre-rendered template can be shown +| instead of starting the framework, which could cause an exception. +| +*/ + +if (file_exists(__DIR__ . '/../storage/framework/maintenance.php')) { + require __DIR__ . '/../storage/framework/maintenance.php'; +} + /* |-------------------------------------------------------------------------- | Register The Auto Loader diff --git a/resources/lang/en/command/messages.php b/resources/lang/en/command/messages.php index 002c699bb..e135a1ec8 100644 --- a/resources/lang/en/command/messages.php +++ b/resources/lang/en/command/messages.php @@ -1,11 +1,6 @@ [ - 'warning' => 'It appears you have already configured an application encryption key. Continuing with this process with overwrite that key and cause data corruption for any existing encrypted data. DO NOT CONTINUE UNLESS YOU KNOW WHAT YOU ARE DOING.', - 'confirm' => 'I understand the consequences of performing this command and accept all responsibility for the loss of encrypted data.', - 'final_confirm' => 'Are you sure you wish to continue? Changing the application encryption key WILL CAUSE DATA LOSS.', - ], 'location' => [ 'no_location_found' => 'Could not locate a record matching the provided short code.', 'ask_short' => 'Location Short Code', diff --git a/resources/scripts/api/server/schedules/createOrUpdateSchedule.ts b/resources/scripts/api/server/schedules/createOrUpdateSchedule.ts index 0545650be..481cea777 100644 --- a/resources/scripts/api/server/schedules/createOrUpdateSchedule.ts +++ b/resources/scripts/api/server/schedules/createOrUpdateSchedule.ts @@ -11,6 +11,7 @@ export default (uuid: string, schedule: Data): Promise => { minute: schedule.cron.minute, hour: schedule.cron.hour, day_of_month: schedule.cron.dayOfMonth, + month: schedule.cron.month, day_of_week: schedule.cron.dayOfWeek, }) .then(({ data }) => resolve(rawDataToServerSchedule(data.attributes))) diff --git a/resources/scripts/api/server/schedules/getServerSchedules.ts b/resources/scripts/api/server/schedules/getServerSchedules.ts index 42514582a..f7a07617c 100644 --- a/resources/scripts/api/server/schedules/getServerSchedules.ts +++ b/resources/scripts/api/server/schedules/getServerSchedules.ts @@ -5,6 +5,7 @@ export interface Schedule { name: string; cron: { dayOfWeek: string; + month: string; dayOfMonth: string; hour: string; minute: string; @@ -46,6 +47,7 @@ export const rawDataToServerSchedule = (data: any): Schedule => ({ name: data.name, cron: { dayOfWeek: data.cron.day_of_week, + month: data.cron.month, dayOfMonth: data.cron.day_of_month, hour: data.cron.hour, minute: data.cron.minute, diff --git a/resources/scripts/components/dashboard/DashboardContainer.tsx b/resources/scripts/components/dashboard/DashboardContainer.tsx index b4cb4c290..2edc06056 100644 --- a/resources/scripts/components/dashboard/DashboardContainer.tsx +++ b/resources/scripts/components/dashboard/DashboardContainer.tsx @@ -16,8 +16,9 @@ import Pagination from '@/components/elements/Pagination'; export default () => { const { clearFlashes, clearAndAddHttpError } = useFlash(); const [ page, setPage ] = useState(1); - const { rootAdmin } = useStoreState(state => state.user.data!); - const [ showOnlyAdmin, setShowOnlyAdmin ] = usePersistedState('show_all_servers', false); + const uuid = useStoreState(state => state.user.data!.uuid); + const rootAdmin = useStoreState(state => state.user.data!.rootAdmin); + const [ showOnlyAdmin, setShowOnlyAdmin ] = usePersistedState(`${uuid}:show_all_servers`, false); const { data: servers, error } = useSWR>( [ '/api/client/servers', showOnlyAdmin, page ], diff --git a/resources/scripts/components/server/schedules/EditScheduleModal.tsx b/resources/scripts/components/server/schedules/EditScheduleModal.tsx index 73f74f2cf..e0df9e981 100644 --- a/resources/scripts/components/server/schedules/EditScheduleModal.tsx +++ b/resources/scripts/components/server/schedules/EditScheduleModal.tsx @@ -19,6 +19,7 @@ type Props = { interface Values { name: string; dayOfWeek: string; + month: string; dayOfMonth: string; hour: string; minute: string; @@ -38,7 +39,7 @@ const EditScheduleModal = ({ schedule, ...props }: Omit -
+
@@ -48,6 +49,9 @@ const EditScheduleModal = ({ schedule, ...props }: Omit
+
+ +
@@ -94,6 +98,7 @@ export default ({ schedule, visible, ...props }: Props) => { minute: values.minute, hour: values.hour, dayOfWeek: values.dayOfWeek, + month: values.month, dayOfMonth: values.dayOfMonth, }, isActive: values.enabled, @@ -116,10 +121,11 @@ export default ({ schedule, visible, ...props }: Props) => { onSubmit={submit} initialValues={{ name: schedule?.name || '', - dayOfWeek: schedule?.cron.dayOfWeek || '*', - dayOfMonth: schedule?.cron.dayOfMonth || '*', - hour: schedule?.cron.hour || '*', minute: schedule?.cron.minute || '*/5', + hour: schedule?.cron.hour || '*', + dayOfMonth: schedule?.cron.dayOfMonth || '*', + month: schedule?.cron.month || '*', + dayOfWeek: schedule?.cron.dayOfWeek || '*', enabled: schedule ? schedule.isActive : true, } as Values} validationSchema={null} diff --git a/resources/scripts/components/server/schedules/ScheduleCronRow.tsx b/resources/scripts/components/server/schedules/ScheduleCronRow.tsx index e7918a132..2a733b2d4 100644 --- a/resources/scripts/components/server/schedules/ScheduleCronRow.tsx +++ b/resources/scripts/components/server/schedules/ScheduleCronRow.tsx @@ -22,7 +22,7 @@ const ScheduleCronRow = ({ cron, className }: Props) => (

Day (Month)

-

*

+

{cron.month}

Month

diff --git a/resources/scripts/components/server/schedules/ScheduleEditContainer.tsx b/resources/scripts/components/server/schedules/ScheduleEditContainer.tsx index 17d58ac4e..8fcb91af0 100644 --- a/resources/scripts/components/server/schedules/ScheduleEditContainer.tsx +++ b/resources/scripts/components/server/schedules/ScheduleEditContainer.tsx @@ -28,9 +28,9 @@ interface State { } const CronBox = ({ title, value }: { title: string; value: string }) => ( -
+

{title}

-

{value}

+

{value}

); @@ -88,13 +88,6 @@ export default () => { : <> -
- - - - - -
@@ -143,6 +136,13 @@ export default () => {
+
+ + + + + +
{schedule.tasks.length > 0 ? schedule.tasks.map(task => ( diff --git a/resources/scripts/plugins/usePersistedState.ts b/resources/scripts/plugins/usePersistedState.ts index f31985558..007e3fcde 100644 --- a/resources/scripts/plugins/usePersistedState.ts +++ b/resources/scripts/plugins/usePersistedState.ts @@ -1,6 +1,6 @@ import { Dispatch, SetStateAction, useEffect, useState } from 'react'; -export function usePersistedState (key: string, defaultValue: S): [S | undefined, Dispatch>] { +export function usePersistedState (key: string, defaultValue: S): [ S | undefined, Dispatch> ] { const [ state, setState ] = useState( () => { try { @@ -12,7 +12,7 @@ export function usePersistedState (key: string, defaultValue: S): return defaultValue; } - } + }, ); useEffect(() => { diff --git a/routes/api-client.php b/routes/api-client.php index a3d27de0f..86dcff070 100644 --- a/routes/api-client.php +++ b/routes/api-client.php @@ -2,9 +2,8 @@ use Illuminate\Support\Facades\Route; use Pterodactyl\Http\Middleware\RequireTwoFactorAuthentication; -use Pterodactyl\Http\Middleware\Api\Client\Server\SubuserBelongsToServer; +use Pterodactyl\Http\Middleware\Api\Client\Server\ResourceBelongsToServer; use Pterodactyl\Http\Middleware\Api\Client\Server\AuthenticateServerAccess; -use Pterodactyl\Http\Middleware\Api\Client\Server\AllocationBelongsToServer; /* |-------------------------------------------------------------------------- @@ -39,7 +38,7 @@ Route::group(['prefix' => '/account'], function () { | Endpoint: /api/client/servers/{server} | */ -Route::group(['prefix' => '/servers/{server}', 'middleware' => [AuthenticateServerAccess::class]], function () { +Route::group(['prefix' => '/servers/{server}', 'middleware' => [AuthenticateServerAccess::class, ResourceBelongsToServer::class]], function () { Route::get('/', 'Servers\ServerController@index')->name('api:client:server.view'); Route::get('/websocket', 'Servers\WebsocketController')->name('api:client:server.ws'); Route::get('/resources', 'Servers\ResourceUtilizationController')->name('api:client:server.resources'); @@ -83,7 +82,7 @@ Route::group(['prefix' => '/servers/{server}', 'middleware' => [AuthenticateServ Route::delete('/{schedule}/tasks/{task}', 'Servers\ScheduleTaskController@delete'); }); - Route::group(['prefix' => '/network', 'middleware' => [AllocationBelongsToServer::class]], function () { + Route::group(['prefix' => '/network'], function () { Route::get('/allocations', 'Servers\NetworkAllocationController@index'); Route::post('/allocations', 'Servers\NetworkAllocationController@store'); Route::post('/allocations/{allocation}', 'Servers\NetworkAllocationController@update'); @@ -91,7 +90,7 @@ Route::group(['prefix' => '/servers/{server}', 'middleware' => [AuthenticateServ Route::delete('/allocations/{allocation}', 'Servers\NetworkAllocationController@delete'); }); - Route::group(['prefix' => '/users', 'middleware' => [SubuserBelongsToServer::class]], function () { + Route::group(['prefix' => '/users'], function () { Route::get('/', 'Servers\SubuserController@index'); Route::post('/', 'Servers\SubuserController@store'); Route::get('/{user}', 'Servers\SubuserController@view'); diff --git a/tests/Assertions/CommandAssertionsTrait.php b/tests/Assertions/CommandAssertionsTrait.php deleted file mode 100644 index bf88daa9f..000000000 --- a/tests/Assertions/CommandAssertionsTrait.php +++ /dev/null @@ -1,26 +0,0 @@ -. - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ - -namespace Tests\Assertions; - -use PHPUnit\Framework\Assert; - -trait CommandAssertionsTrait -{ - /** - * Assert that an output table contains a value. - * - * @param mixed $string - * @param string $display - */ - public function assertTableContains($string, $display) - { - Assert::assertRegExp('/\|(\s+)' . preg_quote($string) . '(\s+)\|/', $display, 'Assert that a response table contains a value.'); - } -} diff --git a/tests/Assertions/ControllerAssertionsTrait.php b/tests/Assertions/ControllerAssertionsTrait.php deleted file mode 100644 index 16cfcdd93..000000000 --- a/tests/Assertions/ControllerAssertionsTrait.php +++ /dev/null @@ -1,207 +0,0 @@ -. - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ - -namespace Tests\Assertions; - -use Illuminate\View\View; -use Illuminate\Http\Response; -use PHPUnit\Framework\Assert; -use Illuminate\Http\JsonResponse; -use Illuminate\Http\RedirectResponse; - -trait ControllerAssertionsTrait -{ - /** - * Assert that a response is an instance of Illuminate View. - * - * @param mixed $response - */ - public function assertIsViewResponse($response) - { - Assert::assertInstanceOf(View::class, $response); - } - - /** - * Assert that a response is an instance of Illuminate Redirect Response. - * - * @param mixed $response - */ - public function assertIsRedirectResponse($response) - { - Assert::assertInstanceOf(RedirectResponse::class, $response); - } - - /** - * Assert that a response is an instance of Illuminate Json Response. - * - * @param mixed $response - */ - public function assertIsJsonResponse($response) - { - Assert::assertInstanceOf(JsonResponse::class, $response); - } - - /** - * Assert that a response is an instance of Illuminate Response. - * - * @param mixed $response - */ - public function assertIsResponse($response) - { - Assert::assertInstanceOf(Response::class, $response); - } - - /** - * Assert that a view name equals the passed name. - * - * @param string $name - * @param mixed $view - */ - public function assertViewNameEquals($name, $view) - { - Assert::assertEquals($name, $view->getName()); - } - - /** - * Assert that a view name does not equal a provided name. - * - * @param string $name - * @param mixed $view - */ - public function assertViewNameNotEquals($name, $view) - { - Assert::assertNotEquals($name, $view->getName()); - } - - /** - * Assert that a view has an attribute passed into it. - * - * @param string $attribute - * @param mixed $view - */ - public function assertViewHasKey($attribute, $view) - { - if (str_contains($attribute, '.')) { - Assert::assertNotEquals( - '__TEST__FAIL', - array_get($view->getData(), $attribute, '__TEST__FAIL') - ); - } else { - Assert::assertArrayHasKey($attribute, $view->getData()); - } - } - - /** - * Assert that a view does not have a specific attribute passed in. - * - * @param string $attribute - * @param mixed $view - */ - public function assertViewNotHasKey($attribute, $view) - { - if (str_contains($attribute, '.')) { - Assert::assertEquals( - '__TEST__PASS', - array_get($view->getData(), $attribute, '__TEST__PASS') - ); - } else { - Assert::assertArrayNotHasKey($attribute, $view->getData()); - } - } - - /** - * Assert that a view attribute equals a given parameter. - * - * @param string $attribute - * @param mixed $value - * @param mixed $view - */ - public function assertViewKeyEquals($attribute, $value, $view) - { - Assert::assertEquals($value, array_get($view->getData(), $attribute, '__TEST__FAIL')); - } - - /** - * Assert that a view attribute does not equal a given parameter. - * - * @param string $attribute - * @param mixed $value - * @param mixed $view - */ - public function assertViewKeyNotEquals($attribute, $value, $view) - { - Assert::assertNotEquals($value, array_get($view->getData(), $attribute, '__TEST__FAIL')); - } - - /** - * Assert that a route redirect equals a given route name. - * - * @param string $route - * @param mixed $response - * @param array $args - */ - public function assertRedirectRouteEquals($route, $response, array $args = []) - { - Assert::assertEquals(route($route, $args), $response->getTargetUrl()); - } - - /** - * Assert that a route redirect URL equals as passed URL. - * - * @param string $url - * @param mixed $response - */ - public function assertRedirectUrlEquals($url, $response) - { - Assert::assertEquals($url, $response->getTargetUrl()); - } - - /** - * Assert that a response code equals a given code. - * - * @param int $code - * @param mixed $response - */ - public function assertResponseCodeEquals($code, $response) - { - Assert::assertEquals($code, $response->getStatusCode()); - } - - /** - * Assert that a response code does not equal a given code. - * - * @param int $code - * @param mixed $response - */ - public function assertResponseCodeNotEquals($code, $response) - { - Assert::assertNotEquals($code, $response->getStatusCode()); - } - - /** - * Assert that a response is in a JSON format. - * - * @param mixed $response - */ - public function assertResponseHasJsonHeaders($response) - { - Assert::assertEquals('application/json', $response->headers->get('content-type')); - } - - /** - * Assert that response JSON matches a given JSON string. - * - * @param array|string $json - * @param mixed $response - */ - public function assertResponseJsonEquals($json, $response) - { - Assert::assertEquals(is_array($json) ? json_encode($json) : $json, $response->getContent()); - } -} diff --git a/tests/Assertions/MiddlewareAttributeAssertionsTrait.php b/tests/Assertions/MiddlewareAttributeAssertionsTrait.php index fb8f70086..bd5ec0d1d 100644 --- a/tests/Assertions/MiddlewareAttributeAssertionsTrait.php +++ b/tests/Assertions/MiddlewareAttributeAssertionsTrait.php @@ -1,6 +1,6 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ - -namespace Tests\Assertions; - -use PHPUnit\Framework\Assert; -use PHPUnit_Util_InvalidArgumentHelper; - -trait NestedObjectAssertionsTrait -{ - /** - * Assert that an object value matches an expected value. - * - * @param string $key - * @param mixed $expected - * @param object $object - */ - public function assertObjectNestedValueEquals(string $key, $expected, $object) - { - if (! is_object($object)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(3, 'object'); - } - - Assert::assertEquals($expected, object_get_strict($object, $key, '__TEST_FAILURE'), 'Assert that an object value equals a provided value.'); - } - - /** - * Assert that an object contains a nested key. - * - * @param string $key - * @param object $object - */ - public function assertObjectHasNestedAttribute(string $key, $object) - { - if (! is_object($object)) { - throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'object'); - } - - Assert::assertNotEquals('__TEST_FAILURE', object_get_strict($object, $key, '__TEST_FAILURE'), 'Assert that an object contains a nested key.'); - } -} diff --git a/tests/Browser/BrowserTestCase.php b/tests/Browser/BrowserTestCase.php index 6972a41dc..68a6ddc1b 100644 --- a/tests/Browser/BrowserTestCase.php +++ b/tests/Browser/BrowserTestCase.php @@ -5,10 +5,10 @@ namespace Pterodactyl\Tests\Browser; use Laravel\Dusk\TestCase; use BadMethodCallException; use Pterodactyl\Models\User; -use Tests\CreatesApplication; use Pterodactyl\Console\Kernel; use Illuminate\Support\Facades\Hash; use Illuminate\Database\Eloquent\Model; +use Pterodactyl\Tests\CreatesApplication; use Facebook\WebDriver\Chrome\ChromeOptions; use Facebook\WebDriver\Remote\RemoteWebDriver; use Facebook\WebDriver\Remote\DesiredCapabilities; @@ -70,14 +70,16 @@ abstract class BrowserTestCase extends TestCase */ protected function driver() { - $options = (new ChromeOptions)->addArguments([ + $options = (new ChromeOptions())->addArguments([ '--disable-gpu', '--disable-infobars', ]); return RemoteWebDriver::create( - 'http://host.pterodactyl.local:4444/wd/hub', DesiredCapabilities::chrome()->setCapability( - ChromeOptions::CAPABILITY, $options + 'http://host.pterodactyl.local:4444/wd/hub', + DesiredCapabilities::chrome()->setCapability( + ChromeOptions::CAPABILITY, + $options ) ); } @@ -86,6 +88,7 @@ abstract class BrowserTestCase extends TestCase * Return an instance of the browser to be used for tests. * * @param \Facebook\WebDriver\Remote\RemoteWebDriver $driver + * * @return \Pterodactyl\Tests\Browser\PterodactylBrowser */ protected function newBrowser($driver): PterodactylBrowser @@ -109,13 +112,10 @@ abstract class BrowserTestCase extends TestCase /** * Return a user model to authenticate aganist and use in the tests. - * - * @param array $attributes - * @return \Pterodactyl\Models\User */ protected function user(array $attributes = []): User { - return factory(User::class)->create(array_merge([ + return User::factory()->create(array_merge([ 'password' => Hash::make(static::$userPassword), ], $attributes)); } diff --git a/tests/Browser/Pages/LoginPage.php b/tests/Browser/Pages/LoginPage.php index 5fd42cbf6..ea60b0580 100644 --- a/tests/Browser/Pages/LoginPage.php +++ b/tests/Browser/Pages/LoginPage.php @@ -4,9 +4,6 @@ namespace Pterodactyl\Tests\Browser\Pages; class LoginPage extends BasePage { - /** - * @return string - */ public function url(): string { return '/auth/login'; diff --git a/tests/Browser/Processes/Authentication/ForgotPasswordProcessTest.php b/tests/Browser/Processes/Authentication/ForgotPasswordProcessTest.php index ab8c9bc8a..f6cef86c4 100644 --- a/tests/Browser/Processes/Authentication/ForgotPasswordProcessTest.php +++ b/tests/Browser/Processes/Authentication/ForgotPasswordProcessTest.php @@ -15,7 +15,7 @@ class ForgotPasswordProcessTest extends BrowserTestCase public function testResetPasswordWithInvalidAccount() { $this->browse(function (PterodactylBrowser $browser) { - $browser->visit(new LoginPage) + $browser->visit(new LoginPage()) ->assertSee(trans('auth.forgot_password.label')) ->click('@forgotPassword') ->waitForLocation('/auth/password') @@ -39,7 +39,7 @@ class ForgotPasswordProcessTest extends BrowserTestCase public function testEmailCarryover() { $this->browse(function (PterodactylBrowser $browser) { - $browser->visit(new LoginPage) + $browser->visit(new LoginPage()) ->type('@username', 'dane@example.com') ->click('@forgotPassword') ->waitForLocation('/auth/password') diff --git a/tests/Browser/Processes/Authentication/LoginProcessTest.php b/tests/Browser/Processes/Authentication/LoginProcessTest.php index bf10fde56..0806cd789 100644 --- a/tests/Browser/Processes/Authentication/LoginProcessTest.php +++ b/tests/Browser/Processes/Authentication/LoginProcessTest.php @@ -27,7 +27,7 @@ class LoginProcessTest extends BrowserTestCase public function testLoginUsingEmail() { $this->browse(function (PterodactylBrowser $browser) { - $browser->visit(new LoginPage) + $browser->visit(new LoginPage()) ->waitFor('@username') ->type('@username', $this->user->email) ->type('@password', self::$userPassword) @@ -44,7 +44,7 @@ class LoginProcessTest extends BrowserTestCase public function testLoginUsingUsername() { $this->browse(function (PterodactylBrowser $browser) { - $browser->visit(new LoginPage) + $browser->visit(new LoginPage()) ->waitFor('@username') ->type('@username', $this->user->username) ->type('@password', self::$userPassword) diff --git a/tests/Browser/Processes/Dashboard/AccountEmailProcessTest.php b/tests/Browser/Processes/Dashboard/AccountEmailProcessTest.php index 311312b21..6efe4ee03 100644 --- a/tests/Browser/Processes/Dashboard/AccountEmailProcessTest.php +++ b/tests/Browser/Processes/Dashboard/AccountEmailProcessTest.php @@ -14,7 +14,7 @@ class AccountEmailProcessTest extends DashboardTestCase { $this->browse(function (PterodactylBrowser $browser) { $browser->loginAs($this->user) - ->visit(new AccountPage) + ->visit(new AccountPage()) ->assertValue('@email', $this->user->email) ->type('@email', 'new.email@example.com') ->type('@password', 'Password123') @@ -34,7 +34,7 @@ class AccountEmailProcessTest extends DashboardTestCase { $this->browse(function (PterodactylBrowser $browser) { $browser->loginAs($this->user) - ->visit(new AccountPage) + ->visit(new AccountPage()) ->assertMissing('@email ~ .input-help.error') ->type('@email', 'admin') ->assertVisible('@email ~ .input-help.error') @@ -51,7 +51,7 @@ class AccountEmailProcessTest extends DashboardTestCase { $this->browse(function (PterodactylBrowser $browser) { $browser->loginAs($this->user) - ->visit(new AccountPage) + ->visit(new AccountPage()) ->type('@email', 'new.email@example.com') ->click('@submit') ->assertFocused('@password') diff --git a/tests/Browser/Processes/Dashboard/AccountPasswordProcessTest.php b/tests/Browser/Processes/Dashboard/AccountPasswordProcessTest.php index 0b5e48786..4b8a5a3b6 100644 --- a/tests/Browser/Processes/Dashboard/AccountPasswordProcessTest.php +++ b/tests/Browser/Processes/Dashboard/AccountPasswordProcessTest.php @@ -14,7 +14,7 @@ class AccountPasswordProcessTest extends DashboardTestCase { $this->browse(function (PterodactylBrowser $browser) { $browser->loginAs($this->user) - ->visit(new AccountPage) + ->visit(new AccountPage()) ->type('@current_password', self::$userPassword) ->assertMissing('@new_password ~ .input-help.error') ->type('@new_password', 'test') @@ -42,7 +42,7 @@ class AccountPasswordProcessTest extends DashboardTestCase { $this->browse(function (PterodactylBrowser $browser) { $browser->loginAs($this->user) - ->visit(new AccountPage) + ->visit(new AccountPage()) ->type('@current_password', 'badpassword') ->type('@new_password', 'testtest') ->type('@confirm_password', 'testtest') diff --git a/tests/Browser/Processes/Dashboard/TwoFactorAuthenticationProcessTest.php b/tests/Browser/Processes/Dashboard/TwoFactorAuthenticationProcessTest.php index 26a13048e..463286ddb 100644 --- a/tests/Browser/Processes/Dashboard/TwoFactorAuthenticationProcessTest.php +++ b/tests/Browser/Processes/Dashboard/TwoFactorAuthenticationProcessTest.php @@ -17,7 +17,7 @@ class TwoFactorAuthenticationProcessTest extends DashboardTestCase { $this->browse(function (PterodactylBrowser $browser) { $browser->loginAs($this->user) - ->visit(new AccountPage) + ->visit(new AccountPage()) ->assertMissing('.modal-mask') ->click('@2fa_button') ->waitFor('@2fa_modal') @@ -42,7 +42,7 @@ class TwoFactorAuthenticationProcessTest extends DashboardTestCase { $this->browse(function (PterodactylBrowser $browser) { $browser->loginAs($this->user) - ->visit(new AccountPage) + ->visit(new AccountPage()) ->click('@2fa_button') ->waitForText(trans('dashboard/account.two_factor.setup.title')) ->assertFocused('@2fa_token') @@ -76,7 +76,7 @@ class TwoFactorAuthenticationProcessTest extends DashboardTestCase */ public function testTwoFactorCanBeDisabled() { - $secret = (new Google2FA)->generateSecretKey(16); + $secret = (new Google2FA())->generateSecretKey(16); $this->user->update([ 'use_totp' => true, @@ -85,7 +85,7 @@ class TwoFactorAuthenticationProcessTest extends DashboardTestCase $this->browse(function (PterodactylBrowser $browser) use ($secret) { $browser->loginAs($this->user) - ->visit(new AccountPage) + ->visit(new AccountPage()) ->click('@2fa_button') ->waitForText(trans('dashboard/account.two_factor.disable.title')) ->click('@2fa_cancel') diff --git a/tests/Browser/PterodactylBrowser.php b/tests/Browser/PterodactylBrowser.php index c7465ff3e..9136a6a65 100644 --- a/tests/Browser/PterodactylBrowser.php +++ b/tests/Browser/PterodactylBrowser.php @@ -11,8 +11,6 @@ class PterodactylBrowser extends Browser /** * Move the mouse to a specific location and then perform a left click action. * - * @param int $x - * @param int $y * @return $this */ public function clickPosition(int $x, int $y) @@ -26,6 +24,7 @@ class PterodactylBrowser extends Browser * Perform a case insensitive search for a string in the body. * * @param string $text + * * @return \Pterodactyl\Tests\Browser\PterodactylBrowser */ public function assertSee($text) @@ -38,6 +37,7 @@ class PterodactylBrowser extends Browser * * @param string $selector * @param string $text + * * @return \Pterodactyl\Tests\Browser\PterodactylBrowser */ public function assertSeeIn($selector, $text) diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php index ab9240255..b7ff2256c 100644 --- a/tests/CreatesApplication.php +++ b/tests/CreatesApplication.php @@ -1,6 +1,6 @@ withMiddleware('api..key:' . ApiKey::TYPE_APPLICATION); } - /** - * @return \Pterodactyl\Models\User - */ public function getApiUser(): User { return $this->user; } - /** - * @return \Pterodactyl\Models\ApiKey - */ public function getApiKey(): ApiKey { return $this->key; @@ -62,10 +58,6 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase /** * Creates a new default API key and refreshes the headers using it. - * - * @param \Pterodactyl\Models\User $user - * @param array $permissions - * @return \Pterodactyl\Models\ApiKey */ protected function createNewDefaultApiKey(User $user, array $permissions = []): ApiKey { @@ -77,8 +69,6 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase /** * Refresh the authorization header for a request to use a different API key. - * - * @param \Pterodactyl\Models\ApiKey $key */ protected function refreshHeaders(ApiKey $key) { @@ -87,26 +77,20 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase /** * Create an administrative user. - * - * @return \Pterodactyl\Models\User */ protected function createApiUser(): User { - return factory(User::class)->create([ + return User::factory()->create([ 'root_admin' => true, ]); } /** * Create a new application API key for a given user model. - * - * @param \Pterodactyl\Models\User $user - * @param array $permissions - * @return \Pterodactyl\Models\ApiKey */ protected function createApiKey(User $user, array $permissions = []): ApiKey { - return factory(ApiKey::class)->create(array_merge([ + return ApiKey::factory()->create(array_merge([ 'user_id' => $user->id, 'key_type' => ApiKey::TYPE_APPLICATION, 'r_servers' => AdminAcl::READ | AdminAcl::WRITE, @@ -123,9 +107,6 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase /** * Return a transformer that can be used for testing purposes. - * - * @param string $abstract - * @return \Pterodactyl\Transformers\Api\Application\BaseTransformer */ protected function getTransformer(string $abstract): BaseTransformer { diff --git a/tests/Integration/Api/Application/Location/LocationControllerTest.php b/tests/Integration/Api/Application/Location/LocationControllerTest.php index 222dc2847..150e01bea 100644 --- a/tests/Integration/Api/Application/Location/LocationControllerTest.php +++ b/tests/Integration/Api/Application/Location/LocationControllerTest.php @@ -16,7 +16,7 @@ class LocationControllerTest extends ApplicationApiIntegrationTestCase */ public function testGetLocations() { - $locations = factory(Location::class)->times(2)->create(); + $locations = Location::factory()->times(2)->create(); $response = $this->getJson('/api/application/locations'); $response->assertStatus(Response::HTTP_OK); @@ -70,7 +70,7 @@ class LocationControllerTest extends ApplicationApiIntegrationTestCase */ public function testGetSingleLocation() { - $location = factory(Location::class)->create(); + $location = Location::factory()->create(); $response = $this->getJson('/api/application/locations/' . $location->id); $response->assertStatus(Response::HTTP_OK); @@ -93,7 +93,7 @@ class LocationControllerTest extends ApplicationApiIntegrationTestCase */ public function testRelationshipsCanBeLoaded() { - $location = factory(Location::class)->create(); + $location = Location::factory()->create(); $server = $this->createServerModel(['user_id' => $this->getApiUser()->id, 'location_id' => $location->id]); $response = $this->getJson('/api/application/locations/' . $location->id . '?include=servers,nodes'); @@ -143,8 +143,8 @@ class LocationControllerTest extends ApplicationApiIntegrationTestCase { $this->createNewDefaultApiKey($this->getApiUser(), ['r_nodes' => 0]); - $location = factory(Location::class)->create(); - factory(Node::class)->create(['location_id' => $location->id]); + $location = Location::factory()->create(); + Node::factory()->create(['location_id' => $location->id]); $response = $this->getJson('/api/application/locations/' . $location->id . '?include=nodes'); $response->assertStatus(Response::HTTP_OK); @@ -187,7 +187,7 @@ class LocationControllerTest extends ApplicationApiIntegrationTestCase */ public function testErrorReturnedIfNoPermission() { - $location = factory(Location::class)->create(); + $location = Location::factory()->create(); $this->createNewDefaultApiKey($this->getApiUser(), ['r_locations' => 0]); $response = $this->getJson('/api/application/locations/' . $location->id); diff --git a/tests/Integration/Api/Application/Nests/EggControllerTest.php b/tests/Integration/Api/Application/Nests/EggControllerTest.php index f9b42dae0..584a64521 100644 --- a/tests/Integration/Api/Application/Nests/EggControllerTest.php +++ b/tests/Integration/Api/Application/Nests/EggControllerTest.php @@ -61,7 +61,9 @@ class EggControllerTest extends ApplicationApiIntegrationTestCase $expected = json_encode(Arr::sortRecursive($datum['attributes'])); $actual = json_encode(Arr::sortRecursive($this->getTransformer(EggTransformer::class)->transform($egg))); - $this->assertSame($expected, $actual, + $this->assertSame( + $expected, + $actual, 'Unable to find JSON fragment: ' . PHP_EOL . PHP_EOL . "[{$expected}]" . PHP_EOL . PHP_EOL . 'within' . PHP_EOL . PHP_EOL . "[{$actual}]." ); } diff --git a/tests/Integration/Api/Application/Users/ExternalUserControllerTest.php b/tests/Integration/Api/Application/Users/ExternalUserControllerTest.php index f28e15a93..983710b16 100644 --- a/tests/Integration/Api/Application/Users/ExternalUserControllerTest.php +++ b/tests/Integration/Api/Application/Users/ExternalUserControllerTest.php @@ -13,7 +13,7 @@ class ExternalUserControllerTest extends ApplicationApiIntegrationTestCase */ public function testGetRemoteUser() { - $user = factory(User::class)->create(); + $user = User::factory()->create(); $response = $this->getJson('/api/application/users/external/' . $user->external_id); $response->assertStatus(Response::HTTP_OK); @@ -60,7 +60,7 @@ class ExternalUserControllerTest extends ApplicationApiIntegrationTestCase */ public function testErrorReturnedIfNoPermission() { - $user = factory(User::class)->create(); + $user = User::factory()->create(); $this->createNewDefaultApiKey($this->getApiUser(), ['r_users' => 0]); $response = $this->getJson('/api/application/users/external/' . $user->external_id); diff --git a/tests/Integration/Api/Application/Users/UserControllerTest.php b/tests/Integration/Api/Application/Users/UserControllerTest.php index 128d9b607..00b091589 100644 --- a/tests/Integration/Api/Application/Users/UserControllerTest.php +++ b/tests/Integration/Api/Application/Users/UserControllerTest.php @@ -16,7 +16,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase */ public function testGetUsers() { - $user = factory(User::class)->create(); + $user = User::factory()->create(); $response = $this->getJson('/api/application/users'); $response->assertStatus(Response::HTTP_OK); @@ -85,7 +85,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase */ public function testGetSingleUser() { - $user = factory(User::class)->create(); + $user = User::factory()->create(); $response = $this->getJson('/api/application/users/' . $user->id); $response->assertStatus(Response::HTTP_OK); @@ -119,7 +119,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase */ public function testRelationshipsCanBeLoaded() { - $user = factory(User::class)->create(); + $user = User::factory()->create(); $server = $this->createServerModel(['user_id' => $user->id]); $response = $this->getJson('/api/application/users/' . $user->id . '?include=servers'); @@ -152,7 +152,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase { $this->createNewDefaultApiKey($this->getApiUser(), ['r_servers' => 0]); - $user = factory(User::class)->create(); + $user = User::factory()->create(); $this->createServerModel(['user_id' => $user->id]); $response = $this->getJson('/api/application/users/' . $user->id . '?include=servers'); @@ -194,7 +194,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase */ public function testErrorReturnedIfNoPermission() { - $user = factory(User::class)->create(); + $user = User::factory()->create(); $this->createNewDefaultApiKey($this->getApiUser(), ['r_users' => 0]); $response = $this->getJson('/api/application/users/' . $user->id); @@ -250,7 +250,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase */ public function testUpdateUser() { - $user = factory(User::class)->create(); + $user = User::factory()->create(); $response = $this->patchJson('/api/application/users/' . $user->id, [ 'username' => 'new.test.name', @@ -279,7 +279,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase */ public function testDeleteUser() { - $user = factory(User::class)->create(); + $user = User::factory()->create(); $this->assertDatabaseHas('users', ['id' => $user->id]); $response = $this->delete('/api/application/users/' . $user->id); @@ -292,9 +292,6 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase * Test that an API key without write permissions cannot create, update, or * delete a user model. * - * @param string $method - * @param string $url - * * @dataProvider userWriteEndpointsDataProvider */ public function testApiKeyWithoutWritePermissions(string $method, string $url) @@ -302,7 +299,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase $this->createNewDefaultApiKey($this->getApiUser(), ['r_users' => AdminAcl::READ]); if (str_contains($url, '{id}')) { - $user = factory(User::class)->create(); + $user = User::factory()->create(); $url = str_replace('{id}', $user->id, $url); } @@ -313,8 +310,6 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase /** * Endpoints that should return a 403 error when the key does not have write * permissions for user management. - * - * @return array */ public function userWriteEndpointsDataProvider(): array { diff --git a/tests/Integration/Api/Client/AccountControllerTest.php b/tests/Integration/Api/Client/AccountControllerTest.php index 6534bd508..3ed689ef9 100644 --- a/tests/Integration/Api/Client/AccountControllerTest.php +++ b/tests/Integration/Api/Client/AccountControllerTest.php @@ -15,7 +15,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase public function testAccountDetailsAreReturned() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(); + $user = User::factory()->create(); $response = $this->actingAs($user)->get('/api/client/account'); @@ -39,7 +39,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase public function testEmailIsUpdated() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(); + $user = User::factory()->create(); $response = $this->actingAs($user)->putJson('/api/client/account/email', [ 'email' => 'hodor@example.com', @@ -58,7 +58,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase public function testEmailIsNotUpdatedWhenPasswordIsInvalid() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(); + $user = User::factory()->create(); $response = $this->actingAs($user)->putJson('/api/client/account/email', [ 'email' => 'hodor@example.com', @@ -77,7 +77,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase public function testEmailIsNotUpdatedWhenNotValid() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(); + $user = User::factory()->create(); $response = $this->actingAs($user)->putJson('/api/client/account/email', [ 'email' => '', @@ -104,7 +104,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase public function testPasswordIsUpdated() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(); + $user = User::factory()->create(); $mock = Mockery::mock(AuthManager::class); $mock->expects('logoutOtherDevices')->with('New_Password1'); @@ -127,7 +127,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase public function testPasswordIsNotUpdatedIfCurrentPasswordIsInvalid() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(); + $user = User::factory()->create(); $response = $this->actingAs($user)->putJson('/api/client/account/password', [ 'current_password' => 'invalid', @@ -146,7 +146,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase */ public function testErrorIsReturnedForInvalidRequestData() { - $user = factory(User::class)->create(); + $user = User::factory()->create(); $this->actingAs($user)->putJson('/api/client/account/password', [ 'current_password' => 'password', @@ -170,7 +170,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase public function testErrorIsReturnedIfPasswordIsNotConfirmed() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(); + $user = User::factory()->create(); $response = $this->actingAs($user)->putJson('/api/client/account/password', [ 'current_password' => 'password', diff --git a/tests/Integration/Api/Client/ApiKeyControllerTest.php b/tests/Integration/Api/Client/ApiKeyControllerTest.php index f4c19f4f2..77bb8e1a6 100644 --- a/tests/Integration/Api/Client/ApiKeyControllerTest.php +++ b/tests/Integration/Api/Client/ApiKeyControllerTest.php @@ -24,9 +24,9 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase public function testApiKeysAreReturned() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(); + $user = User::factory()->create(); /** @var \Pterodactyl\Models\ApiKey $key */ - $key = factory(ApiKey::class)->create([ + $key = ApiKey::factory()->create([ 'user_id' => $user->id, 'key_type' => ApiKey::TYPE_ACCOUNT, ]); @@ -59,13 +59,13 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase public function testApiKeyCanBeCreatedForAccount() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(); + $user = User::factory()->create(); // Small sub-test to ensure we're always comparing the number of keys to the // specific logged in account, and not just the total number of keys stored in // the database. - factory(ApiKey::class)->times(10)->create([ - 'user_id' => factory(User::class)->create()->id, + ApiKey::factory()->times(10)->create([ + 'user_id' => User::factory()->create()->id, 'key_type' => ApiKey::TYPE_ACCOUNT, ]); @@ -103,8 +103,8 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase public function testNoMoreThanFiveApiKeysCanBeCreatedForAnAccount() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(); - factory(ApiKey::class)->times(5)->create([ + $user = User::factory()->create(); + ApiKey::factory()->times(5)->create([ 'user_id' => $user->id, 'key_type' => ApiKey::TYPE_ACCOUNT, ]); @@ -127,7 +127,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase public function testValidationErrorIsReturnedForBadRequests() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(); + $user = User::factory()->create(); $response = $this->actingAs($user)->postJson('/api/client/account/api-keys', [ 'description' => '', @@ -154,9 +154,9 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase public function testApiKeyCanBeDeleted() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(); + $user = User::factory()->create(); /** @var \Pterodactyl\Models\ApiKey $key */ - $key = factory(ApiKey::class)->create([ + $key = ApiKey::factory()->create([ 'user_id' => $user->id, 'key_type' => ApiKey::TYPE_ACCOUNT, ]); @@ -173,9 +173,9 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase public function testNonExistentApiKeyDeletionReturns404Error() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(); + $user = User::factory()->create(); /** @var \Pterodactyl\Models\ApiKey $key */ - $key = factory(ApiKey::class)->create([ + $key = ApiKey::factory()->create([ 'user_id' => $user->id, 'key_type' => ApiKey::TYPE_ACCOUNT, ]); @@ -193,11 +193,11 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase public function testApiKeyBelongingToAnotherUserCannotBeDeleted() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(); + $user = User::factory()->create(); /** @var \Pterodactyl\Models\User $user2 */ - $user2 = factory(User::class)->create(); + $user2 = User::factory()->create(); /** @var \Pterodactyl\Models\ApiKey $key */ - $key = factory(ApiKey::class)->create([ + $key = ApiKey::factory()->create([ 'user_id' => $user2->id, 'key_type' => ApiKey::TYPE_ACCOUNT, ]); @@ -215,9 +215,9 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase public function testApplicationApiKeyCannotBeDeleted() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(); + $user = User::factory()->create(); /** @var \Pterodactyl\Models\ApiKey $key */ - $key = factory(ApiKey::class)->create([ + $key = ApiKey::factory()->create([ 'user_id' => $user->id, 'key_type' => ApiKey::TYPE_APPLICATION, ]); diff --git a/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php b/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php index b77959058..30667d51e 100644 --- a/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php +++ b/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php @@ -2,19 +2,21 @@ namespace Pterodactyl\Tests\Integration\Api\Client; -use Carbon\Carbon; use ReflectionClass; -use Carbon\CarbonImmutable; use Pterodactyl\Models\Node; use Pterodactyl\Models\Task; use Pterodactyl\Models\User; use Webmozart\Assert\Assert; +use Pterodactyl\Models\Backup; use Pterodactyl\Models\Server; use Pterodactyl\Models\Subuser; +use Pterodactyl\Models\Database; use Pterodactyl\Models\Location; use Pterodactyl\Models\Schedule; use Illuminate\Support\Collection; use Pterodactyl\Models\Allocation; +use Pterodactyl\Models\DatabaseHost; +use Pterodactyl\Tests\Integration\TestResponse; use Pterodactyl\Tests\Integration\IntegrationTestCase; use Pterodactyl\Transformers\Api\Client\BaseClientTransformer; @@ -25,6 +27,9 @@ abstract class ClientApiIntegrationTestCase extends IntegrationTestCase */ protected function tearDown(): void { + Database::query()->forceDelete(); + DatabaseHost::query()->forceDelete(); + Backup::query()->forceDelete(); Server::query()->forceDelete(); Node::query()->forceDelete(); Location::query()->forceDelete(); @@ -34,22 +39,24 @@ abstract class ClientApiIntegrationTestCase extends IntegrationTestCase } /** - * Setup tests and ensure all of the times are always the same. + * Override the default createTestResponse from Illuminate so that we can + * just dump 500-level errors to the screen in the tests without having + * to keep re-assigning variables. + * + * @param \Illuminate\Http\Response $response + * + * @return \Illuminate\Testing\TestResponse */ - public function setUp(): void + protected function createTestResponse($response) { - parent::setUp(); - - Carbon::setTestNow(Carbon::now()); - CarbonImmutable::setTestNow(Carbon::now()); + return TestResponse::fromBaseResponse($response); } /** * Returns a link to the specific resource using the client API. * - * @param mixed $model + * @param mixed $model * @param string|null $append - * @return string */ protected function link($model, $append = null): string { @@ -79,17 +86,17 @@ abstract class ClientApiIntegrationTestCase extends IntegrationTestCase * is assumed that the user is actually a subuser of the server. * * @param string[] $permissions - * @return array */ protected function generateTestAccount(array $permissions = []): array { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(); + $user = User::factory()->create(); if (empty($permissions)) { return [$user, $this->createServerModel(['user_id' => $user->id])]; } + /** @var \Pterodactyl\Models\Server $server */ $server = $this->createServerModel(); Subuser::query()->create([ @@ -105,7 +112,6 @@ abstract class ClientApiIntegrationTestCase extends IntegrationTestCase * Asserts that the data passed through matches the output of the data from the transformer. This * will remove the "relationships" key when performing the comparison. * - * @param array $data * @param \Pterodactyl\Models\Model|\Illuminate\Database\Eloquent\Model $model */ protected function assertJsonTransformedWith(array $data, $model) @@ -113,7 +119,7 @@ abstract class ClientApiIntegrationTestCase extends IntegrationTestCase $reflect = new ReflectionClass($model); $transformer = sprintf('\\Pterodactyl\\Transformers\\Api\\Client\\%sTransformer', $reflect->getShortName()); - $transformer = new $transformer; + $transformer = new $transformer(); $this->assertInstanceOf(BaseClientTransformer::class, $transformer); $this->assertSame( diff --git a/tests/Integration/Api/Client/ClientControllerTest.php b/tests/Integration/Api/Client/ClientControllerTest.php index fc8c2c1e1..3ab6b1912 100644 --- a/tests/Integration/Api/Client/ClientControllerTest.php +++ b/tests/Integration/Api/Client/ClientControllerTest.php @@ -5,8 +5,8 @@ namespace Pterodactyl\Tests\Integration\Api\Client; use Pterodactyl\Models\User; use Pterodactyl\Models\Server; use Pterodactyl\Models\Subuser; -use Pterodactyl\Models\Permission; use Pterodactyl\Models\Allocation; +use Pterodactyl\Models\Permission; class ClientControllerTest extends ClientApiIntegrationTestCase { @@ -19,7 +19,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase public function testOnlyLoggedInUsersServersAreReturned() { /** @var \Pterodactyl\Models\User[] $users */ - $users = factory(User::class)->times(3)->create(); + $users = User::factory()->times(3)->create(); /** @var \Pterodactyl\Models\Server[] $servers */ $servers = [ @@ -46,7 +46,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase public function testServersAreFilteredUsingNameAndUuidInformation() { /** @var \Pterodactyl\Models\User[] $users */ - $users = factory(User::class)->times(2)->create(); + $users = User::factory()->times(2)->create(); $users[0]->update(['root_admin' => true]); /** @var \Pterodactyl\Models\Server[] $servers */ @@ -106,8 +106,8 @@ class ClientControllerTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount(); $server2 = $this->createServerModel(['user_id' => $user->id, 'node_id' => $server->node_id]); - $allocation = factory(Allocation::class)->create(['node_id' => $server->node_id, 'server_id' => $server->id, 'ip' => '192.168.1.1', 'port' => 25565]); - $allocation2 = factory(Allocation::class)->create(['node_id' => $server->node_id, 'server_id' => $server2->id, 'ip' => '192.168.1.1', 'port' => 25570]); + $allocation = Allocation::factory()->create(['node_id' => $server->node_id, 'server_id' => $server->id, 'ip' => '192.168.1.1', 'port' => 25565]); + $allocation2 = Allocation::factory()->create(['node_id' => $server->node_id, 'server_id' => $server2->id, 'ip' => '192.168.1.1', 'port' => 25570]); $server->update(['allocation_id' => $allocation->id]); $server2->update(['allocation_id' => $allocation2->id]); @@ -144,7 +144,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase public function testServersUserIsASubuserOfAreReturned() { /** @var \Pterodactyl\Models\User[] $users */ - $users = factory(User::class)->times(3)->create(); + $users = User::factory()->times(3)->create(); $servers = [ $this->createServerModel(['user_id' => $users[0]->id]), $this->createServerModel(['user_id' => $users[1]->id]), @@ -175,7 +175,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase public function testFilterOnlyOwnerServers() { /** @var \Pterodactyl\Models\User[] $users */ - $users = factory(User::class)->times(3)->create(); + $users = User::factory()->times(3)->create(); $servers = [ $this->createServerModel(['user_id' => $users[0]->id]), $this->createServerModel(['user_id' => $users[1]->id]), @@ -204,7 +204,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase public function testPermissionsAreReturned() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(); + $user = User::factory()->create(); $this->actingAs($user) ->getJson('/api/client/permissions') @@ -224,7 +224,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase public function testOnlyAdminLevelServersAreReturned() { /** @var \Pterodactyl\Models\User[] $users */ - $users = factory(User::class)->times(4)->create(); + $users = User::factory()->times(4)->create(); $users[0]->update(['root_admin' => true]); $servers = [ @@ -259,7 +259,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase public function testAllServersAreReturnedToAdmin() { /** @var \Pterodactyl\Models\User[] $users */ - $users = factory(User::class)->times(4)->create(); + $users = User::factory()->times(4)->create(); $users[0]->update(['root_admin' => true]); $servers = [ @@ -292,7 +292,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase public function testNoServersAreReturnedIfAdminFilterIsPassedByRegularUser($type) { /** @var \Pterodactyl\Models\User[] $users */ - $users = factory(User::class)->times(3)->create(); + $users = User::factory()->times(3)->create(); $this->createServerModel(['user_id' => $users[0]->id]); $this->createServerModel(['user_id' => $users[1]->id]); @@ -315,7 +315,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase $server->allocation->notes = 'Test notes'; $server->allocation->save(); - factory(Allocation::class)->times(2)->create([ + Allocation::factory()->times(2)->create([ 'node_id' => $server->node_id, 'server_id' => $server->id, ]); diff --git a/tests/Integration/Api/Client/Server/Allocation/AllocationAuthorizationTest.php b/tests/Integration/Api/Client/Server/Allocation/AllocationAuthorizationTest.php new file mode 100644 index 000000000..b698d8c7e --- /dev/null +++ b/tests/Integration/Api/Client/Server/Allocation/AllocationAuthorizationTest.php @@ -0,0 +1,60 @@ +generateTestAccount(); + // Will be a subuser of $server2. + $server2 = $this->createServerModel(); + // And as no access to $server3. + $server3 = $this->createServerModel(); + + // Set the API $user as a subuser of server 2, but with no permissions + // to do anything with the allocations for that server. + Subuser::factory()->create(['server_id' => $server2->id, 'user_id' => $user->id]); + + $allocation1 = Allocation::factory()->create(['server_id' => $server1->id, 'node_id' => $server1->node_id]); + $allocation2 = Allocation::factory()->create(['server_id' => $server2->id, 'node_id' => $server2->node_id]); + $allocation3 = Allocation::factory()->create(['server_id' => $server3->id, 'node_id' => $server3->node_id]); + + // This is the only valid call for this test, accessing the allocation for the same + // server that the API user is the owner of. + $response = $this->actingAs($user)->json($method, $this->link($server1, '/network/allocations/' . $allocation1->id . $endpoint)); + $this->assertTrue($response->status() <= 204 || $response->status() === 400 || $response->status() === 422); + + // This request fails because the allocation is valid for that server but the user + // making the request is not authorized to perform that action. + $this->actingAs($user)->json($method, $this->link($server2, '/network/allocations/' . $allocation2->id . $endpoint))->assertForbidden(); + + // Both of these should report a 404 error due to the allocations being linked to + // servers that are not the same as the server in the request, or are assigned + // to a server for which the user making the request has no access to. + $this->actingAs($user)->json($method, $this->link($server1, '/network/allocations/' . $allocation2->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server1, '/network/allocations/' . $allocation3->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server2, '/network/allocations/' . $allocation3->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server3, '/network/allocations/' . $allocation3->id . $endpoint))->assertNotFound(); + } + + /** + * @return \string[][] + */ + public function methodDataProvider(): array + { + return [ + ['POST', ''], + ['DELETE', ''], + ['POST', '/primary'], + ]; + } +} diff --git a/tests/Integration/Api/Client/Server/Allocation/CreateNewAllocationTest.php b/tests/Integration/Api/Client/Server/Allocation/CreateNewAllocationTest.php index ab33ba81b..6b8da4048 100644 --- a/tests/Integration/Api/Client/Server/Allocation/CreateNewAllocationTest.php +++ b/tests/Integration/Api/Client/Server/Allocation/CreateNewAllocationTest.php @@ -3,8 +3,8 @@ namespace Pterodactyl\Tests\Integration\Api\Client\Server\Allocation; use Illuminate\Http\Response; -use Pterodactyl\Models\Permission; use Pterodactyl\Models\Allocation; +use Pterodactyl\Models\Permission; use Pterodactyl\Tests\Integration\Api\Client\ClientApiIntegrationTestCase; class CreateNewAllocationTest extends ClientApiIntegrationTestCase @@ -24,7 +24,6 @@ class CreateNewAllocationTest extends ClientApiIntegrationTestCase /** * Tests that a new allocation can be properly assigned to a server. * - * @param array $permission * @dataProvider permissionDataProvider */ public function testNewAllocationCanBeAssignedToServer(array $permission) @@ -33,7 +32,7 @@ class CreateNewAllocationTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount($permission); $server->update(['allocation_limit' => 2]); - $response = $this->actingAs($user)->postJson($this->link($server, "/network/allocations")); + $response = $this->actingAs($user)->postJson($this->link($server, '/network/allocations')); $response->assertJsonPath('object', Allocation::RESOURCE_NAME); $matched = Allocation::query()->findOrFail($response->json('attributes.id')); @@ -52,7 +51,7 @@ class CreateNewAllocationTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount([Permission::ACTION_ALLOCATION_UPDATE]); $server->update(['allocation_limit' => 2]); - $this->actingAs($user)->postJson($this->link($server, "/network/allocations"))->assertForbidden(); + $this->actingAs($user)->postJson($this->link($server, '/network/allocations'))->assertForbidden(); } /** @@ -66,7 +65,7 @@ class CreateNewAllocationTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount(); $server->update(['allocation_limit' => 2]); - $this->actingAs($user)->postJson($this->link($server, "/network/allocations")) + $this->actingAs($user)->postJson($this->link($server, '/network/allocations')) ->assertStatus(Response::HTTP_BAD_REQUEST) ->assertJsonPath('errors.0.code', 'AutoAllocationNotEnabledException') ->assertJsonPath('errors.0.detail', 'Server auto-allocation is not enabled for this instance.'); @@ -81,7 +80,7 @@ class CreateNewAllocationTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount(); $server->update(['allocation_limit' => 1]); - $this->actingAs($user)->postJson($this->link($server, "/network/allocations")) + $this->actingAs($user)->postJson($this->link($server, '/network/allocations')) ->assertStatus(Response::HTTP_BAD_REQUEST) ->assertJsonPath('errors.0.code', 'DisplayException') ->assertJsonPath('errors.0.detail', 'Cannot assign additional allocations to this server: limit has been reached.'); diff --git a/tests/Integration/Api/Client/Server/Allocation/DeleteAllocationTest.php b/tests/Integration/Api/Client/Server/Allocation/DeleteAllocationTest.php index 5b14c1a7e..c986de784 100644 --- a/tests/Integration/Api/Client/Server/Allocation/DeleteAllocationTest.php +++ b/tests/Integration/Api/Client/Server/Allocation/DeleteAllocationTest.php @@ -3,8 +3,8 @@ namespace Pterodactyl\Tests\Integration\Api\Client\Server\Allocation; use Illuminate\Http\Response; -use Pterodactyl\Models\Permission; use Pterodactyl\Models\Allocation; +use Pterodactyl\Models\Permission; use Pterodactyl\Tests\Integration\Api\Client\ClientApiIntegrationTestCase; class DeleteAllocationTest extends ClientApiIntegrationTestCase @@ -13,7 +13,6 @@ class DeleteAllocationTest extends ClientApiIntegrationTestCase * Test that an allocation is deleted from the server and the notes are properly reset * to an empty value on assignment. * - * @param array $permission * @dataProvider permissionDataProvider */ public function testAllocationCanBeDeletedFromServer(array $permission) @@ -22,7 +21,7 @@ class DeleteAllocationTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount($permission); /** @var \Pterodactyl\Models\Allocation $allocation */ - $allocation = factory(Allocation::class)->create([ + $allocation = Allocation::factory()->create([ 'server_id' => $server->id, 'node_id' => $server->node_id, 'notes' => 'hodor', @@ -42,7 +41,7 @@ class DeleteAllocationTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount([Permission::ACTION_ALLOCATION_CREATE]); /** @var \Pterodactyl\Models\Allocation $allocation */ - $allocation = factory(Allocation::class)->create([ + $allocation = Allocation::factory()->create([ 'server_id' => $server->id, 'node_id' => $server->node_id, 'notes' => 'hodor', diff --git a/tests/Integration/Api/Client/Server/Backup/BackupAuthorizationTest.php b/tests/Integration/Api/Client/Server/Backup/BackupAuthorizationTest.php new file mode 100644 index 000000000..aaaf38a6f --- /dev/null +++ b/tests/Integration/Api/Client/Server/Backup/BackupAuthorizationTest.php @@ -0,0 +1,69 @@ +generateTestAccount(); + // Will be a subuser of $server2. + $server2 = $this->createServerModel(); + // And as no access to $server3. + $server3 = $this->createServerModel(); + + // Set the API $user as a subuser of server 2, but with no permissions + // to do anything with the backups for that server. + Subuser::factory()->create(['server_id' => $server2->id, 'user_id' => $user->id]); + + $backup1 = Backup::factory()->create(['server_id' => $server1->id, 'completed_at' => CarbonImmutable::now()]); + $backup2 = Backup::factory()->create(['server_id' => $server2->id, 'completed_at' => CarbonImmutable::now()]); + $backup3 = Backup::factory()->create(['server_id' => $server3->id, 'completed_at' => CarbonImmutable::now()]); + + $this->instance(DeleteBackupService::class, $mock = Mockery::mock(DeleteBackupService::class)); + + if ($method === 'DELETE') { + $mock->expects('handle')->andReturnUndefined(); + } + + // This is the only valid call for this test, accessing the backup for the same + // server that the API user is the owner of. + $this->actingAs($user)->json($method, $this->link($server1, '/backups/' . $backup1->uuid . $endpoint)) + ->assertStatus($method === 'DELETE' ? 204 : 200); + + // This request fails because the backup is valid for that server but the user + // making the request is not authorized to perform that action. + $this->actingAs($user)->json($method, $this->link($server2, '/backups/' . $backup2->uuid . $endpoint))->assertForbidden(); + + // Both of these should report a 404 error due to the backup being linked to + // servers that are not the same as the server in the request, or are assigned + // to a server for which the user making the request has no access to. + $this->actingAs($user)->json($method, $this->link($server1, '/backups/' . $backup2->uuid . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server1, '/backups/' . $backup3->uuid . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server2, '/backups/' . $backup3->uuid . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server3, '/backups/' . $backup3->uuid . $endpoint))->assertNotFound(); + } + + /** + * @return \string[][] + */ + public function methodDataProvider(): array + { + return [ + ['GET', ''], + ['GET', '/download'], + ['DELETE', ''], + ]; + } +} diff --git a/tests/Integration/Api/Client/Server/CommandControllerTest.php b/tests/Integration/Api/Client/Server/CommandControllerTest.php index f3e9df7b2..d6010b675 100644 --- a/tests/Integration/Api/Client/Server/CommandControllerTest.php +++ b/tests/Integration/Api/Client/Server/CommandControllerTest.php @@ -69,7 +69,7 @@ class CommandControllerTest extends ClientApiIntegrationTestCase $this->repository->expects('setServer')->with(Mockery::on(function ($value) use ($server) { return $value->uuid === $server->uuid; }))->andReturnSelf(); - $this->repository->expects('send')->with('say Test')->andReturn(new GuzzleResponse); + $this->repository->expects('send')->with('say Test')->andReturn(new GuzzleResponse()); $response = $this->actingAs($user)->postJson("/api/client/servers/{$server->uuid}/command", [ 'command' => 'say Test', diff --git a/tests/Integration/Api/Client/Server/Database/DatabaseAuthorizationTest.php b/tests/Integration/Api/Client/Server/Database/DatabaseAuthorizationTest.php new file mode 100644 index 000000000..d7063ea33 --- /dev/null +++ b/tests/Integration/Api/Client/Server/Database/DatabaseAuthorizationTest.php @@ -0,0 +1,76 @@ +generateTestAccount(); + // Will be a subuser of $server2. + $server2 = $this->createServerModel(); + // And as no access to $server3. + $server3 = $this->createServerModel(); + + $host = DatabaseHost::factory()->create([]); + + // Set the API $user as a subuser of server 2, but with no permissions + // to do anything with the databases for that server. + Subuser::factory()->create(['server_id' => $server2->id, 'user_id' => $user->id]); + + $database1 = Database::factory()->create(['server_id' => $server1->id, 'database_host_id' => $host->id]); + $database2 = Database::factory()->create(['server_id' => $server2->id, 'database_host_id' => $host->id]); + $database3 = Database::factory()->create(['server_id' => $server3->id, 'database_host_id' => $host->id]); + + $this->instance(DatabasePasswordService::class, $mock = Mockery::mock(DatabasePasswordService::class)); + $this->instance(DatabaseManagementService::class, $mock2 = Mockery::mock(DatabaseManagementService::class)); + + if ($method === 'POST') { + $mock->expects('handle')->andReturnUndefined(); + } else { + $mock2->expects('delete')->andReturnUndefined(); + } + + $hashids = $this->app->make(HashidsInterface::class); + // This is the only valid call for this test, accessing the database for the same + // server that the API user is the owner of. + $this->actingAs($user)->json($method, $this->link($server1, '/databases/' . $hashids->encode($database1->id) . $endpoint)) + ->assertStatus($method === 'DELETE' ? 204 : 200); + + // This request fails because the database is valid for that server but the user + // making the request is not authorized to perform that action. + $this->actingAs($user)->json($method, $this->link($server2, '/databases/' . $hashids->encode($database2->id) . $endpoint))->assertForbidden(); + + // Both of these should report a 404 error due to the database being linked to + // servers that are not the same as the server in the request, or are assigned + // to a server for which the user making the request has no access to. + $this->actingAs($user)->json($method, $this->link($server1, '/databases/' . $hashids->encode($database2->id) . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server1, '/databases/' . $hashids->encode($database3->id) . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server2, '/databases/' . $hashids->encode($database3->id) . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server3, '/databases/' . $hashids->encode($database3->id) . $endpoint))->assertNotFound(); + } + + /** + * @return \string[][] + */ + public function methodDataProvider(): array + { + return [ + ['POST', '/rotate-password'], + ['DELETE', ''], + ]; + } +} diff --git a/tests/Integration/Api/Client/Server/NetworkAllocationControllerTest.php b/tests/Integration/Api/Client/Server/NetworkAllocationControllerTest.php index 185375e86..9741af974 100644 --- a/tests/Integration/Api/Client/Server/NetworkAllocationControllerTest.php +++ b/tests/Integration/Api/Client/Server/NetworkAllocationControllerTest.php @@ -32,7 +32,7 @@ class NetworkAllocationControllerTest extends ClientApiIntegrationTestCase public function testServerAllocationsAreNotReturnedWithoutPermission() { [$user, $server] = $this->generateTestAccount(); - $user2 = factory(User::class)->create(); + $user2 = User::factory()->create(); $server->owner_id = $user2->id; $server->save(); @@ -49,7 +49,6 @@ class NetworkAllocationControllerTest extends ClientApiIntegrationTestCase /** * Tests that notes on an allocation can be set correctly. * - * @param array $permissions * @dataProvider updatePermissionsDataProvider */ public function testAllocationNotesCanBeUpdated(array $permissions) @@ -85,7 +84,7 @@ class NetworkAllocationControllerTest extends ClientApiIntegrationTestCase public function testAllocationNotesCannotBeUpdatedByInvalidUsers() { [$user, $server] = $this->generateTestAccount(); - $user2 = factory(User::class)->create(); + $user2 = User::factory()->create(); $server->owner_id = $user2->id; $server->save(); @@ -98,14 +97,13 @@ class NetworkAllocationControllerTest extends ClientApiIntegrationTestCase } /** - * @param array $permissions * @dataProvider updatePermissionsDataProvider */ public function testPrimaryAllocationCanBeModified(array $permissions) { [$user, $server] = $this->generateTestAccount($permissions); $allocation = $server->allocation; - $allocation2 = factory(Allocation::class)->create(['node_id' => $server->node_id, 'server_id' => $server->id]); + $allocation2 = Allocation::factory()->create(['node_id' => $server->node_id, 'server_id' => $server->id]); $server->allocation_id = $allocation->id; $server->save(); @@ -121,7 +119,7 @@ class NetworkAllocationControllerTest extends ClientApiIntegrationTestCase public function testPrimaryAllocationCannotBeModifiedByInvalidUser() { [$user, $server] = $this->generateTestAccount(); - $user2 = factory(User::class)->create(); + $user2 = User::factory()->create(); $server->owner_id = $user2->id; $server->save(); diff --git a/tests/Integration/Api/Client/Server/PowerControllerTest.php b/tests/Integration/Api/Client/Server/PowerControllerTest.php index 96911cf37..6aed481a8 100644 --- a/tests/Integration/Api/Client/Server/PowerControllerTest.php +++ b/tests/Integration/Api/Client/Server/PowerControllerTest.php @@ -15,7 +15,6 @@ class PowerControllerTest extends ClientApiIntegrationTestCase * an error in response. This checks against the specific permission needed to send * the command to the server. * - * @param string $action * @param string[] $permissions * @dataProvider invalidPermissionDataProvider */ @@ -47,8 +46,6 @@ class PowerControllerTest extends ClientApiIntegrationTestCase /** * Test that sending a valid power actions works. * - * @param string $action - * @param string $permission * @dataProvider validPowerActionDataProvider */ public function testActionCanBeSentToServer(string $action, string $permission) @@ -74,8 +71,6 @@ class PowerControllerTest extends ClientApiIntegrationTestCase /** * Returns invalid permission combinations for a given power action. - * - * @return array */ public function invalidPermissionDataProvider(): array { @@ -88,9 +83,6 @@ class PowerControllerTest extends ClientApiIntegrationTestCase ]; } - /** - * @return array - */ public function validPowerActionDataProvider(): array { return [ diff --git a/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php b/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php index 51345fa79..cde99b090 100644 --- a/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php @@ -25,6 +25,7 @@ class CreateServerScheduleTest extends ClientApiIntegrationTestCase 'minute' => '0', 'hour' => '*/2', 'day_of_week' => '2', + 'month' => '1', 'day_of_month' => '*', ]); @@ -39,6 +40,7 @@ class CreateServerScheduleTest extends ClientApiIntegrationTestCase $this->assertSame('0', $schedule->cron_minute); $this->assertSame('*/2', $schedule->cron_hour); $this->assertSame('2', $schedule->cron_day_of_week); + $this->assertSame('1', $schedule->cron_month); $this->assertSame('*', $schedule->cron_day_of_month); $this->assertSame('Test Schedule', $schedule->name); @@ -69,6 +71,7 @@ class CreateServerScheduleTest extends ClientApiIntegrationTestCase 'minute' => '*', 'hour' => '*', 'day_of_month' => '*', + 'month' => '*', 'day_of_week' => '*', ]) ->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY) @@ -87,9 +90,6 @@ class CreateServerScheduleTest extends ClientApiIntegrationTestCase ->assertForbidden(); } - /** - * @return array - */ public function permissionsDataProvider(): array { return [[[]], [[Permission::ACTION_SCHEDULE_CREATE]]]; diff --git a/tests/Integration/Api/Client/Server/Schedule/DeleteServerScheduleTest.php b/tests/Integration/Api/Client/Server/Schedule/DeleteServerScheduleTest.php index cff7591ba..25f274115 100644 --- a/tests/Integration/Api/Client/Server/Schedule/DeleteServerScheduleTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/DeleteServerScheduleTest.php @@ -20,8 +20,8 @@ class DeleteServerScheduleTest extends ClientApiIntegrationTestCase { [$user, $server] = $this->generateTestAccount($permissions); - $schedule = factory(Schedule::class)->create(['server_id' => $server->id]); - $task = factory(Task::class)->create(['schedule_id' => $schedule->id]); + $schedule = Schedule::factory()->create(['server_id' => $server->id]); + $task = Task::factory()->create(['schedule_id' => $schedule->id]); $this->actingAs($user) ->deleteJson("/api/client/servers/{$server->uuid}/schedules/{$schedule->id}") @@ -52,7 +52,7 @@ class DeleteServerScheduleTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount(); [, $server2] = $this->generateTestAccount(['user_id' => $user->id]); - $schedule = factory(Schedule::class)->create(['server_id' => $server2->id]); + $schedule = Schedule::factory()->create(['server_id' => $server2->id]); $this->actingAs($user) ->deleteJson("/api/client/servers/{$server->uuid}/schedules/{$schedule->id}") @@ -69,7 +69,7 @@ class DeleteServerScheduleTest extends ClientApiIntegrationTestCase { [$user, $server] = $this->generateTestAccount([Permission::ACTION_SCHEDULE_UPDATE]); - $schedule = factory(Schedule::class)->create(['server_id' => $server->id]); + $schedule = Schedule::factory()->create(['server_id' => $server->id]); $this->actingAs($user) ->deleteJson("/api/client/servers/{$server->uuid}/schedules/{$schedule->id}") @@ -78,9 +78,6 @@ class DeleteServerScheduleTest extends ClientApiIntegrationTestCase $this->assertDatabaseHas('schedules', ['id' => $schedule->id]); } - /** - * @return array - */ public function permissionsDataProvider(): array { return [[[]], [[Permission::ACTION_SCHEDULE_DELETE]]]; diff --git a/tests/Integration/Api/Client/Server/Schedule/ExecuteScheduleTest.php b/tests/Integration/Api/Client/Server/Schedule/ExecuteScheduleTest.php index d83faae3c..7c9d34d18 100644 --- a/tests/Integration/Api/Client/Server/Schedule/ExecuteScheduleTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/ExecuteScheduleTest.php @@ -15,7 +15,6 @@ class ExecuteScheduleTest extends ClientApiIntegrationTestCase /** * Test that a schedule can be executed and is updated in the database correctly. * - * @param array $permissions * @dataProvider permissionsDataProvider */ public function testScheduleIsExecutedRightAway(array $permissions) @@ -25,7 +24,7 @@ class ExecuteScheduleTest extends ClientApiIntegrationTestCase Bus::fake(); /** @var \Pterodactyl\Models\Schedule $schedule */ - $schedule = factory(Schedule::class)->create([ + $schedule = Schedule::factory()->create([ 'server_id' => $server->id, ]); @@ -35,7 +34,7 @@ class ExecuteScheduleTest extends ClientApiIntegrationTestCase $response->assertJsonPath('errors.0.detail', 'Cannot process schedule for task execution: no tasks are registered.'); /** @var \Pterodactyl\Models\Task $task */ - $task = factory(Task::class)->create([ + $task = Task::factory()->create([ 'schedule_id' => $schedule->id, 'sequence_id' => 1, 'time_offset' => 2, @@ -60,12 +59,12 @@ class ExecuteScheduleTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount(); /** @var \Pterodactyl\Models\Schedule $schedule */ - $schedule = factory(Schedule::class)->create([ + $schedule = Schedule::factory()->create([ 'server_id' => $server->id, 'is_active' => false, ]); - $response = $this->actingAs($user)->postJson($this->link($schedule, "/execute")); + $response = $this->actingAs($user)->postJson($this->link($schedule, '/execute')); $response->assertStatus(Response::HTTP_BAD_REQUEST); $response->assertJsonPath('errors.0.code', 'BadRequestHttpException'); @@ -80,14 +79,11 @@ class ExecuteScheduleTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount([Permission::ACTION_SCHEDULE_CREATE]); /** @var \Pterodactyl\Models\Schedule $schedule */ - $schedule = factory(Schedule::class)->create(['server_id' => $server->id]); + $schedule = Schedule::factory()->create(['server_id' => $server->id]); $this->actingAs($user)->postJson($this->link($schedule, '/execute'))->assertForbidden(); } - /** - * @return array - */ public function permissionsDataProvider(): array { return [[[]], [[Permission::ACTION_SCHEDULE_UPDATE]]]; diff --git a/tests/Integration/Api/Client/Server/Schedule/GetServerSchedulesTest.php b/tests/Integration/Api/Client/Server/Schedule/GetServerSchedulesTest.php index 67be3fd84..45ae92680 100644 --- a/tests/Integration/Api/Client/Server/Schedule/GetServerSchedulesTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/GetServerSchedulesTest.php @@ -24,7 +24,7 @@ class GetServerSchedulesTest extends ClientApiIntegrationTestCase * Test that schedules for a server are returned. * * @param array $permissions - * @param bool $individual + * @param bool $individual * @dataProvider permissionsDataProvider */ public function testServerSchedulesAreReturned($permissions, $individual) @@ -32,9 +32,9 @@ class GetServerSchedulesTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount($permissions); /** @var \Pterodactyl\Models\Schedule $schedule */ - $schedule = factory(Schedule::class)->create(['server_id' => $server->id]); + $schedule = Schedule::factory()->create(['server_id' => $server->id]); /** @var \Pterodactyl\Models\Task $task */ - $task = factory(Task::class)->create(['schedule_id' => $schedule->id, 'sequence_id' => 1, 'time_offset' => 0]); + $task = Task::factory()->create(['schedule_id' => $schedule->id, 'sequence_id' => 1, 'time_offset' => 0]); $response = $this->actingAs($user) ->getJson( @@ -45,7 +45,7 @@ class GetServerSchedulesTest extends ClientApiIntegrationTestCase ->assertOk(); $prefix = $individual ? '' : 'data.0.'; - if (! $individual) { + if (!$individual) { $response->assertJsonCount(1, 'data'); } @@ -66,7 +66,7 @@ class GetServerSchedulesTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount(); [, $server2] = $this->generateTestAccount(['user_id' => $user->id]); - $schedule = factory(Schedule::class)->create(['server_id' => $server2->id]); + $schedule = Schedule::factory()->create(['server_id' => $server2->id]); $this->actingAs($user) ->getJson("/api/client/servers/{$server->uuid}/schedules/{$schedule->id}") @@ -84,16 +84,13 @@ class GetServerSchedulesTest extends ClientApiIntegrationTestCase ->getJson("/api/client/servers/{$server->uuid}/schedules") ->assertForbidden(); - $schedule = factory(Schedule::class)->create(['server_id' => $server->id]); + $schedule = Schedule::factory()->create(['server_id' => $server->id]); $this->actingAs($user) ->getJson("/api/client/servers/{$server->uuid}/schedules/{$schedule->id}") ->assertForbidden(); } - /** - * @return array - */ public function permissionsDataProvider(): array { return [ diff --git a/tests/Integration/Api/Client/Server/Schedule/ScheduleAuthorizationTest.php b/tests/Integration/Api/Client/Server/Schedule/ScheduleAuthorizationTest.php new file mode 100644 index 000000000..223e9a673 --- /dev/null +++ b/tests/Integration/Api/Client/Server/Schedule/ScheduleAuthorizationTest.php @@ -0,0 +1,70 @@ +generateTestAccount(); + // Will be a subuser of $server2. + $server2 = $this->createServerModel(); + // And as no access to $server3. + $server3 = $this->createServerModel(); + + // Set the API $user as a subuser of server 2, but with no permissions + // to do anything with the schedules for that server. + Subuser::factory()->create(['server_id' => $server2->id, 'user_id' => $user->id]); + + $schedule1 = Schedule::factory()->create(['server_id' => $server1->id]); + $schedule2 = Schedule::factory()->create(['server_id' => $server2->id]); + $schedule3 = Schedule::factory()->create(['server_id' => $server3->id]); + + // This is the only valid call for this test, accessing the schedule for the same + // server that the API user is the owner of. + $response = $this->actingAs($user)->json($method, $this->link($server1, '/schedules/' . $schedule1->id . $endpoint)); + $this->assertTrue($response->status() <= 204 || $response->status() === 400 || $response->status() === 422); + + // This request fails because the schedule is valid for that server but the user + // making the request is not authorized to perform that action. + $this->actingAs($user)->json($method, $this->link($server2, '/schedules/' . $schedule2->id . $endpoint))->assertForbidden(); + + // Both of these should report a 404 error due to the schedules being linked to + // servers that are not the same as the server in the request, or are assigned + // to a server for which the user making the request has no access to. + $this->actingAs($user)->json($method, $this->link($server1, '/schedules/' . $schedule2->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server1, '/schedules/' . $schedule3->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server2, '/schedules/' . $schedule3->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server3, '/schedules/' . $schedule3->id . $endpoint))->assertNotFound(); + } + + /** + * @return \string[][] + */ + public function methodDataProvider(): array + { + return [ + ['GET', ''], + ['POST', ''], + ['DELETE', ''], + ['POST', '/execute'], + ['POST', '/tasks'], + ]; + } +} diff --git a/tests/Integration/Api/Client/Server/Schedule/UpdateServerScheduleTest.php b/tests/Integration/Api/Client/Server/Schedule/UpdateServerScheduleTest.php index ec60a4137..e99486d4e 100644 --- a/tests/Integration/Api/Client/Server/Schedule/UpdateServerScheduleTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/UpdateServerScheduleTest.php @@ -19,6 +19,7 @@ class UpdateServerScheduleTest extends ClientApiIntegrationTestCase 'minute' => '5', 'hour' => '*', 'day_of_week' => '*', + 'month' => '*', 'day_of_month' => '*', 'is_active' => false, ]; @@ -34,8 +35,8 @@ class UpdateServerScheduleTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount($permissions); /** @var \Pterodactyl\Models\Schedule $schedule */ - $schedule = factory(Schedule::class)->create(['server_id' => $server->id]); - $expected = Utilities::getScheduleNextRunDate('5', '*', '*', '*'); + $schedule = Schedule::factory()->create(['server_id' => $server->id]); + $expected = Utilities::getScheduleNextRunDate('5', '*', '*', '*', '*'); $response = $this->actingAs($user) ->postJson("/api/client/servers/{$server->uuid}/schedules/{$schedule->id}", $this->updateData); @@ -59,7 +60,7 @@ class UpdateServerScheduleTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount(); [, $server2] = $this->generateTestAccount(['user_id' => $user->id]); - $schedule = factory(Schedule::class)->create(['server_id' => $server2->id]); + $schedule = Schedule::factory()->create(['server_id' => $server2->id]); $this->actingAs($user) ->postJson("/api/client/servers/{$server->uuid}/schedules/{$schedule->id}") @@ -74,7 +75,7 @@ class UpdateServerScheduleTest extends ClientApiIntegrationTestCase { [$user, $server] = $this->generateTestAccount([Permission::ACTION_SCHEDULE_CREATE]); - $schedule = factory(Schedule::class)->create(['server_id' => $server->id]); + $schedule = Schedule::factory()->create(['server_id' => $server->id]); $this->actingAs($user) ->postJson("/api/client/servers/{$server->uuid}/schedules/{$schedule->id}") @@ -92,7 +93,7 @@ class UpdateServerScheduleTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount(); /** @var \Pterodactyl\Models\Schedule $schedule */ - $schedule = factory(Schedule::class)->create([ + $schedule = Schedule::factory()->create([ 'server_id' => $server->id, 'is_active' => true, 'is_processing' => true, @@ -111,9 +112,6 @@ class UpdateServerScheduleTest extends ClientApiIntegrationTestCase $this->assertFalse($schedule->is_processing); } - /** - * @return array - */ public function permissionsDataProvider(): array { return [[[]], [[Permission::ACTION_SCHEDULE_UPDATE]]]; diff --git a/tests/Integration/Api/Client/Server/ScheduleTask/CreateServerScheduleTaskTest.php b/tests/Integration/Api/Client/Server/ScheduleTask/CreateServerScheduleTaskTest.php index 9f263acd7..6add744cd 100644 --- a/tests/Integration/Api/Client/Server/ScheduleTask/CreateServerScheduleTaskTest.php +++ b/tests/Integration/Api/Client/Server/ScheduleTask/CreateServerScheduleTaskTest.php @@ -21,7 +21,7 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount($permissions); /** @var \Pterodactyl\Models\Schedule $schedule */ - $schedule = factory(Schedule::class)->create(['server_id' => $server->id]); + $schedule = Schedule::factory()->create(['server_id' => $server->id]); $this->assertEmpty($schedule->tasks); $response = $this->actingAs($user)->postJson($this->link($schedule, '/tasks'), [ @@ -51,7 +51,7 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount(); /** @var \Pterodactyl\Models\Schedule $schedule */ - $schedule = factory(Schedule::class)->create(['server_id' => $server->id]); + $schedule = Schedule::factory()->create(['server_id' => $server->id]); $response = $this->actingAs($user)->postJson($this->link($schedule, '/tasks'))->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY); @@ -96,7 +96,7 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount(); /** @var \Pterodactyl\Models\Schedule $schedule */ - $schedule = factory(Schedule::class)->create(['server_id' => $server->id]); + $schedule = Schedule::factory()->create(['server_id' => $server->id]); $this->actingAs($user)->postJson($this->link($schedule, '/tasks'), [ 'action' => 'backup', @@ -121,8 +121,8 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount(); /** @var \Pterodactyl\Models\Schedule $schedule */ - $schedule = factory(Schedule::class)->create(['server_id' => $server->id]); - factory(Task::class)->times(2)->create(['schedule_id' => $schedule->id]); + $schedule = Schedule::factory()->create(['server_id' => $server->id]); + Task::factory()->times(2)->create(['schedule_id' => $schedule->id]); $this->actingAs($user)->postJson($this->link($schedule, '/tasks'), [ 'action' => 'command', @@ -144,7 +144,7 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase [, $server2] = $this->generateTestAccount(['user_id' => $user->id]); /** @var \Pterodactyl\Models\Schedule $schedule */ - $schedule = factory(Schedule::class)->create(['server_id' => $server2->id]); + $schedule = Schedule::factory()->create(['server_id' => $server2->id]); $this->actingAs($user) ->postJson("/api/client/servers/{$server->uuid}/schedules/{$schedule->id}/tasks") @@ -160,16 +160,13 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount([Permission::ACTION_SCHEDULE_CREATE]); /** @var \Pterodactyl\Models\Schedule $schedule */ - $schedule = factory(Schedule::class)->create(['server_id' => $server->id]); + $schedule = Schedule::factory()->create(['server_id' => $server->id]); $this->actingAs($user) ->postJson($this->link($schedule, '/tasks')) ->assertForbidden(); } - /** - * @return array - */ public function permissionsDataProvider(): array { return [[[]], [[Permission::ACTION_SCHEDULE_UPDATE]]]; diff --git a/tests/Integration/Api/Client/Server/ScheduleTask/DeleteScheduleTaskTest.php b/tests/Integration/Api/Client/Server/ScheduleTask/DeleteScheduleTaskTest.php index ef3e1dee4..dc9b3fd42 100644 --- a/tests/Integration/Api/Client/Server/ScheduleTask/DeleteScheduleTaskTest.php +++ b/tests/Integration/Api/Client/Server/ScheduleTask/DeleteScheduleTaskTest.php @@ -19,8 +19,8 @@ class DeleteScheduleTaskTest extends ClientApiIntegrationTestCase $server2 = $this->createServerModel(); [$user] = $this->generateTestAccount(); - $schedule = factory(Schedule::class)->create(['server_id' => $server2->id]); - $task = factory(Task::class)->create(['schedule_id' => $schedule->id]); + $schedule = Schedule::factory()->create(['server_id' => $server2->id]); + $task = Task::factory()->create(['schedule_id' => $schedule->id]); $this->actingAs($user)->deleteJson($this->link($task))->assertNotFound(); } @@ -33,9 +33,9 @@ class DeleteScheduleTaskTest extends ClientApiIntegrationTestCase { [$user, $server] = $this->generateTestAccount(); - $schedule = factory(Schedule::class)->create(['server_id' => $server->id]); - $schedule2 = factory(Schedule::class)->create(['server_id' => $server->id]); - $task = factory(Task::class)->create(['schedule_id' => $schedule->id]); + $schedule = Schedule::factory()->create(['server_id' => $server->id]); + $schedule2 = Schedule::factory()->create(['server_id' => $server->id]); + $task = Task::factory()->create(['schedule_id' => $schedule->id]); $this->actingAs($user)->deleteJson("/api/client/servers/{$server->uuid}/schedules/{$schedule2->id}/tasks/{$task->id}")->assertNotFound(); } @@ -47,12 +47,12 @@ class DeleteScheduleTaskTest extends ClientApiIntegrationTestCase { [$user, $server] = $this->generateTestAccount([Permission::ACTION_SCHEDULE_CREATE]); - $schedule = factory(Schedule::class)->create(['server_id' => $server->id]); - $task = factory(Task::class)->create(['schedule_id' => $schedule->id]); + $schedule = Schedule::factory()->create(['server_id' => $server->id]); + $task = Task::factory()->create(['schedule_id' => $schedule->id]); $this->actingAs($user)->deleteJson($this->link($task))->assertForbidden(); - $user2 = factory(User::class)->create(); + $user2 = User::factory()->create(); $this->actingAs($user2)->deleteJson($this->link($task))->assertNotFound(); } @@ -65,12 +65,12 @@ class DeleteScheduleTaskTest extends ClientApiIntegrationTestCase { [$user, $server] = $this->generateTestAccount(); - $schedule = factory(Schedule::class)->create(['server_id' => $server->id]); + $schedule = Schedule::factory()->create(['server_id' => $server->id]); $tasks = [ - factory(Task::class)->create(['schedule_id' => $schedule->id, 'sequence_id' => 1]), - factory(Task::class)->create(['schedule_id' => $schedule->id, 'sequence_id' => 2]), - factory(Task::class)->create(['schedule_id' => $schedule->id, 'sequence_id' => 3]), - factory(Task::class)->create(['schedule_id' => $schedule->id, 'sequence_id' => 4]), + Task::factory()->create(['schedule_id' => $schedule->id, 'sequence_id' => 1]), + Task::factory()->create(['schedule_id' => $schedule->id, 'sequence_id' => 2]), + Task::factory()->create(['schedule_id' => $schedule->id, 'sequence_id' => 3]), + Task::factory()->create(['schedule_id' => $schedule->id, 'sequence_id' => 4]), ]; $response = $this->actingAs($user)->deleteJson($this->link($tasks[1])); diff --git a/tests/Integration/Api/Client/Server/SettingsControllerTest.php b/tests/Integration/Api/Client/Server/SettingsControllerTest.php index dc52601b9..edd4dc543 100644 --- a/tests/Integration/Api/Client/Server/SettingsControllerTest.php +++ b/tests/Integration/Api/Client/Server/SettingsControllerTest.php @@ -110,17 +110,11 @@ class SettingsControllerTest extends ClientApiIntegrationTestCase $this->assertTrue($server->isInstalled()); } - /** - * @return array - */ public function renamePermissionsDataProvider(): array { return [[[]], [[Permission::ACTION_SETTINGS_RENAME]]]; } - /** - * @return array - */ public function reinstallPermissionsDataProvider(): array { return [[[]], [[Permission::ACTION_SETTINGS_REINSTALL]]]; diff --git a/tests/Integration/Api/Client/Server/Startup/GetStartupAndVariablesTest.php b/tests/Integration/Api/Client/Server/Startup/GetStartupAndVariablesTest.php index 6daa05958..09a6abd02 100644 --- a/tests/Integration/Api/Client/Server/Startup/GetStartupAndVariablesTest.php +++ b/tests/Integration/Api/Client/Server/Startup/GetStartupAndVariablesTest.php @@ -34,7 +34,7 @@ class GetStartupAndVariablesTest extends ClientApiIntegrationTestCase ])->save(); $server = $server->refresh(); - $response = $this->actingAs($user)->getJson($this->link($server) . "/startup"); + $response = $this->actingAs($user)->getJson($this->link($server) . '/startup'); $response->assertOk(); $response->assertJsonPath('meta.startup_command', 'java bungeecord.jar --version [hidden]'); @@ -53,10 +53,10 @@ class GetStartupAndVariablesTest extends ClientApiIntegrationTestCase public function testStartupDataIsNotReturnedWithoutPermission() { [$user, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]); - $this->actingAs($user)->getJson($this->link($server) . "/startup")->assertForbidden(); + $this->actingAs($user)->getJson($this->link($server) . '/startup')->assertForbidden(); - $user2 = factory(User::class)->create(); - $this->actingAs($user2)->getJson($this->link($server) . "/startup")->assertNotFound(); + $user2 = User::factory()->create(); + $this->actingAs($user2)->getJson($this->link($server) . '/startup')->assertNotFound(); } /** diff --git a/tests/Integration/Api/Client/Server/Startup/UpdateStartupVariableTest.php b/tests/Integration/Api/Client/Server/Startup/UpdateStartupVariableTest.php index 3ed1a89cc..0e5e421c1 100644 --- a/tests/Integration/Api/Client/Server/Startup/UpdateStartupVariableTest.php +++ b/tests/Integration/Api/Client/Server/Startup/UpdateStartupVariableTest.php @@ -49,7 +49,6 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase * Test that variables that are either not user_viewable, or not user_editable, cannot be * updated via this endpoint. * - * @param array $permissions * @dataProvider permissionsDataProvider */ public function testStartupVariableCannotBeUpdatedIfNotUserViewableOrEditable(array $permissions) @@ -145,10 +144,10 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase public function testStartupVariableCannotBeUpdatedIfNotUserViewable() { [$user, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]); - $this->actingAs($user)->putJson($this->link($server) . "/startup/variable")->assertForbidden(); + $this->actingAs($user)->putJson($this->link($server) . '/startup/variable')->assertForbidden(); - $user2 = factory(User::class)->create(); - $this->actingAs($user2)->putJson($this->link($server) . "/startup/variable")->assertNotFound(); + $user2 = User::factory()->create(); + $this->actingAs($user2)->putJson($this->link($server) . '/startup/variable')->assertNotFound(); } /** diff --git a/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php b/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php index 3a1f8bc6b..94c9b17ef 100644 --- a/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php +++ b/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php @@ -24,7 +24,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase { [$user, $server] = $this->generateTestAccount($permissions); - $response = $this->actingAs($user)->postJson($this->link($server) . "/users", [ + $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ 'email' => $email = $this->faker->email, 'permissions' => [ Permission::ACTION_USER_CREATE, @@ -61,7 +61,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase Permission::ACTION_CONTROL_CONSOLE, ]); - $response = $this->actingAs($user)->postJson($this->link($server) . "/users", [ + $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ 'email' => $email = $this->faker->email, 'permissions' => [ Permission::ACTION_USER_CREATE, @@ -83,7 +83,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase $email = str_repeat(Str::random(20), 9) . '1@gmail.com'; // 191 is the hard limit for the column in MySQL. - $response = $this->actingAs($user)->postJson($this->link($server) . "/users", [ + $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ 'email' => $email, 'permissions' => [ Permission::ACTION_USER_CREATE, @@ -92,7 +92,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase $response->assertOk(); - $response = $this->actingAs($user)->postJson($this->link($server) . "/users", [ + $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ 'email' => $email . '.au', 'permissions' => [ Permission::ACTION_USER_CREATE, @@ -113,9 +113,9 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount(); /** @var \Pterodactyl\Models\User $existing */ - $existing = factory(User::class)->create(['email' => $this->faker->email]); + $existing = User::factory()->create(['email' => $this->faker->email]); - $response = $this->actingAs($user)->postJson($this->link($server) . "/users", [ + $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ 'email' => $existing->email, 'permissions' => [ Permission::ACTION_USER_CREATE, @@ -135,7 +135,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase { [$user, $server] = $this->generateTestAccount(); - $response = $this->actingAs($user)->postJson($this->link($server) . "/users", [ + $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ 'email' => $email = $this->faker->email, 'permissions' => [ Permission::ACTION_USER_CREATE, @@ -144,7 +144,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase $response->assertOk(); - $response = $this->actingAs($user)->postJson($this->link($server) . "/users", [ + $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ 'email' => $email, 'permissions' => [ Permission::ACTION_USER_CREATE, @@ -156,9 +156,6 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase $response->assertJsonPath('errors.0.detail', 'A user with that email address is already assigned as a subuser for this server.'); } - /** - * @return array - */ public function permissionsDataProvider(): array { return [[[]], [[Permission::ACTION_USER_CREATE]]]; diff --git a/tests/Integration/Api/Client/Server/Subuser/DeleteSubuserTest.php b/tests/Integration/Api/Client/Server/Subuser/DeleteSubuserTest.php index 5810c73b4..eeb248510 100644 --- a/tests/Integration/Api/Client/Server/Subuser/DeleteSubuserTest.php +++ b/tests/Integration/Api/Client/Server/Subuser/DeleteSubuserTest.php @@ -30,13 +30,13 @@ class DeleteSubuserTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount(); /** @var \Pterodactyl\Models\User $differentUser */ - $differentUser = factory(User::class)->create(); + $differentUser = User::factory()->create(); // Generate a UUID that lines up with a user in the database if it were to be cast to an int. - $uuid = $differentUser->id . str_repeat('a', strlen((string)$differentUser->id)) . substr(Uuid::uuid4()->toString(), 8); + $uuid = $differentUser->id . str_repeat('a', strlen((string) $differentUser->id)) . substr(Uuid::uuid4()->toString(), 8); /** @var \Pterodactyl\Models\User $subuser */ - $subuser = factory(User::class)->create(['uuid' => $uuid]); + $subuser = User::factory()->create(['uuid' => $uuid]); Subuser::query()->forceCreate([ 'user_id' => $subuser->id, @@ -52,7 +52,7 @@ class DeleteSubuserTest extends ClientApiIntegrationTestCase // anything in the database. $uuid = '18180000' . substr(Uuid::uuid4()->toString(), 8); /** @var \Pterodactyl\Models\User $subuser */ - $subuser = factory(User::class)->create(['uuid' => $uuid]); + $subuser = User::factory()->create(['uuid' => $uuid]); Subuser::query()->forceCreate([ 'user_id' => $subuser->id, diff --git a/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php b/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php new file mode 100644 index 000000000..f95e06f72 --- /dev/null +++ b/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php @@ -0,0 +1,60 @@ +create(); + + // The API $user is the owner of $server1. + [$user, $server1] = $this->generateTestAccount(); + // Will be a subuser of $server2. + $server2 = $this->createServerModel(); + // And as no access to $server3. + $server3 = $this->createServerModel(); + + // Set the API $user as a subuser of server 2, but with no permissions + // to do anything with the subusers for that server. + Subuser::factory()->create(['server_id' => $server2->id, 'user_id' => $user->id]); + + Subuser::factory()->create(['server_id' => $server1->id, 'user_id' => $internal->id]); + Subuser::factory()->create(['server_id' => $server2->id, 'user_id' => $internal->id]); + Subuser::factory()->create(['server_id' => $server3->id, 'user_id' => $internal->id]); + + $this->instance(DaemonServerRepository::class, $mock = Mockery::mock(DaemonServerRepository::class)); + if ($method === 'DELETE') { + $mock->expects('setServer->revokeUserJTI')->with($internal->id)->andReturnUndefined(); + } + + // This route is acceptable since they're accessing a subuser on their own server. + $this->actingAs($user)->json($method, $this->link($server1, '/users/' . $internal->uuid))->assertStatus($method === 'POST' ? 422 : ($method === 'DELETE' ? 204 : 200)); + + // This route can be revealed since the subuser belongs to the correct server, but + // errors out with a 403 since $user does not have the right permissions for this. + $this->actingAs($user)->json($method, $this->link($server2, '/users/' . $internal->uuid))->assertForbidden(); + $this->actingAs($user)->json($method, $this->link($server3, '/users/' . $internal->uuid))->assertNotFound(); + } + + /** + * @return \string[][] + */ + public function methodDataProvider(): array + { + return [['GET'], ['POST'], ['DELETE']]; + } +} diff --git a/tests/Integration/Api/Client/Server/WebsocketControllerTest.php b/tests/Integration/Api/Client/Server/WebsocketControllerTest.php index e39f3ba00..d6c2119b6 100644 --- a/tests/Integration/Api/Client/Server/WebsocketControllerTest.php +++ b/tests/Integration/Api/Client/Server/WebsocketControllerTest.php @@ -2,12 +2,13 @@ namespace Pterodactyl\Tests\Integration\Api\Client\Server; -use Carbon\Carbon; -use Lcobucci\JWT\Parser; use Carbon\CarbonImmutable; use Illuminate\Http\Response; +use Lcobucci\JWT\Configuration; use Pterodactyl\Models\Permission; use Lcobucci\JWT\Signer\Hmac\Sha256; +use Lcobucci\JWT\Signer\Key\InMemory; +use Lcobucci\JWT\Validation\Constraint\SignedWith; use Pterodactyl\Tests\Integration\Api\Client\ClientApiIntegrationTestCase; class WebsocketControllerTest extends ClientApiIntegrationTestCase @@ -32,8 +33,6 @@ class WebsocketControllerTest extends ClientApiIntegrationTestCase */ public function testJwtAndWebsocketUrlAreReturnedForServerOwner() { - CarbonImmutable::setTestNow(Carbon::now()); - /** @var \Pterodactyl\Models\User $user */ /** @var \Pterodactyl\Models\Server $server */ [$user, $server] = $this->generateTestAccount(); @@ -51,22 +50,33 @@ class WebsocketControllerTest extends ClientApiIntegrationTestCase $this->assertStringStartsWith('wss://', $connection, 'Failed asserting that websocket connection address has expected "wss://" prefix.'); $this->assertStringEndsWith("/api/servers/{$server->uuid}/ws", $connection, 'Failed asserting that websocket connection address uses expected Wings endpoint.'); - $token = (new Parser)->parse($response->json('data.token')); + $config = Configuration::forSymmetricSigner(new Sha256(), $key = InMemory::plainText($server->node->getDecryptedKey())); + $config->setValidationConstraints(new SignedWith(new Sha256(), $key)); + /** @var \Lcobucci\JWT\Token\Plain $token */ + $token = $config->parser()->parse($response->json('data.token')); $this->assertTrue( - $token->verify(new Sha256, $server->node->getDecryptedKey()), + $config->validator()->validate($token, ...$config->validationConstraints()), 'Failed to validate that the JWT data returned was signed using the Node\'s secret key.' ); + // The way we generate times for the JWT will truncate the microseconds from the + // time, but CarbonImmutable::now() will include them, thus causing test failures. + // + // This little chunk of logic just strips those out by generating a new CarbonImmutable + // instance from the current timestamp, which is how the JWT works. We also need to + // switch to UTC here for consistency. + $expect = CarbonImmutable::createFromTimestamp(CarbonImmutable::now()->getTimestamp())->timezone('UTC'); + // Check that the claims are generated correctly. - $this->assertSame(config('app.url'), $token->getClaim('iss')); - $this->assertSame($server->node->getConnectionAddress(), $token->getClaim('aud')); - $this->assertSame(CarbonImmutable::now()->getTimestamp(), $token->getClaim('iat')); - $this->assertSame(CarbonImmutable::now()->subMinutes(5)->getTimestamp(), $token->getClaim('nbf')); - $this->assertSame(CarbonImmutable::now()->addMinutes(10)->getTimestamp(), $token->getClaim('exp')); - $this->assertSame($user->id, $token->getClaim('user_id')); - $this->assertSame($server->uuid, $token->getClaim('server_uuid')); - $this->assertSame(['*'], $token->getClaim('permissions')); + $this->assertTrue($token->hasBeenIssuedBy(config('app.url'))); + $this->assertTrue($token->isPermittedFor($server->node->getConnectionAddress())); + $this->assertEquals($expect, $token->claims()->get('iat')); + $this->assertEquals($expect->subMinutes(5), $token->claims()->get('nbf')); + $this->assertEquals($expect->addMinutes(10), $token->claims()->get('exp')); + $this->assertSame($user->id, $token->claims()->get('user_id')); + $this->assertSame($server->uuid, $token->claims()->get('server_uuid')); + $this->assertSame(['*'], $token->claims()->get('permissions')); } /** @@ -85,14 +95,17 @@ class WebsocketControllerTest extends ClientApiIntegrationTestCase $response->assertOk(); $response->assertJsonStructure(['data' => ['token', 'socket']]); - $token = (new Parser)->parse($response->json('data.token')); + $config = Configuration::forSymmetricSigner(new Sha256(), $key = InMemory::plainText($server->node->getDecryptedKey())); + $config->setValidationConstraints(new SignedWith(new Sha256(), $key)); + /** @var \Lcobucci\JWT\Token\Plain $token */ + $token = $config->parser()->parse($response->json('data.token')); $this->assertTrue( - $token->verify(new Sha256, $server->node->getDecryptedKey()), + $config->validator()->validate($token, ...$config->validationConstraints()), 'Failed to validate that the JWT data returned was signed using the Node\'s secret key.' ); // Check that the claims are generated correctly. - $this->assertSame($permissions, $token->getClaim('permissions')); + $this->assertSame($permissions, $token->claims()->get('permissions')); } } diff --git a/tests/Integration/Api/Client/TwoFactorControllerTest.php b/tests/Integration/Api/Client/TwoFactorControllerTest.php index 1c9b467f6..8af7e31a8 100644 --- a/tests/Integration/Api/Client/TwoFactorControllerTest.php +++ b/tests/Integration/Api/Client/TwoFactorControllerTest.php @@ -18,7 +18,7 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase public function testTwoFactorImageDataIsReturned() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(['use_totp' => false]); + $user = User::factory()->create(['use_totp' => false]); $this->assertFalse($user->use_totp); $this->assertEmpty($user->totp_secret); @@ -42,7 +42,7 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase public function testErrorIsReturnedWhenTwoFactorIsAlreadyEnabled() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(['use_totp' => true]); + $user = User::factory()->create(['use_totp' => true]); $response = $this->actingAs($user)->getJson('/api/client/account/two-factor'); @@ -57,7 +57,7 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase public function testValidationErrorIsReturnedIfInvalidDataIsPassedToEnabled2FA() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(['use_totp' => false]); + $user = User::factory()->create(['use_totp' => false]); $response = $this->actingAs($user)->postJson('/api/client/account/two-factor', [ 'code' => '', @@ -74,7 +74,7 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase public function testTwoFactorCanBeEnabledOnAccount() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(['use_totp' => false]); + $user = User::factory()->create(['use_totp' => false]); // Make the initial call to get the account setup for 2FA. $this->actingAs($user)->getJson('/api/client/account/two-factor')->assertOk(); @@ -111,9 +111,7 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase } } - throw new ExpectationFailedException( - sprintf('Failed asserting that token [%s] exists as a hashed value in recovery_tokens table.', $raw) - ); + throw new ExpectationFailedException(sprintf('Failed asserting that token [%s] exists as a hashed value in recovery_tokens table.', $raw)); } } @@ -126,7 +124,7 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase Carbon::setTestNow(Carbon::now()); /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(['use_totp' => true]); + $user = User::factory()->create(['use_totp' => true]); $response = $this->actingAs($user)->deleteJson('/api/client/account/two-factor', [ 'password' => 'invalid', @@ -157,7 +155,7 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase Carbon::setTestNow(Carbon::now()); /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(['use_totp' => false]); + $user = User::factory()->create(['use_totp' => false]); $response = $this->actingAs($user)->deleteJson('/api/client/account/two-factor', [ 'password' => 'password', diff --git a/tests/Integration/Http/Controllers/Admin/UserControllerTest.php b/tests/Integration/Http/Controllers/Admin/UserControllerTest.php index a29844ca5..d10107833 100644 --- a/tests/Integration/Http/Controllers/Admin/UserControllerTest.php +++ b/tests/Integration/Http/Controllers/Admin/UserControllerTest.php @@ -7,8 +7,8 @@ use Illuminate\Http\Request; use Pterodactyl\Models\User; use Pterodactyl\Models\Subuser; use Illuminate\Pagination\LengthAwarePaginator; -use Pterodactyl\Tests\Integration\IntegrationTestCase; use Pterodactyl\Http\Controllers\Admin\UserController; +use Pterodactyl\Tests\Integration\IntegrationTestCase; class UserControllerTest extends IntegrationTestCase { @@ -23,8 +23,8 @@ class UserControllerTest extends IntegrationTestCase { $unique = Str::random(16); $users = [ - factory(User::class)->create(['username' => $unique . '_1']), - factory(User::class)->create(['username' => $unique . '_2']), + User::factory()->create(['username' => $unique . '_1']), + User::factory()->create(['username' => $unique . '_2']), ]; $servers = [ @@ -51,9 +51,9 @@ class UserControllerTest extends IntegrationTestCase $response = $data['users']->items(); $this->assertCount(2, $response); $this->assertInstanceOf(User::class, $response[0]); - $this->assertSame(3, (int)$response[0]->servers_count); - $this->assertSame(0, (int)$response[0]->subuser_of_count); - $this->assertSame(1, (int)$response[1]->servers_count); - $this->assertSame(2, (int)$response[1]->subuser_of_count); + $this->assertSame(3, (int) $response[0]->servers_count); + $this->assertSame(0, (int) $response[0]->subuser_of_count); + $this->assertSame(1, (int) $response[1]->servers_count); + $this->assertSame(2, (int) $response[1]->subuser_of_count); } } diff --git a/tests/Integration/IntegrationTestCase.php b/tests/Integration/IntegrationTestCase.php index ee7229660..f12eaaef1 100644 --- a/tests/Integration/IntegrationTestCase.php +++ b/tests/Integration/IntegrationTestCase.php @@ -2,10 +2,10 @@ namespace Pterodactyl\Tests\Integration; -use Tests\TestCase; -use Cake\Chronos\Chronos; +use Carbon\CarbonImmutable; +use Pterodactyl\Tests\TestCase; use Illuminate\Database\Eloquent\Model; -use Tests\Traits\Integration\CreatesTestModels; +use Pterodactyl\Tests\Traits\Integration\CreatesTestModels; use Pterodactyl\Transformers\Api\Application\BaseTransformer; abstract class IntegrationTestCase extends TestCase @@ -36,13 +36,10 @@ abstract class IntegrationTestCase extends TestCase /** * Return an ISO-8601 formatted timestamp to use in the API response. - * - * @param string $timestamp - * @return string */ protected function formatTimestamp(string $timestamp): string { - return Chronos::createFromFormat(Chronos::DEFAULT_TO_STRING_FORMAT, $timestamp) + return CarbonImmutable::createFromFormat(CarbonImmutable::DEFAULT_TO_STRING_FORMAT, $timestamp) ->setTimezone(BaseTransformer::RESPONSE_TIMEZONE) ->toIso8601String(); } diff --git a/tests/Integration/Services/Allocations/FindAssignableAllocationServiceTest.php b/tests/Integration/Services/Allocations/FindAssignableAllocationServiceTest.php index ce49a1873..c3b88e2cf 100644 --- a/tests/Integration/Services/Allocations/FindAssignableAllocationServiceTest.php +++ b/tests/Integration/Services/Allocations/FindAssignableAllocationServiceTest.php @@ -32,7 +32,7 @@ class FindAssignableAllocationServiceTest extends IntegrationTestCase { $server = $this->createServerModel(); - $created = factory(Allocation::class)->create([ + $created = Allocation::factory()->create([ 'node_id' => $server->node_id, 'ip' => $server->allocation->ip, ]); @@ -74,7 +74,7 @@ class FindAssignableAllocationServiceTest extends IntegrationTestCase config()->set('pterodactyl.client_features.allocations.range_start', 5000); config()->set('pterodactyl.client_features.allocations.range_end', 5001); - factory(Allocation::class)->create([ + Allocation::factory()->create([ 'server_id' => $server2->id, 'node_id' => $server->node_id, 'ip' => $server->allocation->ip, @@ -92,8 +92,8 @@ class FindAssignableAllocationServiceTest extends IntegrationTestCase config()->set('pterodactyl.client_features.allocations.range_start', 5000); config()->set('pterodactyl.client_features.allocations.range_end', 5005); - for ($i = 5000; $i <= 5005; $i++) { - factory(Allocation::class)->create([ + for ($i = 5000; $i <= 5005; ++$i) { + Allocation::factory()->create([ 'ip' => $server->allocation->ip, 'port' => $i, 'node_id' => $server->node_id, @@ -115,7 +115,7 @@ class FindAssignableAllocationServiceTest extends IntegrationTestCase { $server = $this->createServerModel(); - factory(Allocation::class)->times(5)->create(['node_id' => $server->node_id]); + Allocation::factory()->times(5)->create(['node_id' => $server->node_id]); $this->expectException(NoAutoAllocationSpaceAvailableException::class); $this->expectExceptionMessage('Cannot assign additional allocation: no more space available on node.'); diff --git a/tests/Integration/Services/Databases/DatabaseManagementServiceTest.php b/tests/Integration/Services/Databases/DatabaseManagementServiceTest.php index b5e1565a2..e354e0299 100644 --- a/tests/Integration/Services/Databases/DatabaseManagementServiceTest.php +++ b/tests/Integration/Services/Databases/DatabaseManagementServiceTest.php @@ -3,7 +3,6 @@ namespace Pterodactyl\Tests\Integration\Services\Databases; use Mockery; -use Exception; use BadMethodCallException; use InvalidArgumentException; use Pterodactyl\Models\Database; @@ -63,9 +62,9 @@ class DatabaseManagementServiceTest extends IntegrationTestCase public function testDatabaseCannotBeCreatedIfServerHasReachedLimit() { $server = $this->createServerModel(['database_limit' => 2]); - $host = factory(DatabaseHost::class)->create(['node_id' => $server->node_id]); + $host = DatabaseHost::factory()->create(['node_id' => $server->node_id]); - factory(Database::class)->times(2)->create(['server_id' => $server->id, 'database_host_id' => $host->id]); + Database::factory()->times(2)->create(['server_id' => $server->id, 'database_host_id' => $host->id]); $this->expectException(TooManyDatabasesException::class); @@ -96,9 +95,9 @@ class DatabaseManagementServiceTest extends IntegrationTestCase $server = $this->createServerModel(); $name = DatabaseManagementService::generateUniqueDatabaseName('soemthing', $server->id); - $host = factory(DatabaseHost::class)->create(['node_id' => $server->node_id]); - $host2 = factory(DatabaseHost::class)->create(['node_id' => $server->node_id]); - factory(Database::class)->create([ + $host = DatabaseHost::factory()->create(['node_id' => $server->node_id]); + $host2 = DatabaseHost::factory()->create(['node_id' => $server->node_id]); + Database::factory()->create([ 'database' => $name, 'database_host_id' => $host->id, 'server_id' => $server->id, @@ -125,7 +124,7 @@ class DatabaseManagementServiceTest extends IntegrationTestCase $server = $this->createServerModel(); $name = DatabaseManagementService::generateUniqueDatabaseName('soemthing', $server->id); - $host = factory(DatabaseHost::class)->create(['node_id' => $server->node_id]); + $host = DatabaseHost::factory()->create(['node_id' => $server->node_id]); $this->repository->expects('createDatabase')->with($name); @@ -167,7 +166,7 @@ class DatabaseManagementServiceTest extends IntegrationTestCase $this->assertInstanceOf(Database::class, $response); $this->assertSame($response->server_id, $server->id); - $this->assertRegExp('/^(u[\d]+_)(\w){10}$/', $username); + $this->assertMatchesRegularExpression('/^(u[\d]+_)(\w){10}$/', $username); $this->assertSame($username, $secondUsername); $this->assertSame(24, strlen($password)); @@ -183,11 +182,11 @@ class DatabaseManagementServiceTest extends IntegrationTestCase $server = $this->createServerModel(); $name = DatabaseManagementService::generateUniqueDatabaseName('soemthing', $server->id); - $host = factory(DatabaseHost::class)->create(['node_id' => $server->node_id]); + $host = DatabaseHost::factory()->create(['node_id' => $server->node_id]); - $this->repository->expects('createDatabase')->with($name)->andThrows(new BadMethodCallException); + $this->repository->expects('createDatabase')->with($name)->andThrows(new BadMethodCallException()); $this->repository->expects('dropDatabase')->with($name); - $this->repository->expects('dropUser')->withAnyArgs()->andThrows(new InvalidArgumentException); + $this->repository->expects('dropUser')->withAnyArgs()->andThrows(new InvalidArgumentException()); $this->expectException(BadMethodCallException::class); @@ -200,9 +199,6 @@ class DatabaseManagementServiceTest extends IntegrationTestCase $this->assertDatabaseMissing('databases', ['server_id' => $server->id]); } - /** - * @return array - */ public function invalidDataDataProvider(): array { return [ diff --git a/tests/Integration/Services/Databases/DeployServerDatabaseServiceTest.php b/tests/Integration/Services/Databases/DeployServerDatabaseServiceTest.php index cc66ffe8e..2d4719571 100644 --- a/tests/Integration/Services/Databases/DeployServerDatabaseServiceTest.php +++ b/tests/Integration/Services/Databases/DeployServerDatabaseServiceTest.php @@ -7,7 +7,6 @@ use Pterodactyl\Models\Node; use InvalidArgumentException; use Pterodactyl\Models\Database; use Pterodactyl\Models\DatabaseHost; -use Symfony\Component\VarDumper\Cloner\Data; use Pterodactyl\Tests\Integration\IntegrationTestCase; use Pterodactyl\Services\Databases\DatabaseManagementService; use Pterodactyl\Services\Databases\DeployServerDatabaseService; @@ -53,7 +52,7 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase $server = $this->createServerModel(); $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessageMatches('/^Expected a non-empty value\. Got: /',); + $this->expectExceptionMessageMatches('/^Expected a non-empty value\. Got: /', ); $this->getService()->handle($server, $data); } @@ -65,8 +64,8 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase { $server = $this->createServerModel(); - $node = factory(Node::class)->create(['location_id' => $server->location->id]); - factory(DatabaseHost::class)->create(['node_id' => $node->id]); + $node = Node::factory()->create(['location_id' => $server->location->id]); + DatabaseHost::factory()->create(['node_id' => $node->id]); config()->set('pterodactyl.client_features.databases.allow_random', false); @@ -100,15 +99,15 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase { $server = $this->createServerModel(); - $node = factory(Node::class)->create(['location_id' => $server->location->id]); - factory(DatabaseHost::class)->create(['node_id' => $node->id]); - $host = factory(DatabaseHost::class)->create(['node_id' => $server->node_id]); + $node = Node::factory()->create(['location_id' => $server->location->id]); + DatabaseHost::factory()->create(['node_id' => $node->id]); + $host = DatabaseHost::factory()->create(['node_id' => $server->node_id]); $this->managementService->expects('create')->with($server, [ 'database_host_id' => $host->id, 'database' => "s{$server->id}_something", 'remote' => '%', - ])->andReturns(new Database); + ])->andReturns(new Database()); $response = $this->getService()->handle($server, [ 'database' => 'something', @@ -127,14 +126,14 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase { $server = $this->createServerModel(); - $node = factory(Node::class)->create(['location_id' => $server->location->id]); - $host = factory(DatabaseHost::class)->create(['node_id' => $node->id]); + $node = Node::factory()->create(['location_id' => $server->location->id]); + $host = DatabaseHost::factory()->create(['node_id' => $node->id]); $this->managementService->expects('create')->with($server, [ 'database_host_id' => $host->id, 'database' => "s{$server->id}_something", 'remote' => '%', - ])->andReturns(new Database); + ])->andReturns(new Database()); $response = $this->getService()->handle($server, [ 'database' => 'something', @@ -144,9 +143,6 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase $this->assertInstanceOf(Database::class, $response); } - /** - * @return array - */ public function invalidDataProvider(): array { return [ diff --git a/tests/Integration/Services/Deployment/FindViableNodesServiceTest.php b/tests/Integration/Services/Deployment/FindViableNodesServiceTest.php index abc0bd9a7..f32810cc8 100644 --- a/tests/Integration/Services/Deployment/FindViableNodesServiceTest.php +++ b/tests/Integration/Services/Deployment/FindViableNodesServiceTest.php @@ -6,8 +6,8 @@ use Exception; use Pterodactyl\Models\Node; use InvalidArgumentException; use Pterodactyl\Models\Server; -use Pterodactyl\Models\Location; use Pterodactyl\Models\Database; +use Pterodactyl\Models\Location; use Illuminate\Support\Collection; use Pterodactyl\Tests\Integration\IntegrationTestCase; use Pterodactyl\Services\Deployment\FindViableNodesService; @@ -71,24 +71,24 @@ class FindViableNodesServiceTest extends IntegrationTestCase public function testExpectedNodeIsReturnedForLocation() { /** @var \Pterodactyl\Models\Location[] $locations */ - $locations = factory(Location::class)->times(2)->create(); + $locations = Location::factory()->times(2)->create(); /** @var \Pterodactyl\Models\Node[] $nodes */ $nodes = [ // This node should never be returned once we've completed the initial test which // runs without a location filter. - factory(Node::class)->create([ + Node::factory()->create([ 'location_id' => $locations[0]->id, 'memory' => 2048, 'disk' => 1024 * 100, ]), - factory(Node::class)->create([ + Node::factory()->create([ 'location_id' => $locations[1]->id, 'memory' => 1024, 'disk' => 10240, 'disk_overallocate' => 10, ]), - factory(Node::class)->create([ + Node::factory()->create([ 'location_id' => $locations[1]->id, 'memory' => 1024 * 4, 'memory_overallocate' => 50, @@ -112,7 +112,7 @@ class FindViableNodesServiceTest extends IntegrationTestCase // Helper, I am lazy. $base = function () use ($locations) { - return $this->getService()->setLocations([ $locations[1]->id ])->setDisk(512); + return $this->getService()->setLocations([$locations[1]->id])->setDisk(512); }; // Expect that we can create this server on either node since the disk and memory diff --git a/tests/Integration/Services/Schedules/ProcessScheduleServiceTest.php b/tests/Integration/Services/Schedules/ProcessScheduleServiceTest.php index 93c793d6c..e5dd9e234 100644 --- a/tests/Integration/Services/Schedules/ProcessScheduleServiceTest.php +++ b/tests/Integration/Services/Schedules/ProcessScheduleServiceTest.php @@ -23,7 +23,7 @@ class ProcessScheduleServiceTest extends IntegrationTestCase public function testScheduleWithNoTasksReturnsException() { $server = $this->createServerModel(); - $schedule = factory(Schedule::class)->create(['server_id' => $server->id]); + $schedule = Schedule::factory()->create(['server_id' => $server->id]); $this->expectException(DisplayException::class); $this->expectExceptionMessage('Cannot process schedule for task execution: no tasks are registered.'); @@ -39,13 +39,13 @@ class ProcessScheduleServiceTest extends IntegrationTestCase $server = $this->createServerModel(); /** @var \Pterodactyl\Models\Schedule $schedule */ - $schedule = factory(Schedule::class)->create([ + $schedule = Schedule::factory()->create([ 'server_id' => $server->id, 'cron_minute' => 'hodor', // this will break the getNextRunDate() function. ]); /** @var \Pterodactyl\Models\Task $task */ - $task = factory(Task::class)->create(['schedule_id' => $schedule->id, 'sequence_id' => 1]); + $task = Task::factory()->create(['schedule_id' => $schedule->id, 'sequence_id' => 1]); $this->expectException(InvalidArgumentException::class); @@ -68,10 +68,10 @@ class ProcessScheduleServiceTest extends IntegrationTestCase $server = $this->createServerModel(); /** @var \Pterodactyl\Models\Schedule $schedule */ - $schedule = factory(Schedule::class)->create(['server_id' => $server->id]); + $schedule = Schedule::factory()->create(['server_id' => $server->id]); /** @var \Pterodactyl\Models\Task $task */ - $task = factory(Task::class)->create(['schedule_id' => $schedule->id, 'time_offset' => 10, 'sequence_id' => 1]); + $task = Task::factory()->create(['schedule_id' => $schedule->id, 'time_offset' => 10, 'sequence_id' => 1]); $this->getService()->handle($schedule, $now); @@ -100,16 +100,16 @@ class ProcessScheduleServiceTest extends IntegrationTestCase $server = $this->createServerModel(); /** @var \Pterodactyl\Models\Schedule $schedule */ - $schedule = factory(Schedule::class)->create(['server_id' => $server->id]); + $schedule = Schedule::factory()->create(['server_id' => $server->id]); /** @var \Pterodactyl\Models\Task $task */ - $task2 = factory(Task::class)->create(['schedule_id' => $schedule->id, 'sequence_id' => 4]); - $task = factory(Task::class)->create(['schedule_id' => $schedule->id, 'sequence_id' => 2]); - $task3 = factory(Task::class)->create(['schedule_id' => $schedule->id, 'sequence_id' => 3]); + $task2 = Task::factory()->create(['schedule_id' => $schedule->id, 'sequence_id' => 4]); + $task = Task::factory()->create(['schedule_id' => $schedule->id, 'sequence_id' => 2]); + $task3 = Task::factory()->create(['schedule_id' => $schedule->id, 'sequence_id' => 3]); $this->getService()->handle($schedule); - Bus::assertDispatched(RunTaskJob::class, function (RunTaskJob $job) use ($task) { + Bus::assertDispatched(RunTaskJob::class, function (RunTaskJob $job) use ($task) { return $task->id === $job->task->id; }); @@ -131,9 +131,9 @@ class ProcessScheduleServiceTest extends IntegrationTestCase $server = $this->createServerModel(); /** @var \Pterodactyl\Models\Schedule $schedule */ - $schedule = factory(Schedule::class)->create(['server_id' => $server->id, 'last_run_at' => null]); + $schedule = Schedule::factory()->create(['server_id' => $server->id, 'last_run_at' => null]); /** @var \Pterodactyl\Models\Task $task */ - $task = factory(Task::class)->create(['schedule_id' => $schedule->id, 'sequence_id' => 1]); + $task = Task::factory()->create(['schedule_id' => $schedule->id, 'sequence_id' => 1]); $dispatcher->expects('dispatchNow')->andThrows(new Exception('Test thrown exception')); @@ -151,9 +151,6 @@ class ProcessScheduleServiceTest extends IntegrationTestCase $this->assertDatabaseHas('tasks', ['id' => $task->id, 'is_queued' => false]); } - /** - * @return array - */ public function dispatchNowDataProvider(): array { return [[true], [false]]; diff --git a/tests/Integration/Services/Servers/BuildModificationServiceTest.php b/tests/Integration/Services/Servers/BuildModificationServiceTest.php index 4444cc857..359dff67e 100644 --- a/tests/Integration/Services/Servers/BuildModificationServiceTest.php +++ b/tests/Integration/Services/Servers/BuildModificationServiceTest.php @@ -36,7 +36,7 @@ class BuildModificationServiceTest extends IntegrationTestCase $server2 = $this->createServerModel(); /** @var \Pterodactyl\Models\Allocation[] $allocations */ - $allocations = factory(Allocation::class)->times(4)->create(['node_id' => $server->node_id, 'notes' => 'Random notes']); + $allocations = Allocation::factory()->times(4)->create(['node_id' => $server->node_id, 'notes' => 'Random notes']); $initialAllocationId = $server->allocation_id; $allocations[0]->update(['server_id' => $server->id, 'notes' => 'Test notes']); @@ -83,7 +83,7 @@ class BuildModificationServiceTest extends IntegrationTestCase { $server = $this->createServerModel(); /** @var \Pterodactyl\Models\Allocation[] $allocations */ - $allocations = factory(Allocation::class)->times(4)->create(['node_id' => $server->node_id]); + $allocations = Allocation::factory()->times(4)->create(['node_id' => $server->node_id]); $allocations[0]->update(['server_id' => $server->id]); @@ -155,8 +155,8 @@ class BuildModificationServiceTest extends IntegrationTestCase public function testNoExceptionIsThrownIfOnlyRemovingAllocation() { $server = $this->createServerModel(); - /** @var \Pterodactyl\Models\Allocation[] $allocations */ - $allocation = factory(Allocation::class)->create(['node_id' => $server->node_id, 'server_id' => $server->id]); + /** @var \Pterodactyl\Models\Allocation $allocation */ + $allocation = Allocation::factory()->create(['node_id' => $server->node_id, 'server_id' => $server->id]); $this->daemonServerRepository->expects('setServer->update')->andReturnUndefined(); @@ -178,8 +178,8 @@ class BuildModificationServiceTest extends IntegrationTestCase public function testAllocationInBothAddAndRemoveIsAdded() { $server = $this->createServerModel(); - /** @var \Pterodactyl\Models\Allocation[] $allocations */ - $allocation = factory(Allocation::class)->create(['node_id' => $server->node_id]); + /** @var \Pterodactyl\Models\Allocation $allocation */ + $allocation = Allocation::factory()->create(['node_id' => $server->node_id]); $this->daemonServerRepository->expects('setServer->update')->andReturnUndefined(); @@ -197,9 +197,10 @@ class BuildModificationServiceTest extends IntegrationTestCase public function testUsingSameAllocationIdMultipleTimesDoesNotError() { $server = $this->createServerModel(); - /** @var \Pterodactyl\Models\Allocation[] $allocations */ - $allocation = factory(Allocation::class)->create(['node_id' => $server->node_id, 'server_id' => $server->id]); - $allocation2 = factory(Allocation::class)->create(['node_id' => $server->node_id]); + /** @var \Pterodactyl\Models\Allocation $allocation */ + $allocation = Allocation::factory()->create(['node_id' => $server->node_id, 'server_id' => $server->id]); + /** @var \Pterodactyl\Models\Allocation $allocation2 */ + $allocation2 = Allocation::factory()->create(['node_id' => $server->node_id]); $this->daemonServerRepository->expects('setServer->update')->andReturnUndefined(); @@ -219,8 +220,8 @@ class BuildModificationServiceTest extends IntegrationTestCase public function testThatUpdatesAreRolledBackIfExceptionIsEncountered() { $server = $this->createServerModel(); - /** @var \Pterodactyl\Models\Allocation[] $allocations */ - $allocation = factory(Allocation::class)->create(['node_id' => $server->node_id]); + /** @var \Pterodactyl\Models\Allocation $allocation */ + $allocation = Allocation::factory()->create(['node_id' => $server->node_id]); $this->daemonServerRepository->expects('setServer->update')->andThrows(new DisplayException('Test')); diff --git a/tests/Integration/Services/Servers/ServerCreationServiceTest.php b/tests/Integration/Services/Servers/ServerCreationServiceTest.php index ad6a5dc5d..c622359e9 100644 --- a/tests/Integration/Services/Servers/ServerCreationServiceTest.php +++ b/tests/Integration/Services/Servers/ServerCreationServiceTest.php @@ -4,16 +4,16 @@ namespace Pterodactyl\Tests\Integration\Services\Servers; use Mockery; use Pterodactyl\Models\Egg; +use GuzzleHttp\Psr7\Request; use Pterodactyl\Models\Node; use Pterodactyl\Models\User; -use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Response; use Pterodactyl\Models\Server; use Pterodactyl\Models\Location; use Pterodactyl\Models\Allocation; use Illuminate\Foundation\Testing\WithFaker; -use Illuminate\Validation\ValidationException; use GuzzleHttp\Exception\BadResponseException; +use Illuminate\Validation\ValidationException; use Pterodactyl\Models\Objects\DeploymentObject; use Pterodactyl\Tests\Integration\IntegrationTestCase; use Pterodactyl\Services\Servers\ServerCreationService; @@ -48,15 +48,18 @@ class ServerCreationServiceTest extends IntegrationTestCase public function testServerIsCreatedWithDeploymentObject() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(); + $user = User::factory()->create(); + + /** @var \Pterodactyl\Models\Location $location */ + $location = Location::factory()->create(); /** @var \Pterodactyl\Models\Node $node */ - $node = factory(Node::class)->create([ - 'location_id' => factory(Location::class)->create()->id, + $node = Node::factory()->create([ + 'location_id' => $location->id, ]); /** @var \Pterodactyl\Models\Allocation[]|\Illuminate\Database\Eloquent\Collection $allocations */ - $allocations = factory(Allocation::class)->times(5)->create([ + $allocations = Allocation::factory()->times(5)->create([ 'node_id' => $node->id, ]); @@ -156,15 +159,18 @@ class ServerCreationServiceTest extends IntegrationTestCase public function testErrorEncounteredByWingsCausesServerToBeDeleted() { /** @var \Pterodactyl\Models\User $user */ - $user = factory(User::class)->create(); + $user = User::factory()->create(); + + /** @var \Pterodactyl\Models\Location $location */ + $location = Location::factory()->create(); /** @var \Pterodactyl\Models\Node $node */ - $node = factory(Node::class)->create([ - 'location_id' => factory(Location::class)->create()->id, + $node = Node::factory()->create([ + 'location_id' => $location->id, ]); /** @var \Pterodactyl\Models\Allocation $allocation */ - $allocation = factory(Allocation::class)->create([ + $allocation = Allocation::factory()->create([ 'node_id' => $node->id, ]); diff --git a/tests/Integration/Services/Servers/ServerDeletionServiceTest.php b/tests/Integration/Services/Servers/ServerDeletionServiceTest.php index bcc4cce25..197e6b38f 100644 --- a/tests/Integration/Services/Servers/ServerDeletionServiceTest.php +++ b/tests/Integration/Services/Servers/ServerDeletionServiceTest.php @@ -6,6 +6,7 @@ use Mockery; use Exception; use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Response; +use Pterodactyl\Models\Server; use Pterodactyl\Models\Database; use Pterodactyl\Models\DatabaseHost; use GuzzleHttp\Exception\BadResponseException; @@ -65,7 +66,7 @@ class ServerDeletionServiceTest extends IntegrationTestCase $this->expectException(DaemonConnectionException::class); $this->daemonServerRepository->expects('setServer->delete')->withNoArgs()->andThrows( - new DaemonConnectionException(new BadResponseException('Bad request', new Request('GET', '/test'))) + new DaemonConnectionException(new BadResponseException('Bad request', new Request('GET', '/test'), new Response())) ); $this->getService()->handle($server); @@ -113,17 +114,17 @@ class ServerDeletionServiceTest extends IntegrationTestCase public function testExceptionWhileDeletingStopsProcess() { $server = $this->createServerModel(); - $host = factory(DatabaseHost::class)->create(); + $host = DatabaseHost::factory()->create(); /** @var \Pterodactyl\Models\Database $db */ - $db = factory(Database::class)->create(['database_host_id' => $host->id, 'server_id' => $server->id]); + $db = Database::factory()->create(['database_host_id' => $host->id, 'server_id' => $server->id]); $server->refresh(); $this->daemonServerRepository->expects('setServer->delete')->withNoArgs()->andReturnUndefined(); $this->databaseManagementService->expects('delete')->with(Mockery::on(function ($value) use ($db) { return $value instanceof Database && $value->id === $db->id; - }))->andThrows(new Exception); + }))->andThrows(new Exception()); $this->expectException(Exception::class); $this->getService()->handle($server); @@ -138,17 +139,17 @@ class ServerDeletionServiceTest extends IntegrationTestCase public function testExceptionWhileDeletingDatabasesDoesNotAbortIfForceDeleted() { $server = $this->createServerModel(); - $host = factory(DatabaseHost::class)->create(); + $host = DatabaseHost::factory()->create(); /** @var \Pterodactyl\Models\Database $db */ - $db = factory(Database::class)->create(['database_host_id' => $host->id, 'server_id' => $server->id]); + $db = Database::factory()->create(['database_host_id' => $host->id, 'server_id' => $server->id]); $server->refresh(); $this->daemonServerRepository->expects('setServer->delete')->withNoArgs()->andReturnUndefined(); $this->databaseManagementService->expects('delete')->with(Mockery::on(function ($value) use ($db) { return $value instanceof Database && $value->id === $db->id; - }))->andThrows(new Exception); + }))->andThrows(new Exception()); $this->getService()->withForce(true)->handle($server); diff --git a/tests/Integration/Services/Servers/StartupModificationServiceTest.php b/tests/Integration/Services/Servers/StartupModificationServiceTest.php index 6645af0fa..8f61e1a18 100644 --- a/tests/Integration/Services/Servers/StartupModificationServiceTest.php +++ b/tests/Integration/Services/Servers/StartupModificationServiceTest.php @@ -3,10 +3,9 @@ namespace Pterodactyl\Tests\Integration\Services\Servers; use Exception; -use Ramsey\Uuid\Uuid; use Pterodactyl\Models\Egg; -use Pterodactyl\Models\User; use Pterodactyl\Models\Nest; +use Pterodactyl\Models\User; use Pterodactyl\Models\Server; use Pterodactyl\Models\ServerVariable; use Illuminate\Validation\ValidationException; diff --git a/tests/Integration/Services/Servers/VariableValidatorServiceTest.php b/tests/Integration/Services/Servers/VariableValidatorServiceTest.php index 79a97ff73..01f6f7f02 100644 --- a/tests/Integration/Services/Servers/VariableValidatorServiceTest.php +++ b/tests/Integration/Services/Servers/VariableValidatorServiceTest.php @@ -92,7 +92,6 @@ class VariableValidatorServiceTest extends IntegrationTestCase $this->assertArrayHasKey('environment.BUNGEE_VERSION', $exception->errors()); } - $response = $this->getService()->setUserLevel(User::USER_LEVEL_ADMIN)->handle($egg->id, [ 'BUNGEE_VERSION' => '123', 'SERVER_JARFILE' => 'server.jar', diff --git a/tests/Integration/TestResponse.php b/tests/Integration/TestResponse.php new file mode 100644 index 000000000..2185598c9 --- /dev/null +++ b/tests/Integration/TestResponse.php @@ -0,0 +1,38 @@ +getStatusCode(); + + // Dump the response to the screen before making the assertion which is going + // to fail so that debugging isn't such a nightmare. + if ($actual !== $status && $status !== 500) { + $this->dump(); + if (!is_null($this->exception) && !$this->exception instanceof DisplayException && !$this->exception instanceof ValidationException) { + dump($this->exception); + } + } + + PHPUnit::assertSame($actual, $status, "Expected status code {$status} but received {$actual}."); + + return $this; + } +} diff --git a/tests/TestCase.php b/tests/TestCase.php index 1908ac15e..5e131fa8b 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,8 +1,9 @@ make($args); + $user = User::factory()->make($args); $this->setRequestUserModel($user); return $user; @@ -59,8 +52,7 @@ trait RequestMockHelpers /** * Set a request attribute on the mock object. * - * @param string $attribute - * @param mixed $value + * @param mixed $value */ public function setRequestAttribute(string $attribute, $value) { @@ -69,8 +61,6 @@ trait RequestMockHelpers /** * Set the request route name. - * - * @param string $name */ public function setRequestRouteName(string $name) { @@ -83,7 +73,7 @@ trait RequestMockHelpers protected function buildRequestMock() { $this->request = m::mock($this->requestMockClass); - if (! $this->request instanceof Request) { + if (!$this->request instanceof Request) { throw new InvalidArgumentException('Request mock class must be an instance of ' . Request::class . ' when mocked.'); } @@ -94,13 +84,11 @@ trait RequestMockHelpers * Sets the mocked request user. If a user model is not provided, a factory model * will be created and returned. * - * @param \Pterodactyl\Models\User|null $user - * @return \Pterodactyl\Models\User * @deprecated */ protected function setRequestUser(User $user = null): User { - $user = $user instanceof User ? $user : factory(User::class)->make(); + $user = $user instanceof User ? $user : User::factory()->make(); $this->request->shouldReceive('user')->withNoArgs()->andReturn($user); return $user; diff --git a/tests/Traits/Integration/CreatesTestModels.php b/tests/Traits/Integration/CreatesTestModels.php index 0d3390f63..bafa9baa8 100644 --- a/tests/Traits/Integration/CreatesTestModels.php +++ b/tests/Traits/Integration/CreatesTestModels.php @@ -1,6 +1,6 @@ app->make(EloquentFactory::class); - if (isset($attributes['user_id'])) { $attributes['owner_id'] = $attributes['user_id']; } - if (! isset($attributes['owner_id'])) { - $user = $factory->of(User::class)->create(); + if (!isset($attributes['owner_id'])) { + /** @var \Pterodactyl\Models\User $user */ + $user = User::factory()->create(); $attributes['owner_id'] = $user->id; } - if (! isset($attributes['node_id'])) { - if (! isset($attributes['location_id'])) { - $location = $factory->of(Location::class)->create(); + if (!isset($attributes['node_id'])) { + if (!isset($attributes['location_id'])) { + /** @var \Pterodactyl\Models\Location $location */ + $location = Location::factory()->create(); $attributes['location_id'] = $location->id; } - $node = $factory->of(Node::class)->create(['location_id' => $attributes['location_id']]); + /** @var \Pterodactyl\Models\Node $node */ + $node = Node::factory()->create(['location_id' => $attributes['location_id']]); $attributes['node_id'] = $node->id; } - if (! isset($attributes['allocation_id'])) { - $allocation = $factory->of(Allocation::class)->create(['node_id' => $attributes['node_id']]); + if (!isset($attributes['allocation_id'])) { + /** @var \Pterodactyl\Models\Allocation $allocation */ + $allocation = Allocation::factory()->create(['node_id' => $attributes['node_id']]); $attributes['allocation_id'] = $allocation->id; } - if (! isset($attributes['nest_id'])) { + if (!isset($attributes['nest_id'])) { + /** @var \Pterodactyl\Models\Nest $nest */ $nest = Nest::with('eggs')->first(); $attributes['nest_id'] = $nest->id; - if (! isset($attributes['egg_id'])) { + if (!isset($attributes['egg_id'])) { $attributes['egg_id'] = $nest->getRelation('eggs')->first()->id; } } - if (! isset($attributes['egg_id'])) { + if (!isset($attributes['egg_id'])) { + /** @var \Pterodactyl\Models\Egg $egg */ $egg = Egg::where('nest_id', $attributes['nest_id'])->first(); $attributes['egg_id'] = $egg->id; } unset($attributes['user_id'], $attributes['location_id']); - $server = $factory->of(Server::class)->create($attributes); + /** @var \Pterodactyl\Models\Server $server */ + $server = Server::factory()->create($attributes); Allocation::query()->where('id', $server->allocation_id)->update(['server_id' => $server->id]); - return Server::with([ + return $server->fresh([ 'location', 'user', 'node', 'allocation', 'nest', 'egg', - ])->findOrFail($server->id); + ]); } /** * Clones a given egg allowing us to make modifications that don't affect other * tests that rely on the egg existing in the correct state. - * - * @param \Pterodactyl\Models\Egg $egg - * @return \Pterodactyl\Models\Egg */ protected function cloneEggAndVariables(Egg $egg): Egg { diff --git a/tests/Traits/MocksPdoConnection.php b/tests/Traits/MocksPdoConnection.php index 01c26d12b..c7fe8cdd0 100644 --- a/tests/Traits/MocksPdoConnection.php +++ b/tests/Traits/MocksPdoConnection.php @@ -1,6 +1,6 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ -namespace Tests\Unit\Helpers; +namespace Pterodactyl\Tests\Unit\Helpers; -use Tests\TestCase; +use Pterodactyl\Tests\TestCase; class IsDigitTest extends TestCase { diff --git a/tests/Unit/Http/Middleware/AdminAuthenticateTest.php b/tests/Unit/Http/Middleware/AdminAuthenticateTest.php index efe6e8212..75fb2280e 100644 --- a/tests/Unit/Http/Middleware/AdminAuthenticateTest.php +++ b/tests/Unit/Http/Middleware/AdminAuthenticateTest.php @@ -1,6 +1,6 @@ make(['root_admin' => 1]); + $user = User::factory()->make(['root_admin' => 1]); $this->request->shouldReceive('user')->withNoArgs()->twice()->andReturn($user); @@ -39,7 +39,7 @@ class AdminAuthenticateTest extends MiddlewareTestCase { $this->expectException(AccessDeniedHttpException::class); - $user = factory(User::class)->make(['root_admin' => 0]); + $user = User::factory()->make(['root_admin' => 0]); $this->request->shouldReceive('user')->withNoArgs()->twice()->andReturn($user); @@ -48,8 +48,6 @@ class AdminAuthenticateTest extends MiddlewareTestCase /** * Return an instance of the middleware using mocked dependencies. - * - * @return \Pterodactyl\Http\Middleware\AdminAuthenticate */ private function getMiddleware(): AdminAuthenticate { diff --git a/tests/Unit/Http/Middleware/Api/Application/AuthenticateUserTest.php b/tests/Unit/Http/Middleware/Api/Application/AuthenticateUserTest.php index 3cbd7debf..8ba4c75fc 100644 --- a/tests/Unit/Http/Middleware/Api/Application/AuthenticateUserTest.php +++ b/tests/Unit/Http/Middleware/Api/Application/AuthenticateUserTest.php @@ -1,8 +1,8 @@ make(['allowed_ips' => []]); + $model = ApiKey::factory()->make(['allowed_ips' => []]); $this->setRequestAttribute('api_key', $model); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); @@ -26,7 +26,7 @@ class AuthenticateIPAccessTest extends MiddlewareTestCase */ public function testWithValidIP() { - $model = factory(ApiKey::class)->make(['allowed_ips' => ['127.0.0.1']]); + $model = ApiKey::factory()->make(['allowed_ips' => ['127.0.0.1']]); $this->setRequestAttribute('api_key', $model); $this->request->shouldReceive('ip')->withNoArgs()->once()->andReturn('127.0.0.1'); @@ -39,7 +39,7 @@ class AuthenticateIPAccessTest extends MiddlewareTestCase */ public function testValidIPAgainstCIDRRange() { - $model = factory(ApiKey::class)->make(['allowed_ips' => ['192.168.1.1/28']]); + $model = ApiKey::factory()->make(['allowed_ips' => ['192.168.1.1/28']]); $this->setRequestAttribute('api_key', $model); $this->request->shouldReceive('ip')->withNoArgs()->once()->andReturn('192.168.1.15'); @@ -55,7 +55,7 @@ class AuthenticateIPAccessTest extends MiddlewareTestCase { $this->expectException(AccessDeniedHttpException::class); - $model = factory(ApiKey::class)->make(['allowed_ips' => ['127.0.0.1']]); + $model = ApiKey::factory()->make(['allowed_ips' => ['127.0.0.1']]); $this->setRequestAttribute('api_key', $model); $this->request->shouldReceive('ip')->withNoArgs()->twice()->andReturn('127.0.0.2'); @@ -65,8 +65,6 @@ class AuthenticateIPAccessTest extends MiddlewareTestCase /** * Return an instance of the middleware to be used when testing. - * - * @return \Pterodactyl\Http\Middleware\Api\AuthenticateIPAccess */ private function getMiddleware(): AuthenticateIPAccess { diff --git a/tests/Unit/Http/Middleware/Api/AuthenticateKeyTest.php b/tests/Unit/Http/Middleware/Api/AuthenticateKeyTest.php index 79715e4c8..211e810df 100644 --- a/tests/Unit/Http/Middleware/Api/AuthenticateKeyTest.php +++ b/tests/Unit/Http/Middleware/Api/AuthenticateKeyTest.php @@ -1,17 +1,17 @@ auth = m::mock(AuthManager::class); $this->encrypter = m::mock(Encrypter::class); @@ -69,7 +68,7 @@ class AuthenticateKeyTest extends MiddlewareTestCase $this->expectException(AccessDeniedHttpException::class); $this->request->shouldReceive('bearerToken')->withNoArgs()->twice()->andReturn('abcd1234'); - $this->repository->shouldReceive('findFirstWhere')->andThrow(new RecordNotFoundException); + $this->repository->shouldReceive('findFirstWhere')->andThrow(new RecordNotFoundException()); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions(), ApiKey::TYPE_APPLICATION); } @@ -79,7 +78,7 @@ class AuthenticateKeyTest extends MiddlewareTestCase */ public function testValidToken() { - $model = factory(ApiKey::class)->make(); + $model = ApiKey::factory()->make(); $this->request->shouldReceive('bearerToken')->withNoArgs()->twice()->andReturn($model->identifier . 'decrypted'); $this->repository->shouldReceive('findFirstWhere')->with([ @@ -90,7 +89,7 @@ class AuthenticateKeyTest extends MiddlewareTestCase $this->auth->shouldReceive('guard->loginUsingId')->with($model->user_id)->once()->andReturnNull(); $this->repository->shouldReceive('withoutFreshModel->update')->with($model->id, [ - 'last_used_at' => Chronos::now(), + 'last_used_at' => CarbonImmutable::now(), ])->once()->andReturnNull(); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions(), ApiKey::TYPE_APPLICATION); @@ -102,7 +101,7 @@ class AuthenticateKeyTest extends MiddlewareTestCase */ public function testValidTokenWithUserKey() { - $model = factory(ApiKey::class)->make(); + $model = ApiKey::factory()->make(); $this->request->shouldReceive('bearerToken')->withNoArgs()->twice()->andReturn($model->identifier . 'decrypted'); $this->repository->shouldReceive('findFirstWhere')->with([ @@ -113,7 +112,7 @@ class AuthenticateKeyTest extends MiddlewareTestCase $this->auth->shouldReceive('guard->loginUsingId')->with($model->user_id)->once()->andReturnNull(); $this->repository->shouldReceive('withoutFreshModel->update')->with($model->id, [ - 'last_used_at' => Chronos::now(), + 'last_used_at' => CarbonImmutable::now(), ])->once()->andReturnNull(); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions(), ApiKey::TYPE_ACCOUNT); @@ -126,7 +125,7 @@ class AuthenticateKeyTest extends MiddlewareTestCase */ public function testAccessWithoutToken() { - $user = factory(User::class)->make(['id' => 123]); + $user = User::factory()->make(['id' => 123]); $this->request->shouldReceive('user')->andReturn($user); $this->request->shouldReceive('bearerToken')->withNoArgs()->twice()->andReturnNull(); @@ -147,7 +146,7 @@ class AuthenticateKeyTest extends MiddlewareTestCase { $this->expectException(AccessDeniedHttpException::class); - $model = factory(ApiKey::class)->make(); + $model = ApiKey::factory()->make(); $this->request->shouldReceive('bearerToken')->withNoArgs()->twice()->andReturn($model->identifier . 'asdf'); $this->repository->shouldReceive('findFirstWhere')->with([ @@ -161,8 +160,6 @@ class AuthenticateKeyTest extends MiddlewareTestCase /** * Return an instance of the middleware with mocked dependencies for testing. - * - * @return \Pterodactyl\Http\Middleware\Api\AuthenticateKey */ private function getMiddleware(): AuthenticateKey { diff --git a/tests/Unit/Http/Middleware/Api/Daemon/DaemonAuthenticateTest.php b/tests/Unit/Http/Middleware/Api/Daemon/DaemonAuthenticateTest.php index 35699eb65..945e08701 100644 --- a/tests/Unit/Http/Middleware/Api/Daemon/DaemonAuthenticateTest.php +++ b/tests/Unit/Http/Middleware/Api/Daemon/DaemonAuthenticateTest.php @@ -1,15 +1,15 @@ expectException(AccessDeniedHttpException::class); /** @var \Pterodactyl\Models\Node $model */ - $model = factory(Node::class)->make(); + $model = Node::factory()->make(); $this->request->expects('route->getName')->withNoArgs()->andReturn('random.route'); $this->request->expects('bearerToken')->withNoArgs()->andReturn($model->daemon_token_id . '.random_string_123'); @@ -125,7 +124,7 @@ class DaemonAuthenticateTest extends MiddlewareTestCase public function testSuccessfulMiddlewareProcess() { /** @var \Pterodactyl\Models\Node $model */ - $model = factory(Node::class)->make(); + $model = Node::factory()->make(); $this->request->expects('route->getName')->withNoArgs()->andReturn('random.route'); $this->request->expects('bearerToken')->withNoArgs()->andReturn($model->daemon_token_id . '.' . decrypt($model->daemon_token)); @@ -159,8 +158,6 @@ class DaemonAuthenticateTest extends MiddlewareTestCase /** * Return an instance of the middleware using mocked dependencies. - * - * @return \Pterodactyl\Http\Middleware\Api\Daemon\DaemonAuthenticate */ private function getMiddleware(): DaemonAuthenticate { diff --git a/tests/Unit/Http/Middleware/Api/SetSessionDriverTest.php b/tests/Unit/Http/Middleware/Api/SetSessionDriverTest.php index c41d742ef..83fc2b7bc 100644 --- a/tests/Unit/Http/Middleware/Api/SetSessionDriverTest.php +++ b/tests/Unit/Http/Middleware/Api/SetSessionDriverTest.php @@ -1,11 +1,11 @@ make(['language' => 'de']); + $user = User::factory()->make(['language' => 'de']); $this->request->shouldReceive('user')->withNoArgs()->andReturn($user); $this->appMock->shouldReceive('setLocale')->with('de')->once()->andReturnNull(); @@ -50,8 +50,6 @@ class LanguageMiddlewareTest extends MiddlewareTestCase /** * Return an instance of the middleware using mocked dependencies. - * - * @return \Pterodactyl\Http\Middleware\LanguageMiddleware */ private function getMiddleware(): LanguageMiddleware { diff --git a/tests/Unit/Http/Middleware/MaintenanceMiddlewareTest.php b/tests/Unit/Http/Middleware/MaintenanceMiddlewareTest.php index 68b971e65..a007dd34a 100644 --- a/tests/Unit/Http/Middleware/MaintenanceMiddlewareTest.php +++ b/tests/Unit/Http/Middleware/MaintenanceMiddlewareTest.php @@ -1,6 +1,6 @@ make(); - $node = factory(Node::class)->make(['maintenance' => 0]); + $server = Server::factory()->make(); + $node = Node::factory()->make(['maintenance' => 0]); $server->setRelation('node', $node); $this->setRequestAttribute('server', $server); @@ -45,8 +45,8 @@ class MaintenanceMiddlewareTest extends MiddlewareTestCase */ public function testHandleInMaintenanceMode() { - $server = factory(Server::class)->make(); - $node = factory(Node::class)->make(['maintenance_mode' => 1]); + $server = Server::factory()->make(); + $node = Node::factory()->make(['maintenance_mode' => 1]); $server->setRelation('node', $node); $this->setRequestAttribute('server', $server); @@ -54,15 +54,12 @@ class MaintenanceMiddlewareTest extends MiddlewareTestCase $this->response->shouldReceive('view') ->once() ->with('errors.maintenance') - ->andReturn(new Response); + ->andReturn(new Response()); $response = $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); $this->assertInstanceOf(Response::class, $response); } - /** - * @return \Pterodactyl\Http\Middleware\MaintenanceMiddleware - */ private function getMiddleware(): MaintenanceMiddleware { return new MaintenanceMiddleware($this->response); diff --git a/tests/Unit/Http/Middleware/MiddlewareTestCase.php b/tests/Unit/Http/Middleware/MiddlewareTestCase.php index ac7fd5098..b716681d8 100644 --- a/tests/Unit/Http/Middleware/MiddlewareTestCase.php +++ b/tests/Unit/Http/Middleware/MiddlewareTestCase.php @@ -1,15 +1,17 @@ expectException(AccessDeniedHttpException::class); $this->expectExceptionMessage('Server is suspended and cannot be accessed.'); - $model = factory(Server::class)->make(['status' => Server::STATUS_SUSPENDED]); + $model = Server::factory()->make(['suspended' => 1]); $this->request->shouldReceive('route->parameter')->with('server')->once()->andReturn('123456'); $this->request->shouldReceive('expectsJson')->withNoArgs()->once()->andReturn(true); @@ -67,7 +67,7 @@ class AccessingValidServerTest extends MiddlewareTestCase $this->expectException(ConflictHttpException::class); $this->expectExceptionMessage('Server is still completing the installation process.'); - $model = factory(Server::class)->make(['status' => Server::STATUS_INSTALLING]); + $model = Server::factory()->make(['installed' => 0]); $this->request->shouldReceive('route->parameter')->with('server')->once()->andReturn('123456'); $this->request->shouldReceive('expectsJson')->withNoArgs()->once()->andReturn(true); @@ -101,7 +101,7 @@ class AccessingValidServerTest extends MiddlewareTestCase */ public function testValidServerProcess() { - $model = factory(Server::class)->make(); + $model = Server::factory()->make(); $this->request->shouldReceive('route->parameter')->with('server')->once()->andReturn('123456'); $this->request->shouldReceive('expectsJson')->withNoArgs()->once()->andReturn(false); @@ -117,8 +117,6 @@ class AccessingValidServerTest extends MiddlewareTestCase /** * Provide test data that checks that the correct view is returned for each model type. - * - * @return array */ public function viewDataProvider(): array { @@ -126,16 +124,14 @@ class AccessingValidServerTest extends MiddlewareTestCase $this->refreshApplication(); return [ - [factory(Server::class)->make(['status' => Server::STATUS_SUSPENDED]), 'errors.suspended', 403], - [factory(Server::class)->make(['status' => Server::STATUS_INSTALLING]), 'errors.installing', 409], - [factory(Server::class)->make(['status' => Server::STATUS_INSTALL_FAILED]), 'errors.installing', 409], + [Server::factory()->make(['suspended' => 1]), 'errors.suspended', 403], + [Server::factory()->make(['installed' => 0]), 'errors.installing', 409], + [Server::factory()->make(['installed' => 2]), 'errors.installing', 409], ]; } /** * Return an instance of the middleware using mocked dependencies. - * - * @return \Pterodactyl\Http\Middleware\Server\AccessingValidServer */ private function getMiddleware(): AccessingValidServer { diff --git a/tests/Unit/Rules/UsernameTest.php b/tests/Unit/Rules/UsernameTest.php index 7f7bdbb73..829cab2c3 100644 --- a/tests/Unit/Rules/UsernameTest.php +++ b/tests/Unit/Rules/UsernameTest.php @@ -1,9 +1,9 @@ assertSame('p_username', (string) new Username); + $this->assertSame('p_username', (string) new Username()); } /** @@ -22,7 +22,7 @@ class UsernameTest extends TestCase */ public function testValidUsernames(string $username) { - $this->assertTrue((new Username)->passes('test', $username), 'Assert username is valid.'); + $this->assertTrue((new Username())->passes('test', $username), 'Assert username is valid.'); } /** @@ -32,12 +32,11 @@ class UsernameTest extends TestCase */ public function testInvalidUsernames(string $username) { - $this->assertFalse((new Username)->passes('test', $username), 'Assert username is not valid.'); + $this->assertFalse((new Username())->passes('test', $username), 'Assert username is not valid.'); } /** * Provide valid usernames. - * @return array */ public function validUsernameDataProvider(): array { @@ -54,8 +53,6 @@ class UsernameTest extends TestCase /** * Provide invalid usernames. - * - * @return array */ public function invalidUsernameDataProvider(): array { diff --git a/tests/Unit/Services/Acl/Api/AdminAclTest.php b/tests/Unit/Services/Acl/Api/AdminAclTest.php index 325af82c7..daaea838f 100644 --- a/tests/Unit/Services/Acl/Api/AdminAclTest.php +++ b/tests/Unit/Services/Acl/Api/AdminAclTest.php @@ -1,9 +1,9 @@ make(['r_servers' => AdminAcl::READ | AdminAcl::WRITE]); + $model = ApiKey::factory()->make(['r_servers' => AdminAcl::READ | AdminAcl::WRITE]); $this->assertTrue(AdminAcl::check($model, AdminAcl::RESOURCE_SERVERS, AdminAcl::WRITE)); } /** * Provide valid and invalid permissions combos for testing. - * - * @return array */ public function permissionsDataProvider(): array { diff --git a/tests/Unit/Services/Api/KeyCreationServiceTest.php b/tests/Unit/Services/Api/KeyCreationServiceTest.php index 3f04f24e3..5c847f144 100644 --- a/tests/Unit/Services/Api/KeyCreationServiceTest.php +++ b/tests/Unit/Services/Api/KeyCreationServiceTest.php @@ -1,11 +1,11 @@ make(); + $model = ApiKey::factory()->make(); $this->getFunctionMock('\\Pterodactyl\\Services\\Api', 'str_random') ->expects($this->exactly(2))->willReturnCallback(function ($length) { @@ -68,7 +68,7 @@ class KeyCreationServiceTest extends TestCase */ public function testIdentifierAndTokenAreOnlySetByFunction() { - $model = factory(ApiKey::class)->make(); + $model = ApiKey::factory()->make(); $this->getFunctionMock('\\Pterodactyl\\Services\\Api', 'str_random') ->expects($this->exactly(2))->willReturnCallback(function ($length) { @@ -95,7 +95,7 @@ class KeyCreationServiceTest extends TestCase */ public function testPermissionsAreRetrievedForApplicationKeys() { - $model = factory(ApiKey::class)->make(); + $model = ApiKey::factory()->make(); $this->getFunctionMock('\\Pterodactyl\\Services\\Api', 'str_random') ->expects($this->exactly(2))->willReturnCallback(function ($length) { @@ -125,7 +125,7 @@ class KeyCreationServiceTest extends TestCase */ public function testPermissionsAreNotRetrievedForNonApplicationKeys($keyType) { - $model = factory(ApiKey::class)->make(); + $model = ApiKey::factory()->make(); $this->getFunctionMock('\\Pterodactyl\\Services\\Api', 'str_random') ->expects($this->exactly(2))->willReturnCallback(function ($length) { @@ -149,8 +149,6 @@ class KeyCreationServiceTest extends TestCase /** * Provide key types that are not an application specific key. - * - * @return array */ public function keyTypeDataProvider(): array { @@ -161,8 +159,6 @@ class KeyCreationServiceTest extends TestCase /** * Return an instance of the service with mocked dependencies for testing. - * - * @return \Pterodactyl\Services\Api\KeyCreationService */ private function getService(): KeyCreationService {