diff --git a/.editorconfig b/.editorconfig index 1ba6cf9f7..c70b7be22 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,7 +8,7 @@ indent_size = 4 charset = utf-8 trim_trailing_whitespace = true -[.*yml] +[*.yml] indent_size = 2 [*.md] diff --git a/.env.ci b/.env.ci index 8d0848734..e893452d4 100644 --- a/.env.ci +++ b/.env.ci @@ -2,9 +2,11 @@ APP_ENV=testing APP_DEBUG=true APP_KEY=SomeRandomString3232RandomString APP_THEME=pterodactyl -APP_TIMEZONE=America/Los_Angeles +APP_TIMEZONE=UTC APP_URL=http://localhost/ +APP_ENVIRONMENT_ONLY=true +DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_DATABASE=panel_test DB_USERNAME=root @@ -16,4 +18,3 @@ MAIL_DRIVER=array QUEUE_DRIVER=sync HASHIDS_SALT=test123 -APP_ENVIRONMENT_ONLY=true diff --git a/.env.example b/.env.example index 97f68f78a..b852f8d86 100644 --- a/.env.example +++ b/.env.example @@ -2,40 +2,43 @@ APP_ENV=production APP_DEBUG=false APP_KEY= APP_THEME=pterodactyl -APP_TIMEZONE=America/New_York -APP_CLEAR_TASKLOG=720 -APP_DELETE_MINUTES=10 -APP_ENVIRONMENT_ONLY=true -LOG_CHANNEL=daily -APP_LOCALE=en +APP_TIMEZONE=UTC APP_URL=http://panel.example.com +APP_LOCALE=en +APP_ENVIRONMENT_ONLY=true +LOG_CHANNEL=daily +LOG_DEPRECATIONS_CHANNEL=null +LOG_LEVEL=debug + +DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=panel DB_USERNAME=pterodactyl DB_PASSWORD= -SESSION_DRIVER=file +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 + CACHE_DRIVER=file +QUEUE_CONNECTION=sync +SESSION_DRIVER=file HASHIDS_SALT= HASHIDS_LENGTH=8 -MAIL_DRIVER=smtp +MAIL_MAILER=smtp MAIL_HOST=smtp.example.com MAIL_PORT=25 MAIL_USERNAME= MAIL_PASSWORD= MAIL_ENCRYPTION=tls -MAIL_FROM=no-reply@example.com -MAILGUN_ENDPOINT=api.mailgun.net +MAIL_FROM_ADDRESS=no-reply@example.com +MAIL_FROM_NAME="Pterodactyl Panel" # You should set this to your domain to prevent it defaulting to 'localhost', causing # mail servers such as Gmail to reject your mail. # # @see: https://github.com/pterodactyl/panel/pull/3110 # SERVER_NAME=panel.example.com - -QUEUE_HIGH=high -QUEUE_STANDARD=standard -QUEUE_LOW=low diff --git a/.eslintignore b/.eslintignore index 6fdfb93fe..01050140a 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,6 @@ public node_modules resources/views +babel.config.js +tailwind.config.js webpack.config.js diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 71f610ef7..5b4b7c5ca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,24 +1,32 @@ -name: Build Panel +name: Build + on: push: branches: - 'develop' - 'v2' pull_request: + jobs: - build: + ui: + name: UI runs-on: ubuntu-20.04 if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')" strategy: matrix: - node-version: [16.x] + node-version: [16] steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - run: npm install -g yarn - - run: yarn install - - run: yarn build:production + - name: Code Checkout + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Build + run: yarn build:production diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 444208c53..45f584351 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,45 +1,51 @@ name: Publish Docker Image + on: push: branches: - 'develop' - tags: - - 'v*' + - 'release/v*' + jobs: - push_to_registry: + push: name: Push Image to GitHub Packages - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 # Always run against a tag, even if the commit into the tag has [docker skip] # within the commit message. if: "!contains(github.ref, 'develop') || (!contains(github.event.head_commit.message, 'skip docker') && !contains(github.event.head_commit.message, 'docker skip'))" steps: - - uses: actions/checkout@v2 - - uses: crazy-max/ghaction-docker-meta@v1 + - name: Code Checkout + uses: actions/checkout@v3 + + - name: Docker Metadata + uses: docker/metadata-action@v4 id: docker_meta with: images: ghcr.io/pterodactyl/panel - - uses: docker/setup-qemu-action@v1 - - uses: docker/setup-buildx-action@v1 - - uses: docker/login-action@v1 + + - name: Setup QEMU + uses: docker/setup-qemu-action@v2 + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Docker Login + uses: docker/login-action@v2 with: 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 + + - name: Release production build uses: docker/build-push-action@v2 - if: "!contains(github.ref, 'develop')" + if: "contains(github.ref, 'release/v')" with: push: true platforms: linux/amd64,linux/arm64 tags: ${{ steps.docker_meta.outputs.tags }} labels: ${{ steps.docker_meta.outputs.labels }} - - name: Release Development Build + + - name: Release development build uses: docker/build-push-action@v2 if: "contains(github.ref, 'develop')" with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0169c35ac..26d5b9034 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,16 +1,29 @@ -name: Create Release +name: Release + on: push: tags: - 'v*' + jobs: release: + name: Release runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - name: Code Checkout + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 with: - node-version: '16.x' + node-version: 16 + cache: 'yarn' + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Build + run: yarn build:production - name: Create release branch and bump version env: @@ -26,11 +39,6 @@ jobs: git commit -m "bump version for release" git push - - name: Build assets - run: | - yarn install - yarn run build:production - - name: Create release archive run: | rm -rf node_modules/ test/ codecov.yml CODE_OF_CONDUCT.md CONTRIBUTING.md phpunit.xml Vagrantfile @@ -62,7 +70,7 @@ jobs: draft: true prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }} - - name: Upload binary + - name: Upload release archive id: upload-release-archive uses: actions/upload-release-asset@v1 env: @@ -73,7 +81,7 @@ jobs: asset_name: panel.tar.gz asset_content_type: application/gzip - - name: Upload checksum + - name: Upload release checksum id: upload-release-checksum uses: actions/upload-release-asset@v1 env: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e9412ec60..5486076dd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,19 +1,22 @@ -name: Run Tests +name: Tests + on: push: branches: - 'develop' - 'v2' pull_request: + jobs: tests: + name: Tests runs-on: ubuntu-20.04 if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')" strategy: fail-fast: false matrix: - php: [ 7.4, 8.0, 8.1 ] - database: [ 'mariadb:10.2', 'mysql:8' ] + php: [8.0, 8.1] + database: ['mariadb:10.2', 'mysql:8'] services: database: image: ${{ matrix.database }} @@ -23,35 +26,48 @@ jobs: ports: - 3306 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 - name: "php-${{ matrix.php }} (${{ matrix.database }})" steps: - - uses: actions/checkout@v2 - - name: get cache directory + - name: Code Checkout + uses: actions/checkout@v3 + + - name: Get cache directory id: composer-cache run: | echo "::set-output name=dir::$(composer config cache-files-dir)" - - uses: actions/cache@v2 + + - name: Cache + uses: actions/cache@v3 with: path: | ~/.php_cs.cache ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-cache-${{ matrix.php }}-${{ hashFiles('**.composer.lock') }} - - uses: shivammathur/setup-php@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} extensions: bcmath, cli, curl, gd, mbstring, mysql, openssl, pdo, tokenizer, xml, zip tools: composer:v2 coverage: none - - run: cp .env.ci .env - - run: composer install --prefer-dist --no-interaction --no-progress - - run: vendor/bin/php-cs-fixer fix --dry-run --diff + + - name: Setup .env + run: cp .env.ci .env + + - name: Install dependencies + run: composer install --no-interaction --no-progress --no-suggest --prefer-dist + + - name: PHP CS Fixer + run: vendor/bin/php-cs-fixer fix --dry-run --diff continue-on-error: true - - name: execute unit tests + + - name: Unit tests run: vendor/bin/phpunit --bootstrap vendor/autoload.php tests/Unit if: ${{ always() }} env: DB_HOST: UNIT_NO_DB - - name: execute integration tests + + - name: Integration tests run: vendor/bin/phpunit tests/Integration env: DB_PORT: ${{ job.services.database.ports[3306] }} diff --git a/.yarnclean b/.yarnclean deleted file mode 100644 index 7bbe5ebab..000000000 --- a/.yarnclean +++ /dev/null @@ -1 +0,0 @@ -@types/react-native diff --git a/app/Console/Commands/Environment/AppSettingsCommand.php b/app/Console/Commands/Environment/AppSettingsCommand.php index 8d684bb2e..8b9aad48e 100644 --- a/app/Console/Commands/Environment/AppSettingsCommand.php +++ b/app/Console/Commands/Environment/AppSettingsCommand.php @@ -31,19 +31,8 @@ class AppSettingsCommand extends Command 'sync' => 'Sync', ]; - /** - * @var \Illuminate\Contracts\Console\Kernel - */ - protected $command; - - /** - * @var string - */ protected $description = 'Configure basic environment settings for the Panel.'; - /** - * @var string - */ protected $signature = 'p:environment:setup {--new-salt : Whether or not to generate a new salt for Hashids.} {--author= : The email that services created on this instance should be linked to.} @@ -57,19 +46,14 @@ class AppSettingsCommand extends Command {--redis-port= : Port to connect to redis over.} {--settings-ui= : Enable or disable the settings UI.}'; - /** - * @var array - */ - protected $variables = []; + protected array $variables = []; /** * AppSettingsCommand constructor. */ - public function __construct(Kernel $command) + public function __construct(private Kernel $console) { parent::__construct(); - - $this->command = $command; } /** @@ -77,7 +61,7 @@ class AppSettingsCommand extends Command * * @throws \Pterodactyl\Exceptions\PterodactylException */ - public function handle() + public function handle(): int { if (empty(config('hashids.salt')) || $this->option('new-salt')) { $this->variables['HASHIDS_SALT'] = str_random(20); @@ -98,13 +82,13 @@ class AppSettingsCommand extends Command $this->output->comment('The application URL MUST begin with https:// or http:// depending on if you are using SSL or not. If you do not include the scheme your emails and other content will link to the wrong location.'); $this->variables['APP_URL'] = $this->option('url') ?? $this->ask( 'Application URL', - config('app.url', 'http://example.org') + config('app.url', 'https://example.com') ); - $this->output->comment('The timezone should match one of PHP\'s supported timezones. If you are unsure, please reference http://php.net/manual/en/timezones.php.'); + $this->output->comment('The timezone should match one of PHP\'s supported timezones. If you are unsure, please reference https://php.net/manual/en/timezones.php.'); $this->variables['APP_TIMEZONE'] = $this->option('timezone') ?? $this->anticipate( 'Application Timezone', - DateTimeZone::listIdentifiers(DateTimeZone::ALL), + DateTimeZone::listIdentifiers(), config('app.timezone') ); @@ -136,14 +120,16 @@ class AppSettingsCommand extends Command } // Make sure session cookies are set as "secure" when using HTTPS - if (strpos($this->variables['APP_URL'], 'https://') === 0) { + if (str_starts_with($this->variables['APP_URL'], 'https://')) { $this->variables['SESSION_SECURE_COOKIE'] = 'true'; } $this->checkForRedis(); $this->writeToEnvironment($this->variables); - $this->info($this->command->output()); + $this->info($this->console->output()); + + return 0; } /** diff --git a/app/Console/Commands/Environment/DatabaseSettingsCommand.php b/app/Console/Commands/Environment/DatabaseSettingsCommand.php index 6254eaf20..0186a12b1 100644 --- a/app/Console/Commands/Environment/DatabaseSettingsCommand.php +++ b/app/Console/Commands/Environment/DatabaseSettingsCommand.php @@ -12,24 +12,8 @@ class DatabaseSettingsCommand extends Command { use EnvironmentWriterTrait; - /** - * @var \Illuminate\Contracts\Console\Kernel - */ - protected $console; - - /** - * @var \Illuminate\Database\DatabaseManager - */ - protected $database; - - /** - * @var string - */ protected $description = 'Configure database settings for the Panel.'; - /** - * @var string - */ protected $signature = 'p:environment:database {--host= : The connection address for the MySQL server.} {--port= : The connection port for the MySQL server.} @@ -37,30 +21,22 @@ class DatabaseSettingsCommand extends Command {--username= : Username to use when connecting.} {--password= : Password to use for this database.}'; - /** - * @var array - */ - protected $variables = []; + protected array $variables = []; /** * DatabaseSettingsCommand constructor. */ - public function __construct(DatabaseManager $database, Kernel $console) + public function __construct(private DatabaseManager $database, private Kernel $console) { parent::__construct(); - - $this->console = $console; - $this->database = $database; } /** * Handle command execution. * - * @return int - * * @throws \Pterodactyl\Exceptions\PterodactylException */ - public function handle() + public function handle(): int { $this->output->note('It is highly recommended to not use "localhost" as your database host as we have seen frequent socket connection issues. If you want to use a local connection you should be using "127.0.0.1".'); $this->variables['DB_HOST'] = $this->option('host') ?? $this->ask( diff --git a/app/Console/Commands/Environment/EmailSettingsCommand.php b/app/Console/Commands/Environment/EmailSettingsCommand.php index 57998a2ea..cae0094c0 100644 --- a/app/Console/Commands/Environment/EmailSettingsCommand.php +++ b/app/Console/Commands/Environment/EmailSettingsCommand.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Console\Commands\Environment; @@ -17,19 +10,8 @@ class EmailSettingsCommand extends Command { use EnvironmentWriterTrait; - /** - * @var \Illuminate\Contracts\Config\Repository - */ - protected $config; - - /** - * @var string - */ protected $description = 'Set or update the email sending configuration for the Panel.'; - /** - * @var string - */ protected $signature = 'p:environment:mail {--driver= : The mail driver to use.} {--email= : Email address that messages from the Panel will originate from.} @@ -41,19 +23,14 @@ class EmailSettingsCommand extends Command {--username=} {--password=}'; - /** - * @var array - */ - protected $variables = []; + protected array $variables = []; /** * EmailSettingsCommand constructor. */ - public function __construct(ConfigRepository $config) + public function __construct(private ConfigRepository $config) { parent::__construct(); - - $this->config = $config; } /** @@ -70,7 +47,7 @@ class EmailSettingsCommand extends Command 'mail' => 'PHP\'s Internal Mail Function', 'mailgun' => 'Mailgun Transactional Email', 'mandrill' => 'Mandrill Transactional Email', - 'postmark' => 'Postmarkapp Transactional Email', + 'postmark' => 'Postmark Transactional Email', ], $this->config->get('mail.driver', 'smtp') ); diff --git a/app/Console/Commands/InfoCommand.php b/app/Console/Commands/InfoCommand.php index 4db0be702..bc1d11792 100644 --- a/app/Console/Commands/InfoCommand.php +++ b/app/Console/Commands/InfoCommand.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Console\Commands; @@ -15,35 +8,16 @@ use Illuminate\Contracts\Config\Repository as ConfigRepository; class InfoCommand extends Command { - /** - * @var string - */ protected $description = 'Displays the application, database, and email configurations along with the panel version.'; - /** - * @var \Illuminate\Contracts\Config\Repository - */ - protected $config; - - /** - * @var string - */ protected $signature = 'p:info'; - /** - * @var \Pterodactyl\Services\Helpers\SoftwareVersionService - */ - protected $versionService; - /** * VersionCommand constructor. */ - public function __construct(ConfigRepository $config, SoftwareVersionService $versionService) + public function __construct(private ConfigRepository $config, private SoftwareVersionService $versionService) { parent::__construct(); - - $this->config = $config; - $this->versionService = $versionService; } /** @@ -78,10 +52,10 @@ class InfoCommand extends Command $driver = $this->config->get('database.default'); $this->table([], [ ['Driver', $driver], - ['Host', $this->config->get("database.connections.{$driver}.host")], - ['Port', $this->config->get("database.connections.{$driver}.port")], - ['Database', $this->config->get("database.connections.{$driver}.database")], - ['Username', $this->config->get("database.connections.{$driver}.username")], + ['Host', $this->config->get("database.connections.$driver.host")], + ['Port', $this->config->get("database.connections.$driver.port")], + ['Database', $this->config->get("database.connections.$driver.database")], + ['Username', $this->config->get("database.connections.$driver.username")], ], 'compact'); $this->output->title('Email Configuration'); @@ -98,13 +72,8 @@ class InfoCommand extends Command /** * Format output in a Name: Value manner. - * - * @param string $value - * @param string $opts - * - * @return string */ - private function formatText($value, $opts = '') + private function formatText(string $value, string $opts = ''): string { return sprintf('<%s>%s', $opts, $value); } diff --git a/app/Console/Commands/Location/DeleteLocationCommand.php b/app/Console/Commands/Location/DeleteLocationCommand.php index 898dbb924..3193e0c3d 100644 --- a/app/Console/Commands/Location/DeleteLocationCommand.php +++ b/app/Console/Commands/Location/DeleteLocationCommand.php @@ -1,56 +1,28 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Console\Commands\Location; use Illuminate\Console\Command; +use Illuminate\Support\Collection; use Pterodactyl\Services\Locations\LocationDeletionService; use Pterodactyl\Contracts\Repository\LocationRepositoryInterface; class DeleteLocationCommand extends Command { - /** - * @var \Pterodactyl\Services\Locations\LocationDeletionService - */ - protected $deletionService; - - /** - * @var string - */ protected $description = 'Deletes a location from the Panel.'; - /** - * @var \Illuminate\Support\Collection - */ - protected $locations; - - /** - * @var \Pterodactyl\Contracts\Repository\LocationRepositoryInterface - */ - protected $repository; - - /** - * @var string - */ protected $signature = 'p:location:delete {--short= : The short code of the location to delete.}'; + protected Collection $locations; + /** * DeleteLocationCommand constructor. */ public function __construct( - LocationDeletionService $deletionService, - LocationRepositoryInterface $repository + private LocationDeletionService $deletionService, + private LocationRepositoryInterface $repository ) { parent::__construct(); - - $this->deletionService = $deletionService; - $this->repository = $repository; } /** diff --git a/app/Console/Commands/Location/MakeLocationCommand.php b/app/Console/Commands/Location/MakeLocationCommand.php index db4d4e2e0..f09f1604e 100644 --- a/app/Console/Commands/Location/MakeLocationCommand.php +++ b/app/Console/Commands/Location/MakeLocationCommand.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Console\Commands\Location; @@ -14,31 +7,18 @@ use Pterodactyl\Services\Locations\LocationCreationService; class MakeLocationCommand extends Command { - /** - * @var \Pterodactyl\Services\Locations\LocationCreationService - */ - protected $creationService; - - /** - * @var string - */ protected $signature = 'p:location:make {--short= : The shortcode name of this location (ex. us1).} {--long= : A longer description of this location.}'; - /** - * @var string - */ protected $description = 'Creates a new location on the system via the CLI.'; /** * Create a new command instance. */ - public function __construct(LocationCreationService $creationService) + public function __construct(private LocationCreationService $creationService) { parent::__construct(); - - $this->creationService = $creationService; } /** diff --git a/app/Console/Commands/Maintenance/CleanServiceBackupFilesCommand.php b/app/Console/Commands/Maintenance/CleanServiceBackupFilesCommand.php index 69a3b118a..fa71171ab 100644 --- a/app/Console/Commands/Maintenance/CleanServiceBackupFilesCommand.php +++ b/app/Console/Commands/Maintenance/CleanServiceBackupFilesCommand.php @@ -5,27 +5,19 @@ namespace Pterodactyl\Console\Commands\Maintenance; use SplFileInfo; use Carbon\Carbon; use Illuminate\Console\Command; +use Illuminate\Contracts\Filesystem\Filesystem; use Illuminate\Contracts\Filesystem\Factory as FilesystemFactory; class CleanServiceBackupFilesCommand extends Command { public const BACKUP_THRESHOLD_MINUTES = 5; - /** - * @var string - */ protected $description = 'Clean orphaned .bak files created when modifying services.'; - /** - * @var \Illuminate\Contracts\Filesystem\Filesystem - */ - protected $disk; - - /** - * @var string - */ protected $signature = 'p:maintenance:clean-service-backups'; + protected Filesystem $disk; + /** * CleanServiceBackupFilesCommand constructor. */ diff --git a/app/Console/Commands/Maintenance/PruneOrphanedBackupsCommand.php b/app/Console/Commands/Maintenance/PruneOrphanedBackupsCommand.php index 71aeb4f30..b51a415b2 100644 --- a/app/Console/Commands/Maintenance/PruneOrphanedBackupsCommand.php +++ b/app/Console/Commands/Maintenance/PruneOrphanedBackupsCommand.php @@ -9,24 +9,26 @@ use Pterodactyl\Repositories\Eloquent\BackupRepository; class PruneOrphanedBackupsCommand extends Command { - /** - * @var string - */ 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.'; - public function handle(BackupRepository $repository) + /** + * PruneOrphanedBackupsCommand constructor. + */ + public function __construct(private BackupRepository $backupRepository) + { + parent::__construct(); + } + + public function handle() { $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() + $query = $this->backupRepository->getBuilder() ->whereNull('completed_at') ->where('created_at', '<=', CarbonImmutable::now()->subMinutes($since)->toDateTimeString()); @@ -37,7 +39,7 @@ class PruneOrphanedBackupsCommand extends Command return; } - $this->warn("Marking {$count} backups that have not been marked as completed in the last {$since} minutes as failed."); + $this->warn("Marking $count backups that have not been marked as completed in the last $since minutes as failed."); $query->update([ 'is_successful' => false, diff --git a/app/Console/Commands/Node/MakeNodeCommand.php b/app/Console/Commands/Node/MakeNodeCommand.php index 3fbd30d6c..2d2623ad7 100644 --- a/app/Console/Commands/Node/MakeNodeCommand.php +++ b/app/Console/Commands/Node/MakeNodeCommand.php @@ -1,13 +1,5 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ - namespace Pterodactyl\Console\Commands\Node; use Illuminate\Console\Command; @@ -15,14 +7,6 @@ use Pterodactyl\Services\Nodes\NodeCreationService; class MakeNodeCommand extends Command { - /** - * @var \Pterodactyl\Services\Nodes\NodeCreationService - */ - protected $creationService; - - /** - * @var string - */ protected $signature = 'p:node:make {--name= : A name to identify the node.} {--description= : A description to identify the node.} @@ -41,20 +25,23 @@ class MakeNodeCommand extends Command {--daemonSFTPPort= : Enter the wings SFTP listening port.} {--daemonBase= : Enter the base folder.}'; - /** - * @var string - */ protected $description = 'Creates a new node on the system via the CLI.'; + /** + * MakeNodeCommand constructor. + */ + public function __construct(private NodeCreationService $creationService) + { + parent::__construct(); + } + /** * Handle the command execution process. * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ - public function handle(NodeCreationService $creationService) + public function handle() { - $this->creationService = $creationService; - $data['name'] = $this->option('name') ?? $this->ask('Enter a short identifier used to distinguish this node from others'); $data['description'] = $this->option('description') ?? $this->ask('Enter a description to identify the node'); $data['location_id'] = $this->option('locationId') ?? $this->ask('Enter a valid location id'); diff --git a/app/Console/Commands/Node/NodeConfigurationCommand.php b/app/Console/Commands/Node/NodeConfigurationCommand.php index fdd06417b..9bf0f425c 100644 --- a/app/Console/Commands/Node/NodeConfigurationCommand.php +++ b/app/Console/Commands/Node/NodeConfigurationCommand.php @@ -13,7 +13,7 @@ class NodeConfigurationCommand extends Command protected $description = 'Displays the configuration for the specified node.'; - public function handle() + public function handle(): int { $column = ctype_digit((string) $this->argument('node')) ? 'id' : 'uuid'; @@ -28,7 +28,7 @@ class NodeConfigurationCommand extends Command if (!in_array($format, ['yaml', 'yml', 'json'])) { $this->error('Invalid format specified. Valid options are "yaml" and "json".'); - exit(1); + return 1; } if ($format === 'json') { diff --git a/app/Console/Commands/Node/NodeListCommand.php b/app/Console/Commands/Node/NodeListCommand.php index 01ed4fde4..718ddd0d2 100644 --- a/app/Console/Commands/Node/NodeListCommand.php +++ b/app/Console/Commands/Node/NodeListCommand.php @@ -9,7 +9,7 @@ class NodeListCommand extends Command { protected $signature = 'p:node:list {--format=text : The output format: "text" or "json". }'; - public function handle() + public function handle(): int { $nodes = Node::query()->with('location')->get()->map(function (Node $node) { return [ diff --git a/app/Console/Commands/Overrides/SeedCommand.php b/app/Console/Commands/Overrides/SeedCommand.php index 5f050e340..7b7b5edb7 100644 --- a/app/Console/Commands/Overrides/SeedCommand.php +++ b/app/Console/Commands/Overrides/SeedCommand.php @@ -13,14 +13,14 @@ class SeedCommand extends BaseSeedCommand * Block someone from running this seed command if they have not completed * the migration process. */ - public function handle() + public function handle(): int { if (!$this->hasCompletedMigrations()) { $this->showMigrationWarning(); - return; + return 1; } - parent::handle(); + return parent::handle(); } } diff --git a/app/Console/Commands/Overrides/UpCommand.php b/app/Console/Commands/Overrides/UpCommand.php index 3001edcbe..0a7caaeb7 100644 --- a/app/Console/Commands/Overrides/UpCommand.php +++ b/app/Console/Commands/Overrides/UpCommand.php @@ -13,14 +13,14 @@ class UpCommand extends BaseUpCommand * Block someone from running this up command if they have not completed * the migration process. */ - public function handle() + public function handle(): int { if (!$this->hasCompletedMigrations()) { $this->showMigrationWarning(); - return; + return 1; } - parent::handle(); + return parent::handle(); } } diff --git a/app/Console/Commands/Schedule/ProcessRunnableCommand.php b/app/Console/Commands/Schedule/ProcessRunnableCommand.php index b334fbb13..49043f0f8 100644 --- a/app/Console/Commands/Schedule/ProcessRunnableCommand.php +++ b/app/Console/Commands/Schedule/ProcessRunnableCommand.php @@ -12,20 +12,14 @@ use Pterodactyl\Services\Schedules\ProcessScheduleService; class ProcessRunnableCommand extends Command { - /** - * @var string - */ protected $signature = 'p:schedule:process'; - /** - * @var string - */ protected $description = 'Process schedules in the database and determine which are ready to run.'; /** * Handle command execution. */ - public function handle() + public function handle(): int { $schedules = Schedule::query() ->with('tasks') @@ -38,7 +32,7 @@ class ProcessRunnableCommand extends Command if ($schedules->count() < 1) { $this->line('There are no scheduled tasks for servers that need to be run.'); - return; + return 0; } $bar = $this->output->createProgressBar(count($schedules)); @@ -50,6 +44,8 @@ class ProcessRunnableCommand extends Command } $this->line(''); + + return 0; } /** @@ -75,7 +71,7 @@ class ProcessRunnableCommand extends Command } catch (Throwable|Exception $exception) { Log::error($exception, ['schedule_id' => $schedule->id]); - $this->error("An error was encountered while processing Schedule #{$schedule->id}: " . $exception->getMessage()); + $this->error("An error was encountered while processing Schedule #$schedule->id: " . $exception->getMessage()); } } } diff --git a/app/Console/Commands/Server/BulkPowerActionCommand.php b/app/Console/Commands/Server/BulkPowerActionCommand.php index 01607bece..4e7ae1af9 100644 --- a/app/Console/Commands/Server/BulkPowerActionCommand.php +++ b/app/Console/Commands/Server/BulkPowerActionCommand.php @@ -4,6 +4,7 @@ namespace Pterodactyl\Console\Commands\Server; use Pterodactyl\Models\Server; use Illuminate\Console\Command; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Validation\ValidationException; use Illuminate\Validation\Factory as ValidatorFactory; use Pterodactyl\Repositories\Wings\DaemonPowerRepository; @@ -11,31 +12,33 @@ use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; class BulkPowerActionCommand extends Command { - /** - * @var string - */ protected $signature = 'p:server:bulk-power {action : The action to perform (start, stop, restart, kill)} {--servers= : A comma separated list of servers.} {--nodes= : A comma separated list of nodes.}'; - /** - * @var string - */ protected $description = 'Perform bulk power management on large groupings of servers or nodes at once.'; + /** + * BulkPowerActionCommand constructor. + */ + public function __construct(private DaemonPowerRepository $powerRepository, private ValidatorFactory $validator) + { + parent::__construct(); + } + /** * Handle the bulk power request. * * @throws \Illuminate\Validation\ValidationException */ - public function handle(DaemonPowerRepository $powerRepository, ValidatorFactory $validator) + public function handle() { $action = $this->argument('action'); $nodes = empty($this->option('nodes')) ? [] : explode(',', $this->option('nodes')); $servers = empty($this->option('servers')) ? [] : explode(',', $this->option('servers')); - $validator = $validator->make([ + $validator = $this->validator->make([ 'action' => $action, 'nodes' => $nodes, 'servers' => $servers, @@ -61,6 +64,7 @@ class BulkPowerActionCommand extends Command } $bar = $this->output->createProgressBar($count); + $powerRepository = $this->powerRepository; $this->getQueryBuilder($servers, $nodes)->each(function (Server $server) use ($action, $powerRepository, &$bar) { $bar->clear(); @@ -84,10 +88,8 @@ class BulkPowerActionCommand extends Command /** * Returns the query builder instance that will return the servers that should be affected. - * - * @return \Illuminate\Database\Eloquent\Builder */ - protected function getQueryBuilder(array $servers, array $nodes) + protected function getQueryBuilder(array $servers, array $nodes): Builder { $instance = Server::query()->whereNull('status'); diff --git a/app/Console/Commands/UpgradeCommand.php b/app/Console/Commands/UpgradeCommand.php index 86b2ed5f9..54e54e465 100644 --- a/app/Console/Commands/UpgradeCommand.php +++ b/app/Console/Commands/UpgradeCommand.php @@ -12,7 +12,6 @@ class UpgradeCommand extends Command { protected const DEFAULT_URL = 'https://github.com/pterodactyl/panel/releases/%s/panel.tar.gz'; - /** @var string */ protected $signature = 'p:upgrade {--user= : The user that PHP runs under. All files will be owned by this user.} {--group= : The group that PHP runs under. All files will be owned by this group.} @@ -20,7 +19,6 @@ class UpgradeCommand extends Command {--release= : A specific Pterodactyl version to download from GitHub. Leave blank to use latest.} {--skip-download : If set no archive will be downloaded.}'; - /** @var string */ protected $description = 'Downloads a new archive for Pterodactyl from GitHub and then executes the normal upgrade commands.'; /** @@ -92,7 +90,7 @@ class UpgradeCommand extends Command } } - ini_set('output_buffering', 0); + ini_set('output_buffering', '0'); $bar = $this->output->createProgressBar($skipDownload ? 9 : 10); $bar->start(); diff --git a/app/Console/Commands/User/DeleteUserCommand.php b/app/Console/Commands/User/DeleteUserCommand.php index 4c847257e..2b13b4866 100644 --- a/app/Console/Commands/User/DeleteUserCommand.php +++ b/app/Console/Commands/User/DeleteUserCommand.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Console\Commands\User; @@ -16,42 +9,19 @@ use Pterodactyl\Services\Users\UserDeletionService; class DeleteUserCommand extends Command { - /** - * @var \Pterodactyl\Services\Users\UserDeletionService - */ - protected $deletionService; - - /** - * @var string - */ protected $description = 'Deletes a user from the Panel if no servers are attached to their account.'; - /** - * @var \Pterodactyl\Contracts\Repository\UserRepositoryInterface - */ - protected $repository; - - /** - * @var string - */ protected $signature = 'p:user:delete {--user=}'; /** * DeleteUserCommand constructor. */ - public function __construct(UserDeletionService $deletionService) + public function __construct(private UserDeletionService $deletionService) { parent::__construct(); - - $this->deletionService = $deletionService; } - /** - * @return bool - * - * @throws \Pterodactyl\Exceptions\DisplayException - */ - public function handle() + public function handle(): int { $search = $this->option('user') ?? $this->ask(trans('command/messages.user.search_users')); Assert::notEmpty($search, 'Search term should be an email address, got: %s.'); @@ -68,7 +38,7 @@ class DeleteUserCommand extends Command return $this->handle(); } - return false; + return 1; } if ($this->input->isInteractive()) { @@ -85,7 +55,7 @@ class DeleteUserCommand extends Command if (count($results) > 1) { $this->error(trans('command/messages.user.multiple_found')); - return false; + return 1; } $deleteUser = $results->first(); @@ -95,5 +65,7 @@ class DeleteUserCommand extends Command $this->deletionService->handle($deleteUser); $this->info(trans('command/messages.user.deleted')); } + + return 0; } } diff --git a/app/Console/Commands/User/DisableTwoFactorCommand.php b/app/Console/Commands/User/DisableTwoFactorCommand.php index 05e98c045..052220114 100644 --- a/app/Console/Commands/User/DisableTwoFactorCommand.php +++ b/app/Console/Commands/User/DisableTwoFactorCommand.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Console\Commands\User; @@ -14,29 +7,16 @@ use Pterodactyl\Contracts\Repository\UserRepositoryInterface; class DisableTwoFactorCommand extends Command { - /** - * @var string - */ protected $description = 'Disable two-factor authentication for a specific user in the Panel.'; - /** - * @var \Pterodactyl\Contracts\Repository\UserRepositoryInterface - */ - protected $repository; - - /** - * @var string - */ protected $signature = 'p:user:disable2fa {--email= : The email of the user to disable 2-Factor for.}'; /** * DisableTwoFactorCommand constructor. */ - public function __construct(UserRepositoryInterface $repository) + public function __construct(private UserRepositoryInterface $repository) { parent::__construct(); - - $this->repository = $repository; } /** diff --git a/app/Console/Commands/User/MakeUserCommand.php b/app/Console/Commands/User/MakeUserCommand.php index f981a2f23..635a95646 100644 --- a/app/Console/Commands/User/MakeUserCommand.php +++ b/app/Console/Commands/User/MakeUserCommand.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Console\Commands\User; @@ -14,29 +7,16 @@ use Pterodactyl\Services\Users\UserCreationService; class MakeUserCommand extends Command { - /** - * @var \Pterodactyl\Services\Users\UserCreationService - */ - protected $creationService; - - /** - * @var string - */ protected $description = 'Creates a user on the system via the CLI.'; - /** - * @var string - */ protected $signature = 'p:user:make {--email=} {--username=} {--name-first=} {--name-last=} {--password=} {--admin=} {--no-password}'; /** * MakeUserCommand constructor. */ - public function __construct(UserCreationService $creationService) + public function __construct(private UserCreationService $creationService) { parent::__construct(); - - $this->creationService = $creationService; } /** diff --git a/app/Console/RequiresDatabaseMigrations.php b/app/Console/RequiresDatabaseMigrations.php index 0a4ca4944..2e5ebe6b2 100644 --- a/app/Console/RequiresDatabaseMigrations.php +++ b/app/Console/RequiresDatabaseMigrations.php @@ -33,7 +33,7 @@ trait RequiresDatabaseMigrations * them to properly run the migrations rather than ignoring all of the other previous * errors... */ - protected function showMigrationWarning() + protected function showMigrationWarning(): void { $this->getOutput()->writeln(' | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | diff --git a/app/Contracts/Criteria/CriteriaInterface.php b/app/Contracts/Criteria/CriteriaInterface.php index cb9f56d7f..5edfcdb62 100644 --- a/app/Contracts/Criteria/CriteriaInterface.php +++ b/app/Contracts/Criteria/CriteriaInterface.php @@ -1,24 +1,14 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Contracts\Criteria; +use Illuminate\Database\Eloquent\Model; use Pterodactyl\Repositories\Repository; interface CriteriaInterface { /** * Apply selected criteria to a repository call. - * - * @param \Illuminate\Database\Eloquent\Model $model - * - * @return mixed */ - public function apply($model, Repository $repository); + public function apply(Model $model, Repository $repository): mixed; } diff --git a/app/Contracts/Extensions/HashidsInterface.php b/app/Contracts/Extensions/HashidsInterface.php index 876c2bac4..1cf83b4a0 100644 --- a/app/Contracts/Extensions/HashidsInterface.php +++ b/app/Contracts/Extensions/HashidsInterface.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Contracts\Extensions; @@ -16,12 +9,7 @@ interface HashidsInterface extends VendorHashidsInterface /** * Decode an encoded hashid and return the first result. * - * @param string $encoded - * @param null $default - * - * @return mixed - * * @throws \InvalidArgumentException */ - public function decodeFirst($encoded, $default = null); + public function decodeFirst(string $encoded, string $default = null): mixed; } diff --git a/app/Contracts/Http/ClientPermissionsRequest.php b/app/Contracts/Http/ClientPermissionsRequest.php index 85eae2259..a99bca35c 100644 --- a/app/Contracts/Http/ClientPermissionsRequest.php +++ b/app/Contracts/Http/ClientPermissionsRequest.php @@ -6,7 +6,7 @@ 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 + * validate that the authenticated user has permission to perform this action against * the given resource (server). */ public function permission(): string; diff --git a/app/Contracts/Repository/AllocationRepositoryInterface.php b/app/Contracts/Repository/AllocationRepositoryInterface.php index 24507f9a7..810880327 100644 --- a/app/Contracts/Repository/AllocationRepositoryInterface.php +++ b/app/Contracts/Repository/AllocationRepositoryInterface.php @@ -2,18 +2,18 @@ namespace Pterodactyl\Contracts\Repository; +use Pterodactyl\Models\Allocation; + interface AllocationRepositoryInterface extends RepositoryInterface { /** - * Return all of the allocations that exist for a node that are not currently + * Return all the allocations that exist for a node that are not currently * allocated. */ public function getUnassignedAllocationIds(int $node): array; /** * Return a single allocation from those meeting the requirements. - * - * @return \Pterodactyl\Models\Allocation|null */ - public function getRandomAllocation(array $nodes, array $ports, bool $dedicated = false); + public function getRandomAllocation(array $nodes, array $ports, bool $dedicated = false): ?Allocation; } diff --git a/app/Contracts/Repository/ApiKeyRepositoryInterface.php b/app/Contracts/Repository/ApiKeyRepositoryInterface.php index 91e0a3827..bfebbddb6 100644 --- a/app/Contracts/Repository/ApiKeyRepositoryInterface.php +++ b/app/Contracts/Repository/ApiKeyRepositoryInterface.php @@ -8,12 +8,12 @@ use Illuminate\Support\Collection; interface ApiKeyRepositoryInterface extends RepositoryInterface { /** - * Get all of the account API keys that exist for a specific user. + * Get all the account API keys that exist for a specific user. */ public function getAccountKeys(User $user): Collection; /** - * Get all of the application API keys that exist for a specific user. + * Get all the application API keys that exist for a specific user. */ public function getApplicationKeys(User $user): Collection; diff --git a/app/Contracts/Repository/ApiPermissionRepositoryInterface.php b/app/Contracts/Repository/ApiPermissionRepositoryInterface.php index 3d1b8526e..911587571 100644 --- a/app/Contracts/Repository/ApiPermissionRepositoryInterface.php +++ b/app/Contracts/Repository/ApiPermissionRepositoryInterface.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Contracts\Repository; diff --git a/app/Contracts/Repository/DatabaseRepositoryInterface.php b/app/Contracts/Repository/DatabaseRepositoryInterface.php index 622072203..befc2ce4d 100644 --- a/app/Contracts/Repository/DatabaseRepositoryInterface.php +++ b/app/Contracts/Repository/DatabaseRepositoryInterface.php @@ -2,7 +2,6 @@ namespace Pterodactyl\Contracts\Repository; -use Pterodactyl\Models\Database; use Illuminate\Support\Collection; use Illuminate\Contracts\Pagination\LengthAwarePaginator; @@ -12,10 +11,8 @@ interface DatabaseRepositoryInterface extends RepositoryInterface /** * Set the connection name to execute statements against. - * - * @return $this */ - public function setConnection(string $connection); + public function setConnection(string $connection): self; /** * Return the connection to execute statements against. @@ -23,12 +20,12 @@ interface DatabaseRepositoryInterface extends RepositoryInterface public function getConnection(): string; /** - * Return all of the databases belonging to a server. + * Return all the databases belonging to a server. */ public function getDatabasesForServer(int $server): Collection; /** - * Return all of the databases for a given host with the server relationship loaded. + * Return all the databases for a given host with the server relationship loaded. */ public function getDatabasesForHost(int $host, int $count = 25): LengthAwarePaginator; @@ -39,10 +36,8 @@ interface DatabaseRepositoryInterface extends RepositoryInterface /** * Create a new database user on a given connection. - * - * @param $max_connections */ - public function createUser(string $username, string $remote, string $password, string $max_connections): bool; + public function createUser(string $username, string $remote, string $password, ?int $max_connections): bool; /** * Give a specific user access to a given database. @@ -61,8 +56,6 @@ interface DatabaseRepositoryInterface extends RepositoryInterface /** * Drop a given user on a specific connection. - * - * @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 733e70cfb..5f2162c4c 100644 --- a/app/Contracts/Repository/EggRepositoryInterface.php +++ b/app/Contracts/Repository/EggRepositoryInterface.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Contracts\Repository; @@ -28,13 +21,11 @@ interface EggRepositoryInterface extends RepositoryInterface /** * Return an egg with the scriptFrom and configFrom relations loaded onto the model. - * - * @param int|string $value */ - public function getWithCopyAttributes($value, string $column = 'id'): Egg; + public function getWithCopyAttributes(int|string $value, string $column = 'id'): Egg; /** - * Return all of the data needed to export a service. + * Return all the data needed to export a service. * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ diff --git a/app/Contracts/Repository/EggVariableRepositoryInterface.php b/app/Contracts/Repository/EggVariableRepositoryInterface.php index 6a00955d4..e20080818 100644 --- a/app/Contracts/Repository/EggVariableRepositoryInterface.php +++ b/app/Contracts/Repository/EggVariableRepositoryInterface.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Contracts\Repository; diff --git a/app/Contracts/Repository/LocationRepositoryInterface.php b/app/Contracts/Repository/LocationRepositoryInterface.php index d24cee5bd..066a2e7c6 100644 --- a/app/Contracts/Repository/LocationRepositoryInterface.php +++ b/app/Contracts/Repository/LocationRepositoryInterface.php @@ -13,14 +13,12 @@ interface LocationRepositoryInterface extends RepositoryInterface public function getAllWithDetails(): Collection; /** - * Return all of the available locations with the nodes as a relationship. + * Return all the available locations with the nodes as a relationship. */ public function getAllWithNodes(): Collection; /** - * Return all of the nodes and their respective count of servers for a location. - * - * @return mixed + * Return all the nodes and their respective count of servers for a location. * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -29,8 +27,6 @@ interface LocationRepositoryInterface extends RepositoryInterface /** * Return a location and the count of nodes in that location. * - * @return mixed - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function getWithNodeCount(int $id): Location; diff --git a/app/Contracts/Repository/NestRepositoryInterface.php b/app/Contracts/Repository/NestRepositoryInterface.php index 1f430dbf8..2f80bedd5 100644 --- a/app/Contracts/Repository/NestRepositoryInterface.php +++ b/app/Contracts/Repository/NestRepositoryInterface.php @@ -1,37 +1,25 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Contracts\Repository; use Pterodactyl\Models\Nest; +use Illuminate\Database\Eloquent\Collection; 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 */ - public function getWithEggs(int $id = null); + public function getWithEggs(int $id = null): Collection|Nest; /** * Return a nest or all nests and the count of eggs and servers for that nest. * - * @return \Pterodactyl\Models\Nest|\Illuminate\Database\Eloquent\Collection - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function getWithCounts(int $id = null); + public function getWithCounts(int $id = null): Collection|Nest; /** * Return a nest along with its associated eggs and the servers relation on those eggs. diff --git a/app/Contracts/Repository/PermissionRepositoryInterface.php b/app/Contracts/Repository/PermissionRepositoryInterface.php index b35c0e59d..ad67f8f41 100644 --- a/app/Contracts/Repository/PermissionRepositoryInterface.php +++ b/app/Contracts/Repository/PermissionRepositoryInterface.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Contracts\Repository; diff --git a/app/Contracts/Repository/RepositoryInterface.php b/app/Contracts/Repository/RepositoryInterface.php index e9350d5f0..5dc0c6655 100644 --- a/app/Contracts/Repository/RepositoryInterface.php +++ b/app/Contracts/Repository/RepositoryInterface.php @@ -3,87 +3,67 @@ namespace Pterodactyl\Contracts\Repository; use Illuminate\Support\Collection; +use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Contracts\Pagination\LengthAwarePaginator; interface RepositoryInterface { /** * Return an identifier or Model object to be used by the repository. - * - * @return string|\Closure|object */ - public function model(); + public function model(): string; /** * Return the model being used for this repository instance. - * - * @return mixed */ - public function getModel(); + public function getModel(): Model; /** * Returns an instance of a query builder. - * - * @return mixed */ - public function getBuilder(); + public function getBuilder(): Builder; /** * Returns the columns to be selected or returned by the query. - * - * @return mixed */ - public function getColumns(); + public function getColumns(): array; /** * An array of columns to filter the response by. - * - * @param array|string $columns - * - * @return $this */ - public function setColumns($columns = ['*']); + public function setColumns(array|string $columns = ['*']): self; /** * Stop repository update functions from returning a fresh * model when changes are committed. - * - * @return $this */ - public function withoutFreshModel(); + public function withoutFreshModel(): self; /** * Return a fresh model with a repository updates a model. - * - * @return $this */ - public function withFreshModel(); + public function withFreshModel(): self; /** - * Set whether or not the repository should return a fresh model + * Set whether the repository should return a fresh model * when changes are committed. - * - * @return $this */ - public function setFreshModel(bool $fresh = true); + public function setFreshModel(bool $fresh = true): self; /** * Create a new model instance and persist it to the database. * - * @return mixed - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ - public function create(array $fields, bool $validate = true, bool $force = false); + public function create(array $fields, bool $validate = true, bool $force = false): mixed; /** * Find a model that has the specific ID passed. * - * @return mixed - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function find(int $id); + public function find(int $id): mixed; /** * Find a model matching an array of where clauses. @@ -93,11 +73,9 @@ interface RepositoryInterface /** * Find and return the first matching instance for the given fields. * - * @return mixed - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function findFirstWhere(array $fields); + public function findFirstWhere(array $fields): mixed; /** * Return a count of records matching the passed arguments. @@ -117,14 +95,10 @@ interface RepositoryInterface /** * Update a given ID with the passed array of fields. * - * @param int $id - * - * @return mixed - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function update($id, array $fields, bool $validate = true, bool $force = false); + public function update(int $id, array $fields, bool $validate = true, bool $force = false): mixed; /** * Perform a mass update where matching records are updated using whereIn. @@ -135,11 +109,9 @@ interface RepositoryInterface /** * Update a record if it exists in the database, otherwise create it. * - * @return mixed - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ - public function updateOrCreate(array $where, array $fields, bool $validate = true, bool $force = false); + public function updateOrCreate(array $where, array $fields, bool $validate = true, bool $force = false): mixed; /** * Return all records associated with the given model. diff --git a/app/Contracts/Repository/ScheduleRepositoryInterface.php b/app/Contracts/Repository/ScheduleRepositoryInterface.php index c7bb0ee26..fa9c18b41 100644 --- a/app/Contracts/Repository/ScheduleRepositoryInterface.php +++ b/app/Contracts/Repository/ScheduleRepositoryInterface.php @@ -8,12 +8,12 @@ use Illuminate\Support\Collection; interface ScheduleRepositoryInterface extends RepositoryInterface { /** - * Return all of the schedules for a given server. + * Return all the schedules for a given server. */ public function findServerSchedules(int $server): Collection; /** - * Return a schedule model with all of the associated tasks as a relationship. + * Return a schedule model with all the associated tasks as a relationship. * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ diff --git a/app/Contracts/Repository/ServerRepositoryInterface.php b/app/Contracts/Repository/ServerRepositoryInterface.php index fc3e6ff1a..9294a191b 100644 --- a/app/Contracts/Repository/ServerRepositoryInterface.php +++ b/app/Contracts/Repository/ServerRepositoryInterface.php @@ -67,7 +67,7 @@ interface ServerRepositoryInterface extends RepositoryInterface public function isUniqueUuidCombo(string $uuid, string $short): bool; /** - * Returns all of the servers that exist for a given node in a paginated response. + * Returns all the servers that exist for a given node in a paginated response. */ public function loadAllServersForNode(int $node, int $limit): LengthAwarePaginator; } diff --git a/app/Contracts/Repository/SessionRepositoryInterface.php b/app/Contracts/Repository/SessionRepositoryInterface.php index 305752fb4..0a433af71 100644 --- a/app/Contracts/Repository/SessionRepositoryInterface.php +++ b/app/Contracts/Repository/SessionRepositoryInterface.php @@ -7,14 +7,12 @@ use Illuminate\Support\Collection; interface SessionRepositoryInterface extends RepositoryInterface { /** - * Return all of the active sessions for a user. + * Return all the active sessions for a user. */ public function getUserSessions(int $user): Collection; /** * Delete a session for a given user. - * - * @return int|null */ - public function deleteUserSession(int $user, string $session); + public function deleteUserSession(int $user, string $session): ?int; } diff --git a/app/Contracts/Repository/SettingsRepositoryInterface.php b/app/Contracts/Repository/SettingsRepositoryInterface.php index e5b2bb773..c55c09b74 100644 --- a/app/Contracts/Repository/SettingsRepositoryInterface.php +++ b/app/Contracts/Repository/SettingsRepositoryInterface.php @@ -14,12 +14,8 @@ interface SettingsRepositoryInterface extends RepositoryInterface /** * Retrieve a persistent setting from the database. - * - * @param mixed $default - * - * @return mixed */ - public function get(string $key, $default); + public function get(string $key, mixed $default): mixed; /** * Remove a key from the database cache. diff --git a/app/Contracts/Repository/TaskRepositoryInterface.php b/app/Contracts/Repository/TaskRepositoryInterface.php index 18811ba5c..0cd980d21 100644 --- a/app/Contracts/Repository/TaskRepositoryInterface.php +++ b/app/Contracts/Repository/TaskRepositoryInterface.php @@ -15,8 +15,6 @@ interface TaskRepositoryInterface extends RepositoryInterface /** * Returns the next task in a schedule. - * - * @return \Pterodactyl\Models\Task|null */ - public function getNextTask(int $schedule, int $index); + public function getNextTask(int $schedule, int $index): ?Task; } diff --git a/app/Events/ActivityLogged.php b/app/Events/ActivityLogged.php index 254288760..ca9db7930 100644 --- a/app/Events/ActivityLogged.php +++ b/app/Events/ActivityLogged.php @@ -8,11 +8,8 @@ use Illuminate\Database\Eloquent\Model; class ActivityLogged extends Event { - public ActivityLog $model; - - public function __construct(ActivityLog $model) + public function __construct(public ActivityLog $model) { - $this->model = $model; } public function is(string $event): bool @@ -25,12 +22,12 @@ class ActivityLogged extends Event return $this->isSystem() ? null : $this->model->actor; } - public function isServerEvent() + public function isServerEvent(): bool { return Str::startsWith($this->model->event, 'server:'); } - public function isSystem() + public function isSystem(): bool { return is_null($this->model->actor_id); } diff --git a/app/Events/Auth/DirectLogin.php b/app/Events/Auth/DirectLogin.php new file mode 100644 index 000000000..99df4e100 --- /dev/null +++ b/app/Events/Auth/DirectLogin.php @@ -0,0 +1,13 @@ +. - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Events\Auth; +use Pterodactyl\Events\Event; use Illuminate\Queue\SerializesModels; -class FailedCaptcha +class FailedCaptcha extends Event { use SerializesModels; - /** - * The IP that the request originated from. - * - * @var string - */ - public $ip; - - /** - * The domain that was used to try to verify the request with recaptcha api. - * - * @var string - */ - public $domain; - /** * Create a new event instance. - * - * @param string $ip - * @param string $domain */ - public function __construct($ip, $domain) + public function __construct(public string $ip, public string $domain) { - $this->ip = $ip; - $this->domain = $domain; } } diff --git a/app/Events/Auth/FailedPasswordReset.php b/app/Events/Auth/FailedPasswordReset.php index 913bd0a6f..7a2bc3799 100644 --- a/app/Events/Auth/FailedPasswordReset.php +++ b/app/Events/Auth/FailedPasswordReset.php @@ -1,43 +1,18 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Events\Auth; +use Pterodactyl\Events\Event; use Illuminate\Queue\SerializesModels; -class FailedPasswordReset +class FailedPasswordReset extends Event { use SerializesModels; - /** - * The IP that the request originated from. - * - * @var string - */ - public $ip; - - /** - * The email address that was used when the reset request failed. - * - * @var string - */ - public $email; - /** * Create a new event instance. - * - * @param string $ip - * @param string $email */ - public function __construct($ip, $email) + public function __construct(public string $ip, public string $email) { - $this->ip = $ip; - $this->email = $email; } } diff --git a/app/Events/Auth/ProvidedAuthenticationToken.php b/app/Events/Auth/ProvidedAuthenticationToken.php index 71a1c6797..baf363d52 100644 --- a/app/Events/Auth/ProvidedAuthenticationToken.php +++ b/app/Events/Auth/ProvidedAuthenticationToken.php @@ -3,16 +3,11 @@ namespace Pterodactyl\Events\Auth; use Pterodactyl\Models\User; +use Pterodactyl\Events\Event; -class ProvidedAuthenticationToken +class ProvidedAuthenticationToken extends Event { - public User $user; - - public bool $recovery; - - public function __construct(User $user, bool $recovery = false) + public function __construct(public User $user, public bool $recovery = false) { - $this->user = $user; - $this->recovery = $recovery; } } diff --git a/app/Events/Server/Created.php b/app/Events/Server/Created.php index 8963b3cbf..3eb545f09 100644 --- a/app/Events/Server/Created.php +++ b/app/Events/Server/Created.php @@ -1,33 +1,19 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Events\Server; +use Pterodactyl\Events\Event; use Pterodactyl\Models\Server; use Illuminate\Queue\SerializesModels; -class Created +class Created extends Event { use SerializesModels; - /** - * The Eloquent model of the server. - * - * @var \Pterodactyl\Models\Server - */ - public $server; - /** * Create a new event instance. */ - public function __construct(Server $server) + public function __construct(public Server $server) { - $this->server = $server; } } diff --git a/app/Events/Server/Creating.php b/app/Events/Server/Creating.php index 457f586ed..36e4c5ccb 100644 --- a/app/Events/Server/Creating.php +++ b/app/Events/Server/Creating.php @@ -1,33 +1,19 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Events\Server; +use Pterodactyl\Events\Event; use Pterodactyl\Models\Server; use Illuminate\Queue\SerializesModels; -class Creating +class Creating extends Event { use SerializesModels; - /** - * The Eloquent model of the server. - * - * @var \Pterodactyl\Models\Server - */ - public $server; - /** * Create a new event instance. */ - public function __construct(Server $server) + public function __construct(public Server $server) { - $this->server = $server; } } diff --git a/app/Events/Server/Deleted.php b/app/Events/Server/Deleted.php index c9f69cab5..04e496185 100644 --- a/app/Events/Server/Deleted.php +++ b/app/Events/Server/Deleted.php @@ -1,33 +1,19 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Events\Server; +use Pterodactyl\Events\Event; use Pterodactyl\Models\Server; use Illuminate\Queue\SerializesModels; -class Deleted +class Deleted extends Event { use SerializesModels; - /** - * The Eloquent model of the server. - * - * @var \Pterodactyl\Models\Server - */ - public $server; - /** * Create a new event instance. */ - public function __construct(Server $server) + public function __construct(public Server $server) { - $this->server = $server; } } diff --git a/app/Events/Server/Deleting.php b/app/Events/Server/Deleting.php index e411e2a70..636b9483c 100644 --- a/app/Events/Server/Deleting.php +++ b/app/Events/Server/Deleting.php @@ -1,33 +1,19 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Events\Server; +use Pterodactyl\Events\Event; use Pterodactyl\Models\Server; use Illuminate\Queue\SerializesModels; -class Deleting +class Deleting extends Event { use SerializesModels; - /** - * The Eloquent model of the server. - * - * @var \Pterodactyl\Models\Server - */ - public $server; - /** * Create a new event instance. */ - public function __construct(Server $server) + public function __construct(public Server $server) { - $this->server = $server; } } diff --git a/app/Events/Server/Installed.php b/app/Events/Server/Installed.php index 81b6963bc..614ead218 100644 --- a/app/Events/Server/Installed.php +++ b/app/Events/Server/Installed.php @@ -10,18 +10,10 @@ class Installed extends Event { use SerializesModels; - /** - * @var \Pterodactyl\Models\Server - */ - public $server; - /** * Create a new event instance. - * - * @var \Pterodactyl\Models\Server */ - public function __construct(Server $server) + public function __construct(public Server $server) { - $this->server = $server; } } diff --git a/app/Events/Server/Saved.php b/app/Events/Server/Saved.php index c6dc024c5..d9b4151eb 100644 --- a/app/Events/Server/Saved.php +++ b/app/Events/Server/Saved.php @@ -1,33 +1,19 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Events\Server; +use Pterodactyl\Events\Event; use Pterodactyl\Models\Server; use Illuminate\Queue\SerializesModels; -class Saved +class Saved extends Event { use SerializesModels; - /** - * The Eloquent model of the server. - * - * @var \Pterodactyl\Models\Server - */ - public $server; - /** * Create a new event instance. */ - public function __construct(Server $server) + public function __construct(public Server $server) { - $this->server = $server; } } diff --git a/app/Events/Server/Saving.php b/app/Events/Server/Saving.php index 9e80d6265..f2ee59dfa 100644 --- a/app/Events/Server/Saving.php +++ b/app/Events/Server/Saving.php @@ -1,33 +1,19 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Events\Server; +use Pterodactyl\Events\Event; use Pterodactyl\Models\Server; use Illuminate\Queue\SerializesModels; -class Saving +class Saving extends Event { use SerializesModels; - /** - * The Eloquent model of the server. - * - * @var \Pterodactyl\Models\Server - */ - public $server; - /** * Create a new event instance. */ - public function __construct(Server $server) + public function __construct(public Server $server) { - $this->server = $server; } } diff --git a/app/Events/Server/Updated.php b/app/Events/Server/Updated.php index b813b0997..35677f35d 100644 --- a/app/Events/Server/Updated.php +++ b/app/Events/Server/Updated.php @@ -1,33 +1,19 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Events\Server; +use Pterodactyl\Events\Event; use Pterodactyl\Models\Server; use Illuminate\Queue\SerializesModels; -class Updated +class Updated extends Event { use SerializesModels; - /** - * The Eloquent model of the server. - * - * @var \Pterodactyl\Models\Server - */ - public $server; - /** * Create a new event instance. */ - public function __construct(Server $server) + public function __construct(public Server $server) { - $this->server = $server; } } diff --git a/app/Events/Server/Updating.php b/app/Events/Server/Updating.php index 4c8ead093..5e70e3add 100644 --- a/app/Events/Server/Updating.php +++ b/app/Events/Server/Updating.php @@ -1,33 +1,19 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Events\Server; +use Pterodactyl\Events\Event; use Pterodactyl\Models\Server; use Illuminate\Queue\SerializesModels; -class Updating +class Updating extends Event { use SerializesModels; - /** - * The Eloquent model of the server. - * - * @var \Pterodactyl\Models\Server - */ - public $server; - /** * Create a new event instance. */ - public function __construct(Server $server) + public function __construct(public Server $server) { - $this->server = $server; } } diff --git a/app/Events/Subuser/Created.php b/app/Events/Subuser/Created.php index 2467fe99a..bd4cdbe67 100644 --- a/app/Events/Subuser/Created.php +++ b/app/Events/Subuser/Created.php @@ -1,33 +1,19 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Events\Subuser; +use Pterodactyl\Events\Event; use Pterodactyl\Models\Subuser; use Illuminate\Queue\SerializesModels; -class Created +class Created extends Event { use SerializesModels; - /** - * The Eloquent model of the server. - * - * @var \Pterodactyl\Models\Subuser - */ - public $subuser; - /** * Create a new event instance. */ - public function __construct(Subuser $subuser) + public function __construct(public Subuser $subuser) { - $this->subuser = $subuser; } } diff --git a/app/Events/Subuser/Creating.php b/app/Events/Subuser/Creating.php index 03aa5f7fd..fd1e00eea 100644 --- a/app/Events/Subuser/Creating.php +++ b/app/Events/Subuser/Creating.php @@ -1,33 +1,19 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Events\Subuser; +use Pterodactyl\Events\Event; use Pterodactyl\Models\Subuser; use Illuminate\Queue\SerializesModels; -class Creating +class Creating extends Event { use SerializesModels; - /** - * The Eloquent model of the server. - * - * @var \Pterodactyl\Models\Subuser - */ - public $subuser; - /** * Create a new event instance. */ - public function __construct(Subuser $subuser) + public function __construct(public Subuser $subuser) { - $this->subuser = $subuser; } } diff --git a/app/Events/Subuser/Deleted.php b/app/Events/Subuser/Deleted.php index 0e9744c3f..6c0dc05ec 100644 --- a/app/Events/Subuser/Deleted.php +++ b/app/Events/Subuser/Deleted.php @@ -1,33 +1,19 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Events\Subuser; +use Pterodactyl\Events\Event; use Pterodactyl\Models\Subuser; use Illuminate\Queue\SerializesModels; -class Deleted +class Deleted extends Event { use SerializesModels; - /** - * The Eloquent model of the server. - * - * @var \Pterodactyl\Models\Subuser - */ - public $subuser; - /** * Create a new event instance. */ - public function __construct(Subuser $subuser) + public function __construct(public Subuser $subuser) { - $this->subuser = $subuser; } } diff --git a/app/Events/Subuser/Deleting.php b/app/Events/Subuser/Deleting.php index 9d1e12c2f..d26b3fc44 100644 --- a/app/Events/Subuser/Deleting.php +++ b/app/Events/Subuser/Deleting.php @@ -1,33 +1,19 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Events\Subuser; +use Pterodactyl\Events\Event; use Pterodactyl\Models\Subuser; use Illuminate\Queue\SerializesModels; -class Deleting +class Deleting extends Event { use SerializesModels; - /** - * The Eloquent model of the server. - * - * @var \Pterodactyl\Models\Subuser - */ - public $subuser; - /** * Create a new event instance. */ - public function __construct(Subuser $subuser) + public function __construct(public Subuser $subuser) { - $this->subuser = $subuser; } } diff --git a/app/Events/User/Created.php b/app/Events/User/Created.php index 72eba811c..b4e3cf792 100644 --- a/app/Events/User/Created.php +++ b/app/Events/User/Created.php @@ -1,33 +1,19 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Events\User; use Pterodactyl\Models\User; +use Pterodactyl\Events\Event; use Illuminate\Queue\SerializesModels; -class Created +class Created extends Event { use SerializesModels; - /** - * The Eloquent model of the server. - * - * @var \Pterodactyl\Models\User - */ - public $user; - /** * Create a new event instance. */ - public function __construct(User $user) + public function __construct(public User $user) { - $this->user = $user; } } diff --git a/app/Events/User/Creating.php b/app/Events/User/Creating.php index 7948d7067..75f76c95b 100644 --- a/app/Events/User/Creating.php +++ b/app/Events/User/Creating.php @@ -1,33 +1,19 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Events\User; use Pterodactyl\Models\User; +use Pterodactyl\Events\Event; use Illuminate\Queue\SerializesModels; -class Creating +class Creating extends Event { use SerializesModels; - /** - * The Eloquent model of the server. - * - * @var \Pterodactyl\Models\User - */ - public $user; - /** * Create a new event instance. */ - public function __construct(User $user) + public function __construct(public User $user) { - $this->user = $user; } } diff --git a/app/Events/User/Deleted.php b/app/Events/User/Deleted.php index 48b524874..914014cf5 100644 --- a/app/Events/User/Deleted.php +++ b/app/Events/User/Deleted.php @@ -1,33 +1,19 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Events\User; use Pterodactyl\Models\User; +use Pterodactyl\Events\Event; use Illuminate\Queue\SerializesModels; -class Deleted +class Deleted extends Event { use SerializesModels; - /** - * The Eloquent model of the server. - * - * @var \Pterodactyl\Models\User - */ - public $user; - /** * Create a new event instance. */ - public function __construct(User $user) + public function __construct(public User $user) { - $this->user = $user; } } diff --git a/app/Events/User/Deleting.php b/app/Events/User/Deleting.php index a386bd951..ba8df8b74 100644 --- a/app/Events/User/Deleting.php +++ b/app/Events/User/Deleting.php @@ -1,33 +1,19 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Events\User; use Pterodactyl\Models\User; +use Pterodactyl\Events\Event; use Illuminate\Queue\SerializesModels; -class Deleting +class Deleting extends Event { use SerializesModels; - /** - * The Eloquent model of the server. - * - * @var \Pterodactyl\Models\User - */ - public $user; - /** * Create a new event instance. */ - public function __construct(User $user) + public function __construct(public User $user) { - $this->user = $user; } } diff --git a/app/Exceptions/AccountNotFoundException.php b/app/Exceptions/AccountNotFoundException.php index 885e712e6..832fbf2d1 100644 --- a/app/Exceptions/AccountNotFoundException.php +++ b/app/Exceptions/AccountNotFoundException.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Exceptions; diff --git a/app/Exceptions/AutoDeploymentException.php b/app/Exceptions/AutoDeploymentException.php index 96627763b..d1d3de5c5 100644 --- a/app/Exceptions/AutoDeploymentException.php +++ b/app/Exceptions/AutoDeploymentException.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Exceptions; diff --git a/app/Exceptions/DisplayException.php b/app/Exceptions/DisplayException.php index c7b3b2edb..c29120f9a 100644 --- a/app/Exceptions/DisplayException.php +++ b/app/Exceptions/DisplayException.php @@ -4,9 +4,12 @@ namespace Pterodactyl\Exceptions; use Exception; use Throwable; +use Illuminate\Http\Request; use Psr\Log\LoggerInterface; use Illuminate\Http\Response; +use Illuminate\Http\JsonResponse; use Illuminate\Container\Container; +use Illuminate\Http\RedirectResponse; use Prologue\Alerts\AlertsMessageBag; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; @@ -18,44 +21,24 @@ class DisplayException extends PterodactylException implements HttpExceptionInte public const LEVEL_ERROR = 'error'; /** - * @var string + * DisplayException constructor. */ - protected $level; - - /** - * Exception constructor. - * - * @param string $message - * @param string $level - * @param int $code - */ - public function __construct($message, Throwable $previous = null, $level = self::LEVEL_ERROR, $code = 0) + public function __construct(string $message, ?Throwable $previous = null, protected string $level = self::LEVEL_ERROR, int $code = 0) { parent::__construct($message, $code, $previous); - - $this->level = $level; } - /** - * @return string - */ - public function getErrorLevel() + public function getErrorLevel(): string { return $this->level; } - /** - * @return int - */ - public function getStatusCode() + public function getStatusCode(): int { return Response::HTTP_BAD_REQUEST; } - /** - * @return array - */ - public function getHeaders() + public function getHeaders(): array { return []; } @@ -64,12 +47,8 @@ class DisplayException extends PterodactylException implements HttpExceptionInte * Render the exception to the user by adding a flashed message to the session * and then redirecting them back to the page that they came from. If the * 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) + public function render(Request $request): JsonResponse|RedirectResponse { if ($request->expectsJson()) { return response()->json(Handler::toArray($this), $this->getStatusCode(), $this->getHeaders()); @@ -84,9 +63,7 @@ class DisplayException extends PterodactylException implements HttpExceptionInte * Log the exception to the logs using the defined error level only if the previous * exception is set. * - * @return mixed - * - * @throws \Exception + * @throws \Throwable */ public function report() { @@ -96,7 +73,7 @@ class DisplayException extends PterodactylException implements HttpExceptionInte try { $logger = Container::getInstance()->make(LoggerInterface::class); - } catch (Exception $ex) { + } catch (Exception) { throw $this->getPrevious(); } diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index c8d46da3f..bcc636b5c 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -7,18 +7,20 @@ use Throwable; use PDOException; 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\Http\RedirectResponse; use Illuminate\Foundation\Application; use Illuminate\Auth\AuthenticationException; use Illuminate\Session\TokenMismatchException; use Illuminate\Validation\ValidationException; +use Symfony\Component\HttpFoundation\Response; use Illuminate\Auth\Access\AuthorizationException; use Illuminate\Database\Eloquent\ModelNotFoundException; use Symfony\Component\HttpKernel\Exception\HttpException; +use Symfony\Component\Mailer\Exception\TransportException; use Pterodactyl\Exceptions\Repository\RecordNotFoundException; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; @@ -26,7 +28,7 @@ use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; class Handler extends ExceptionHandler { /** - * Laravel's validation parser formats custom rules using the class name + * The validation parser in Laravel formats custom rules using the class name * resulting in some weird rule names. This string will be parsed out and * replaced with 'p_' in the response code. */ @@ -34,8 +36,6 @@ class Handler extends ExceptionHandler /** * A list of the exception types that should not be reported. - * - * @var array */ protected $dontReport = [ AuthenticationException::class, @@ -50,8 +50,6 @@ class Handler extends ExceptionHandler /** * Maps exceptions to a specific response code. This handles special exception * types that don't have a defined response code. - * - * @var array */ protected static array $exceptionResponseCodes = [ AuthenticationException::class => 401, @@ -61,8 +59,6 @@ class Handler extends ExceptionHandler /** * A list of the inputs that are never flashed for validation exceptions. - * - * @var array */ protected $dontFlash = [ 'token', @@ -89,7 +85,7 @@ class Handler extends ExceptionHandler $ex = $this->generateCleanedExceptionStack($ex); }); - $this->reportable(function (Swift_TransportException $ex) { + $this->reportable(function (TransportException $ex) { $ex = $this->generateCleanedExceptionStack($ex); }); } @@ -125,11 +121,9 @@ class Handler extends ExceptionHandler * * @param \Illuminate\Http\Request $request * - * @return \Symfony\Component\HttpFoundation\Response - * * @throws \Throwable */ - public function render($request, Throwable $exception) + public function render($request, Throwable $e): Response { $connections = $this->container->make(Connection::class); @@ -146,7 +140,7 @@ class Handler extends ExceptionHandler $connections->rollBack(0); } - return parent::render($request, $exception); + return parent::render($request, $e); } /** @@ -154,10 +148,8 @@ class Handler extends ExceptionHandler * calls to the API. * * @param \Illuminate\Http\Request $request - * - * @return \Illuminate\Http\JsonResponse */ - public function invalidJson($request, ValidationException $exception) + public function invalidJson($request, ValidationException $exception): JsonResponse { $codes = Collection::make($exception->validator->failed())->mapWithKeys(function ($reasons, $field) { $cleaned = []; @@ -197,21 +189,21 @@ class Handler extends ExceptionHandler /** * Return the exception as a JSONAPI representation for use on API requests. */ - protected function convertExceptionToArray(Throwable $exception, array $override = []): array + protected function convertExceptionToArray(Throwable $e, array $override = []): array { - $match = self::$exceptionResponseCodes[get_class($exception)] ?? null; + $match = self::$exceptionResponseCodes[get_class($e)] ?? null; $error = [ - 'code' => class_basename($exception), - 'status' => method_exists($exception, 'getStatusCode') - ? strval($exception->getStatusCode()) + 'code' => class_basename($e), + 'status' => method_exists($e, 'getStatusCode') + ? strval($e->getStatusCode()) : strval($match ?? '500'), - 'detail' => $exception instanceof HttpExceptionInterface || !is_null($match) - ? $exception->getMessage() + 'detail' => $e instanceof HttpExceptionInterface || !is_null($match) + ? $e->getMessage() : 'An unexpected error was encountered while processing this request, please try again.', ]; - if ($exception instanceof ModelNotFoundException || $exception->getPrevious() instanceof ModelNotFoundException) { + if ($e instanceof ModelNotFoundException || $e->getPrevious() instanceof ModelNotFoundException) { // Show a nicer error message compared to the standard "No query results for model" // response that is normally returned. If we are in debug mode this will get overwritten // with a more specific error message to help narrow down things. @@ -220,17 +212,17 @@ class Handler extends ExceptionHandler if (config('app.debug')) { $error = array_merge($error, [ - 'detail' => $exception->getMessage(), + 'detail' => $e->getMessage(), 'source' => [ - 'line' => $exception->getLine(), - 'file' => str_replace(Application::getInstance()->basePath(), '', $exception->getFile()), + 'line' => $e->getLine(), + 'file' => str_replace(Application::getInstance()->basePath(), '', $e->getFile()), ], 'meta' => [ - 'trace' => Collection::make($exception->getTrace()) + 'trace' => Collection::make($e->getTrace()) ->map(fn ($trace) => Arr::except($trace, ['args'])) ->all(), - 'previous' => Collection::make($this->extractPrevious($exception)) - ->map(fn ($exception) => $exception->getTrace()) + 'previous' => Collection::make($this->extractPrevious($e)) + ->map(fn ($exception) => $e->getTrace()) ->map(fn ($trace) => Arr::except($trace, ['args'])) ->all(), ], @@ -252,10 +244,8 @@ class Handler extends ExceptionHandler * Convert an authentication exception into an unauthenticated response. * * @param \Illuminate\Http\Request $request - * - * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse */ - protected function unauthenticated($request, AuthenticationException $exception) + protected function unauthenticated($request, AuthenticationException $exception): JsonResponse|RedirectResponse { if ($request->expectsJson()) { return new JsonResponse($this->convertExceptionToArray($exception), JsonResponse::HTTP_UNAUTHORIZED); @@ -265,7 +255,7 @@ class Handler extends ExceptionHandler } /** - * Extracts all of the previous exceptions that lead to the one passed into this + * Extracts all the previous exceptions that lead to the one passed into this * function being thrown. * * @return \Throwable[] diff --git a/app/Exceptions/Http/Base/InvalidPasswordProvidedException.php b/app/Exceptions/Http/Base/InvalidPasswordProvidedException.php index 5f17186bc..bdcb8ec34 100644 --- a/app/Exceptions/Http/Base/InvalidPasswordProvidedException.php +++ b/app/Exceptions/Http/Base/InvalidPasswordProvidedException.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Exceptions\Http\Base; diff --git a/app/Exceptions/Http/Connection/DaemonConnectionException.php b/app/Exceptions/Http/Connection/DaemonConnectionException.php index c308b9b72..8c3d474a6 100644 --- a/app/Exceptions/Http/Connection/DaemonConnectionException.php +++ b/app/Exceptions/Http/Connection/DaemonConnectionException.php @@ -12,20 +12,15 @@ use Pterodactyl\Exceptions\DisplayException; */ class DaemonConnectionException extends DisplayException { - /** - * @var int - */ - private $statusCode = Response::HTTP_GATEWAY_TIMEOUT; + private int $statusCode = Response::HTTP_GATEWAY_TIMEOUT; /** * Every request to the Wings instance will return a unique X-Request-Id header * which allows for all errors to be efficiently tied to a specific request that * triggered them, and gives users a more direct method of informing hosts when * something goes wrong. - * - * @var string|null */ - private $requestId; + private ?string $requestId; /** * Throw a displayable exception caused by a daemon connection error. @@ -34,7 +29,7 @@ class DaemonConnectionException extends DisplayException { /** @var \GuzzleHttp\Psr7\Response|null $response */ $response = method_exists($previous, 'getResponse') ? $previous->getResponse() : null; - $this->requestId = $response ? $response->getHeaderLine('X-Request-Id') : null; + $this->requestId = $response?->getHeaderLine('X-Request-Id'); if ($useStatusCode) { $this->statusCode = is_null($response) ? $this->statusCode : $response->getStatusCode(); @@ -72,8 +67,6 @@ class DaemonConnectionException extends DisplayException /** * Override the default reporting method for DisplayException by just logging immediately * here and including the specific X-Request-Id header that was returned by the call. - * - * @return void */ public function report() { @@ -84,18 +77,13 @@ class DaemonConnectionException extends DisplayException /** * Return the HTTP status code for this exception. - * - * @return int */ - public function getStatusCode() + public function getStatusCode(): int { return $this->statusCode; } - /** - * @return string|null - */ - public function getRequestId() + public function getRequestId(): ?string { return $this->requestId; } diff --git a/app/Exceptions/Http/Server/FileTypeNotEditableException.php b/app/Exceptions/Http/Server/FileTypeNotEditableException.php index c47dd3695..06f6a508b 100644 --- a/app/Exceptions/Http/Server/FileTypeNotEditableException.php +++ b/app/Exceptions/Http/Server/FileTypeNotEditableException.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Exceptions\Http\Server; diff --git a/app/Exceptions/Model/DataValidationException.php b/app/Exceptions/Model/DataValidationException.php index 81582864c..6ceb6e94f 100644 --- a/app/Exceptions/Model/DataValidationException.php +++ b/app/Exceptions/Model/DataValidationException.php @@ -2,6 +2,7 @@ namespace Pterodactyl\Exceptions\Model; +use Illuminate\Support\MessageBag; use Illuminate\Database\Eloquent\Model; use Illuminate\Contracts\Validation\Validator; use Pterodactyl\Exceptions\PterodactylException; @@ -10,20 +11,10 @@ use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; class DataValidationException extends PterodactylException implements HttpExceptionInterface, MessageProvider { - /** - * The validator instance. - */ - protected Validator $validator; - - /** - * The underlying model instance that triggered this exception. - */ - protected Model $model; - /** * DataValidationException constructor. */ - public function __construct(Validator $validator, Model $model) + public function __construct(protected Validator $validator, protected Model $model) { $message = sprintf( 'Could not save %s[%s]: failed to validate data: %s', @@ -33,35 +24,25 @@ class DataValidationException extends PterodactylException implements HttpExcept ); parent::__construct($message); - - $this->validator = $validator; - $this->model = $model; } /** * Return the validator message bag. - * - * @return \Illuminate\Support\MessageBag */ - public function getMessageBag() + public function getMessageBag(): MessageBag { return $this->validator->errors(); } /** * Return the status code for this request. - * - * @return int */ - public function getStatusCode() + public function getStatusCode(): int { return 500; } - /** - * @return array - */ - public function getHeaders() + public function getHeaders(): array { return []; } diff --git a/app/Exceptions/Repository/RecordNotFoundException.php b/app/Exceptions/Repository/RecordNotFoundException.php index 53cfa2222..ed1127ce7 100644 --- a/app/Exceptions/Repository/RecordNotFoundException.php +++ b/app/Exceptions/Repository/RecordNotFoundException.php @@ -9,20 +9,16 @@ class RecordNotFoundException extends RepositoryException implements HttpExcepti { /** * Returns the status code. - * - * @return int */ - public function getStatusCode() + public function getStatusCode(): int { return Response::HTTP_NOT_FOUND; } /** * Returns response headers. - * - * @return array */ - public function getHeaders() + public function getHeaders(): array { return []; } diff --git a/app/Exceptions/Service/Allocation/InvalidPortMappingException.php b/app/Exceptions/Service/Allocation/InvalidPortMappingException.php index fe14413eb..6cf066a5c 100644 --- a/app/Exceptions/Service/Allocation/InvalidPortMappingException.php +++ b/app/Exceptions/Service/Allocation/InvalidPortMappingException.php @@ -8,10 +8,8 @@ class InvalidPortMappingException extends DisplayException { /** * InvalidPortMappingException constructor. - * - * @param mixed $port */ - public function __construct($port) + public function __construct(mixed $port) { parent::__construct(trans('exceptions.allocations.invalid_mapping', ['port' => $port])); } diff --git a/app/Exceptions/Service/Egg/HasChildrenException.php b/app/Exceptions/Service/Egg/HasChildrenException.php index 7198f8306..9463b70e4 100644 --- a/app/Exceptions/Service/Egg/HasChildrenException.php +++ b/app/Exceptions/Service/Egg/HasChildrenException.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Exceptions\Service\Egg; diff --git a/app/Exceptions/Service/Egg/InvalidCopyFromException.php b/app/Exceptions/Service/Egg/InvalidCopyFromException.php index 149c42dd6..d0e33e21f 100644 --- a/app/Exceptions/Service/Egg/InvalidCopyFromException.php +++ b/app/Exceptions/Service/Egg/InvalidCopyFromException.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Exceptions\Service\Egg; diff --git a/app/Exceptions/Service/Egg/NoParentConfigurationFoundException.php b/app/Exceptions/Service/Egg/NoParentConfigurationFoundException.php index 867b09c1a..ab9f5b404 100644 --- a/app/Exceptions/Service/Egg/NoParentConfigurationFoundException.php +++ b/app/Exceptions/Service/Egg/NoParentConfigurationFoundException.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Exceptions\Service\Egg; diff --git a/app/Exceptions/Service/Egg/Variable/ReservedVariableNameException.php b/app/Exceptions/Service/Egg/Variable/ReservedVariableNameException.php index 03ad09e5e..bc921ee25 100644 --- a/app/Exceptions/Service/Egg/Variable/ReservedVariableNameException.php +++ b/app/Exceptions/Service/Egg/Variable/ReservedVariableNameException.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Exceptions\Service\Egg\Variable; diff --git a/app/Exceptions/Service/HasActiveServersException.php b/app/Exceptions/Service/HasActiveServersException.php index 5c43101c5..d3b46a884 100644 --- a/app/Exceptions/Service/HasActiveServersException.php +++ b/app/Exceptions/Service/HasActiveServersException.php @@ -7,10 +7,7 @@ use Pterodactyl\Exceptions\DisplayException; class HasActiveServersException extends DisplayException { - /** - * @return int - */ - public function getStatusCode() + public function getStatusCode(): int { return Response::HTTP_BAD_REQUEST; } diff --git a/app/Exceptions/Service/Helper/CdnVersionFetchingException.php b/app/Exceptions/Service/Helper/CdnVersionFetchingException.php index 2f934033a..34eb760bd 100644 --- a/app/Exceptions/Service/Helper/CdnVersionFetchingException.php +++ b/app/Exceptions/Service/Helper/CdnVersionFetchingException.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Exceptions\Service\Helper; diff --git a/app/Exceptions/Service/InvalidFileUploadException.php b/app/Exceptions/Service/InvalidFileUploadException.php index 6d0585d2a..7d73ac207 100644 --- a/app/Exceptions/Service/InvalidFileUploadException.php +++ b/app/Exceptions/Service/InvalidFileUploadException.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Exceptions\Service; diff --git a/app/Exceptions/Service/Location/HasActiveNodesException.php b/app/Exceptions/Service/Location/HasActiveNodesException.php index 1270807b8..43a4e01e3 100644 --- a/app/Exceptions/Service/Location/HasActiveNodesException.php +++ b/app/Exceptions/Service/Location/HasActiveNodesException.php @@ -7,10 +7,7 @@ use Pterodactyl\Exceptions\DisplayException; class HasActiveNodesException extends DisplayException { - /** - * @return int - */ - public function getStatusCode() + public function getStatusCode(): int { return Response::HTTP_BAD_REQUEST; } diff --git a/app/Exceptions/Service/Schedule/Task/TaskIntervalTooLongException.php b/app/Exceptions/Service/Schedule/Task/TaskIntervalTooLongException.php index 1863ce7ee..0c3afb48c 100644 --- a/app/Exceptions/Service/Schedule/Task/TaskIntervalTooLongException.php +++ b/app/Exceptions/Service/Schedule/Task/TaskIntervalTooLongException.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Exceptions\Service\Schedule\Task; diff --git a/app/Exceptions/Service/Server/RequiredVariableMissingException.php b/app/Exceptions/Service/Server/RequiredVariableMissingException.php index 068c8af0f..e8423a428 100644 --- a/app/Exceptions/Service/Server/RequiredVariableMissingException.php +++ b/app/Exceptions/Service/Server/RequiredVariableMissingException.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Exceptions\Service\Server; diff --git a/app/Exceptions/Service/Subuser/ServerSubuserExistsException.php b/app/Exceptions/Service/Subuser/ServerSubuserExistsException.php index 87c845927..8133a1334 100644 --- a/app/Exceptions/Service/Subuser/ServerSubuserExistsException.php +++ b/app/Exceptions/Service/Subuser/ServerSubuserExistsException.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Exceptions\Service\Subuser; diff --git a/app/Exceptions/Service/Subuser/UserIsServerOwnerException.php b/app/Exceptions/Service/Subuser/UserIsServerOwnerException.php index 99839424e..cc7225a2b 100644 --- a/app/Exceptions/Service/Subuser/UserIsServerOwnerException.php +++ b/app/Exceptions/Service/Subuser/UserIsServerOwnerException.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Exceptions\Service\Subuser; diff --git a/app/Extensions/Backups/BackupManager.php b/app/Extensions/Backups/BackupManager.php index 80515848e..32df8f22d 100644 --- a/app/Extensions/Backups/BackupManager.php +++ b/app/Extensions/Backups/BackupManager.php @@ -9,64 +9,45 @@ use Illuminate\Support\Str; use Webmozart\Assert\Assert; use InvalidArgumentException; use Illuminate\Foundation\Application; -use League\Flysystem\AdapterInterface; -use League\Flysystem\AwsS3v3\AwsS3Adapter; -use League\Flysystem\Memory\MemoryAdapter; -use Illuminate\Contracts\Config\Repository; +use League\Flysystem\FilesystemAdapter; +use Pterodactyl\Extensions\Filesystem\S3Filesystem; +use League\Flysystem\InMemory\InMemoryFilesystemAdapter; +use Illuminate\Contracts\Config\Repository as ConfigRepository; class BackupManager { - /** - * @var \Illuminate\Foundation\Application - */ - protected $app; - - /** - * @var \Illuminate\Contracts\Config\Repository - */ - protected $config; + protected ConfigRepository $config; /** * The array of resolved backup drivers. - * - * @var \League\Flysystem\AdapterInterface[] */ - protected $adapters = []; + protected array $adapters = []; /** * The registered custom driver creators. - * - * @var array */ - protected $customCreators; + protected array $customCreators; /** * BackupManager constructor. */ - public function __construct(Application $app) + public function __construct(protected Application $app) { - $this->app = $app; - $this->config = $app->make(Repository::class); + $this->config = $app->make(ConfigRepository::class); } /** * Returns a backup adapter instance. - * - * @return \League\Flysystem\AdapterInterface */ - public function adapter(string $name = null) + public function adapter(string $name = null): FilesystemAdapter { return $this->get($name ?: $this->getDefaultAdapter()); } /** * Set the given backup adapter instance. - * - * @param \League\Flysystem\AdapterInterface $disk - * - * @return $this */ - public function set(string $name, $disk) + public function set(string $name, FilesystemAdapter $disk): self { $this->adapters[$name] = $disk; @@ -75,25 +56,21 @@ class BackupManager /** * Gets a backup adapter. - * - * @return \League\Flysystem\AdapterInterface */ - protected function get(string $name) + protected function get(string $name): FilesystemAdapter { return $this->adapters[$name] = $this->resolve($name); } /** * Resolve the given backup disk. - * - * @return \League\Flysystem\AdapterInterface */ - protected function resolve(string $name) + protected function resolve(string $name): FilesystemAdapter { $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']; @@ -106,44 +83,34 @@ class BackupManager if (method_exists($this, $adapterMethod)) { $instance = $this->{$adapterMethod}($config); - Assert::isInstanceOf($instance, AdapterInterface::class); + Assert::isInstanceOf($instance, FilesystemAdapter::class); return $instance; } - throw new InvalidArgumentException("Adapter [{$adapter}] is not supported."); + throw new InvalidArgumentException("Adapter [$adapter] is not supported."); } /** * Calls a custom creator for a given adapter type. - * - * @return \League\Flysystem\AdapterInterface */ - protected function callCustomCreator(array $config) + protected function callCustomCreator(array $config): mixed { - $adapter = $this->customCreators[$config['adapter']]($this->app, $config); - - Assert::isInstanceOf($adapter, AdapterInterface::class); - - return $adapter; + return $this->customCreators[$config['adapter']]($this->app, $config); } /** - * Creates a new wings adapter. - * - * @return \League\Flysystem\AdapterInterface + * Creates a new Wings adapter. */ - public function createWingsAdapter(array $config) + public function createWingsAdapter(array $config): FilesystemAdapter { - return new MemoryAdapter(null); + return new InMemoryFilesystemAdapter(null); } /** * Creates a new S3 adapter. - * - * @return \League\Flysystem\AdapterInterface */ - public function createS3Adapter(array $config) + public function createS3Adapter(array $config): FilesystemAdapter { $config['version'] = 'latest'; @@ -153,25 +120,21 @@ class BackupManager $client = new S3Client($config); - return new AwsS3Adapter($client, $config['bucket'], $config['prefix'] ?? '', $config['options'] ?? []); + return new S3Filesystem($client, $config['bucket'], $config['prefix'] ?? '', $config['options'] ?? []); } /** * Returns the configuration associated with a given backup type. - * - * @return array */ - protected function getConfig(string $name) + protected function getConfig(string $name): array { - return $this->config->get("backups.disks.{$name}") ?: []; + return $this->config->get("backups.disks.$name") ?: []; } /** * Get the default backup driver name. - * - * @return string */ - public function getDefaultAdapter() + public function getDefaultAdapter(): string { return $this->config->get('backups.default'); } @@ -179,7 +142,7 @@ class BackupManager /** * Set the default session driver name. */ - public function setDefaultAdapter(string $name) + public function setDefaultAdapter(string $name): void { $this->config->set('backups.default', $name); } @@ -188,13 +151,11 @@ class BackupManager * Unset the given adapter instances. * * @param string|string[] $adapter - * - * @return $this */ - public function forget($adapter) + public function forget(array|string $adapter): self { foreach ((array) $adapter as $adapterName) { - unset($this->adapters[$adapter]); + unset($this->adapters[$adapterName]); } return $this; @@ -202,10 +163,8 @@ class BackupManager /** * Register a custom adapter creator closure. - * - * @return $this */ - public function extend(string $adapter, Closure $callback) + public function extend(string $adapter, Closure $callback): self { $this->customCreators[$adapter] = $callback; diff --git a/app/Extensions/DynamicDatabaseConnection.php b/app/Extensions/DynamicDatabaseConnection.php index 94251bce8..5adbd171d 100644 --- a/app/Extensions/DynamicDatabaseConnection.php +++ b/app/Extensions/DynamicDatabaseConnection.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Extensions; @@ -20,44 +13,22 @@ class DynamicDatabaseConnection public const DB_COLLATION = 'utf8_unicode_ci'; public const DB_DRIVER = 'mysql'; - /** - * @var \Illuminate\Config\Repository - */ - protected $config; - - /** - * @var \Illuminate\Contracts\Encryption\Encrypter - */ - protected $encrypter; - - /** - * @var \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface - */ - protected $repository; - /** * DynamicDatabaseConnection constructor. */ public function __construct( - ConfigRepository $config, - DatabaseHostRepositoryInterface $repository, - Encrypter $encrypter + protected ConfigRepository $config, + protected Encrypter $encrypter, + protected DatabaseHostRepositoryInterface $repository ) { - $this->config = $config; - $this->encrypter = $encrypter; - $this->repository = $repository; } /** * Adds a dynamic database connection entry to the runtime config. * - * @param string $connection - * @param \Pterodactyl\Models\DatabaseHost|int $host - * @param string $database - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function set($connection, $host, $database = 'mysql') + public function set(string $connection, DatabaseHost|int $host, string $database = 'mysql'): void { if (!$host instanceof DatabaseHost) { $host = $this->repository->find($host); diff --git a/app/Extensions/Facades/Theme.php b/app/Extensions/Facades/Theme.php index 69e8e0dac..55ebc1002 100644 --- a/app/Extensions/Facades/Theme.php +++ b/app/Extensions/Facades/Theme.php @@ -6,10 +6,7 @@ use Illuminate\Support\Facades\Facade; class Theme extends Facade { - /** - * @return string - */ - protected static function getFacadeAccessor() + protected static function getFacadeAccessor(): string { return 'extensions.themes'; } diff --git a/app/Extensions/Filesystem/S3Filesystem.php b/app/Extensions/Filesystem/S3Filesystem.php new file mode 100644 index 000000000..df57a508b --- /dev/null +++ b/app/Extensions/Filesystem/S3Filesystem.php @@ -0,0 +1,35 @@ +client; + } + + public function getBucket(): string + { + return $this->bucket; + } +} diff --git a/app/Extensions/Hashids.php b/app/Extensions/Hashids.php index ab07fc86d..1a6bfdb39 100644 --- a/app/Extensions/Hashids.php +++ b/app/Extensions/Hashids.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Extensions; @@ -17,7 +10,7 @@ class Hashids extends VendorHashids implements HashidsInterface /** * {@inheritdoc} */ - public function decodeFirst($encoded, $default = null) + public function decodeFirst(string $encoded, string $default = null): mixed { $result = $this->decode($encoded); if (!is_array($result)) { diff --git a/app/Extensions/Illuminate/Database/Eloquent/Builder.php b/app/Extensions/Illuminate/Database/Eloquent/Builder.php index 0a152eb26..6ce63c2b6 100644 --- a/app/Extensions/Illuminate/Database/Eloquent/Builder.php +++ b/app/Extensions/Illuminate/Database/Eloquent/Builder.php @@ -8,10 +8,8 @@ class Builder extends EloquentBuilder { /** * Do nothing. - * - * @return $this */ - public function search() + public function search(): self { return $this; } diff --git a/app/Extensions/Spatie/Fractalistic/Fractal.php b/app/Extensions/Spatie/Fractalistic/Fractal.php index b9c651d35..0c65d6e8e 100644 --- a/app/Extensions/Spatie/Fractalistic/Fractal.php +++ b/app/Extensions/Spatie/Fractalistic/Fractal.php @@ -2,6 +2,7 @@ namespace Pterodactyl\Extensions\Spatie\Fractalistic; +use League\Fractal\Scope; use League\Fractal\TransformerAbstract; use Spatie\Fractal\Fractal as SpatieFractal; use Illuminate\Contracts\Pagination\LengthAwarePaginator; @@ -13,12 +14,10 @@ class Fractal extends SpatieFractal /** * Create fractal data. * - * @return \League\Fractal\Scope - * * @throws \Spatie\Fractalistic\Exceptions\InvalidTransformation * @throws \Spatie\Fractalistic\Exceptions\NoTransformerSpecified */ - public function createData() + public function createData(): Scope { // Set the serializer by default. if (is_null($this->serializer)) { diff --git a/app/Extensions/Themes/Theme.php b/app/Extensions/Themes/Theme.php index c82c5f757..fd65583e3 100644 --- a/app/Extensions/Themes/Theme.php +++ b/app/Extensions/Themes/Theme.php @@ -4,17 +4,17 @@ namespace Pterodactyl\Extensions\Themes; class Theme { - public function js($path) + public function js($path): string { return sprintf('' . PHP_EOL, $this->getUrl($path)); } - public function css($path) + public function css($path): string { return sprintf('' . PHP_EOL, $this->getUrl($path)); } - protected function getUrl($path) + protected function getUrl($path): string { return '/themes/pterodactyl/' . ltrim($path, '/'); } diff --git a/app/Facades/Activity.php b/app/Facades/Activity.php index 9297153af..564021001 100644 --- a/app/Facades/Activity.php +++ b/app/Facades/Activity.php @@ -7,7 +7,7 @@ use Pterodactyl\Services\Activity\ActivityLogService; class Activity extends Facade { - protected static function getFacadeAccessor() + protected static function getFacadeAccessor(): string { return ActivityLogService::class; } diff --git a/app/Facades/LogBatch.php b/app/Facades/LogBatch.php index fedfde125..03d0de57a 100644 --- a/app/Facades/LogBatch.php +++ b/app/Facades/LogBatch.php @@ -3,12 +3,12 @@ namespace Pterodactyl\Facades; use Illuminate\Support\Facades\Facade; -use Pterodactyl\Services\Activity\AcitvityLogBatchService; +use Pterodactyl\Services\Activity\ActivityLogBatchService; class LogBatch extends Facade { - protected static function getFacadeAccessor() + protected static function getFacadeAccessor(): string { - return AcitvityLogBatchService::class; + return ActivityLogBatchService::class; } } diff --git a/app/Facades/LogTarget.php b/app/Facades/LogTarget.php index 18e356e60..9ea236002 100644 --- a/app/Facades/LogTarget.php +++ b/app/Facades/LogTarget.php @@ -7,7 +7,7 @@ use Pterodactyl\Services\Activity\ActivityLogTargetableService; class LogTarget extends Facade { - protected static function getFacadeAccessor() + protected static function getFacadeAccessor(): string { return ActivityLogTargetableService::class; } diff --git a/app/Helpers/Time.php b/app/Helpers/Time.php index fd9a265a3..e8e585c2b 100644 --- a/app/Helpers/Time.php +++ b/app/Helpers/Time.php @@ -17,6 +17,6 @@ final class Time { $offset = round(CarbonImmutable::now($timezone)->getTimezone()->getOffset(CarbonImmutable::now('UTC')) / 3600); - return sprintf('%s%s:00', $offset > 0 ? '+' : '-', str_pad(abs($offset), 2, '0', STR_PAD_LEFT)); + return sprintf('%s%s:00', $offset > 0 ? '+' : '-', str_pad((string) abs($offset), 2, '0', STR_PAD_LEFT)); } } diff --git a/app/Helpers/Utilities.php b/app/Helpers/Utilities.php index b48e9f091..f6341c03d 100644 --- a/app/Helpers/Utilities.php +++ b/app/Helpers/Utilities.php @@ -12,7 +12,7 @@ class Utilities { /** * Generates a random string and injects special characters into it, in addition to - * the randomness of the alpha-numeric default response. + * the randomness of the alphanumeric default response. */ public static function randomStringWithSpecialCharacters(int $length = 16): string { @@ -36,21 +36,16 @@ class Utilities /** * Converts schedule cron data into a carbon object. * - * @return \Carbon\Carbon + * @throws \Exception */ - public static function getScheduleNextRunDate(string $minute, string $hour, string $dayOfMonth, string $month, string $dayOfWeek) + public static function getScheduleNextRunDate(string $minute, string $hour, string $dayOfMonth, string $month, string $dayOfWeek): Carbon { - return Carbon::instance(CronExpression::factory( + return Carbon::instance((new CronExpression( sprintf('%s %s %s %s %s', $minute, $hour, $dayOfMonth, $month, $dayOfWeek) - )->getNextRunDate()); + ))->getNextRunDate()); } - /** - * @param mixed $default - * - * @return string - */ - public static function checked(string $name, $default) + public static function checked(string $name, mixed $default): string { $errors = session('errors'); diff --git a/app/Http/Controllers/Admin/ApiController.php b/app/Http/Controllers/Admin/ApiController.php index ef9c86355..02ad6e540 100644 --- a/app/Http/Controllers/Admin/ApiController.php +++ b/app/Http/Controllers/Admin/ApiController.php @@ -9,6 +9,7 @@ use Pterodactyl\Models\ApiKey; use Illuminate\Http\RedirectResponse; use Prologue\Alerts\AlertsMessageBag; use Pterodactyl\Services\Acl\Api\AdminAcl; +use Illuminate\View\Factory as ViewFactory; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Services\Api\KeyCreationService; use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface; @@ -17,31 +18,14 @@ use Pterodactyl\Http\Requests\Admin\Api\StoreApplicationApiKeyRequest; class ApiController extends Controller { /** - * @var \Prologue\Alerts\AlertsMessageBag - */ - private $alert; - - /** - * @var \Pterodactyl\Services\Api\KeyCreationService - */ - private $keyCreationService; - - /** - * @var \Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface - */ - private $repository; - - /** - * ApplicationApiController constructor. + * ApiController constructor. */ public function __construct( - AlertsMessageBag $alert, - ApiKeyRepositoryInterface $repository, - KeyCreationService $keyCreationService + private AlertsMessageBag $alert, + private ApiKeyRepositoryInterface $repository, + private KeyCreationService $keyCreationService, + private ViewFactory $view, ) { - $this->alert = $alert; - $this->keyCreationService = $keyCreationService; - $this->repository = $repository; } /** @@ -49,7 +33,7 @@ class ApiController extends Controller */ public function index(Request $request): View { - return view('admin.api.index', [ + return $this->view->make('admin.api.index', [ 'keys' => $this->repository->getApplicationKeys($request->user()), ]); } @@ -64,7 +48,7 @@ class ApiController extends Controller $resources = AdminAcl::getResourceList(); sort($resources); - return view('admin.api.new', [ + return $this->view->make('admin.api.new', [ 'resources' => $resources, 'permissions' => [ 'r' => AdminAcl::READ, diff --git a/app/Http/Controllers/Admin/BaseController.php b/app/Http/Controllers/Admin/BaseController.php index 68e923ad8..53f53ce54 100644 --- a/app/Http/Controllers/Admin/BaseController.php +++ b/app/Http/Controllers/Admin/BaseController.php @@ -3,22 +3,17 @@ namespace Pterodactyl\Http\Controllers\Admin; use Illuminate\View\View; +use Illuminate\View\Factory as ViewFactory; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Services\Helpers\SoftwareVersionService; class BaseController extends Controller { - /** - * @var \Pterodactyl\Services\Helpers\SoftwareVersionService - */ - private $version; - /** * BaseController constructor. */ - public function __construct(SoftwareVersionService $version) + public function __construct(private SoftwareVersionService $version, private ViewFactory $view) { - $this->version = $version; } /** @@ -26,6 +21,6 @@ class BaseController extends Controller */ public function index(): View { - return view('admin.index', ['version' => $this->version]); + return $this->view->make('admin.index', ['version' => $this->version]); } } diff --git a/app/Http/Controllers/Admin/DatabaseController.php b/app/Http/Controllers/Admin/DatabaseController.php index 9e6cc000a..e0dc0dc57 100644 --- a/app/Http/Controllers/Admin/DatabaseController.php +++ b/app/Http/Controllers/Admin/DatabaseController.php @@ -8,6 +8,7 @@ use Illuminate\View\View; use Pterodactyl\Models\DatabaseHost; use Illuminate\Http\RedirectResponse; use Prologue\Alerts\AlertsMessageBag; +use Illuminate\View\Factory as ViewFactory; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Services\Databases\Hosts\HostUpdateService; use Pterodactyl\Http\Requests\Admin\DatabaseHostFormRequest; @@ -19,60 +20,19 @@ use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface; class DatabaseController extends Controller { - /** - * @var \Prologue\Alerts\AlertsMessageBag - */ - private $alert; - - /** - * @var \Pterodactyl\Services\Databases\Hosts\HostCreationService - */ - private $creationService; - - /** - * @var \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface - */ - private $databaseRepository; - - /** - * @var \Pterodactyl\Services\Databases\Hosts\HostDeletionService - */ - private $deletionService; - - /** - * @var \Pterodactyl\Contracts\Repository\LocationRepositoryInterface - */ - private $locationRepository; - - /** - * @var \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface - */ - private $repository; - - /** - * @var \Pterodactyl\Services\Databases\Hosts\HostUpdateService - */ - private $updateService; - /** * DatabaseController constructor. */ public function __construct( - AlertsMessageBag $alert, - DatabaseHostRepositoryInterface $repository, - DatabaseRepositoryInterface $databaseRepository, - HostCreationService $creationService, - HostDeletionService $deletionService, - HostUpdateService $updateService, - LocationRepositoryInterface $locationRepository + private AlertsMessageBag $alert, + private DatabaseHostRepositoryInterface $repository, + private DatabaseRepositoryInterface $databaseRepository, + private HostCreationService $creationService, + private HostDeletionService $deletionService, + private HostUpdateService $updateService, + private LocationRepositoryInterface $locationRepository, + private ViewFactory $view ) { - $this->alert = $alert; - $this->creationService = $creationService; - $this->databaseRepository = $databaseRepository; - $this->deletionService = $deletionService; - $this->repository = $repository; - $this->locationRepository = $locationRepository; - $this->updateService = $updateService; } /** @@ -80,7 +40,7 @@ class DatabaseController extends Controller */ public function index(): View { - return view('admin.databases.index', [ + return $this->view->make('admin.databases.index', [ 'locations' => $this->locationRepository->getAllWithNodes(), 'hosts' => $this->repository->getWithViewDetails(), ]); @@ -93,7 +53,7 @@ class DatabaseController extends Controller */ public function view(int $host): View { - return view('admin.databases.view', [ + return $this->view->make('admin.databases.view', [ 'locations' => $this->locationRepository->getAllWithNodes(), 'host' => $this->repository->find($host), 'databases' => $this->databaseRepository->getDatabasesForHost($host), diff --git a/app/Http/Controllers/Admin/LocationController.php b/app/Http/Controllers/Admin/LocationController.php index 195977f27..ea01cbaa9 100644 --- a/app/Http/Controllers/Admin/LocationController.php +++ b/app/Http/Controllers/Admin/LocationController.php @@ -1,16 +1,12 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Http\Controllers\Admin; +use Illuminate\View\View; use Pterodactyl\Models\Location; +use Illuminate\Http\RedirectResponse; use Prologue\Alerts\AlertsMessageBag; +use Illuminate\View\Factory as ViewFactory; use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Http\Requests\Admin\LocationFormRequest; @@ -21,56 +17,25 @@ use Pterodactyl\Contracts\Repository\LocationRepositoryInterface; class LocationController extends Controller { - /** - * @var \Prologue\Alerts\AlertsMessageBag - */ - protected $alert; - - /** - * @var \Pterodactyl\Services\Locations\LocationCreationService - */ - protected $creationService; - - /** - * @var \Pterodactyl\Services\Locations\LocationDeletionService - */ - protected $deletionService; - - /** - * @var \Pterodactyl\Contracts\Repository\LocationRepositoryInterface - */ - protected $repository; - - /** - * @var \Pterodactyl\Services\Locations\LocationUpdateService - */ - protected $updateService; - /** * LocationController constructor. */ public function __construct( - AlertsMessageBag $alert, - LocationCreationService $creationService, - LocationDeletionService $deletionService, - LocationRepositoryInterface $repository, - LocationUpdateService $updateService + protected AlertsMessageBag $alert, + protected LocationCreationService $creationService, + protected LocationDeletionService $deletionService, + protected LocationRepositoryInterface $repository, + protected LocationUpdateService $updateService, + protected ViewFactory $view ) { - $this->alert = $alert; - $this->creationService = $creationService; - $this->deletionService = $deletionService; - $this->repository = $repository; - $this->updateService = $updateService; } /** * Return the location overview page. - * - * @return \Illuminate\View\View */ - public function index() + public function index(): View { - return view('admin.locations.index', [ + return $this->view->make('admin.locations.index', [ 'locations' => $this->repository->getAllWithDetails(), ]); } @@ -78,15 +43,11 @@ class LocationController extends Controller /** * Return the location view page. * - * @param int $id - * - * @return \Illuminate\View\View - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function view($id) + public function view(int $id): View { - return view('admin.locations.view', [ + return $this->view->make('admin.locations.view', [ 'location' => $this->repository->getWithNodes($id), ]); } @@ -94,11 +55,9 @@ class LocationController extends Controller /** * Handle request to create new location. * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Throwable */ - public function create(LocationFormRequest $request) + public function create(LocationFormRequest $request): RedirectResponse { $location = $this->creationService->handle($request->normalize()); $this->alert->success('Location was created successfully.')->flash(); @@ -109,11 +68,9 @@ class LocationController extends Controller /** * Handle request to update or delete location. * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Throwable */ - public function update(LocationFormRequest $request, Location $location) + public function update(LocationFormRequest $request, Location $location): RedirectResponse { if ($request->input('action') === 'delete') { return $this->delete($location); @@ -128,12 +85,10 @@ class LocationController extends Controller /** * Delete a location from the system. * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Exception * @throws \Pterodactyl\Exceptions\DisplayException */ - public function delete(Location $location) + public function delete(Location $location): RedirectResponse { try { $this->deletionService->handle($location->id); diff --git a/app/Http/Controllers/Admin/MountController.php b/app/Http/Controllers/Admin/MountController.php index 811abfba2..097ad6690 100644 --- a/app/Http/Controllers/Admin/MountController.php +++ b/app/Http/Controllers/Admin/MountController.php @@ -3,11 +3,15 @@ namespace Pterodactyl\Http\Controllers\Admin; use Ramsey\Uuid\Uuid; +use Illuminate\View\View; use Illuminate\Http\Request; use Pterodactyl\Models\Nest; +use Illuminate\Http\Response; use Pterodactyl\Models\Mount; use Pterodactyl\Models\Location; +use Illuminate\Http\RedirectResponse; use Prologue\Alerts\AlertsMessageBag; +use Illuminate\View\Factory as ViewFactory; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Http\Requests\Admin\MountFormRequest; use Pterodactyl\Repositories\Eloquent\MountRepository; @@ -16,49 +20,24 @@ use Pterodactyl\Contracts\Repository\LocationRepositoryInterface; class MountController extends Controller { - /** - * @var \Prologue\Alerts\AlertsMessageBag - */ - protected $alert; - - /** - * @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface - */ - protected $nestRepository; - - /** - * @var \Pterodactyl\Contracts\Repository\LocationRepositoryInterface - */ - protected $locationRepository; - - /** - * @var \Pterodactyl\Repositories\Eloquent\MountRepository - */ - protected $repository; - /** * MountController constructor. */ public function __construct( - AlertsMessageBag $alert, - NestRepositoryInterface $nestRepository, - LocationRepositoryInterface $locationRepository, - MountRepository $repository + protected AlertsMessageBag $alert, + protected NestRepositoryInterface $nestRepository, + protected LocationRepositoryInterface $locationRepository, + protected MountRepository $repository, + protected ViewFactory $view ) { - $this->alert = $alert; - $this->nestRepository = $nestRepository; - $this->locationRepository = $locationRepository; - $this->repository = $repository; } /** * Return the mount overview page. - * - * @return \Illuminate\View\View */ - public function index() + public function index(): View { - return view('admin.mounts.index', [ + return $this->view->make('admin.mounts.index', [ 'mounts' => $this->repository->getAllWithDetails(), ]); } @@ -66,18 +45,14 @@ class MountController extends Controller /** * Return the mount view page. * - * @param string $id - * - * @return \Illuminate\View\View - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function view($id) + public function view(string $id): View { $nests = Nest::query()->with('eggs')->get(); $locations = Location::query()->with('nodes')->get(); - return view('admin.mounts.view', [ + return $this->view->make('admin.mounts.view', [ 'mount' => $this->repository->getWithRelations($id), 'nests' => $nests, 'locations' => $locations, @@ -87,11 +62,9 @@ class MountController extends Controller /** * Handle request to create new mount. * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Throwable */ - public function create(MountFormRequest $request) + public function create(MountFormRequest $request): RedirectResponse { $model = (new Mount())->fill($request->validated()); $model->forceFill(['uuid' => Uuid::uuid4()->toString()]); @@ -107,11 +80,9 @@ class MountController extends Controller /** * Handle request to update or delete location. * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Throwable */ - public function update(MountFormRequest $request, Mount $mount) + public function update(MountFormRequest $request, Mount $mount): RedirectResponse { if ($request->input('action') === 'delete') { return $this->delete($mount); @@ -127,11 +98,9 @@ class MountController extends Controller /** * Delete a location from the system. * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Exception */ - public function delete(Mount $mount) + public function delete(Mount $mount): RedirectResponse { $mount->delete(); @@ -139,11 +108,9 @@ class MountController extends Controller } /** - * Adds eggs to the mount's many to many relation. - * - * @return \Illuminate\Http\RedirectResponse + * Adds eggs to the mount's many-to-many relation. */ - public function addEggs(Request $request, Mount $mount) + public function addEggs(Request $request, Mount $mount): RedirectResponse { $validatedData = $request->validate([ 'eggs' => 'required|exists:eggs,id', @@ -160,11 +127,9 @@ class MountController extends Controller } /** - * Adds nodes to the mount's many to many relation. - * - * @return \Illuminate\Http\RedirectResponse + * Adds nodes to the mount's many-to-many relation. */ - public function addNodes(Request $request, Mount $mount) + public function addNodes(Request $request, Mount $mount): RedirectResponse { $data = $request->validate(['nodes' => 'required|exists:nodes,id']); @@ -179,11 +144,9 @@ class MountController extends Controller } /** - * Deletes an egg from the mount's many to many relation. - * - * @return \Illuminate\Http\Response + * Deletes an egg from the mount's many-to-many relation. */ - public function deleteEgg(Mount $mount, int $egg_id) + public function deleteEgg(Mount $mount, int $egg_id): Response { $mount->eggs()->detach($egg_id); @@ -191,11 +154,9 @@ class MountController extends Controller } /** - * Deletes an node from the mount's many to many relation. - * - * @return \Illuminate\Http\Response + * Deletes a node from the mount's many-to-many relation. */ - public function deleteNode(Mount $mount, int $node_id) + public function deleteNode(Mount $mount, int $node_id): Response { $mount->nodes()->detach($node_id); diff --git a/app/Http/Controllers/Admin/Nests/EggController.php b/app/Http/Controllers/Admin/Nests/EggController.php index a67c51311..010c28af0 100644 --- a/app/Http/Controllers/Admin/Nests/EggController.php +++ b/app/Http/Controllers/Admin/Nests/EggController.php @@ -1,19 +1,13 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Http\Controllers\Admin\Nests; -use Javascript; +use JavaScript; use Illuminate\View\View; use Pterodactyl\Models\Egg; use Illuminate\Http\RedirectResponse; use Prologue\Alerts\AlertsMessageBag; +use Illuminate\View\Factory as ViewFactory; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Services\Eggs\EggUpdateService; use Pterodactyl\Services\Eggs\EggCreationService; @@ -24,32 +18,18 @@ use Pterodactyl\Contracts\Repository\NestRepositoryInterface; class EggController extends Controller { - protected $alert; - - protected $creationService; - - protected $deletionService; - - protected $nestRepository; - - protected $repository; - - protected $updateService; - + /** + * EggController constructor. + */ public function __construct( - AlertsMessageBag $alert, - EggCreationService $creationService, - EggDeletionService $deletionService, - EggRepositoryInterface $repository, - EggUpdateService $updateService, - NestRepositoryInterface $nestRepository + protected AlertsMessageBag $alert, + protected EggCreationService $creationService, + protected EggDeletionService $deletionService, + protected EggRepositoryInterface $repository, + protected EggUpdateService $updateService, + protected NestRepositoryInterface $nestRepository, + protected ViewFactory $view ) { - $this->alert = $alert; - $this->creationService = $creationService; - $this->deletionService = $deletionService; - $this->nestRepository = $nestRepository; - $this->repository = $repository; - $this->updateService = $updateService; } /** @@ -60,9 +40,9 @@ class EggController extends Controller public function create(): View { $nests = $this->nestRepository->getWithEggs(); - Javascript::put(['nests' => $nests->keyBy('id')]); + JavaScript::put(['nests' => $nests->keyBy('id')]); - return view('admin.eggs.new', ['nests' => $nests]); + return $this->view->make('admin.eggs.new', ['nests' => $nests]); } /** @@ -87,7 +67,7 @@ class EggController extends Controller */ public function view(Egg $egg): View { - return view('admin.eggs.view', [ + return $this->view->make('admin.eggs.view', [ 'egg' => $egg, 'images' => array_map( fn ($key, $value) => $key === $value ? $value : "$key|$value", diff --git a/app/Http/Controllers/Admin/Nests/EggScriptController.php b/app/Http/Controllers/Admin/Nests/EggScriptController.php index 4ae8f410b..4f997e5a8 100644 --- a/app/Http/Controllers/Admin/Nests/EggScriptController.php +++ b/app/Http/Controllers/Admin/Nests/EggScriptController.php @@ -6,6 +6,7 @@ use Illuminate\View\View; use Pterodactyl\Models\Egg; use Illuminate\Http\RedirectResponse; use Prologue\Alerts\AlertsMessageBag; +use Illuminate\View\Factory as ViewFactory; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Services\Eggs\Scripts\InstallScriptService; use Pterodactyl\Contracts\Repository\EggRepositoryInterface; @@ -13,32 +14,15 @@ use Pterodactyl\Http\Requests\Admin\Egg\EggScriptFormRequest; class EggScriptController extends Controller { - /** - * @var \Prologue\Alerts\AlertsMessageBag - */ - protected $alert; - - /** - * @var \Pterodactyl\Services\Eggs\Scripts\InstallScriptService - */ - protected $installScriptService; - - /** - * @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface - */ - protected $repository; - /** * EggScriptController constructor. */ public function __construct( - AlertsMessageBag $alert, - EggRepositoryInterface $repository, - InstallScriptService $installScriptService + protected AlertsMessageBag $alert, + protected EggRepositoryInterface $repository, + protected InstallScriptService $installScriptService, + protected ViewFactory $view ) { - $this->alert = $alert; - $this->installScriptService = $installScriptService; - $this->repository = $repository; } /** @@ -57,7 +41,7 @@ class EggScriptController extends Controller ['copy_script_from', '=', $egg->id], ]); - return view('admin.eggs.scripts', [ + return $this->view->make('admin.eggs.scripts', [ 'copyFromOptions' => $copy, 'relyOnScript' => $rely, 'egg' => $egg, diff --git a/app/Http/Controllers/Admin/Nests/EggShareController.php b/app/Http/Controllers/Admin/Nests/EggShareController.php index 32882ba5c..b2c704e52 100644 --- a/app/Http/Controllers/Admin/Nests/EggShareController.php +++ b/app/Http/Controllers/Admin/Nests/EggShareController.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Http\Controllers\Admin\Nests; @@ -22,38 +15,14 @@ use Pterodactyl\Services\Eggs\Sharing\EggUpdateImporterService; class EggShareController extends Controller { /** - * @var \Prologue\Alerts\AlertsMessageBag - */ - protected $alert; - - /** - * @var \Pterodactyl\Services\Eggs\Sharing\EggExporterService - */ - protected $exporterService; - - /** - * @var \Pterodactyl\Services\Eggs\Sharing\EggImporterService - */ - protected $importerService; - - /** - * @var \Pterodactyl\Services\Eggs\Sharing\EggUpdateImporterService - */ - protected $updateImporterService; - - /** - * OptionShareController constructor. + * EggShareController constructor. */ public function __construct( - AlertsMessageBag $alert, - EggExporterService $exporterService, - EggImporterService $importerService, - EggUpdateImporterService $updateImporterService + protected AlertsMessageBag $alert, + protected EggExporterService $exporterService, + protected EggImporterService $importerService, + protected EggUpdateImporterService $updateImporterService ) { - $this->alert = $alert; - $this->exporterService = $exporterService; - $this->importerService = $importerService; - $this->updateImporterService = $updateImporterService; } /** @@ -61,7 +30,7 @@ class EggShareController extends Controller */ public function export(Egg $egg): Response { - $filename = trim(preg_replace('/[^\w]/', '-', kebab_case($egg->name)), '-'); + $filename = trim(preg_replace('/\W/', '-', kebab_case($egg->name)), '-'); return response($this->exporterService->handle($egg->id), 200, [ 'Content-Transfer-Encoding' => 'binary', diff --git a/app/Http/Controllers/Admin/Nests/EggVariableController.php b/app/Http/Controllers/Admin/Nests/EggVariableController.php index 193f3b9b5..40274b323 100644 --- a/app/Http/Controllers/Admin/Nests/EggVariableController.php +++ b/app/Http/Controllers/Admin/Nests/EggVariableController.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Http\Controllers\Admin\Nests; @@ -14,6 +7,7 @@ use Pterodactyl\Models\Egg; use Pterodactyl\Models\EggVariable; use Illuminate\Http\RedirectResponse; use Prologue\Alerts\AlertsMessageBag; +use Illuminate\View\Factory as ViewFactory; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Contracts\Repository\EggRepositoryInterface; use Pterodactyl\Services\Eggs\Variables\VariableUpdateService; @@ -23,46 +17,17 @@ use Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface; class EggVariableController extends Controller { - /** - * @var \Prologue\Alerts\AlertsMessageBag - */ - protected $alert; - - /** - * @var \Pterodactyl\Services\Eggs\Variables\VariableCreationService - */ - protected $creationService; - - /** - * @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface - */ - protected $repository; - - /** - * @var \Pterodactyl\Services\Eggs\Variables\VariableUpdateService - */ - protected $updateService; - - /** - * @var \Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface - */ - protected $variableRepository; - /** * EggVariableController constructor. */ public function __construct( - AlertsMessageBag $alert, - VariableCreationService $creationService, - VariableUpdateService $updateService, - EggRepositoryInterface $repository, - EggVariableRepositoryInterface $variableRepository + protected AlertsMessageBag $alert, + protected VariableCreationService $creationService, + protected VariableUpdateService $updateService, + protected EggRepositoryInterface $repository, + protected EggVariableRepositoryInterface $variableRepository, + protected ViewFactory $view ) { - $this->alert = $alert; - $this->creationService = $creationService; - $this->repository = $repository; - $this->updateService = $updateService; - $this->variableRepository = $variableRepository; } /** @@ -74,7 +39,7 @@ class EggVariableController extends Controller { $egg = $this->repository->getWithVariables($egg); - return view('admin.eggs.variables', ['egg' => $egg]); + return $this->view->make('admin.eggs.variables', ['egg' => $egg]); } /** diff --git a/app/Http/Controllers/Admin/Nests/NestController.php b/app/Http/Controllers/Admin/Nests/NestController.php index 89e1efd77..037dd0943 100644 --- a/app/Http/Controllers/Admin/Nests/NestController.php +++ b/app/Http/Controllers/Admin/Nests/NestController.php @@ -1,17 +1,11 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Http\Controllers\Admin\Nests; use Illuminate\View\View; use Illuminate\Http\RedirectResponse; use Prologue\Alerts\AlertsMessageBag; +use Illuminate\View\Factory as ViewFactory; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Services\Nests\NestUpdateService; use Pterodactyl\Services\Nests\NestCreationService; @@ -21,46 +15,17 @@ use Pterodactyl\Http\Requests\Admin\Nest\StoreNestFormRequest; class NestController extends Controller { - /** - * @var \Prologue\Alerts\AlertsMessageBag - */ - protected $alert; - - /** - * @var \Pterodactyl\Services\Nests\NestCreationService - */ - protected $nestCreationService; - - /** - * @var \Pterodactyl\Services\Nests\NestDeletionService - */ - protected $nestDeletionService; - - /** - * @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface - */ - protected $repository; - - /** - * @var \Pterodactyl\Services\Nests\NestUpdateService - */ - protected $nestUpdateService; - /** * NestController constructor. */ public function __construct( - AlertsMessageBag $alert, - NestCreationService $nestCreationService, - NestDeletionService $nestDeletionService, - NestRepositoryInterface $repository, - NestUpdateService $nestUpdateService + protected AlertsMessageBag $alert, + protected NestCreationService $nestCreationService, + protected NestDeletionService $nestDeletionService, + protected NestRepositoryInterface $repository, + protected NestUpdateService $nestUpdateService, + protected ViewFactory $view ) { - $this->alert = $alert; - $this->nestDeletionService = $nestDeletionService; - $this->nestCreationService = $nestCreationService; - $this->nestUpdateService = $nestUpdateService; - $this->repository = $repository; } /** @@ -70,7 +35,7 @@ class NestController extends Controller */ public function index(): View { - return view('admin.nests.index', [ + return $this->view->make('admin.nests.index', [ 'nests' => $this->repository->getWithCounts(), ]); } @@ -80,7 +45,7 @@ class NestController extends Controller */ public function create(): View { - return view('admin.nests.new'); + return $this->view->make('admin.nests.new'); } /** @@ -97,13 +62,13 @@ class NestController extends Controller } /** - * Return details about a nest including all of the eggs and servers per egg. + * Return details about a nest including all the eggs and servers per egg. * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function view(int $nest): View { - return view('admin.nests.view', [ + return $this->view->make('admin.nests.view', [ 'nest' => $this->repository->getWithEggServers($nest), ]); } diff --git a/app/Http/Controllers/Admin/NodeAutoDeployController.php b/app/Http/Controllers/Admin/NodeAutoDeployController.php index 79305a38b..ac0684a9c 100644 --- a/app/Http/Controllers/Admin/NodeAutoDeployController.php +++ b/app/Http/Controllers/Admin/NodeAutoDeployController.php @@ -13,43 +13,23 @@ use Pterodactyl\Repositories\Eloquent\ApiKeyRepository; class NodeAutoDeployController extends Controller { - /** - * @var \Pterodactyl\Services\Api\KeyCreationService - */ - private $keyCreationService; - - /** - * @var \Pterodactyl\Repositories\Eloquent\ApiKeyRepository - */ - private $repository; - - /** - * @var \Illuminate\Contracts\Encryption\Encrypter - */ - private $encrypter; - /** * NodeAutoDeployController constructor. */ public function __construct( - ApiKeyRepository $repository, - Encrypter $encrypter, - KeyCreationService $keyCreationService + private ApiKeyRepository $repository, + private Encrypter $encrypter, + private KeyCreationService $keyCreationService ) { - $this->keyCreationService = $keyCreationService; - $this->repository = $repository; - $this->encrypter = $encrypter; } /** - * Generates a new API key for the logged in user with only permission to read + * 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. * - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ - public function __invoke(Request $request, Node $node) + public function __invoke(Request $request, Node $node): JsonResponse { /** @var \Pterodactyl\Models\ApiKey|null $key */ $key = $this->repository->getApplicationKeys($request->user()) diff --git a/app/Http/Controllers/Admin/Nodes/NodeController.php b/app/Http/Controllers/Admin/Nodes/NodeController.php index d3d53fc8c..d80df6c80 100644 --- a/app/Http/Controllers/Admin/Nodes/NodeController.php +++ b/app/Http/Controllers/Admin/Nodes/NodeController.php @@ -2,40 +2,26 @@ namespace Pterodactyl\Http\Controllers\Admin\Nodes; +use Illuminate\View\View; use Illuminate\Http\Request; use Pterodactyl\Models\Node; use Spatie\QueryBuilder\QueryBuilder; -use Illuminate\Contracts\View\Factory; use Pterodactyl\Http\Controllers\Controller; -use Pterodactyl\Repositories\Eloquent\NodeRepository; +use Illuminate\Contracts\View\Factory as ViewFactory; class NodeController extends Controller { - /** - * @var \Illuminate\Contracts\View\Factory - */ - private $view; - - /** - * @var \Pterodactyl\Repositories\Eloquent\NodeRepository - */ - private $repository; - /** * NodeController constructor. */ - public function __construct(NodeRepository $repository, Factory $view) + public function __construct(private ViewFactory $view) { - $this->view = $view; - $this->repository = $repository; } /** * Returns a listing of nodes on the system. - * - * @return \Illuminate\Contracts\View\View */ - public function index(Request $request) + public function index(Request $request): View { $nodes = QueryBuilder::for( Node::query()->with('location')->withCount('servers') diff --git a/app/Http/Controllers/Admin/Nodes/NodeViewController.php b/app/Http/Controllers/Admin/Nodes/NodeViewController.php index b45b23a09..673890323 100644 --- a/app/Http/Controllers/Admin/Nodes/NodeViewController.php +++ b/app/Http/Controllers/Admin/Nodes/NodeViewController.php @@ -2,12 +2,13 @@ namespace Pterodactyl\Http\Controllers\Admin\Nodes; +use Illuminate\View\View; use Illuminate\Http\Request; use Pterodactyl\Models\Node; use Illuminate\Support\Collection; use Pterodactyl\Models\Allocation; -use Illuminate\Contracts\View\Factory; use Pterodactyl\Http\Controllers\Controller; +use Illuminate\Contracts\View\Factory as ViewFactory; use Pterodactyl\Repositories\Eloquent\NodeRepository; use Pterodactyl\Repositories\Eloquent\ServerRepository; use Pterodactyl\Traits\Controllers\JavascriptInjection; @@ -19,61 +20,23 @@ class NodeViewController extends Controller { use JavascriptInjection; - /** - * @var \Pterodactyl\Repositories\Eloquent\NodeRepository - */ - private $repository; - - /** - * @var \Illuminate\Contracts\View\Factory - */ - private $view; - - /** - * @var \Pterodactyl\Services\Helpers\SoftwareVersionService - */ - private $versionService; - - /** - * @var \Pterodactyl\Repositories\Eloquent\LocationRepository - */ - private $locationRepository; - - /** - * @var \Pterodactyl\Repositories\Eloquent\AllocationRepository - */ - private $allocationRepository; - - /** - * @var \Pterodactyl\Repositories\Eloquent\ServerRepository - */ - private $serverRepository; - /** * NodeViewController constructor. */ public function __construct( - AllocationRepository $allocationRepository, - LocationRepository $locationRepository, - NodeRepository $repository, - ServerRepository $serverRepository, - SoftwareVersionService $versionService, - Factory $view + private AllocationRepository $allocationRepository, + private LocationRepository $locationRepository, + private NodeRepository $repository, + private ServerRepository $serverRepository, + private SoftwareVersionService $versionService, + private ViewFactory $view ) { - $this->repository = $repository; - $this->view = $view; - $this->versionService = $versionService; - $this->locationRepository = $locationRepository; - $this->allocationRepository = $allocationRepository; - $this->serverRepository = $serverRepository; } /** * Returns index view for a specific node on the system. - * - * @return \Illuminate\Contracts\View\View */ - public function index(Request $request, Node $node) + public function index(Request $request, Node $node): View { $node = $this->repository->loadLocationAndServerCount($node); @@ -86,10 +49,8 @@ class NodeViewController extends Controller /** * Returns the settings page for a specific node. - * - * @return \Illuminate\Contracts\View\View */ - public function settings(Request $request, Node $node) + public function settings(Request $request, Node $node): View { return $this->view->make('admin.nodes.view.settings', [ 'node' => $node, @@ -99,20 +60,16 @@ class NodeViewController extends Controller /** * Return the node configuration page for a specific node. - * - * @return \Illuminate\Contracts\View\View */ - public function configuration(Request $request, Node $node) + public function configuration(Request $request, Node $node): View { return $this->view->make('admin.nodes.view.configuration', compact('node')); } /** * Return the node allocation management page. - * - * @return \Illuminate\Contracts\View\View */ - public function allocations(Request $request, Node $node) + public function allocations(Request $request, Node $node): View { $node = $this->repository->loadNodeAllocations($node); @@ -129,10 +86,8 @@ class NodeViewController extends Controller /** * Return a listing of servers that exist for this specific node. - * - * @return \Illuminate\Contracts\View\View */ - public function servers(Request $request, Node $node) + public function servers(Request $request, Node $node): View { $this->plainInject([ 'node' => Collection::wrap($node->makeVisible(['daemon_token_id', 'daemon_token'])) diff --git a/app/Http/Controllers/Admin/Nodes/SystemInformationController.php b/app/Http/Controllers/Admin/Nodes/SystemInformationController.php index 954897a88..875b1afbe 100644 --- a/app/Http/Controllers/Admin/Nodes/SystemInformationController.php +++ b/app/Http/Controllers/Admin/Nodes/SystemInformationController.php @@ -11,27 +11,19 @@ use Pterodactyl\Repositories\Wings\DaemonConfigurationRepository; class SystemInformationController extends Controller { - /** - * @var \Pterodactyl\Repositories\Wings\DaemonConfigurationRepository - */ - private $repository; - /** * SystemInformationController constructor. */ - public function __construct(DaemonConfigurationRepository $repository) + public function __construct(private DaemonConfigurationRepository $repository) { - $this->repository = $repository; } /** * Returns system information from the Daemon. * - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ - public function __invoke(Request $request, Node $node) + public function __invoke(Request $request, Node $node): JsonResponse { $data = $this->repository->setNode($node)->getSystemInformation(); diff --git a/app/Http/Controllers/Admin/NodesController.php b/app/Http/Controllers/Admin/NodesController.php index 193326dee..573a1d9f8 100644 --- a/app/Http/Controllers/Admin/NodesController.php +++ b/app/Http/Controllers/Admin/NodesController.php @@ -1,19 +1,15 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Http\Controllers\Admin; +use Illuminate\View\View; use Illuminate\Http\Request; use Pterodactyl\Models\Node; use Illuminate\Http\Response; use Pterodactyl\Models\Allocation; +use Illuminate\Http\RedirectResponse; use Prologue\Alerts\AlertsMessageBag; +use Illuminate\View\Factory as ViewFactory; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Services\Nodes\NodeUpdateService; use Illuminate\Cache\Repository as CacheRepository; @@ -32,103 +28,30 @@ use Pterodactyl\Http\Requests\Admin\Node\AllocationAliasFormRequest; class NodesController extends Controller { - /** - * @var \Pterodactyl\Services\Allocations\AllocationDeletionService - */ - protected $allocationDeletionService; - - /** - * @var \Prologue\Alerts\AlertsMessageBag - */ - protected $alert; - - /** - * @var \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface - */ - protected $allocationRepository; - - /** - * @var \Pterodactyl\Services\Allocations\AssignmentService - */ - protected $assignmentService; - - /** - * @var \Illuminate\Cache\Repository - */ - protected $cache; - - /** - * @var \Pterodactyl\Services\Nodes\NodeCreationService - */ - protected $creationService; - - /** - * @var \Pterodactyl\Services\Nodes\NodeDeletionService - */ - protected $deletionService; - - /** - * @var \Pterodactyl\Contracts\Repository\LocationRepositoryInterface - */ - protected $locationRepository; - - /** - * @var \Pterodactyl\Contracts\Repository\NodeRepositoryInterface - */ - protected $repository; - - /** - * @var \Pterodactyl\Contracts\Repository\ServerRepositoryInterface - */ - protected $serverRepository; - - /** - * @var \Pterodactyl\Services\Nodes\NodeUpdateService - */ - protected $updateService; - - /** - * @var \Pterodactyl\Services\Helpers\SoftwareVersionService - */ - protected $versionService; - /** * NodesController constructor. */ public function __construct( - AlertsMessageBag $alert, - AllocationDeletionService $allocationDeletionService, - AllocationRepositoryInterface $allocationRepository, - AssignmentService $assignmentService, - CacheRepository $cache, - NodeCreationService $creationService, - NodeDeletionService $deletionService, - LocationRepositoryInterface $locationRepository, - NodeRepositoryInterface $repository, - ServerRepositoryInterface $serverRepository, - NodeUpdateService $updateService, - SoftwareVersionService $versionService + protected AlertsMessageBag $alert, + protected AllocationDeletionService $allocationDeletionService, + protected AllocationRepositoryInterface $allocationRepository, + protected AssignmentService $assignmentService, + protected CacheRepository $cache, + protected NodeCreationService $creationService, + protected NodeDeletionService $deletionService, + protected LocationRepositoryInterface $locationRepository, + protected NodeRepositoryInterface $repository, + protected ServerRepositoryInterface $serverRepository, + protected NodeUpdateService $updateService, + protected SoftwareVersionService $versionService, + protected ViewFactory $view ) { - $this->alert = $alert; - $this->allocationDeletionService = $allocationDeletionService; - $this->allocationRepository = $allocationRepository; - $this->assignmentService = $assignmentService; - $this->cache = $cache; - $this->creationService = $creationService; - $this->deletionService = $deletionService; - $this->locationRepository = $locationRepository; - $this->repository = $repository; - $this->serverRepository = $serverRepository; - $this->updateService = $updateService; - $this->versionService = $versionService; } /** * Displays create new node page. - * - * @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View */ - public function create() + public function create(): View|RedirectResponse { $locations = $this->locationRepository->all(); if (count($locations) < 1) { @@ -137,17 +60,15 @@ class NodesController extends Controller return redirect()->route('admin.locations'); } - return view('admin.nodes.new', ['locations' => $locations]); + return $this->view->make('admin.nodes.new', ['locations' => $locations]); } /** * Post controller to create a new node on the system. * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ - public function store(NodeFormRequest $request) + public function store(NodeFormRequest $request): RedirectResponse { $node = $this->creationService->handle($request->normalize()); $this->alert->info(trans('admin/node.notices.node_created'))->flash(); @@ -158,13 +79,11 @@ class NodesController extends Controller /** * Updates settings for a node. * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function updateSettings(NodeFormRequest $request, Node $node) + public function updateSettings(NodeFormRequest $request, Node $node): RedirectResponse { $this->updateService->handle($node, $request->normalize(), $request->input('reset_secret') === 'on'); $this->alert->success(trans('admin/node.notices.node_updated'))->flash(); @@ -203,12 +122,8 @@ class NodesController extends Controller /** * Remove all allocations for a specific IP at once on a node. - * - * @param int $node - * - * @return \Illuminate\Http\RedirectResponse */ - public function allocationRemoveBlock(Request $request, $node) + public function allocationRemoveBlock(Request $request, int $node): RedirectResponse { $this->allocationRepository->deleteWhere([ ['node_id', '=', $node], @@ -225,12 +140,10 @@ class NodesController extends Controller /** * Sets an alias for a specific allocation on a node. * - * @return \Symfony\Component\HttpFoundation\Response - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function allocationSetAlias(AllocationAliasFormRequest $request) + public function allocationSetAlias(AllocationAliasFormRequest $request): \Symfony\Component\HttpFoundation\Response { $this->allocationRepository->update($request->input('allocation_id'), [ 'ip_alias' => (empty($request->input('alias'))) ? null : $request->input('alias'), @@ -242,16 +155,12 @@ class NodesController extends Controller /** * Creates new allocations on a node. * - * @param int|\Pterodactyl\Models\Node $node - * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Pterodactyl\Exceptions\Service\Allocation\CidrOutOfRangeException * @throws \Pterodactyl\Exceptions\Service\Allocation\InvalidPortMappingException * @throws \Pterodactyl\Exceptions\Service\Allocation\PortOutOfRangeException * @throws \Pterodactyl\Exceptions\Service\Allocation\TooManyPortsInRangeException */ - public function createAllocation(AllocationFormRequest $request, Node $node) + public function createAllocation(AllocationFormRequest $request, Node $node): RedirectResponse { $this->assignmentService->handle($node, $request->normalize()); $this->alert->success(trans('admin/node.notices.allocations_added'))->flash(); @@ -262,13 +171,9 @@ class NodesController extends Controller /** * Deletes a node from the system. * - * @param $node - * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Pterodactyl\Exceptions\DisplayException */ - public function delete($node) + public function delete(int|Node $node): RedirectResponse { $this->deletionService->handle($node); $this->alert->success(trans('admin/node.notices.node_deleted'))->flash(); diff --git a/app/Http/Controllers/Admin/Servers/CreateServerController.php b/app/Http/Controllers/Admin/Servers/CreateServerController.php index b8f5a320b..c7a1653ad 100644 --- a/app/Http/Controllers/Admin/Servers/CreateServerController.php +++ b/app/Http/Controllers/Admin/Servers/CreateServerController.php @@ -3,77 +3,40 @@ namespace Pterodactyl\Http\Controllers\Admin\Servers; use JavaScript; +use Illuminate\View\View; +use Pterodactyl\Models\Node; +use Pterodactyl\Models\Location; use Illuminate\Http\RedirectResponse; use Prologue\Alerts\AlertsMessageBag; +use Illuminate\View\Factory as ViewFactory; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Repositories\Eloquent\NestRepository; use Pterodactyl\Repositories\Eloquent\NodeRepository; use Pterodactyl\Http\Requests\Admin\ServerFormRequest; -use Pterodactyl\Repositories\Eloquent\ServerRepository; use Pterodactyl\Services\Servers\ServerCreationService; -use Pterodactyl\Repositories\Eloquent\LocationRepository; class CreateServerController extends Controller { - /** - * @var \Pterodactyl\Repositories\Eloquent\ServerRepository - */ - private $repository; - - /** - * @var \Pterodactyl\Repositories\Eloquent\NodeRepository - */ - private $nodeRepository; - - /** - * @var \Prologue\Alerts\AlertsMessageBag - */ - private $alert; - - /** - * @var \Pterodactyl\Repositories\Eloquent\NestRepository - */ - private $nestRepository; - - /** - * @var \Pterodactyl\Repositories\Eloquent\LocationRepository - */ - private $locationRepository; - - /** - * @var \Pterodactyl\Services\Servers\ServerCreationService - */ - private $creationService; - /** * CreateServerController constructor. */ public function __construct( - AlertsMessageBag $alert, - NestRepository $nestRepository, - LocationRepository $locationRepository, - NodeRepository $nodeRepository, - ServerRepository $repository, - ServerCreationService $creationService + private AlertsMessageBag $alert, + private NestRepository $nestRepository, + private NodeRepository $nodeRepository, + private ServerCreationService $creationService, + private ViewFactory $view ) { - $this->repository = $repository; - $this->nodeRepository = $nodeRepository; - $this->alert = $alert; - $this->nestRepository = $nestRepository; - $this->locationRepository = $locationRepository; - $this->creationService = $creationService; } /** * Displays the create server page. * - * @return \Illuminate\Contracts\View\Factory - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function index() + public function index(): View|RedirectResponse { - $nodes = $this->nodeRepository->all(); + $nodes = Node::all(); if (count($nodes) < 1) { $this->alert->warning(trans('admin/server.alerts.node_required'))->flash(); @@ -82,7 +45,7 @@ class CreateServerController extends Controller $nests = $this->nestRepository->getWithEggs(); - Javascript::put([ + JavaScript::put([ 'nodeData' => $this->nodeRepository->getNodesForServerCreation(), 'nests' => $nests->map(function ($item) { return array_merge($item->toArray(), [ @@ -91,8 +54,8 @@ class CreateServerController extends Controller })->keyBy('id'), ]); - return view('admin.servers.new', [ - 'locations' => $this->locationRepository->all(), + return $this->view->make('admin.servers.new', [ + 'locations' => Location::all(), 'nests' => $nests, ]); } @@ -100,15 +63,13 @@ class CreateServerController extends Controller /** * Create a new server on the remote system. * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Illuminate\Validation\ValidationException * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableAllocationException * @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableNodeException * @throws \Throwable */ - public function store(ServerFormRequest $request) + public function store(ServerFormRequest $request): RedirectResponse { $data = $request->except(['_token']); if (!empty($data['custom_image'])) { @@ -118,10 +79,8 @@ class CreateServerController extends Controller $server = $this->creationService->handle($data); - $this->alert->success( - trans('admin/server.alerts.server_created') - )->flash(); + $this->alert->success(trans('admin/server.alerts.server_created'))->flash(); - return RedirectResponse::create('/admin/servers/view/' . $server->id); + return new RedirectResponse('/admin/servers/view/' . $server->id); } } diff --git a/app/Http/Controllers/Admin/Servers/ServerController.php b/app/Http/Controllers/Admin/Servers/ServerController.php index f369b7ad5..430c3f2b9 100644 --- a/app/Http/Controllers/Admin/Servers/ServerController.php +++ b/app/Http/Controllers/Admin/Servers/ServerController.php @@ -2,45 +2,29 @@ namespace Pterodactyl\Http\Controllers\Admin\Servers; +use Illuminate\View\View; use Illuminate\Http\Request; use Pterodactyl\Models\Server; use Spatie\QueryBuilder\QueryBuilder; -use Illuminate\Contracts\View\Factory; use Spatie\QueryBuilder\AllowedFilter; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Models\Filters\AdminServerFilter; -use Pterodactyl\Repositories\Eloquent\ServerRepository; +use Illuminate\Contracts\View\Factory as ViewFactory; class ServerController extends Controller { - /** - * @var \Illuminate\Contracts\View\Factory - */ - private $view; - - /** - * @var \Pterodactyl\Repositories\Eloquent\ServerRepository - */ - private $repository; - /** * ServerController constructor. */ - public function __construct( - Factory $view, - ServerRepository $repository - ) { - $this->view = $view; - $this->repository = $repository; + public function __construct(private ViewFactory $view) + { } /** - * Returns all of the servers that exist on the system using a paginated result set. If + * Returns all 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. - * - * @return \Illuminate\Contracts\View\View */ - public function index(Request $request) + public function index(Request $request): View { $servers = QueryBuilder::for(Server::query()->with('node', 'user', 'allocation')) ->allowedFilters([ diff --git a/app/Http/Controllers/Admin/Servers/ServerTransferController.php b/app/Http/Controllers/Admin/Servers/ServerTransferController.php index 9166ae3e9..cdb2bb557 100644 --- a/app/Http/Controllers/Admin/Servers/ServerTransferController.php +++ b/app/Http/Controllers/Admin/Servers/ServerTransferController.php @@ -5,81 +5,34 @@ namespace Pterodactyl\Http\Controllers\Admin\Servers; use Illuminate\Http\Request; use Pterodactyl\Models\Server; use Prologue\Alerts\AlertsMessageBag; +use Illuminate\Http\RedirectResponse; use Pterodactyl\Models\ServerTransfer; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Services\Servers\TransferService; use Pterodactyl\Repositories\Eloquent\NodeRepository; -use Pterodactyl\Repositories\Eloquent\ServerRepository; -use Pterodactyl\Repositories\Eloquent\LocationRepository; use Pterodactyl\Repositories\Wings\DaemonConfigurationRepository; use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface; class ServerTransferController extends Controller { - /** - * @var \Prologue\Alerts\AlertsMessageBag - */ - private $alert; - - /** - * @var \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface - */ - private $allocationRepository; - - /** - * @var \Pterodactyl\Repositories\Eloquent\ServerRepository - */ - private $repository; - - /** - * @var \Pterodactyl\Repositories\Eloquent\LocationRepository - */ - private $locationRepository; - - /** - * @var \Pterodactyl\Repositories\Eloquent\NodeRepository - */ - private $nodeRepository; - - /** - * @var \Pterodactyl\Services\Servers\TransferService - */ - private $transferService; - - /** - * @var \Pterodactyl\Repositories\Wings\DaemonConfigurationRepository - */ - private $daemonConfigurationRepository; - /** * ServerTransferController constructor. */ public function __construct( - AlertsMessageBag $alert, - AllocationRepositoryInterface $allocationRepository, - ServerRepository $repository, - LocationRepository $locationRepository, - NodeRepository $nodeRepository, - TransferService $transferService, - DaemonConfigurationRepository $daemonConfigurationRepository + private AlertsMessageBag $alert, + private AllocationRepositoryInterface $allocationRepository, + private NodeRepository $nodeRepository, + private TransferService $transferService, + private DaemonConfigurationRepository $daemonConfigurationRepository ) { - $this->alert = $alert; - $this->allocationRepository = $allocationRepository; - $this->repository = $repository; - $this->locationRepository = $locationRepository; - $this->nodeRepository = $nodeRepository; - $this->transferService = $transferService; - $this->daemonConfigurationRepository = $daemonConfigurationRepository; } /** * Starts a transfer of a server to a new node. * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Throwable */ - public function transfer(Request $request, Server $server) + public function transfer(Request $request, Server $server): RedirectResponse { $validatedData = $request->validate([ 'node_id' => 'required|exists:nodes,id', @@ -112,7 +65,7 @@ class ServerTransferController extends Controller $transfer->save(); - // Add the allocations to the server so they cannot be automatically assigned while the transfer is in progress. + // Add the allocations to the server, so they cannot be automatically assigned while the transfer is in progress. $this->assignAllocationsToServer($server, $node_id, $allocation_id, $additional_allocations); // Request an archive from the server's current daemon. (this also checks if the daemon is online) @@ -132,7 +85,7 @@ class ServerTransferController extends Controller private function assignAllocationsToServer(Server $server, int $node_id, int $allocation_id, array $additional_allocations) { $allocations = $additional_allocations; - array_push($allocations, $allocation_id); + $allocations[] = $allocation_id; $unassigned = $this->allocationRepository->getUnassignedAllocationIds($node_id); diff --git a/app/Http/Controllers/Admin/Servers/ServerViewController.php b/app/Http/Controllers/Admin/Servers/ServerViewController.php index 9186a8935..7cf64a2f5 100644 --- a/app/Http/Controllers/Admin/Servers/ServerViewController.php +++ b/app/Http/Controllers/Admin/Servers/ServerViewController.php @@ -3,13 +3,14 @@ namespace Pterodactyl\Http\Controllers\Admin\Servers; use JavaScript; +use Illuminate\View\View; use Illuminate\Http\Request; use Pterodactyl\Models\Nest; use Pterodactyl\Models\Server; -use Illuminate\Contracts\View\Factory; use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Services\Servers\EnvironmentService; +use Illuminate\Contracts\View\Factory as ViewFactory; use Pterodactyl\Repositories\Eloquent\NestRepository; use Pterodactyl\Repositories\Eloquent\NodeRepository; use Pterodactyl\Repositories\Eloquent\MountRepository; @@ -22,95 +23,41 @@ class ServerViewController extends Controller { use JavascriptInjection; - /** - * @var \Illuminate\Contracts\View\Factory - */ - private $view; - - /** - * @var \Pterodactyl\Repositories\Eloquent\DatabaseHostRepository - */ - private $databaseHostRepository; - - /** - * @var \Pterodactyl\Repositories\Eloquent\ServerRepository - */ - private $repository; - - /** - * @var \Pterodactyl\Repositories\Eloquent\MountRepository - */ - protected $mountRepository; - - /** - * @var \Pterodactyl\Repositories\Eloquent\NestRepository - */ - private $nestRepository; - - /** - * @var \Pterodactyl\Repositories\Eloquent\LocationRepository - */ - private $locationRepository; - - /** - * @var \Pterodactyl\Repositories\Eloquent\NodeRepository - */ - private $nodeRepository; - - /** - * @var \Pterodactyl\Services\Servers\EnvironmentService - */ - private $environmentService; - /** * ServerViewController constructor. */ public function __construct( - Factory $view, - DatabaseHostRepository $databaseHostRepository, - LocationRepository $locationRepository, - MountRepository $mountRepository, - NestRepository $nestRepository, - NodeRepository $nodeRepository, - ServerRepository $repository, - EnvironmentService $environmentService + private DatabaseHostRepository $databaseHostRepository, + private LocationRepository $locationRepository, + private MountRepository $mountRepository, + private NestRepository $nestRepository, + private NodeRepository $nodeRepository, + private ServerRepository $repository, + private EnvironmentService $environmentService, + private ViewFactory $view ) { - $this->view = $view; - $this->databaseHostRepository = $databaseHostRepository; - $this->locationRepository = $locationRepository; - $this->mountRepository = $mountRepository; - $this->nestRepository = $nestRepository; - $this->nodeRepository = $nodeRepository; - $this->repository = $repository; - $this->environmentService = $environmentService; } /** * Returns the index view for a server. - * - * @return \Illuminate\Contracts\View\View */ - public function index(Request $request, Server $server) + public function index(Request $request, Server $server): View { return $this->view->make('admin.servers.view.index', compact('server')); } /** * Returns the server details page. - * - * @return \Illuminate\Contracts\View\View */ - public function details(Request $request, Server $server) + public function details(Request $request, Server $server): View { return $this->view->make('admin.servers.view.details', compact('server')); } /** * Returns a view of server build settings. - * - * @return \Illuminate\Contracts\View\View */ - public function build(Request $request, Server $server) + public function build(Request $request, Server $server): View { $allocations = $server->node->allocations->toBase(); @@ -124,11 +71,9 @@ class ServerViewController extends Controller /** * Returns the server startup management page. * - * @return \Illuminate\Contracts\View\View - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function startup(Request $request, Server $server) + public function startup(Request $request, Server $server): View { $nests = $this->nestRepository->getWithEggs(); $variables = $this->environmentService->handle($server); @@ -147,11 +92,9 @@ class ServerViewController extends Controller } /** - * Returns all of the databases that exist for the server. - * - * @return \Illuminate\Contracts\View\View + * Returns all the databases that exist for the server. */ - public function database(Request $request, Server $server) + public function database(Request $request, Server $server): View { return $this->view->make('admin.servers.view.database', [ 'hosts' => $this->databaseHostRepository->all(), @@ -160,11 +103,9 @@ class ServerViewController extends Controller } /** - * Returns all of the mounts that exist for the server. - * - * @return \Illuminate\Contracts\View\View + * Returns all the mounts that exist for the server. */ - public function mounts(Request $request, Server $server) + public function mounts(Request $request, Server $server): View { $server->load('mounts'); @@ -178,11 +119,9 @@ 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. * - * @return \Illuminate\Contracts\View\View - * * @throws \Pterodactyl\Exceptions\DisplayException */ - public function manage(Request $request, Server $server) + public function manage(Request $request, Server $server): View { if ($server->status === Server::STATUS_INSTALL_FAILED) { throw new DisplayException('This server is in a failed install state and cannot be recovered. Please delete and re-create the server.'); @@ -195,7 +134,7 @@ class ServerViewController extends Controller $canTransfer = true; } - Javascript::put([ + JavaScript::put([ 'nodeData' => $this->nodeRepository->getNodesForServerCreation(), ]); @@ -208,10 +147,8 @@ class ServerViewController extends Controller /** * Returns the server deletion page. - * - * @return \Illuminate\Contracts\View\View */ - public function delete(Request $request, Server $server) + public function delete(Request $request, Server $server): View { return $this->view->make('admin.servers.view.delete', compact('server')); } diff --git a/app/Http/Controllers/Admin/ServersController.php b/app/Http/Controllers/Admin/ServersController.php index c226638b9..3d2c55ac4 100644 --- a/app/Http/Controllers/Admin/ServersController.php +++ b/app/Http/Controllers/Admin/ServersController.php @@ -1,20 +1,15 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Http\Controllers\Admin; use Illuminate\Http\Request; use Pterodactyl\Models\User; +use Illuminate\Http\Response; use Pterodactyl\Models\Mount; use Pterodactyl\Models\Server; use Pterodactyl\Models\Database; use Pterodactyl\Models\MountServer; +use Illuminate\Http\RedirectResponse; use Prologue\Alerts\AlertsMessageBag; use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Http\Controllers\Controller; @@ -41,148 +36,38 @@ use Pterodactyl\Http\Requests\Admin\Servers\Databases\StoreServerDatabaseRequest class ServersController extends Controller { - /** - * @var \Prologue\Alerts\AlertsMessageBag - */ - protected $alert; - - /** - * @var \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface - */ - protected $allocationRepository; - - /** - * @var \Pterodactyl\Services\Servers\BuildModificationService - */ - protected $buildModificationService; - - /** - * @var \Illuminate\Contracts\Config\Repository - */ - protected $config; - - /** - * @var \Pterodactyl\Repositories\Wings\DaemonServerRepository - */ - private $daemonServerRepository; - - /** - * @var \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface - */ - protected $databaseRepository; - - /** - * @var \Pterodactyl\Services\Databases\DatabaseManagementService - */ - protected $databaseManagementService; - - /** - * @var \Pterodactyl\Services\Databases\DatabasePasswordService - */ - protected $databasePasswordService; - - /** - * @var \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface - */ - protected $databaseHostRepository; - - /** - * @var \Pterodactyl\Services\Servers\ServerDeletionService - */ - protected $deletionService; - - /** - * @var \Pterodactyl\Services\Servers\DetailsModificationService - */ - protected $detailsModificationService; - - /** - * @var \Pterodactyl\Repositories\Eloquent\MountRepository - */ - protected $mountRepository; - - /** - * @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface - */ - protected $nestRepository; - - /** - * @var \Pterodactyl\Services\Servers\ReinstallServerService - */ - protected $reinstallService; - - /** - * @var \Pterodactyl\Contracts\Repository\ServerRepositoryInterface - */ - protected $repository; - - /** - * @var \Pterodactyl\Services\Servers\ServerConfigurationStructureService - */ - private $serverConfigurationStructureService; - - /** - * @var \Pterodactyl\Services\Servers\StartupModificationService - */ - private $startupModificationService; - - /** - * @var \Pterodactyl\Services\Servers\SuspensionService - */ - protected $suspensionService; - /** * ServersController constructor. */ public function __construct( - AlertsMessageBag $alert, - AllocationRepositoryInterface $allocationRepository, - BuildModificationService $buildModificationService, - ConfigRepository $config, - DaemonServerRepository $daemonServerRepository, - DatabaseManagementService $databaseManagementService, - DatabasePasswordService $databasePasswordService, - DatabaseRepositoryInterface $databaseRepository, - DatabaseHostRepository $databaseHostRepository, - ServerDeletionService $deletionService, - DetailsModificationService $detailsModificationService, - ReinstallServerService $reinstallService, - ServerRepositoryInterface $repository, - MountRepository $mountRepository, - NestRepositoryInterface $nestRepository, - ServerConfigurationStructureService $serverConfigurationStructureService, - StartupModificationService $startupModificationService, - SuspensionService $suspensionService + protected AlertsMessageBag $alert, + protected AllocationRepositoryInterface $allocationRepository, + protected BuildModificationService $buildModificationService, + protected ConfigRepository $config, + protected DaemonServerRepository $daemonServerRepository, + protected DatabaseManagementService $databaseManagementService, + protected DatabasePasswordService $databasePasswordService, + protected DatabaseRepositoryInterface $databaseRepository, + protected DatabaseHostRepository $databaseHostRepository, + protected ServerDeletionService $deletionService, + protected DetailsModificationService $detailsModificationService, + protected ReinstallServerService $reinstallService, + protected ServerRepositoryInterface $repository, + protected MountRepository $mountRepository, + protected NestRepositoryInterface $nestRepository, + protected ServerConfigurationStructureService $serverConfigurationStructureService, + protected StartupModificationService $startupModificationService, + protected SuspensionService $suspensionService ) { - $this->alert = $alert; - $this->allocationRepository = $allocationRepository; - $this->buildModificationService = $buildModificationService; - $this->config = $config; - $this->daemonServerRepository = $daemonServerRepository; - $this->databaseHostRepository = $databaseHostRepository; - $this->databaseManagementService = $databaseManagementService; - $this->databasePasswordService = $databasePasswordService; - $this->databaseRepository = $databaseRepository; - $this->detailsModificationService = $detailsModificationService; - $this->deletionService = $deletionService; - $this->nestRepository = $nestRepository; - $this->reinstallService = $reinstallService; - $this->repository = $repository; - $this->mountRepository = $mountRepository; - $this->serverConfigurationStructureService = $serverConfigurationStructureService; - $this->startupModificationService = $startupModificationService; - $this->suspensionService = $suspensionService; } /** * Update the details for a server. * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function setDetails(Request $request, Server $server) + public function setDetails(Request $request, Server $server): RedirectResponse { $this->detailsModificationService->handle($server, $request->only([ 'owner_id', 'external_id', 'name', 'description', @@ -194,15 +79,13 @@ class ServersController extends Controller } /** - * Toggles the install status for a server. - * - * @return \Illuminate\Http\RedirectResponse + * Toggles the installation status for a server. * * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function toggleInstall(Server $server) + public function toggleInstall(Server $server): RedirectResponse { if ($server->status === Server::STATUS_INSTALL_FAILED) { throw new DisplayException(trans('admin/server.exceptions.marked_as_failed')); @@ -220,13 +103,11 @@ class ServersController extends Controller /** * Reinstalls the server with the currently assigned service. * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function reinstallServer(Server $server) + public function reinstallServer(Server $server): RedirectResponse { $this->reinstallService->handle($server); $this->alert->success(trans('admin/server.alerts.server_reinstalled'))->flash(); @@ -237,13 +118,11 @@ class ServersController extends Controller /** * Manage the suspension status for a server. * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function manageSuspension(Request $request, Server $server) + public function manageSuspension(Request $request, Server $server): RedirectResponse { $this->suspensionService->toggle($server, $request->input('action')); $this->alert->success(trans('admin/server.alerts.suspension_toggled', [ @@ -256,13 +135,11 @@ class ServersController extends Controller /** * Update the build configuration for a server. * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Illuminate\Validation\ValidationException */ - public function updateBuild(Request $request, Server $server) + public function updateBuild(Request $request, Server $server): RedirectResponse { try { $this->buildModificationService->handle($server, $request->only([ @@ -282,12 +159,10 @@ class ServersController extends Controller /** * Start the server deletion process. * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Throwable */ - public function delete(Request $request, Server $server) + public function delete(Request $request, Server $server): RedirectResponse { $this->deletionService->withForce($request->filled('force_delete'))->handle($server); $this->alert->success(trans('admin/server.alerts.server_deleted'))->flash(); @@ -298,11 +173,9 @@ class ServersController extends Controller /** * Update the startup command as well as variables. * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Illuminate\Validation\ValidationException */ - public function saveStartup(Request $request, Server $server) + public function saveStartup(Request $request, Server $server): RedirectResponse { $data = $request->except('_token'); if (!empty($data['custom_docker_image'])) { @@ -326,11 +199,9 @@ class ServersController extends Controller /** * Creates a new database assigned to a specific server. * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Throwable */ - public function newDatabase(StoreServerDatabaseRequest $request, Server $server) + public function newDatabase(StoreServerDatabaseRequest $request, Server $server): RedirectResponse { $this->databaseManagementService->create($server, [ 'database' => DatabaseManagementService::generateUniqueDatabaseName($request->input('database'), $server->id), @@ -345,13 +216,12 @@ class ServersController extends Controller /** * Resets the database password for a specific database on this server. * - * @return \Illuminate\Http\Response - * * @throws \Throwable */ - public function resetDatabasePassword(Request $request, Server $server) + public function resetDatabasePassword(Request $request, Server $server): Response { - $database = $server->databases()->where('id', $request->input('database'))->findOrFail(); + /** @var \Pterodactyl\Models\Database $database */ + $database = $server->databases()->findOrFail($request->input('database')); $this->databasePasswordService->handle($database); @@ -361,11 +231,9 @@ class ServersController extends Controller /** * Deletes a database from a server. * - * @return \Illuminate\Http\Response - * * @throws \Exception */ - public function deleteDatabase(Server $server, Database $database) + public function deleteDatabase(Server $server, Database $database): Response { $this->databaseManagementService->delete($database); @@ -375,11 +243,9 @@ class ServersController extends Controller /** * Add a mount to a server. * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Throwable */ - public function addMount(Request $request, Server $server) + public function addMount(Request $request, Server $server): RedirectResponse { $mountServer = (new MountServer())->forceFill([ 'mount_id' => $request->input('mount_id'), @@ -395,10 +261,8 @@ class ServersController extends Controller /** * Remove a mount from a server. - * - * @return \Illuminate\Http\RedirectResponse */ - public function deleteMount(Server $server, Mount $mount) + public function deleteMount(Server $server, Mount $mount): RedirectResponse { MountServer::where('mount_id', $mount->id)->where('server_id', $server->id)->delete(); diff --git a/app/Http/Controllers/Admin/Settings/AdvancedController.php b/app/Http/Controllers/Admin/Settings/AdvancedController.php index 49959bddd..bf6883232 100644 --- a/app/Http/Controllers/Admin/Settings/AdvancedController.php +++ b/app/Http/Controllers/Admin/Settings/AdvancedController.php @@ -6,6 +6,7 @@ use Illuminate\View\View; use Illuminate\Http\RedirectResponse; use Prologue\Alerts\AlertsMessageBag; use Illuminate\Contracts\Console\Kernel; +use Illuminate\View\Factory as ViewFactory; use Pterodactyl\Http\Controllers\Controller; use Illuminate\Contracts\Config\Repository as ConfigRepository; use Pterodactyl\Contracts\Repository\SettingsRepositoryInterface; @@ -13,39 +14,16 @@ use Pterodactyl\Http\Requests\Admin\Settings\AdvancedSettingsFormRequest; class AdvancedController extends Controller { - /** - * @var \Prologue\Alerts\AlertsMessageBag - */ - private $alert; - - /** - * @var \Illuminate\Contracts\Config\Repository - */ - private $config; - - /** - * @var \Illuminate\Contracts\Console\Kernel - */ - private $kernel; - - /** - * @var \Pterodactyl\Contracts\Repository\SettingsRepositoryInterface - */ - private $settings; - /** * AdvancedController constructor. */ public function __construct( - AlertsMessageBag $alert, - ConfigRepository $config, - Kernel $kernel, - SettingsRepositoryInterface $settings + private AlertsMessageBag $alert, + private ConfigRepository $config, + private Kernel $kernel, + private SettingsRepositoryInterface $settings, + private ViewFactory $view ) { - $this->alert = $alert; - $this->config = $config; - $this->kernel = $kernel; - $this->settings = $settings; } /** @@ -61,7 +39,7 @@ class AdvancedController extends Controller $showRecaptchaWarning = true; } - return view('admin.settings.advanced', [ + return $this->view->make('admin.settings.advanced', [ 'showRecaptchaWarning' => $showRecaptchaWarning, ]); } diff --git a/app/Http/Controllers/Admin/Settings/IndexController.php b/app/Http/Controllers/Admin/Settings/IndexController.php index 190646fd4..eabede932 100644 --- a/app/Http/Controllers/Admin/Settings/IndexController.php +++ b/app/Http/Controllers/Admin/Settings/IndexController.php @@ -6,6 +6,7 @@ use Illuminate\View\View; use Illuminate\Http\RedirectResponse; use Prologue\Alerts\AlertsMessageBag; use Illuminate\Contracts\Console\Kernel; +use Illuminate\View\Factory as ViewFactory; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Traits\Helpers\AvailableLanguages; use Pterodactyl\Services\Helpers\SoftwareVersionService; @@ -16,39 +17,16 @@ class IndexController extends Controller { use AvailableLanguages; - /** - * @var \Prologue\Alerts\AlertsMessageBag - */ - private $alert; - - /** - * @var \Illuminate\Contracts\Console\Kernel - */ - private $kernel; - - /** - * @var \Pterodactyl\Contracts\Repository\SettingsRepositoryInterface - */ - private $settings; - - /** - * @var \Pterodactyl\Services\Helpers\SoftwareVersionService - */ - private $versionService; - /** * IndexController constructor. */ public function __construct( - AlertsMessageBag $alert, - Kernel $kernel, - SettingsRepositoryInterface $settings, - SoftwareVersionService $versionService + private AlertsMessageBag $alert, + private Kernel $kernel, + private SettingsRepositoryInterface $settings, + private SoftwareVersionService $versionService, + private ViewFactory $view ) { - $this->alert = $alert; - $this->kernel = $kernel; - $this->settings = $settings; - $this->versionService = $versionService; } /** @@ -56,7 +34,7 @@ class IndexController extends Controller */ public function index(): View { - return view('admin.settings.index', [ + return $this->view->make('admin.settings.index', [ 'version' => $this->versionService, 'languages' => $this->getAvailableLanguages(true), ]); diff --git a/app/Http/Controllers/Admin/Settings/MailController.php b/app/Http/Controllers/Admin/Settings/MailController.php index 8f3e15ed6..058e3a90e 100644 --- a/app/Http/Controllers/Admin/Settings/MailController.php +++ b/app/Http/Controllers/Admin/Settings/MailController.php @@ -6,9 +6,9 @@ use Exception; use Illuminate\View\View; use Illuminate\Http\Request; use Illuminate\Http\Response; -use Prologue\Alerts\AlertsMessageBag; use Illuminate\Contracts\Console\Kernel; use Pterodactyl\Notifications\MailTested; +use Illuminate\View\Factory as ViewFactory; use Illuminate\Support\Facades\Notification; use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Http\Controllers\Controller; @@ -20,46 +20,16 @@ use Pterodactyl\Http\Requests\Admin\Settings\MailSettingsFormRequest; class MailController extends Controller { - /** - * @var \Prologue\Alerts\AlertsMessageBag - */ - private $alert; - - /** - * @var \Illuminate\Contracts\Config\Repository - */ - private $config; - - /** - * @var \Illuminate\Contracts\Encryption\Encrypter - */ - private $encrypter; - - /** - * @var \Illuminate\Contracts\Console\Kernel - */ - private $kernel; - - /** - * @var \Pterodactyl\Contracts\Repository\SettingsRepositoryInterface - */ - private $settings; - /** * MailController constructor. */ public function __construct( - AlertsMessageBag $alert, - ConfigRepository $config, - Encrypter $encrypter, - Kernel $kernel, - SettingsRepositoryInterface $settings + private ConfigRepository $config, + private Encrypter $encrypter, + private Kernel $kernel, + private SettingsRepositoryInterface $settings, + private ViewFactory $view ) { - $this->alert = $alert; - $this->config = $config; - $this->encrypter = $encrypter; - $this->kernel = $kernel; - $this->settings = $settings; } /** @@ -68,7 +38,7 @@ class MailController extends Controller */ public function index(): View { - return view('admin.settings.mail', [ + return $this->view->make('admin.settings.mail', [ 'disabled' => $this->config->get('mail.driver') !== 'smtp', ]); } diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index b13ee62bf..254a72f8c 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -2,10 +2,15 @@ namespace Pterodactyl\Http\Controllers\Admin; +use Illuminate\View\View; use Illuminate\Http\Request; use Pterodactyl\Models\User; +use Pterodactyl\Models\Model; +use Illuminate\Support\Collection; +use Illuminate\Http\RedirectResponse; use Prologue\Alerts\AlertsMessageBag; use Spatie\QueryBuilder\QueryBuilder; +use Illuminate\View\Factory as ViewFactory; use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Http\Controllers\Controller; use Illuminate\Contracts\Translation\Translator; @@ -20,61 +25,24 @@ class UserController extends Controller { use AvailableLanguages; - /** - * @var \Prologue\Alerts\AlertsMessageBag - */ - protected $alert; - - /** - * @var \Pterodactyl\Services\Users\UserCreationService - */ - protected $creationService; - - /** - * @var \Pterodactyl\Services\Users\UserDeletionService - */ - protected $deletionService; - - /** - * @var \Pterodactyl\Contracts\Repository\UserRepositoryInterface - */ - protected $repository; - - /** - * @var \Illuminate\Contracts\Translation\Translator - */ - protected $translator; - - /** - * @var \Pterodactyl\Services\Users\UserUpdateService - */ - protected $updateService; - /** * UserController constructor. */ public function __construct( - AlertsMessageBag $alert, - UserCreationService $creationService, - UserDeletionService $deletionService, - Translator $translator, - UserUpdateService $updateService, - UserRepositoryInterface $repository + protected AlertsMessageBag $alert, + protected UserCreationService $creationService, + protected UserDeletionService $deletionService, + protected Translator $translator, + protected UserUpdateService $updateService, + protected UserRepositoryInterface $repository, + protected ViewFactory $view ) { - $this->alert = $alert; - $this->creationService = $creationService; - $this->deletionService = $deletionService; - $this->repository = $repository; - $this->translator = $translator; - $this->updateService = $updateService; } /** * Display user index page. - * - * @return \Illuminate\View\View */ - public function index(Request $request) + public function index(Request $request): View { $users = QueryBuilder::for( User::query()->select('users.*') @@ -88,29 +56,25 @@ class UserController extends Controller ->allowedSorts(['id', 'uuid']) ->paginate(50); - return view('admin.users.index', ['users' => $users]); + return $this->view->make('admin.users.index', ['users' => $users]); } /** * Display new user page. - * - * @return \Illuminate\View\View */ - public function create() + public function create(): View { - return view('admin.users.new', [ + return $this->view->make('admin.users.new', [ 'languages' => $this->getAvailableLanguages(true), ]); } /** * Display user view page. - * - * @return \Illuminate\View\View */ - public function view(User $user) + public function view(User $user): View { - return view('admin.users.view', [ + return $this->view->make('admin.users.view', [ 'user' => $user, 'languages' => $this->getAvailableLanguages(true), ]); @@ -119,12 +83,10 @@ class UserController extends Controller /** * Delete a user from the system. * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Exception * @throws \Pterodactyl\Exceptions\DisplayException */ - public function delete(Request $request, User $user) + public function delete(Request $request, User $user): RedirectResponse { if ($request->user()->id === $user->id) { throw new DisplayException($this->translator->get('admin/user.exceptions.user_has_servers')); @@ -138,12 +100,10 @@ class UserController extends Controller /** * Create a user. * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Exception * @throws \Throwable */ - public function store(UserFormRequest $request) + public function store(UserFormRequest $request): RedirectResponse { $user = $this->creationService->handle($request->normalize()); $this->alert->success($this->translator->get('admin/user.notices.account_created'))->flash(); @@ -154,12 +114,10 @@ class UserController extends Controller /** * Update a user on the system. * - * @return \Illuminate\Http\RedirectResponse - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function update(UserFormRequest $request, User $user) + public function update(UserFormRequest $request, User $user): RedirectResponse { $this->updateService ->setUserLevel(User::USER_LEVEL_ADMIN) @@ -172,10 +130,8 @@ class UserController extends Controller /** * Get a JSON response of users on the system. - * - * @return \Illuminate\Support\Collection|\Pterodactyl\Models\Model */ - public function json(Request $request) + public function json(Request $request): Model|Collection { $users = QueryBuilder::for(User::query())->allowedFilters(['email'])->paginate(25); diff --git a/app/Http/Controllers/Api/Application/ApplicationApiController.php b/app/Http/Controllers/Api/Application/ApplicationApiController.php index 91da81893..dfc2cad97 100644 --- a/app/Http/Controllers/Api/Application/ApplicationApiController.php +++ b/app/Http/Controllers/Api/Application/ApplicationApiController.php @@ -13,15 +13,9 @@ use Pterodactyl\Transformers\Api\Application\BaseTransformer; abstract class ApplicationApiController extends Controller { - /** - * @var \Illuminate\Http\Request - */ - protected $request; + protected Request $request; - /** - * @var \Pterodactyl\Extensions\Spatie\Fractalistic\Fractal - */ - protected $fractal; + protected Fractal $fractal; /** * ApplicationApiController constructor. @@ -30,7 +24,7 @@ abstract class ApplicationApiController extends Controller { Container::getInstance()->call([$this, 'loadDependencies']); - // Parse all of the includes to use on this request. + // Parse all the includes to use on this request. $input = $this->request->input('include', []); $input = is_array($input) ? $input : explode(',', $input); @@ -62,7 +56,6 @@ abstract class ApplicationApiController extends Controller * @return T * * @noinspection PhpDocSignatureInspection - * @noinspection PhpUndefinedClassInspection */ public function getTransformer(string $abstract) { @@ -72,7 +65,7 @@ abstract class ApplicationApiController extends Controller } /** - * Return a HTTP/204 response for the API. + * Return an HTTP/204 response for the API. */ 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 e8f166aba..b95a0776a 100644 --- a/app/Http/Controllers/Api/Application/Locations/LocationController.php +++ b/app/Http/Controllers/Api/Application/Locations/LocationController.php @@ -9,7 +9,6 @@ use Spatie\QueryBuilder\QueryBuilder; use Pterodactyl\Services\Locations\LocationUpdateService; use Pterodactyl\Services\Locations\LocationCreationService; use Pterodactyl\Services\Locations\LocationDeletionService; -use Pterodactyl\Contracts\Repository\LocationRepositoryInterface; use Pterodactyl\Transformers\Api\Application\LocationTransformer; use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController; use Pterodactyl\Http\Requests\Api\Application\Locations\GetLocationRequest; @@ -20,45 +19,19 @@ use Pterodactyl\Http\Requests\Api\Application\Locations\UpdateLocationRequest; class LocationController extends ApplicationApiController { - /** - * @var \Pterodactyl\Services\Locations\LocationCreationService - */ - private $creationService; - - /** - * @var \Pterodactyl\Services\Locations\LocationDeletionService - */ - private $deletionService; - - /** - * @var \Pterodactyl\Contracts\Repository\LocationRepositoryInterface - */ - private $repository; - - /** - * @var \Pterodactyl\Services\Locations\LocationUpdateService - */ - private $updateService; - /** * LocationController constructor. */ public function __construct( - LocationCreationService $creationService, - LocationDeletionService $deletionService, - LocationRepositoryInterface $repository, - LocationUpdateService $updateService + private LocationCreationService $creationService, + private LocationDeletionService $deletionService, + private LocationUpdateService $updateService ) { parent::__construct(); - - $this->creationService = $creationService; - $this->deletionService = $deletionService; - $this->repository = $repository; - $this->updateService = $updateService; } /** - * Return all of the locations currently registered on the Panel. + * Return all the locations currently registered on the Panel. */ public function index(GetLocationsRequest $request): array { @@ -83,7 +56,7 @@ class LocationController extends ApplicationApiController } /** - * Store a new location on the Panel and return a HTTP/201 response code with the + * Store a new location on the Panel and return an HTTP/201 response code with the * new location attached. * * @throws \Pterodactyl\Exceptions\Model\DataValidationException diff --git a/app/Http/Controllers/Api/Application/Nests/NestController.php b/app/Http/Controllers/Api/Application/Nests/NestController.php index 232bf026c..f0044f53c 100644 --- a/app/Http/Controllers/Api/Application/Nests/NestController.php +++ b/app/Http/Controllers/Api/Application/Nests/NestController.php @@ -10,19 +10,12 @@ use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController; class NestController extends ApplicationApiController { - /** - * @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface - */ - private $repository; - /** * NestController constructor. */ - public function __construct(NestRepositoryInterface $repository) + public function __construct(private NestRepositoryInterface $repository) { parent::__construct(); - - $this->repository = $repository; } /** diff --git a/app/Http/Controllers/Api/Application/Nodes/AllocationController.php b/app/Http/Controllers/Api/Application/Nodes/AllocationController.php index ecc7e1cd4..77404945a 100644 --- a/app/Http/Controllers/Api/Application/Nodes/AllocationController.php +++ b/app/Http/Controllers/Api/Application/Nodes/AllocationController.php @@ -18,31 +18,18 @@ use Pterodactyl\Http\Requests\Api\Application\Allocations\DeleteAllocationReques class AllocationController extends ApplicationApiController { - /** - * @var \Pterodactyl\Services\Allocations\AssignmentService - */ - private $assignmentService; - - /** - * @var \Pterodactyl\Services\Allocations\AllocationDeletionService - */ - private $deletionService; - /** * AllocationController constructor. */ public function __construct( - AssignmentService $assignmentService, - AllocationDeletionService $deletionService + private AssignmentService $assignmentService, + private AllocationDeletionService $deletionService ) { parent::__construct(); - - $this->assignmentService = $assignmentService; - $this->deletionService = $deletionService; } /** - * Return all of the allocations that exist for a given node. + * Return all the allocations that exist for a given node. */ public function index(GetAllocationsRequest $request, Node $node): array { diff --git a/app/Http/Controllers/Api/Application/Nodes/NodeConfigurationController.php b/app/Http/Controllers/Api/Application/Nodes/NodeConfigurationController.php index 95ae70f3b..2d812a89b 100644 --- a/app/Http/Controllers/Api/Application/Nodes/NodeConfigurationController.php +++ b/app/Http/Controllers/Api/Application/Nodes/NodeConfigurationController.php @@ -13,10 +13,8 @@ class NodeConfigurationController extends ApplicationApiController * Returns the configuration information for a node. This allows for automated deployments * to remote machines so long as an API key is provided to the machine to make the request * with, and the node is known. - * - * @return \Illuminate\Http\JsonResponse */ - public function __invoke(GetNodeRequest $request, Node $node) + public function __invoke(GetNodeRequest $request, Node $node): JsonResponse { return new JsonResponse($node->getConfiguration()); } diff --git a/app/Http/Controllers/Api/Application/Nodes/NodeController.php b/app/Http/Controllers/Api/Application/Nodes/NodeController.php index 2daf187c2..e0e3575d8 100644 --- a/app/Http/Controllers/Api/Application/Nodes/NodeController.php +++ b/app/Http/Controllers/Api/Application/Nodes/NodeController.php @@ -8,7 +8,6 @@ use Spatie\QueryBuilder\QueryBuilder; use Pterodactyl\Services\Nodes\NodeUpdateService; use Pterodactyl\Services\Nodes\NodeCreationService; use Pterodactyl\Services\Nodes\NodeDeletionService; -use Pterodactyl\Contracts\Repository\NodeRepositoryInterface; use Pterodactyl\Transformers\Api\Application\NodeTransformer; use Pterodactyl\Http\Requests\Api\Application\Nodes\GetNodeRequest; use Pterodactyl\Http\Requests\Api\Application\Nodes\GetNodesRequest; @@ -19,45 +18,19 @@ use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController; class NodeController extends ApplicationApiController { - /** - * @var \Pterodactyl\Services\Nodes\NodeCreationService - */ - private $creationService; - - /** - * @var \Pterodactyl\Services\Nodes\NodeDeletionService - */ - private $deletionService; - - /** - * @var \Pterodactyl\Contracts\Repository\NodeRepositoryInterface - */ - private $repository; - - /** - * @var \Pterodactyl\Services\Nodes\NodeUpdateService - */ - private $updateService; - /** * NodeController constructor. */ public function __construct( - NodeCreationService $creationService, - NodeDeletionService $deletionService, - NodeUpdateService $updateService, - NodeRepositoryInterface $repository + private NodeCreationService $creationService, + private NodeDeletionService $deletionService, + private NodeUpdateService $updateService ) { parent::__construct(); - - $this->repository = $repository; - $this->creationService = $creationService; - $this->deletionService = $deletionService; - $this->updateService = $updateService; } /** - * Return all of the nodes currently available on the Panel. + * Return all the nodes currently available on the Panel. */ public function index(GetNodesRequest $request): array { @@ -82,7 +55,7 @@ class NodeController extends ApplicationApiController } /** - * Create a new node on the Panel. Returns the created node and a HTTP/201 + * Create a new node on the Panel. Returns the created node and an HTTP/201 * status response on success. * * @throws \Pterodactyl\Exceptions\Model\DataValidationException diff --git a/app/Http/Controllers/Api/Application/Nodes/NodeDeploymentController.php b/app/Http/Controllers/Api/Application/Nodes/NodeDeploymentController.php index 9d5c75a05..4b49fa9c6 100644 --- a/app/Http/Controllers/Api/Application/Nodes/NodeDeploymentController.php +++ b/app/Http/Controllers/Api/Application/Nodes/NodeDeploymentController.php @@ -9,19 +9,12 @@ use Pterodactyl\Http\Requests\Api\Application\Nodes\GetDeployableNodesRequest; class NodeDeploymentController extends ApplicationApiController { - /** - * @var \Pterodactyl\Services\Deployment\FindViableNodesService - */ - private $viableNodesService; - /** * NodeDeploymentController constructor. */ - public function __construct(FindViableNodesService $viableNodesService) + public function __construct(private FindViableNodesService $viableNodesService) { parent::__construct(); - - $this->viableNodesService = $viableNodesService; } /** diff --git a/app/Http/Controllers/Api/Application/Servers/DatabaseController.php b/app/Http/Controllers/Api/Application/Servers/DatabaseController.php index 2b9564728..1717c5dd8 100644 --- a/app/Http/Controllers/Api/Application/Servers/DatabaseController.php +++ b/app/Http/Controllers/Api/Application/Servers/DatabaseController.php @@ -8,7 +8,6 @@ use Pterodactyl\Models\Database; use Illuminate\Http\JsonResponse; use Pterodactyl\Services\Databases\DatabasePasswordService; use Pterodactyl\Services\Databases\DatabaseManagementService; -use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface; use Pterodactyl\Transformers\Api\Application\ServerDatabaseTransformer; use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController; use Pterodactyl\Http\Requests\Api\Application\Servers\Databases\GetServerDatabaseRequest; @@ -18,34 +17,14 @@ use Pterodactyl\Http\Requests\Api\Application\Servers\Databases\StoreServerDatab class DatabaseController extends ApplicationApiController { - /** - * @var \Pterodactyl\Services\Databases\DatabaseManagementService - */ - private $databaseManagementService; - - /** - * @var \Pterodactyl\Services\Databases\DatabasePasswordService - */ - private $databasePasswordService; - - /** - * @var \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface - */ - private $repository; - /** * DatabaseController constructor. */ public function __construct( - DatabaseManagementService $databaseManagementService, - DatabasePasswordService $databasePasswordService, - DatabaseRepositoryInterface $repository + private DatabaseManagementService $databaseManagementService, + private DatabasePasswordService $databasePasswordService ) { parent::__construct(); - - $this->databaseManagementService = $databaseManagementService; - $this->databasePasswordService = $databasePasswordService; - $this->repository = $repository; } /** diff --git a/app/Http/Controllers/Api/Application/Servers/ServerController.php b/app/Http/Controllers/Api/Application/Servers/ServerController.php index 0072822e3..2eb69162d 100644 --- a/app/Http/Controllers/Api/Application/Servers/ServerController.php +++ b/app/Http/Controllers/Api/Application/Servers/ServerController.php @@ -8,7 +8,6 @@ use Illuminate\Http\JsonResponse; use Spatie\QueryBuilder\QueryBuilder; use Pterodactyl\Services\Servers\ServerCreationService; use Pterodactyl\Services\Servers\ServerDeletionService; -use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; use Pterodactyl\Transformers\Api\Application\ServerTransformer; use Pterodactyl\Http\Requests\Api\Application\Servers\GetServerRequest; use Pterodactyl\Http\Requests\Api\Application\Servers\GetServersRequest; @@ -18,38 +17,18 @@ use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController; class ServerController extends ApplicationApiController { - /** - * @var \Pterodactyl\Services\Servers\ServerCreationService - */ - private $creationService; - - /** - * @var \Pterodactyl\Services\Servers\ServerDeletionService - */ - private $deletionService; - - /** - * @var \Pterodactyl\Contracts\Repository\ServerRepositoryInterface - */ - private $repository; - /** * ServerController constructor. */ public function __construct( - ServerCreationService $creationService, - ServerDeletionService $deletionService, - ServerRepositoryInterface $repository + private ServerCreationService $creationService, + private ServerDeletionService $deletionService ) { parent::__construct(); - - $this->creationService = $creationService; - $this->deletionService = $deletionService; - $this->repository = $repository; } /** - * Return all of the servers that currently exist on the Panel. + * Return all the servers that currently exist on the Panel. */ public function index(GetServersRequest $request): array { @@ -94,6 +73,8 @@ class ServerController extends ApplicationApiController } /** + * Deletes a server. + * * @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 bcecf277c..ae5f5438c 100644 --- a/app/Http/Controllers/Api/Application/Servers/ServerDetailsController.php +++ b/app/Http/Controllers/Api/Application/Servers/ServerDetailsController.php @@ -12,27 +12,14 @@ use Pterodactyl\Http\Requests\Api\Application\Servers\UpdateServerBuildConfigura class ServerDetailsController extends ApplicationApiController { - /** - * @var \Pterodactyl\Services\Servers\BuildModificationService - */ - private $buildModificationService; - - /** - * @var \Pterodactyl\Services\Servers\DetailsModificationService - */ - private $detailsModificationService; - /** * ServerDetailsController constructor. */ public function __construct( - BuildModificationService $buildModificationService, - DetailsModificationService $detailsModificationService + private BuildModificationService $buildModificationService, + private DetailsModificationService $detailsModificationService ) { parent::__construct(); - - $this->buildModificationService = $buildModificationService; - $this->detailsModificationService = $detailsModificationService; } /** diff --git a/app/Http/Controllers/Api/Application/Servers/ServerManagementController.php b/app/Http/Controllers/Api/Application/Servers/ServerManagementController.php index ddbbbe1dd..d4dcaa24c 100644 --- a/app/Http/Controllers/Api/Application/Servers/ServerManagementController.php +++ b/app/Http/Controllers/Api/Application/Servers/ServerManagementController.php @@ -12,26 +12,13 @@ use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController; class ServerManagementController extends ApplicationApiController { /** - * @var \Pterodactyl\Services\Servers\ReinstallServerService - */ - private $reinstallServerService; - - /** - * @var \Pterodactyl\Services\Servers\SuspensionService - */ - private $suspensionService; - - /** - * SuspensionController constructor. + * ServerManagementController constructor. */ public function __construct( - ReinstallServerService $reinstallServerService, - SuspensionService $suspensionService + private ReinstallServerService $reinstallServerService, + private SuspensionService $suspensionService ) { parent::__construct(); - - $this->reinstallServerService = $reinstallServerService; - $this->suspensionService = $suspensionService; } /** @@ -41,7 +28,7 @@ class ServerManagementController extends ApplicationApiController */ public function suspend(ServerWriteRequest $request, Server $server): Response { - $this->suspensionService->toggle($server, SuspensionService::ACTION_SUSPEND); + $this->suspensionService->toggle($server); return $this->returnNoContent(); } diff --git a/app/Http/Controllers/Api/Application/Servers/StartupController.php b/app/Http/Controllers/Api/Application/Servers/StartupController.php index 6c854102b..6c2da078a 100644 --- a/app/Http/Controllers/Api/Application/Servers/StartupController.php +++ b/app/Http/Controllers/Api/Application/Servers/StartupController.php @@ -11,19 +11,12 @@ use Pterodactyl\Http\Requests\Api\Application\Servers\UpdateServerStartupRequest class StartupController extends ApplicationApiController { - /** - * @var \Pterodactyl\Services\Servers\StartupModificationService - */ - private $modificationService; - /** * StartupController constructor. */ - public function __construct(StartupModificationService $modificationService) + public function __construct(private StartupModificationService $modificationService) { parent::__construct(); - - $this->modificationService = $modificationService; } /** diff --git a/app/Http/Controllers/Api/Application/Users/UserController.php b/app/Http/Controllers/Api/Application/Users/UserController.php index 0a5675e2d..0ddae27b1 100644 --- a/app/Http/Controllers/Api/Application/Users/UserController.php +++ b/app/Http/Controllers/Api/Application/Users/UserController.php @@ -3,13 +3,11 @@ namespace Pterodactyl\Http\Controllers\Api\Application\Users; use Pterodactyl\Models\User; -use Illuminate\Http\Response; use Illuminate\Http\JsonResponse; use Spatie\QueryBuilder\QueryBuilder; use Pterodactyl\Services\Users\UserUpdateService; use Pterodactyl\Services\Users\UserCreationService; use Pterodactyl\Services\Users\UserDeletionService; -use Pterodactyl\Contracts\Repository\UserRepositoryInterface; use Pterodactyl\Transformers\Api\Application\UserTransformer; use Pterodactyl\Http\Requests\Api\Application\Users\GetUsersRequest; use Pterodactyl\Http\Requests\Api\Application\Users\StoreUserRequest; @@ -19,41 +17,15 @@ use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController; class UserController extends ApplicationApiController { - /** - * @var \Pterodactyl\Services\Users\UserCreationService - */ - private $creationService; - - /** - * @var \Pterodactyl\Services\Users\UserDeletionService - */ - private $deletionService; - - /** - * @var \Pterodactyl\Contracts\Repository\UserRepositoryInterface - */ - private $repository; - - /** - * @var \Pterodactyl\Services\Users\UserUpdateService - */ - private $updateService; - /** * UserController constructor. */ public function __construct( - UserRepositoryInterface $repository, - UserCreationService $creationService, - UserDeletionService $deletionService, - UserUpdateService $updateService + private UserCreationService $creationService, + private UserDeletionService $deletionService, + private UserUpdateService $updateService ) { parent::__construct(); - - $this->creationService = $creationService; - $this->deletionService = $deletionService; - $this->repository = $repository; - $this->updateService = $updateService; } /** @@ -107,7 +79,7 @@ class UserController extends ApplicationApiController } /** - * Store a new user on the system. Returns the created user and a HTTP/201 + * Store a new user on the system. Returns the created user and an HTTP/201 * header on successful creation. * * @throws \Exception diff --git a/app/Http/Controllers/Api/Client/AccountController.php b/app/Http/Controllers/Api/Client/AccountController.php index db7a1971d..cbe8b0315 100644 --- a/app/Http/Controllers/Api/Client/AccountController.php +++ b/app/Http/Controllers/Api/Client/AccountController.php @@ -14,25 +14,12 @@ use Pterodactyl\Http\Requests\Api\Client\Account\UpdatePasswordRequest; class AccountController extends ClientApiController { - /** - * @var \Pterodactyl\Services\Users\UserUpdateService - */ - private $updateService; - - /** - * @var \Illuminate\Auth\AuthManager - */ - private $manager; - /** * AccountController constructor. */ - public function __construct(AuthManager $manager, UserUpdateService $updateService) + public function __construct(private AuthManager $manager, private UserUpdateService $updateService) { parent::__construct(); - - $this->updateService = $updateService; - $this->manager = $manager; } public function index(Request $request): array diff --git a/app/Http/Controllers/Api/Client/ApiKeyController.php b/app/Http/Controllers/Api/Client/ApiKeyController.php index c6b6f7092..ac00a4d8f 100644 --- a/app/Http/Controllers/Api/Client/ApiKeyController.php +++ b/app/Http/Controllers/Api/Client/ApiKeyController.php @@ -13,11 +13,9 @@ use Pterodactyl\Http\Requests\Api\Client\Account\StoreApiKeyRequest; class ApiKeyController extends ClientApiController { /** - * Returns all of the API keys that exist for the given client. - * - * @return array + * Returns all the API keys that exist for the given client. */ - public function index(ClientApiRequest $request) + public function index(ClientApiRequest $request): array { return $this->fractal->collection($request->user()->apiKeys) ->transformWith($this->getTransformer(ApiKeyTransformer::class)) @@ -26,6 +24,8 @@ class ApiKeyController extends ClientApiController /** * Store a new API key for a user's account. + * + * @throws \Pterodactyl\Exceptions\DisplayException */ public function store(StoreApiKeyRequest $request): array { @@ -51,10 +51,8 @@ class ApiKeyController extends ClientApiController /** * Deletes a given API key. - * - * @return \Illuminate\Http\JsonResponse */ - public function delete(ClientApiRequest $request, string $identifier) + public function delete(ClientApiRequest $request, string $identifier): JsonResponse { /** @var \Pterodactyl\Models\ApiKey $key */ $key = $request->user()->apiKeys() diff --git a/app/Http/Controllers/Api/Client/ClientApiController.php b/app/Http/Controllers/Api/Client/ClientApiController.php index 56e6a1714..a468d762a 100644 --- a/app/Http/Controllers/Api/Client/ClientApiController.php +++ b/app/Http/Controllers/Api/Client/ClientApiController.php @@ -10,10 +10,8 @@ abstract class ClientApiController extends ApplicationApiController { /** * Returns only the includes which are valid for the given transformer. - * - * @return string[] */ - protected function getIncludesForTransformer(BaseClientTransformer $transformer, array $merge = []) + protected function getIncludesForTransformer(BaseClientTransformer $transformer, array $merge = []): array { $filtered = array_filter($this->parseIncludes(), function ($datum) use ($transformer) { return in_array($datum, $transformer->getAvailableIncludes()); @@ -24,10 +22,8 @@ abstract class ClientApiController extends ApplicationApiController /** * Returns the parsed includes for this request. - * - * @return string[] */ - protected function parseIncludes() + protected function parseIncludes(): array { $includes = $this->request->query('include') ?? []; @@ -49,7 +45,6 @@ abstract class ClientApiController extends ApplicationApiController * * @return T * - * @noinspection PhpUndefinedClassInspection * @noinspection PhpDocSignatureInspection */ public function getTransformer(string $abstract) diff --git a/app/Http/Controllers/Api/Client/ClientController.php b/app/Http/Controllers/Api/Client/ClientController.php index f83471ff8..9afb72628 100644 --- a/app/Http/Controllers/Api/Client/ClientController.php +++ b/app/Http/Controllers/Api/Client/ClientController.php @@ -7,29 +7,21 @@ use Pterodactyl\Models\Permission; use Spatie\QueryBuilder\QueryBuilder; use Spatie\QueryBuilder\AllowedFilter; use Pterodactyl\Models\Filters\MultiFieldServerFilter; -use Pterodactyl\Repositories\Eloquent\ServerRepository; use Pterodactyl\Transformers\Api\Client\ServerTransformer; use Pterodactyl\Http\Requests\Api\Client\GetServersRequest; class ClientController extends ClientApiController { - /** - * @var \Pterodactyl\Repositories\Eloquent\ServerRepository - */ - private $repository; - /** * ClientController constructor. */ - public function __construct(ServerRepository $repository) + public function __construct() { parent::__construct(); - - $this->repository = $repository; } /** - * Return all of the servers available to the client making the API + * Return all the servers available to the client making the API * request, including servers the user has access to as a subuser. */ public function index(GetServersRequest $request): array @@ -49,8 +41,8 @@ class ClientController extends ClientApiController ]); $type = $request->input('type'); - // Either return all of the servers the user has access to because they are an admin `?type=admin` or - // just return all of the servers the user has access to because they are the owner or a subuser of the + // Either return all the servers the user has access to because they are an admin `?type=admin` or + // just return all the servers the user has access to because they are the owner or a subuser of the // server. If ?type=admin-all is passed all servers on the system will be returned to the user, rather // than only servers they can see because they are an admin. if (in_array($type, ['admin', 'admin-all'])) { @@ -75,11 +67,9 @@ class ClientController extends ClientApiController } /** - * Returns all of the subuser permissions available on the system. - * - * @return array + * Returns all the subuser permissions available on the system. */ - public function permissions() + public function permissions(): array { return [ 'object' => 'system_permissions', diff --git a/app/Http/Controllers/Api/Client/SSHKeyController.php b/app/Http/Controllers/Api/Client/SSHKeyController.php index 7d0902d36..aa0f0c686 100644 --- a/app/Http/Controllers/Api/Client/SSHKeyController.php +++ b/app/Http/Controllers/Api/Client/SSHKeyController.php @@ -11,7 +11,7 @@ use Pterodactyl\Http\Requests\Api\Client\Account\StoreSSHKeyRequest; class SSHKeyController extends ClientApiController { /** - * Returns all of the SSH keys that have been configured for the logged in + * Returns all the SSH keys that have been configured for the logged-in * user account. */ public function index(ClientApiRequest $request): array diff --git a/app/Http/Controllers/Api/Client/Servers/BackupController.php b/app/Http/Controllers/Api/Client/Servers/BackupController.php index bfd9b68ba..7a35341c1 100644 --- a/app/Http/Controllers/Api/Client/Servers/BackupController.php +++ b/app/Http/Controllers/Api/Client/Servers/BackupController.php @@ -21,29 +21,17 @@ use Pterodactyl\Http\Requests\Api\Client\Servers\Backups\StoreBackupRequest; class BackupController extends ClientApiController { - private InitiateBackupService $initiateBackupService; - private DeleteBackupService $deleteBackupService; - private DownloadLinkService $downloadLinkService; - private DaemonBackupRepository $daemonRepository; - private BackupRepository $repository; - /** * BackupController constructor. */ public function __construct( - DaemonBackupRepository $daemonRepository, - DeleteBackupService $deleteBackupService, - InitiateBackupService $initiateBackupService, - DownloadLinkService $downloadLinkService, - BackupRepository $repository + private DaemonBackupRepository $daemonRepository, + private DeleteBackupService $deleteBackupService, + private InitiateBackupService $initiateBackupService, + private DownloadLinkService $downloadLinkService, + private BackupRepository $repository ) { parent::__construct(); - - $this->repository = $repository; - $this->initiateBackupService = $initiateBackupService; - $this->deleteBackupService = $deleteBackupService; - $this->downloadLinkService = $downloadLinkService; - $this->daemonRepository = $daemonRepository; } /** @@ -194,9 +182,9 @@ class BackupController extends ClientApiController * to begin the process of finding (or downloading) the backup and unpacking it * over the server files. * - * If the "truncate" flag is passed through in this request then all of the + * If the "truncate" flag is passed through in this request then all the * files that currently exist on the server will be deleted before restoring. - * Otherwise the archive will simply be unpacked over the existing files. + * Otherwise, the archive will simply be unpacked over the existing files. * * @throws \Throwable */ diff --git a/app/Http/Controllers/Api/Client/Servers/CommandController.php b/app/Http/Controllers/Api/Client/Servers/CommandController.php index 05be19c60..6cc50de47 100644 --- a/app/Http/Controllers/Api/Client/Servers/CommandController.php +++ b/app/Http/Controllers/Api/Client/Servers/CommandController.php @@ -15,19 +15,12 @@ use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; class CommandController extends ClientApiController { - /** - * @var \Pterodactyl\Repositories\Wings\DaemonCommandRepository - */ - private $repository; - /** * CommandController constructor. */ - public function __construct(DaemonCommandRepository $repository) + public function __construct(private DaemonCommandRepository $repository) { parent::__construct(); - - $this->repository = $repository; } /** diff --git a/app/Http/Controllers/Api/Client/Servers/DatabaseController.php b/app/Http/Controllers/Api/Client/Servers/DatabaseController.php index 34f2139f6..728c67e91 100644 --- a/app/Http/Controllers/Api/Client/Servers/DatabaseController.php +++ b/app/Http/Controllers/Api/Client/Servers/DatabaseController.php @@ -6,7 +6,6 @@ use Illuminate\Http\Response; use Pterodactyl\Models\Server; use Pterodactyl\Models\Database; use Pterodactyl\Facades\Activity; -use Pterodactyl\Repositories\Eloquent\DatabaseRepository; use Pterodactyl\Services\Databases\DatabasePasswordService; use Pterodactyl\Transformers\Api\Client\DatabaseTransformer; use Pterodactyl\Services\Databases\DatabaseManagementService; @@ -19,45 +18,19 @@ use Pterodactyl\Http\Requests\Api\Client\Servers\Databases\RotatePasswordRequest class DatabaseController extends ClientApiController { - /** - * @var \Pterodactyl\Services\Databases\DeployServerDatabaseService - */ - private $deployDatabaseService; - - /** - * @var \Pterodactyl\Repositories\Eloquent\DatabaseRepository - */ - private $repository; - - /** - * @var \Pterodactyl\Services\Databases\DatabaseManagementService - */ - private $managementService; - - /** - * @var \Pterodactyl\Services\Databases\DatabasePasswordService - */ - private $passwordService; - /** * DatabaseController constructor. */ public function __construct( - DatabaseManagementService $managementService, - DatabasePasswordService $passwordService, - DatabaseRepository $repository, - DeployServerDatabaseService $deployDatabaseService + private DeployServerDatabaseService $deployDatabaseService, + private DatabaseManagementService $managementService, + private DatabasePasswordService $passwordService ) { parent::__construct(); - - $this->deployDatabaseService = $deployDatabaseService; - $this->repository = $repository; - $this->managementService = $managementService; - $this->passwordService = $passwordService; } /** - * Return all of the databases that belong to the given server. + * Return all the databases that belong to the given server. */ public function index(GetDatabasesRequest $request, Server $server): array { @@ -92,11 +65,9 @@ class DatabaseController extends ClientApiController * Rotates the password for the given server model and returns a fresh instance to * the caller. * - * @return array - * * @throws \Throwable */ - public function rotatePassword(RotatePasswordRequest $request, Server $server, Database $database) + public function rotatePassword(RotatePasswordRequest $request, Server $server, Database $database): array { $this->passwordService->handle($database); $database->refresh(); @@ -126,6 +97,6 @@ class DatabaseController extends ClientApiController ->property('name', $database->database) ->log(); - return Response::create('', Response::HTTP_NO_CONTENT); + return new Response('', Response::HTTP_NO_CONTENT); } } diff --git a/app/Http/Controllers/Api/Client/Servers/FileController.php b/app/Http/Controllers/Api/Client/Servers/FileController.php index 68e1ec086..23e6718a5 100644 --- a/app/Http/Controllers/Api/Client/Servers/FileController.php +++ b/app/Http/Controllers/Api/Client/Servers/FileController.php @@ -25,27 +25,14 @@ use Pterodactyl\Http\Requests\Api\Client\Servers\Files\WriteFileContentRequest; class FileController extends ClientApiController { - /** - * @var \Pterodactyl\Repositories\Wings\DaemonFileRepository - */ - private $fileRepository; - - /** - * @var \Pterodactyl\Services\Nodes\NodeJWTService - */ - private $jwtService; - /** * FileController constructor. */ public function __construct( - NodeJWTService $jwtService, - DaemonFileRepository $fileRepository + private NodeJWTService $jwtService, + private DaemonFileRepository $fileRepository ) { parent::__construct(); - - $this->fileRepository = $fileRepository; - $this->jwtService = $jwtService; } /** @@ -85,11 +72,9 @@ class FileController extends ClientApiController * Generates a one-time token with a link that the user can use to * download a given file. * - * @return array - * * @throws \Throwable */ - public function download(GetFileContentsRequest $request, Server $server) + public function download(GetFileContentsRequest $request, Server $server): array { $token = $this->jwtService ->setExpiresAt(CarbonImmutable::now()->addMinutes(15)) diff --git a/app/Http/Controllers/Api/Client/Servers/FileUploadController.php b/app/Http/Controllers/Api/Client/Servers/FileUploadController.php index 710315bdd..98fcd587d 100644 --- a/app/Http/Controllers/Api/Client/Servers/FileUploadController.php +++ b/app/Http/Controllers/Api/Client/Servers/FileUploadController.php @@ -12,28 +12,19 @@ use Pterodactyl\Http\Requests\Api\Client\Servers\Files\UploadFileRequest; class FileUploadController extends ClientApiController { - /** - * @var \Pterodactyl\Services\Nodes\NodeJWTService - */ - private $jwtService; - /** * FileUploadController constructor. */ public function __construct( - NodeJWTService $jwtService + private NodeJWTService $jwtService ) { parent::__construct(); - - $this->jwtService = $jwtService; } /** - * Returns a url where files can be uploaded to. - * - * @return \Illuminate\Http\JsonResponse + * Returns an url where files can be uploaded to. */ - public function __invoke(UploadFileRequest $request, Server $server) + public function __invoke(UploadFileRequest $request, Server $server): JsonResponse { return new JsonResponse([ 'object' => 'signed_url', @@ -44,11 +35,9 @@ class FileUploadController extends ClientApiController } /** - * Returns a url where files can be uploaded to. - * - * @return string + * Returns an url where files can be uploaded to. */ - protected function getUploadUrl(Server $server, User $user) + protected function getUploadUrl(Server $server, User $user): string { $token = $this->jwtService ->setExpiresAt(CarbonImmutable::now()->addMinutes(15)) diff --git a/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php b/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php index 80455e0f8..4e3c5f9bb 100644 --- a/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php +++ b/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php @@ -8,7 +8,6 @@ use Pterodactyl\Facades\Activity; use Pterodactyl\Models\Allocation; use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Repositories\Eloquent\ServerRepository; -use Pterodactyl\Repositories\Eloquent\AllocationRepository; use Pterodactyl\Transformers\Api\Client\AllocationTransformer; use Pterodactyl\Http\Controllers\Api\Client\ClientApiController; use Pterodactyl\Services\Allocations\FindAssignableAllocationService; @@ -21,38 +20,18 @@ use Pterodactyl\Http\Requests\Api\Client\Servers\Network\SetPrimaryAllocationReq class NetworkAllocationController extends ClientApiController { /** - * @var \Pterodactyl\Repositories\Eloquent\AllocationRepository - */ - private $repository; - - /** - * @var \Pterodactyl\Repositories\Eloquent\ServerRepository - */ - private $serverRepository; - - /** - * @var \Pterodactyl\Services\Allocations\FindAssignableAllocationService - */ - private $assignableAllocationService; - - /** - * NetworkController constructor. + * NetworkAllocationController constructor. */ public function __construct( - AllocationRepository $repository, - ServerRepository $serverRepository, - FindAssignableAllocationService $assignableAllocationService + private FindAssignableAllocationService $assignableAllocationService, + private ServerRepository $serverRepository ) { parent::__construct(); - - $this->repository = $repository; - $this->serverRepository = $serverRepository; - $this->assignableAllocationService = $assignableAllocationService; } /** - * Lists all of the allocations available to a server and wether or - * not they are currently assigned as the primary for this server. + * Lists all the allocations available to a server and whether + * they are currently assigned as the primary for this server. */ public function index(GetNetworkRequest $request, Server $server): array { @@ -132,11 +111,9 @@ class NetworkAllocationController extends ClientApiController /** * Delete an allocation from a server. * - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\DisplayException */ - public function delete(DeleteAllocationRequest $request, Server $server, Allocation $allocation) + public function delete(DeleteAllocationRequest $request, Server $server, Allocation $allocation): JsonResponse { // Don't allow the deletion of allocations if the server does not have an // allocation limit set. diff --git a/app/Http/Controllers/Api/Client/Servers/PowerController.php b/app/Http/Controllers/Api/Client/Servers/PowerController.php index 01d1c1349..ca0575765 100644 --- a/app/Http/Controllers/Api/Client/Servers/PowerController.php +++ b/app/Http/Controllers/Api/Client/Servers/PowerController.php @@ -11,19 +11,12 @@ use Pterodactyl\Http\Requests\Api\Client\Servers\SendPowerRequest; class PowerController extends ClientApiController { - /** - * @var \Pterodactyl\Repositories\Wings\DaemonPowerRepository - */ - private $repository; - /** * PowerController constructor. */ - public function __construct(DaemonPowerRepository $repository) + public function __construct(private DaemonPowerRepository $repository) { parent::__construct(); - - $this->repository = $repository; } /** diff --git a/app/Http/Controllers/Api/Client/Servers/ResourceUtilizationController.php b/app/Http/Controllers/Api/Client/Servers/ResourceUtilizationController.php index d28622392..dcaf48115 100644 --- a/app/Http/Controllers/Api/Client/Servers/ResourceUtilizationController.php +++ b/app/Http/Controllers/Api/Client/Servers/ResourceUtilizationController.php @@ -12,19 +12,12 @@ use Pterodactyl\Http\Requests\Api\Client\Servers\GetServerRequest; class ResourceUtilizationController extends ClientApiController { - private DaemonServerRepository $repository; - - private Repository $cache; - /** * ResourceUtilizationController constructor. */ - public function __construct(Repository $cache, DaemonServerRepository $repository) + public function __construct(private Repository $cache, private DaemonServerRepository $repository) { parent::__construct(); - - $this->cache = $cache; - $this->repository = $repository; } /** @@ -36,7 +29,7 @@ class ResourceUtilizationController extends ClientApiController */ public function __invoke(GetServerRequest $request, Server $server): array { - $key = "resources:{$server->uuid}"; + $key = "resources:$server->uuid"; $stats = $this->cache->remember($key, Carbon::now()->addSeconds(20), function () use ($server) { return $this->repository->setServer($server)->getDetails(); }); diff --git a/app/Http/Controllers/Api/Client/Servers/ScheduleController.php b/app/Http/Controllers/Api/Client/Servers/ScheduleController.php index eb92bb002..50c04c70f 100644 --- a/app/Http/Controllers/Api/Client/Servers/ScheduleController.php +++ b/app/Http/Controllers/Api/Client/Servers/ScheduleController.php @@ -25,33 +25,18 @@ use Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\TriggerScheduleReques class ScheduleController extends ClientApiController { - /** - * @var \Pterodactyl\Repositories\Eloquent\ScheduleRepository - */ - private $repository; - - /** - * @var \Pterodactyl\Services\Schedules\ProcessScheduleService - */ - private $service; - /** * ScheduleController constructor. */ - public function __construct(ScheduleRepository $repository, ProcessScheduleService $service) + public function __construct(private ScheduleRepository $repository, private ProcessScheduleService $service) { parent::__construct(); - - $this->repository = $repository; - $this->service = $service; } /** - * Returns all of the schedules belonging to a given server. - * - * @return array + * Returns all the schedules belonging to a given server. */ - public function index(ViewScheduleRequest $request, Server $server) + public function index(ViewScheduleRequest $request, Server $server): array { $schedules = $server->schedules->loadMissing('tasks'); @@ -63,12 +48,10 @@ class ScheduleController extends ClientApiController /** * Store a new schedule for a server. * - * @return array - * * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ - public function store(StoreScheduleRequest $request, Server $server) + public function store(StoreScheduleRequest $request, Server $server): array { /** @var \Pterodactyl\Models\Schedule $model */ $model = $this->repository->create([ @@ -96,10 +79,8 @@ class ScheduleController extends ClientApiController /** * Returns a specific schedule for the server. - * - * @return array */ - public function view(ViewScheduleRequest $request, Server $server, Schedule $schedule) + public function view(ViewScheduleRequest $request, Server $server, Schedule $schedule): array { if ($schedule->server_id !== $server->id) { throw new NotFoundHttpException(); @@ -115,13 +96,11 @@ class ScheduleController extends ClientApiController /** * Updates a given schedule with the new data provided. * - * @return array - * * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function update(UpdateScheduleRequest $request, Server $server, Schedule $schedule) + public function update(UpdateScheduleRequest $request, Server $server, Schedule $schedule): array { $active = (bool) $request->input('is_active'); @@ -161,11 +140,9 @@ 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. * - * @return \Illuminate\Http\JsonResponse - * * @throws \Throwable */ - public function execute(TriggerScheduleRequest $request, Server $server, Schedule $schedule) + public function execute(TriggerScheduleRequest $request, Server $server, Schedule $schedule): JsonResponse { $this->service->handle($schedule, true); @@ -176,10 +153,8 @@ class ScheduleController extends ClientApiController /** * Deletes a schedule and it's associated tasks. - * - * @return \Illuminate\Http\JsonResponse */ - public function delete(DeleteScheduleRequest $request, Server $server, Schedule $schedule) + public function delete(DeleteScheduleRequest $request, Server $server, Schedule $schedule): JsonResponse { $this->repository->delete($schedule->id); diff --git a/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php b/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php index 75bb48d82..addca2876 100644 --- a/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php +++ b/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php @@ -20,35 +20,25 @@ use Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\StoreTaskRequest; class ScheduleTaskController extends ClientApiController { - /** - * @var \Pterodactyl\Repositories\Eloquent\TaskRepository - */ - private $repository; - /** * ScheduleTaskController constructor. */ - public function __construct(TaskRepository $repository) + public function __construct(private TaskRepository $repository) { parent::__construct(); - - $this->repository = $repository; } /** * Create a new task for a given schedule and store it in the database. * - * @return array - * - * @throws \Pterodactyl\Exceptions\Model\HttpForbiddenException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Service\ServiceLimitExceededException */ - public function store(StoreTaskRequest $request, Server $server, Schedule $schedule) + public function store(StoreTaskRequest $request, Server $server, Schedule $schedule): array { $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."); } if ($server->backup_limit === 0 && $request->action === 'backup') { @@ -81,13 +71,10 @@ class ScheduleTaskController extends ClientApiController /** * Updates a given task for a server. * - * @return array - * - * @throws \Pterodactyl\Exceptions\Model\HttpForbiddenException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function update(StoreTaskRequest $request, Server $server, Schedule $schedule, Task $task) + public function update(StoreTaskRequest $request, Server $server, Schedule $schedule, Task $task): array { if ($schedule->id !== $task->schedule_id || $server->id !== $schedule->server_id) { throw new NotFoundHttpException(); @@ -118,11 +105,9 @@ 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. * - * @return \Illuminate\Http\JsonResponse - * * @throws \Exception */ - public function delete(ClientApiRequest $request, Server $server, Schedule $schedule, Task $task) + public function delete(ClientApiRequest $request, Server $server, Schedule $schedule, Task $task): JsonResponse { if ($task->schedule_id !== $schedule->id || $schedule->server_id !== $server->id) { throw new NotFoundHttpException(); diff --git a/app/Http/Controllers/Api/Client/Servers/ServerController.php b/app/Http/Controllers/Api/Client/Servers/ServerController.php index 82091c48b..63eb9b988 100644 --- a/app/Http/Controllers/Api/Client/Servers/ServerController.php +++ b/app/Http/Controllers/Api/Client/Servers/ServerController.php @@ -3,7 +3,6 @@ namespace Pterodactyl\Http\Controllers\Api\Client\Servers; use Pterodactyl\Models\Server; -use Pterodactyl\Repositories\Eloquent\SubuserRepository; use Pterodactyl\Transformers\Api\Client\ServerTransformer; use Pterodactyl\Services\Servers\GetUserPermissionsService; use Pterodactyl\Http\Controllers\Api\Client\ClientApiController; @@ -11,25 +10,12 @@ use Pterodactyl\Http\Requests\Api\Client\Servers\GetServerRequest; class ServerController extends ClientApiController { - /** - * @var \Pterodactyl\Repositories\Eloquent\SubuserRepository - */ - private $repository; - - /** - * @var \Pterodactyl\Services\Servers\GetUserPermissionsService - */ - private $permissionsService; - /** * ServerController constructor. */ - public function __construct(GetUserPermissionsService $permissionsService, SubuserRepository $repository) + public function __construct(private GetUserPermissionsService $permissionsService) { parent::__construct(); - - $this->repository = $repository; - $this->permissionsService = $permissionsService; } /** diff --git a/app/Http/Controllers/Api/Client/Servers/SettingsController.php b/app/Http/Controllers/Api/Client/Servers/SettingsController.php index 883362b79..7f1946a21 100644 --- a/app/Http/Controllers/Api/Client/Servers/SettingsController.php +++ b/app/Http/Controllers/Api/Client/Servers/SettingsController.php @@ -16,38 +16,23 @@ use Pterodactyl\Http\Requests\Api\Client\Servers\Settings\ReinstallServerRequest class SettingsController extends ClientApiController { - /** - * @var \Pterodactyl\Repositories\Eloquent\ServerRepository - */ - private $repository; - - /** - * @var \Pterodactyl\Services\Servers\ReinstallServerService - */ - private $reinstallServerService; - /** * SettingsController constructor. */ public function __construct( - ServerRepository $repository, - ReinstallServerService $reinstallServerService + private ServerRepository $repository, + private ReinstallServerService $reinstallServerService ) { parent::__construct(); - - $this->repository = $repository; - $this->reinstallServerService = $reinstallServerService; } /** * Renames a server. * - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function rename(RenameServerRequest $request, Server $server) + public function rename(RenameServerRequest $request, Server $server): JsonResponse { $this->repository->update($server->id, [ 'name' => $request->input('name'), @@ -65,11 +50,9 @@ class SettingsController extends ClientApiController /** * Reinstalls the server on the daemon. * - * @return \Illuminate\Http\JsonResponse - * * @throws \Throwable */ - public function reinstall(ReinstallServerRequest $request, Server $server) + public function reinstall(ReinstallServerRequest $request, Server $server): JsonResponse { $this->reinstallServerService->handle($server); @@ -81,11 +64,9 @@ class SettingsController extends ClientApiController /** * Changes the Docker image in use by the server. * - * @return \Illuminate\Http\JsonResponse - * * @throws \Throwable */ - public function dockerImage(SetDockerImageRequest $request, Server $server) + public function dockerImage(SetDockerImageRequest $request, Server $server): JsonResponse { if (!in_array($server->image, array_values($server->egg->docker_images))) { throw new BadRequestHttpException('This server\'s Docker image has been manually set by an administrator and cannot be updated.'); diff --git a/app/Http/Controllers/Api/Client/Servers/StartupController.php b/app/Http/Controllers/Api/Client/Servers/StartupController.php index 78194affd..9548be25e 100644 --- a/app/Http/Controllers/Api/Client/Servers/StartupController.php +++ b/app/Http/Controllers/Api/Client/Servers/StartupController.php @@ -5,7 +5,6 @@ namespace Pterodactyl\Http\Controllers\Api\Client\Servers; use Pterodactyl\Models\Server; use Pterodactyl\Facades\Activity; use Pterodactyl\Services\Servers\StartupCommandService; -use Pterodactyl\Services\Servers\VariableValidatorService; use Pterodactyl\Repositories\Eloquent\ServerVariableRepository; use Pterodactyl\Transformers\Api\Client\EggVariableTransformer; use Pterodactyl\Http\Controllers\Api\Client\ClientApiController; @@ -15,41 +14,22 @@ use Pterodactyl\Http\Requests\Api\Client\Servers\Startup\UpdateStartupVariableRe class StartupController extends ClientApiController { - /** - * @var \Pterodactyl\Services\Servers\VariableValidatorService - */ - private $service; - - /** - * @var \Pterodactyl\Repositories\Eloquent\ServerVariableRepository - */ - private $repository; - - /** - * @var \Pterodactyl\Services\Servers\StartupCommandService - */ - private $startupCommandService; - /** * StartupController constructor. */ - public function __construct(VariableValidatorService $service, StartupCommandService $startupCommandService, ServerVariableRepository $repository) - { + public function __construct( + private StartupCommandService $startupCommandService, + private ServerVariableRepository $repository + ) { parent::__construct(); - - $this->service = $service; - $this->repository = $repository; - $this->startupCommandService = $startupCommandService; } /** - * Returns the startup information for the server including all of the variables. - * - * @return array + * Returns the startup information for the server including all the variables. */ - public function index(GetStartupRequest $request, Server $server) + public function index(GetStartupRequest $request, Server $server): array { - $startup = $this->startupCommandService->handle($server, false); + $startup = $this->startupCommandService->handle($server); return $this->fractal->collection( $server->variables()->where('user_viewable', true)->get() @@ -66,13 +46,11 @@ class StartupController extends ClientApiController /** * Updates a single variable for a server. * - * @return array - * * @throws \Illuminate\Validation\ValidationException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function update(UpdateStartupVariableRequest $request, Server $server) + public function update(UpdateStartupVariableRequest $request, Server $server): array { /** @var \Pterodactyl\Models\EggVariable $variable */ $variable = $server->variables()->where('env_variable', $request->input('key'))->first(); @@ -97,7 +75,7 @@ class StartupController extends ClientApiController $variable = $variable->refresh(); $variable->server_value = $request->input('value'); - $startup = $this->startupCommandService->handle($server, false); + $startup = $this->startupCommandService->handle($server); if ($variable->env_variable !== $request->input('value')) { Activity::event('server:startup.edit') diff --git a/app/Http/Controllers/Api/Client/Servers/SubuserController.php b/app/Http/Controllers/Api/Client/Servers/SubuserController.php index dfa503e48..2c403c691 100644 --- a/app/Http/Controllers/Api/Client/Servers/SubuserController.php +++ b/app/Http/Controllers/Api/Client/Servers/SubuserController.php @@ -21,42 +21,21 @@ use Pterodactyl\Http\Requests\Api\Client\Servers\Subusers\UpdateSubuserRequest; class SubuserController extends ClientApiController { - /** - * @var \Pterodactyl\Repositories\Eloquent\SubuserRepository - */ - private $repository; - - /** - * @var \Pterodactyl\Services\Subusers\SubuserCreationService - */ - private $creationService; - - /** - * @var \Pterodactyl\Repositories\Wings\DaemonServerRepository - */ - private $serverRepository; - /** * SubuserController constructor. */ public function __construct( - SubuserRepository $repository, - SubuserCreationService $creationService, - DaemonServerRepository $serverRepository + private SubuserRepository $repository, + private SubuserCreationService $creationService, + private DaemonServerRepository $serverRepository ) { parent::__construct(); - - $this->repository = $repository; - $this->creationService = $creationService; - $this->serverRepository = $serverRepository; } /** * Return the users associated with this server instance. - * - * @return array */ - public function index(GetSubuserRequest $request, Server $server) + public function index(GetSubuserRequest $request, Server $server): array { return $this->fractal->collection($server->subusers) ->transformWith($this->getTransformer(SubuserTransformer::class)) @@ -65,10 +44,8 @@ class SubuserController extends ClientApiController /** * Returns a single subuser associated with this server instance. - * - * @return array */ - public function view(GetSubuserRequest $request) + public function view(GetSubuserRequest $request): array { $subuser = $request->attributes->get('subuser'); @@ -80,14 +57,12 @@ class SubuserController extends ClientApiController /** * Create a new subuser for the given server. * - * @return array - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Service\Subuser\ServerSubuserExistsException * @throws \Pterodactyl\Exceptions\Service\Subuser\UserIsServerOwnerException * @throws \Throwable */ - public function store(StoreSubuserRequest $request, Server $server) + public function store(StoreSubuserRequest $request, Server $server): array { $response = $this->creationService->handle( $server, @@ -143,7 +118,7 @@ class SubuserController extends ClientApiController $this->serverRepository->setServer($server)->revokeUserJTI($subuser->user_id); } catch (DaemonConnectionException $exception) { // Don't block this request if we can't connect to the Wings instance. Chances are it is - // offline in this event and the token will be invalid anyways once Wings boots back. + // offline and the token will be invalid once Wings boots back. Log::warning($exception, ['user_id' => $subuser->user_id, 'server_id' => $server->id]); $instance->property('revoked', false); @@ -160,10 +135,8 @@ class SubuserController extends ClientApiController /** * Removes a subusers from a server's assignment. - * - * @return \Illuminate\Http\JsonResponse */ - public function delete(DeleteSubuserRequest $request, Server $server) + public function delete(DeleteSubuserRequest $request, Server $server): JsonResponse { /** @var \Pterodactyl\Models\Subuser $subuser */ $subuser = $request->attributes->get('subuser'); diff --git a/app/Http/Controllers/Api/Client/Servers/WebsocketController.php b/app/Http/Controllers/Api/Client/Servers/WebsocketController.php index 5446b22ce..59b6f75d4 100644 --- a/app/Http/Controllers/Api/Client/Servers/WebsocketController.php +++ b/app/Http/Controllers/Api/Client/Servers/WebsocketController.php @@ -14,38 +14,23 @@ use Pterodactyl\Http\Controllers\Api\Client\ClientApiController; class WebsocketController extends ClientApiController { - /** - * @var \Pterodactyl\Services\Nodes\NodeJWTService - */ - private $jwtService; - - /** - * @var \Pterodactyl\Services\Servers\GetUserPermissionsService - */ - private $permissionsService; - /** * WebsocketController constructor. */ public function __construct( - NodeJWTService $jwtService, - GetUserPermissionsService $permissionsService + private NodeJWTService $jwtService, + private GetUserPermissionsService $permissionsService ) { parent::__construct(); - - $this->jwtService = $jwtService; - $this->permissionsService = $permissionsService; } /** * Generates a one-time token that is sent along in every websocket call to the Daemon. - * This is a signed JWT that the Daemon then uses the verify the user's identity, and - * allows us to continually renew this token and avoid users mainitaining sessions wrongly, + * This is a signed JWT that the Daemon then uses to verify the user's identity, and + * allows us to continually renew this token and avoid users maintaining sessions wrongly, * as well as ensure that user's only perform actions they're allowed to. - * - * @return \Illuminate\Http\JsonResponse */ - public function __invoke(ClientApiRequest $request, Server $server) + public function __invoke(ClientApiRequest $request, Server $server): JsonResponse { $user = $request->user(); if ($user->cannot(Permission::ACTION_WEBSOCKET_CONNECT, $server)) { diff --git a/app/Http/Controllers/Api/Client/TwoFactorController.php b/app/Http/Controllers/Api/Client/TwoFactorController.php index 74857cd7a..8cfa09b6e 100644 --- a/app/Http/Controllers/Api/Client/TwoFactorController.php +++ b/app/Http/Controllers/Api/Client/TwoFactorController.php @@ -7,41 +7,22 @@ use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\Http\JsonResponse; use Pterodactyl\Facades\Activity; -use Illuminate\Contracts\Validation\Factory; use Pterodactyl\Services\Users\TwoFactorSetupService; use Pterodactyl\Services\Users\ToggleTwoFactorService; +use Illuminate\Contracts\Validation\Factory as ValidationFactory; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; class TwoFactorController extends ClientApiController { - /** - * @var \Pterodactyl\Services\Users\TwoFactorSetupService - */ - private $setupService; - - /** - * @var \Illuminate\Contracts\Validation\Factory - */ - private $validation; - - /** - * @var \Pterodactyl\Services\Users\ToggleTwoFactorService - */ - private $toggleTwoFactorService; - /** * TwoFactorController constructor. */ public function __construct( - ToggleTwoFactorService $toggleTwoFactorService, - TwoFactorSetupService $setupService, - Factory $validation + private ToggleTwoFactorService $toggleTwoFactorService, + private TwoFactorSetupService $setupService, + private ValidationFactory $validation ) { parent::__construct(); - - $this->setupService = $setupService; - $this->validation = $validation; - $this->toggleTwoFactorService = $toggleTwoFactorService; } /** @@ -49,12 +30,10 @@ class TwoFactorController extends ClientApiController * it on their account. If two-factor is already enabled this endpoint * will return a 400 error. * - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function index(Request $request) + public function index(Request $request): JsonResponse { if ($request->user()->use_totp) { throw new BadRequestHttpException('Two-factor authentication is already enabled on this account.'); @@ -68,12 +47,10 @@ class TwoFactorController extends ClientApiController /** * Updates a user's account to have two-factor enabled. * - * @return \Illuminate\Http\JsonResponse - * * @throws \Throwable * @throws \Illuminate\Validation\ValidationException */ - public function store(Request $request) + public function store(Request $request): JsonResponse { $validator = $this->validation->make($request->all(), [ 'code' => ['required', 'string', 'size:6'], @@ -101,10 +78,9 @@ class TwoFactorController extends ClientApiController * Disables two-factor authentication on an account if the password provided * is valid. * - * @return \Illuminate\Http\JsonResponse * @throws \Throwable */ - public function delete(Request $request) + public function delete(Request $request): JsonResponse { if (!password_verify($request->input('password') ?? '', $request->user()->password)) { throw new BadRequestHttpException('The password provided was not valid.'); diff --git a/app/Http/Controllers/Api/Remote/ActivityProcessingController.php b/app/Http/Controllers/Api/Remote/ActivityProcessingController.php index 04a844888..ac9dd5416 100644 --- a/app/Http/Controllers/Api/Remote/ActivityProcessingController.php +++ b/app/Http/Controllers/Api/Remote/ActivityProcessingController.php @@ -4,12 +4,13 @@ namespace Pterodactyl\Http\Controllers\Api\Remote; use Exception; use Carbon\Carbon; +use DateTimeInterface; use Illuminate\Support\Str; use Pterodactyl\Models\User; use Webmozart\Assert\Assert; use Pterodactyl\Models\Server; -use Pterodactyl\Models\ActivityLog; use Illuminate\Support\Facades\Log; +use Pterodactyl\Models\ActivityLog; use Pterodactyl\Models\ActivityLogSubject; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Http\Requests\Api\Remote\ActivityEventRequest; @@ -36,7 +37,7 @@ class ActivityProcessingController extends Controller try { $when = Carbon::createFromFormat( - Carbon::RFC3339, + DateTimeInterface::RFC3339, preg_replace('/(\.\d+)Z$/', 'Z', $datum['timestamp']), 'UTC' ); diff --git a/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php b/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php index a1ffb81bc..7d92e0b1a 100644 --- a/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php +++ b/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php @@ -6,10 +6,9 @@ use Carbon\CarbonImmutable; use Illuminate\Http\Request; use Pterodactyl\Models\Backup; use Illuminate\Http\JsonResponse; -use League\Flysystem\AwsS3v3\AwsS3Adapter; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Extensions\Backups\BackupManager; -use Pterodactyl\Repositories\Eloquent\BackupRepository; +use Pterodactyl\Extensions\Filesystem\S3Filesystem; use Symfony\Component\HttpKernel\Exception\ConflictHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; @@ -17,35 +16,21 @@ class BackupRemoteUploadController extends Controller { public const DEFAULT_MAX_PART_SIZE = 5 * 1024 * 1024 * 1024; - /** - * @var \Pterodactyl\Repositories\Eloquent\BackupRepository - */ - private $repository; - - /** - * @var \Pterodactyl\Extensions\Backups\BackupManager - */ - private $backupManager; - /** * BackupRemoteUploadController constructor. */ - public function __construct(BackupRepository $repository, BackupManager $backupManager) + public function __construct(private BackupManager $backupManager) { - $this->repository = $repository; - $this->backupManager = $backupManager; } /** * Returns the required presigned urls to upload a backup to S3 cloud storage. * - * @return \Illuminate\Http\JsonResponse - * * @throws \Exception * @throws \Throwable * @throws \Illuminate\Database\Eloquent\ModelNotFoundException */ - public function __invoke(Request $request, string $backup) + public function __invoke(Request $request, string $backup): JsonResponse { // Get the size query parameter. $size = (int) $request->query('size'); @@ -64,7 +49,7 @@ class BackupRemoteUploadController extends Controller // Ensure we are using the S3 adapter. $adapter = $this->backupManager->adapter(); - if (!$adapter instanceof AwsS3Adapter) { + if (!$adapter instanceof S3Filesystem) { throw new BadRequestHttpException('The configured backup adapter is not an S3 compatible adapter.'); } @@ -116,7 +101,7 @@ class BackupRemoteUploadController extends Controller } /** - * Get the configured maximum size of a single part in the multipart uplaod. + * Get the configured maximum size of a single part in the multipart upload. * * The function tries to retrieve a configured value from the configuration. * If no value is specified, a fallback value will be used. @@ -125,10 +110,8 @@ class BackupRemoteUploadController extends Controller * the fallback value will be used too. * * The fallback value is {@see BackupRemoteUploadController::DEFAULT_MAX_PART_SIZE}. - * - * @return int */ - private function getConfiguredMaxPartSize() + private function getConfiguredMaxPartSize(): int { $maxPartSize = (int) config('backups.max_part_size', self::DEFAULT_MAX_PART_SIZE); if ($maxPartSize <= 0) { diff --git a/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php b/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php index 93ebc74a8..f9c2a7932 100644 --- a/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php +++ b/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php @@ -7,36 +7,28 @@ use Illuminate\Http\Request; use Pterodactyl\Models\Backup; use Illuminate\Http\JsonResponse; use Pterodactyl\Facades\Activity; -use League\Flysystem\AwsS3v3\AwsS3Adapter; use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Extensions\Backups\BackupManager; +use Pterodactyl\Extensions\Filesystem\S3Filesystem; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Pterodactyl\Http\Requests\Api\Remote\ReportBackupCompleteRequest; class BackupStatusController extends Controller { - /** - * @var \Pterodactyl\Extensions\Backups\BackupManager - */ - private $backupManager; - /** * BackupStatusController constructor. */ - public function __construct(BackupManager $backupManager) + public function __construct(private BackupManager $backupManager) { - $this->backupManager = $backupManager; } /** * Handles updating the state of a backup. * - * @return \Illuminate\Http\JsonResponse - * * @throws \Throwable */ - public function index(ReportBackupCompleteRequest $request, string $backup) + public function index(ReportBackupCompleteRequest $request, string $backup): JsonResponse { /** @var \Pterodactyl\Models\Backup $model */ $model = Backup::query()->where('uuid', $backup)->firstOrFail(); @@ -65,7 +57,7 @@ class BackupStatusController extends Controller // Check if we are using the s3 backup adapter. If so, make sure we mark the backup as // being completed in S3 correctly. $adapter = $this->backupManager->adapter(); - if ($adapter instanceof AwsS3Adapter) { + if ($adapter instanceof S3Filesystem) { $this->completeMultipartUpload($model, $adapter, $successful, $request->input('parts')); } }); @@ -81,8 +73,6 @@ class BackupStatusController extends Controller * The only thing the successful field does is update the entry value for the audit logs * table tracking for this restoration. * - * @return \Illuminate\Http\JsonResponse - * * @throws \Throwable */ public function restore(Request $request, string $backup): JsonResponse @@ -107,7 +97,7 @@ class BackupStatusController extends Controller * @throws \Exception * @throws \Pterodactyl\Exceptions\DisplayException */ - protected function completeMultipartUpload(Backup $backup, AwsS3Adapter $adapter, bool $successful, ?array $parts): void + protected function completeMultipartUpload(Backup $backup, S3Filesystem $adapter, bool $successful, ?array $parts): void { // This should never really happen, but if it does don't let us fall victim to Amazon's // wildly fun error messaging. Just stop the process right here. diff --git a/app/Http/Controllers/Api/Remote/EggInstallController.php b/app/Http/Controllers/Api/Remote/EggInstallController.php index e1f804be2..31df7a96c 100644 --- a/app/Http/Controllers/Api/Remote/EggInstallController.php +++ b/app/Http/Controllers/Api/Remote/EggInstallController.php @@ -10,23 +10,11 @@ use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; class EggInstallController extends Controller { - /** - * @var \Pterodactyl\Services\Servers\EnvironmentService - */ - private $environment; - - /** - * @var \Pterodactyl\Contracts\Repository\ServerRepositoryInterface - */ - private $repository; - /** * EggInstallController constructor. */ - public function __construct(EnvironmentService $environment, ServerRepositoryInterface $repository) + public function __construct(private EnvironmentService $environment, private ServerRepositoryInterface $repository) { - $this->environment = $environment; - $this->repository = $repository; } /** diff --git a/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php b/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php index 785544052..8ce88e89e 100644 --- a/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php +++ b/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php @@ -15,49 +15,24 @@ use Pterodactyl\Services\Servers\ServerConfigurationStructureService; class ServerDetailsController extends Controller { - protected ConnectionInterface $connection; - - /** - * @var \Pterodactyl\Services\Eggs\EggConfigurationService - */ - private $eggConfigurationService; - - /** - * @var \Pterodactyl\Repositories\Eloquent\ServerRepository - */ - private $repository; - - /** - * @var \Pterodactyl\Services\Servers\ServerConfigurationStructureService - */ - private $configurationStructureService; - /** * ServerConfigurationController constructor. */ public function __construct( - ConnectionInterface $connection, - ServerRepository $repository, - ServerConfigurationStructureService $configurationStructureService, - EggConfigurationService $eggConfigurationService + protected ConnectionInterface $connection, + private ServerRepository $repository, + private ServerConfigurationStructureService $configurationStructureService, + private EggConfigurationService $eggConfigurationService ) { - $this->eggConfigurationService = $eggConfigurationService; - $this->repository = $repository; - $this->configurationStructureService = $configurationStructureService; - $this->connection = $connection; } /** * 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 string $uuid - * - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function __invoke(Request $request, $uuid) + public function __invoke(Request $request, string $uuid): JsonResponse { $server = $this->repository->getByUuid($uuid); @@ -69,15 +44,13 @@ class ServerDetailsController extends Controller /** * Lists all servers with their configurations that are assigned to the requesting node. - * - * @return \Pterodactyl\Http\Resources\Wings\ServerConfigurationCollection */ - public function list(Request $request) + public function list(Request $request): ServerConfigurationCollection { /** @var \Pterodactyl\Models\Node $node */ $node = $request->attributes->get('node'); - // Avoid run-away N+1 SQL queries by pre-loading the relationships that are used + // Avoid run-away N+1 SQL queries by preloading the relationships that are used // within each of the services called below. $servers = Server::query()->with('allocations', 'egg', 'mounts', 'variables', 'location') ->where('node_id', $node->id) @@ -94,15 +67,13 @@ class ServerDetailsController extends Controller * do not get incorrectly stuck in installing/restoring from backup states since * a Wings reboot would completely stop those processes. * - * @return \Illuminate\Http\JsonResponse - * * @throws \Throwable */ - public function resetState(Request $request) + public function resetState(Request $request): JsonResponse { $node = $request->attributes->get('node'); - // Get all of the servers that are currently marked as restoring from a backup + // Get all the servers that are currently marked as restoring from a backup // on this node that do not have a failed backup tracked in the audit logs table // as well. // diff --git a/app/Http/Controllers/Api/Remote/Servers/ServerInstallController.php b/app/Http/Controllers/Api/Remote/Servers/ServerInstallController.php index 1c82e6d88..e78843763 100644 --- a/app/Http/Controllers/Api/Remote/Servers/ServerInstallController.php +++ b/app/Http/Controllers/Api/Remote/Servers/ServerInstallController.php @@ -15,30 +15,16 @@ use Pterodactyl\Http\Requests\Api\Remote\InstallationDataRequest; class ServerInstallController extends Controller { - /** - * @var \Pterodactyl\Repositories\Eloquent\ServerRepository - */ - private $repository; - - /** - * @var \Illuminate\Contracts\Events\Dispatcher - */ - private $eventDispatcher; - /** * ServerInstallController constructor. */ - public function __construct(ServerRepository $repository, EventDispatcher $eventDispatcher) + public function __construct(private ServerRepository $repository, private EventDispatcher $eventDispatcher) { - $this->repository = $repository; - $this->eventDispatcher = $eventDispatcher; } /** * Returns installation information for a server. * - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function index(Request $request, string $uuid): JsonResponse @@ -56,8 +42,6 @@ class ServerInstallController extends Controller /** * Updates the installation state of a server. * - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ @@ -77,7 +61,7 @@ class ServerInstallController extends Controller $isInitialInstall = is_null($server->installed_at); if ($isInitialInstall && config()->get('pterodactyl.email.send_install_notification', true)) { $this->eventDispatcher->dispatch(new ServerInstalled($server)); - } elseif (! $isInitialInstall && config()->get('pterodactyl.email.send_reinstall_notification', true)) { + } elseif (!$isInitialInstall && config()->get('pterodactyl.email.send_reinstall_notification', true)) { $this->eventDispatcher->dispatch(new ServerInstalled($server)); } diff --git a/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php b/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php index 7e3ac810f..6f49d66e0 100644 --- a/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php +++ b/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php @@ -16,68 +16,28 @@ use Pterodactyl\Repositories\Eloquent\ServerRepository; use Pterodactyl\Repositories\Wings\DaemonServerRepository; use Pterodactyl\Repositories\Wings\DaemonTransferRepository; use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; -use Pterodactyl\Services\Servers\ServerConfigurationStructureService; class ServerTransferController extends Controller { - /** - * @var \Illuminate\Database\ConnectionInterface - */ - private $connection; - - /** - * @var \Pterodactyl\Repositories\Eloquent\ServerRepository - */ - private $repository; - - /** - * @var \Pterodactyl\Repositories\Wings\DaemonServerRepository - */ - private $daemonServerRepository; - - /** - * @var \Pterodactyl\Repositories\Wings\DaemonTransferRepository - */ - private $daemonTransferRepository; - - /** - * @var \Pterodactyl\Services\Servers\ServerConfigurationStructureService - */ - private $configurationStructureService; - - /** - * @var \Pterodactyl\Services\Nodes\NodeJWTService - */ - private $jwtService; - /** * ServerTransferController constructor. */ public function __construct( - ConnectionInterface $connection, - ServerRepository $repository, - DaemonServerRepository $daemonServerRepository, - DaemonTransferRepository $daemonTransferRepository, - ServerConfigurationStructureService $configurationStructureService, - NodeJWTService $jwtService + private ConnectionInterface $connection, + private ServerRepository $repository, + private DaemonServerRepository $daemonServerRepository, + private DaemonTransferRepository $daemonTransferRepository, + private NodeJWTService $jwtService ) { - $this->connection = $connection; - $this->repository = $repository; - $this->daemonServerRepository = $daemonServerRepository; - $this->daemonTransferRepository = $daemonTransferRepository; - $this->configurationStructureService = $configurationStructureService; - $this->jwtService = $jwtService; } /** * The daemon notifies us about the archive status. * - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Throwable */ - public function archive(Request $request, string $uuid) + public function archive(Request $request, string $uuid): JsonResponse { $server = $this->repository->getByUuid($uuid); @@ -114,11 +74,9 @@ class ServerTransferController extends Controller /** * The daemon notifies us about a transfer failure. * - * @return \Illuminate\Http\JsonResponse - * * @throws \Throwable */ - public function failure(string $uuid) + public function failure(string $uuid): JsonResponse { $server = $this->repository->getByUuid($uuid); @@ -168,14 +126,12 @@ class ServerTransferController extends Controller } /** - * Release all of the reserved allocations for this transfer and mark it as failed in + * Release all the reserved allocations for this transfer and mark it as failed in * the database. * - * @return \Illuminate\Http\JsonResponse - * * @throws \Throwable */ - protected function processFailedTransfer(ServerTransfer $transfer) + protected function processFailedTransfer(ServerTransfer $transfer): JsonResponse { $this->connection->transaction(function () use (&$transfer) { $transfer->forceFill(['successful' => false])->saveOrFail(); diff --git a/app/Http/Controllers/Api/Remote/SftpAuthenticationController.php b/app/Http/Controllers/Api/Remote/SftpAuthenticationController.php index ab8ef8246..a360d1d0e 100644 --- a/app/Http/Controllers/Api/Remote/SftpAuthenticationController.php +++ b/app/Http/Controllers/Api/Remote/SftpAuthenticationController.php @@ -22,11 +22,8 @@ class SftpAuthenticationController extends Controller { use ThrottlesLogins; - protected GetUserPermissionsService $permissions; - - public function __construct(GetUserPermissionsService $permissions) + public function __construct(protected GetUserPermissionsService $permissions) { - $this->permissions = $permissions; } /** @@ -44,7 +41,7 @@ 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."); } $user = $this->getUser($request, $connection['username']); @@ -60,7 +57,7 @@ class SftpAuthenticationController extends Controller $key = null; try { $key = PublicKeyLoader::loadPublicKey(trim($request->input('password'))); - } catch (NoKeyLoadedException $exception) { + } catch (NoKeyLoadedException) { // do nothing } diff --git a/app/Http/Controllers/Auth/AbstractLoginController.php b/app/Http/Controllers/Auth/AbstractLoginController.php index 7c4b5c394..f07282fba 100644 --- a/app/Http/Controllers/Auth/AbstractLoginController.php +++ b/app/Http/Controllers/Auth/AbstractLoginController.php @@ -8,6 +8,8 @@ use Illuminate\Auth\AuthManager; use Illuminate\Http\JsonResponse; use Illuminate\Auth\Events\Failed; use Illuminate\Container\Container; +use Illuminate\Support\Facades\Event; +use Pterodactyl\Events\Auth\DirectLogin; use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Http\Controllers\Controller; use Illuminate\Contracts\Auth\Authenticatable; @@ -21,24 +23,18 @@ abstract class AbstractLoginController extends Controller /** * Lockout time for failed login requests. - * - * @var int */ - protected $lockoutTime; + protected int $lockoutTime; /** * After how many attempts should logins be throttled and locked. - * - * @var int */ - protected $maxLoginAttempts; + protected int $maxLoginAttempts; /** * Where to redirect users after login / registration. - * - * @var string */ - protected $redirectTo = '/'; + protected string $redirectTo = '/'; /** * LoginController constructor. @@ -81,6 +77,8 @@ abstract class AbstractLoginController extends Controller $this->auth->guard()->login($user, true); + Event::dispatch(new DirectLogin($user, true)); + return new JsonResponse([ 'data' => [ 'complete' => true, @@ -91,7 +89,7 @@ abstract class AbstractLoginController extends Controller } /** - * Determine if the user is logging in using an email or username,. + * Determine if the user is logging in using an email or username. */ protected function getField(string $input = null): string { @@ -103,6 +101,6 @@ abstract class AbstractLoginController extends Controller */ protected function fireFailedLoginEvent(Authenticatable $user = null, array $credentials = []) { - event(new Failed('auth', $user, $credentials)); + Event::dispatch(new Failed('auth', $user, $credentials)); } } diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index 7b409e519..d67b0de51 100644 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -15,9 +15,6 @@ class ForgotPasswordController extends Controller /** * Get the response for a failed password reset link. - * - * @param \Illuminate\Http\Request - * @param string $response */ protected function sendResetLinkFailedResponse(Request $request, $response): JsonResponse { diff --git a/app/Http/Controllers/Auth/LoginCheckpointController.php b/app/Http/Controllers/Auth/LoginCheckpointController.php index d74b3f8a4..af05c55ef 100644 --- a/app/Http/Controllers/Auth/LoginCheckpointController.php +++ b/app/Http/Controllers/Auth/LoginCheckpointController.php @@ -18,22 +18,15 @@ class LoginCheckpointController extends AbstractLoginController { private const TOKEN_EXPIRED_MESSAGE = 'The authentication token provided has expired, please refresh the page and try again.'; - private ValidationFactory $validation; - - private Google2FA $google2FA; - - private Encrypter $encrypter; - /** * LoginCheckpointController constructor. */ - public function __construct(Encrypter $encrypter, Google2FA $google2FA, ValidationFactory $validation) - { + public function __construct( + private Encrypter $encrypter, + private Google2FA $google2FA, + private ValidationFactory $validation + ) { parent::__construct(); - - $this->google2FA = $google2FA; - $this->encrypter = $encrypter; - $this->validation = $validation; } /** @@ -41,8 +34,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. * - * @return \Illuminate\Http\JsonResponse|void - * * @throws \PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException * @throws \PragmaRX\Google2FA\Exceptions\InvalidCharactersException * @throws \PragmaRX\Google2FA\Exceptions\SecretKeyTooShortException @@ -67,7 +58,7 @@ class LoginCheckpointController extends AbstractLoginController try { /** @var \Pterodactyl\Models\User $user */ $user = User::query()->findOrFail($details['user_id']); - } catch (ModelNotFoundException $exception) { + } catch (ModelNotFoundException) { $this->sendFailedLoginResponse($request, null, self::TOKEN_EXPIRED_MESSAGE); } @@ -95,11 +86,9 @@ class LoginCheckpointController extends AbstractLoginController * 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. * - * @return bool - * * @throws \Exception */ - protected function isValidRecoveryToken(User $user, string $value) + protected function isValidRecoveryToken(User $user, string $value): bool { foreach ($user->recoveryTokens as $token) { if (password_verify($value, $token->token)) { diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 18cc8815c..2dbb34ee3 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -14,22 +14,18 @@ use Illuminate\Database\Eloquent\ModelNotFoundException; class LoginController extends AbstractLoginController { - private ViewFactory $view; - /** * LoginController constructor. */ - public function __construct(ViewFactory $view) + public function __construct(private ViewFactory $view) { parent::__construct(); - - $this->view = $view; } /** * 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. + * base authentication view component. React will take over at this point and + * turn the login area into an SPA. */ public function index(): View { @@ -39,8 +35,6 @@ class LoginController extends AbstractLoginController /** * Handle a login request to the application. * - * @return \Illuminate\Http\JsonResponse|void - * * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Illuminate\Validation\ValidationException */ @@ -56,14 +50,14 @@ class LoginController extends AbstractLoginController /** @var \Pterodactyl\Models\User $user */ $user = User::query()->where($this->getField($username), $username)->firstOrFail(); - } catch (ModelNotFoundException $exception) { + } catch (ModelNotFoundException) { $this->sendFailedLoginResponse($request); } // Ensure that the account is using a valid username and password before trying to // 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. + // can proceed to the next step in the login process. if (!password_verify($request->input('password'), $user->password)) { $this->sendFailedLoginResponse($request, $user); } diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index 1107510a8..3325a1e6b 100644 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -20,39 +20,19 @@ class ResetPasswordController extends Controller /** * The URL to redirect users to after password reset. - * - * @var string */ - public $redirectTo = '/'; + public string $redirectTo = '/'; - /** - * @var bool - */ - protected $hasTwoFactor = false; - - /** - * @var \Illuminate\Contracts\Events\Dispatcher - */ - private $dispatcher; - - /** - * @var \Illuminate\Contracts\Hashing\Hasher - */ - private $hasher; - - /** - * @var \Pterodactyl\Contracts\Repository\UserRepositoryInterface - */ - private $userRepository; + protected bool $hasTwoFactor = false; /** * ResetPasswordController constructor. */ - public function __construct(Dispatcher $dispatcher, Hasher $hasher, UserRepositoryInterface $userRepository) - { - $this->dispatcher = $dispatcher; - $this->hasher = $hasher; - $this->userRepository = $userRepository; + public function __construct( + private Dispatcher $dispatcher, + private Hasher $hasher, + private UserRepositoryInterface $userRepository + ) { } /** @@ -64,7 +44,7 @@ class ResetPasswordController extends Controller { // Here we will attempt to reset the user's password. If it is successful we // 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. + // database. Otherwise, we will parse the error and return the response. $response = $this->broker()->reset( $this->credentials($request), function ($user, $password) { diff --git a/app/Http/Controllers/Base/IndexController.php b/app/Http/Controllers/Base/IndexController.php index 058280be6..fecaa91a3 100644 --- a/app/Http/Controllers/Base/IndexController.php +++ b/app/Http/Controllers/Base/IndexController.php @@ -2,31 +2,27 @@ namespace Pterodactyl\Http\Controllers\Base; +use Illuminate\View\View; +use Illuminate\View\Factory as ViewFactory; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; class IndexController extends Controller { - /** - * @var \Pterodactyl\Contracts\Repository\ServerRepositoryInterface - */ - protected $repository; - /** * IndexController constructor. */ - public function __construct(ServerRepositoryInterface $repository) - { - $this->repository = $repository; + public function __construct( + protected ServerRepositoryInterface $repository, + protected ViewFactory $view + ) { } /** * Returns listing of user's servers. - * - * @return \Illuminate\View\View */ - public function index() + public function index(): View { - return view('templates/base.core'); + return $this->view->make('templates/base.core'); } } diff --git a/app/Http/Controllers/Base/LocaleController.php b/app/Http/Controllers/Base/LocaleController.php index 8cd83b5ef..5214defdd 100644 --- a/app/Http/Controllers/Base/LocaleController.php +++ b/app/Http/Controllers/Base/LocaleController.php @@ -19,10 +19,8 @@ class LocaleController extends Controller /** * Returns translation data given a specific locale and namespace. - * - * @return \Illuminate\Http\JsonResponse */ - public function __invoke(Request $request) + public function __invoke(Request $request): JsonResponse { $locales = explode(' ', $request->input('locale') ?? ''); $namespaces = explode(' ', $request->input('namespace') ?? ''); diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index f23d9f830..7df1ed2b1 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -2,8 +2,8 @@ namespace Pterodactyl\Http; -use Fruitcake\Cors\HandleCors; use Illuminate\Auth\Middleware\Authorize; +use Illuminate\Http\Middleware\HandleCors; use Illuminate\Auth\Middleware\Authenticate; use Illuminate\Http\Middleware\TrustProxies; use Pterodactyl\Http\Middleware\TrimStrings; @@ -38,8 +38,6 @@ class Kernel extends HttpKernel { /** * The application's global HTTP middleware stack. - * - * @var array */ protected $middleware = [ TrustProxies::class, @@ -52,8 +50,6 @@ class Kernel extends HttpKernel /** * The application's route middleware groups. - * - * @var array */ protected $middlewareGroups = [ 'web' => [ @@ -89,8 +85,6 @@ class Kernel extends HttpKernel /** * The application's route middleware. - * - * @var array */ protected $routeMiddleware = [ 'auth' => Authenticate::class, diff --git a/app/Http/Middleware/Activity/TrackAPIKey.php b/app/Http/Middleware/Activity/TrackAPIKey.php index 90d53759e..bf3394a23 100644 --- a/app/Http/Middleware/Activity/TrackAPIKey.php +++ b/app/Http/Middleware/Activity/TrackAPIKey.php @@ -14,10 +14,8 @@ class TrackAPIKey * API key, or it is just a cookie authenticated session. This data is set in a * request singleton so that all tracked activity log events are properly associated * with the given API key. - * - * @return mixed */ - public function handle(Request $request, Closure $next) + public function handle(Request $request, Closure $next): mixed { if ($request->user()) { $token = $request->user()->currentAccessToken(); diff --git a/app/Http/Middleware/Admin/Servers/ServerInstalled.php b/app/Http/Middleware/Admin/Servers/ServerInstalled.php index baf88af2d..63c90c397 100644 --- a/app/Http/Middleware/Admin/Servers/ServerInstalled.php +++ b/app/Http/Middleware/Admin/Servers/ServerInstalled.php @@ -13,10 +13,8 @@ class ServerInstalled { /** * Checks that the server is installed before allowing access through the route. - * - * @return mixed */ - public function handle(Request $request, Closure $next) + public function handle(Request $request, Closure $next): mixed { /** @var \Pterodactyl\Models\Server|null $server */ $server = $request->route()->parameter('server'); diff --git a/app/Http/Middleware/AdminAuthenticate.php b/app/Http/Middleware/AdminAuthenticate.php index 72a7c8629..0bd024506 100644 --- a/app/Http/Middleware/AdminAuthenticate.php +++ b/app/Http/Middleware/AdminAuthenticate.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Http\Middleware; @@ -18,11 +11,9 @@ class AdminAuthenticate /** * Handle an incoming request. * - * @return mixed - * * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException */ - public function handle(Request $request, Closure $next) + public function handle(Request $request, Closure $next): mixed { if (!$request->user() || !$request->user()->root_admin) { throw new AccessDeniedHttpException(); diff --git a/app/Http/Middleware/Api/Application/AuthenticateApplicationUser.php b/app/Http/Middleware/Api/Application/AuthenticateApplicationUser.php index 983f4d369..2e366c471 100644 --- a/app/Http/Middleware/Api/Application/AuthenticateApplicationUser.php +++ b/app/Http/Middleware/Api/Application/AuthenticateApplicationUser.php @@ -11,10 +11,8 @@ class AuthenticateApplicationUser /** * Authenticate that the currently authenticated user is an administrator * and should be allowed to proceed through the application API. - * - * @return mixed */ - public function handle(Request $request, Closure $next) + public function handle(Request $request, Closure $next): mixed { /** @var \Pterodactyl\Models\User|null $user */ $user = $request->user(); diff --git a/app/Http/Middleware/Api/AuthenticateIPAccess.php b/app/Http/Middleware/Api/AuthenticateIPAccess.php index 163d03d68..c55ce8b3f 100644 --- a/app/Http/Middleware/Api/AuthenticateIPAccess.php +++ b/app/Http/Middleware/Api/AuthenticateIPAccess.php @@ -15,12 +15,10 @@ class AuthenticateIPAccess /** * Determine if a request IP has permission to access the API. * - * @return mixed - * * @throws \Exception * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException */ - public function handle(Request $request, Closure $next) + public function handle(Request $request, Closure $next): mixed { /** @var \Laravel\Sanctum\TransientToken|\Pterodactyl\Models\ApiKey $token */ $token = $request->user()->currentAccessToken(); diff --git a/app/Http/Middleware/Api/Client/RequireClientApiKey.php b/app/Http/Middleware/Api/Client/RequireClientApiKey.php index 7203203c7..1ddd0f128 100644 --- a/app/Http/Middleware/Api/Client/RequireClientApiKey.php +++ b/app/Http/Middleware/Api/Client/RequireClientApiKey.php @@ -11,10 +11,8 @@ class RequireClientApiKey /** * Blocks a request to the Client API endpoints if the user is providing an API token * that was created for the application API. - * - * @return mixed */ - public function handle(Request $request, \Closure $next) + public function handle(Request $request, \Closure $next): mixed { $token = $request->user()->currentAccessToken(); diff --git a/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php b/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php index 0634e2585..40a4d0cf1 100644 --- a/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php +++ b/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php @@ -5,40 +5,29 @@ namespace Pterodactyl\Http\Middleware\Api\Client\Server; use Closure; use Illuminate\Http\Request; use Pterodactyl\Models\Server; -use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Pterodactyl\Exceptions\Http\Server\ServerStateConflictException; class AuthenticateServerAccess { - /** - * @var \Pterodactyl\Contracts\Repository\ServerRepositoryInterface - */ - private $repository; - /** * Routes that this middleware should not apply to if the user is an admin. - * - * @var string[] */ - protected $except = [ + protected array $except = [ 'api:client:server.ws', ]; /** * AuthenticateServerAccess constructor. */ - public function __construct(ServerRepositoryInterface $repository) + public function __construct() { - $this->repository = $repository; } /** * Authenticate that this server exists and is not suspended or marked as installing. - * - * @return mixed */ - public function handle(Request $request, Closure $next) + public function handle(Request $request, Closure $next): mixed { /** @var \Pterodactyl\Models\User $user */ $user = $request->user(); diff --git a/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php b/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php index d8c4731d3..5d3530d86 100644 --- a/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php +++ b/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php @@ -25,10 +25,8 @@ class ResourceBelongsToServer * This is critical to ensuring that all subsequent logic is using exactly the * server that is expected, and that we're not accessing a resource completely * unrelated to the server provided in the request. - * - * @return mixed */ - public function handle(Request $request, Closure $next) + public function handle(Request $request, Closure $next): mixed { $params = $request->route()->parameters(); if (is_null($params) || !$params['server'] instanceof Server) { @@ -59,8 +57,8 @@ class ResourceBelongsToServer 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. + // 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)) { @@ -70,8 +68,8 @@ class ResourceBelongsToServer // 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. + // 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) { diff --git a/app/Http/Middleware/Api/Client/SubstituteClientBindings.php b/app/Http/Middleware/Api/Client/SubstituteClientBindings.php index 38d87bf2f..ec30d80fd 100644 --- a/app/Http/Middleware/Api/Client/SubstituteClientBindings.php +++ b/app/Http/Middleware/Api/Client/SubstituteClientBindings.php @@ -10,10 +10,8 @@ class SubstituteClientBindings extends SubstituteBindings { /** * @param \Illuminate\Http\Request $request - * - * @return mixed */ - public function handle($request, Closure $next) + public function handle($request, Closure $next): mixed { // Override default behavior of the model binding to use a specific table // column rather than the default 'id'. diff --git a/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php b/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php index f79d598eb..cea8bc5ed 100644 --- a/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php +++ b/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php @@ -13,42 +13,26 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; class DaemonAuthenticate { - /** - * @var \Pterodactyl\Repositories\Eloquent\NodeRepository - */ - private $repository; - - /** - * @var \Illuminate\Contracts\Encryption\Encrypter - */ - private $encrypter; - /** * Daemon routes that this middleware should be skipped on. - * - * @var array */ - protected $except = [ + protected array $except = [ 'daemon.configuration', ]; /** * DaemonAuthenticate constructor. */ - public function __construct(Encrypter $encrypter, NodeRepository $repository) + public function __construct(private Encrypter $encrypter, private NodeRepository $repository) { - $this->repository = $repository; - $this->encrypter = $encrypter; } /** * Check if a request from the daemon can be properly attributed back to a single node instance. * - * @return mixed - * * @throws \Symfony\Component\HttpKernel\Exception\HttpException */ - public function handle(Request $request, Closure $next) + public function handle(Request $request, Closure $next): mixed { if (in_array($request->route()->getName(), $this->except)) { return $next($request); diff --git a/app/Http/Middleware/Api/IsValidJson.php b/app/Http/Middleware/Api/IsValidJson.php index 5f53b097d..e35173aac 100644 --- a/app/Http/Middleware/Api/IsValidJson.php +++ b/app/Http/Middleware/Api/IsValidJson.php @@ -13,10 +13,8 @@ class IsValidJson * Throw an exception if the request should be valid JSON data but there is an error while * 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. - * - * @return mixed */ - public function handle(Request $request, Closure $next) + public function handle(Request $request, Closure $next): mixed { if ($request->isJson() && !empty($request->getContent())) { try { diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.php index 9c0cadd86..1ac425a33 100644 --- a/app/Http/Middleware/EncryptCookies.php +++ b/app/Http/Middleware/EncryptCookies.php @@ -8,8 +8,6 @@ class EncryptCookies extends BaseEncrypter { /** * The names of the cookies that should not be encrypted. - * - * @var array */ protected $except = []; } diff --git a/app/Http/Middleware/LanguageMiddleware.php b/app/Http/Middleware/LanguageMiddleware.php index 914d4395f..2f0d53b47 100644 --- a/app/Http/Middleware/LanguageMiddleware.php +++ b/app/Http/Middleware/LanguageMiddleware.php @@ -8,25 +8,17 @@ use Illuminate\Foundation\Application; class LanguageMiddleware { - /** - * @var \Illuminate\Foundation\Application - */ - private $app; - /** * LanguageMiddleware constructor. */ - public function __construct(Application $app) + public function __construct(private Application $app) { - $this->app = $app; } /** * Handle an incoming request and set the user's preferred language. - * - * @return mixed */ - public function handle(Request $request, Closure $next) + public function handle(Request $request, Closure $next): mixed { $this->app->setLocale($request->user()->language ?? config('app.locale', 'en')); diff --git a/app/Http/Middleware/MaintenanceMiddleware.php b/app/Http/Middleware/MaintenanceMiddleware.php index 582626162..9899542d1 100644 --- a/app/Http/Middleware/MaintenanceMiddleware.php +++ b/app/Http/Middleware/MaintenanceMiddleware.php @@ -3,31 +3,22 @@ namespace Pterodactyl\Http\Middleware; use Closure; +use Illuminate\Http\Request; use Illuminate\Contracts\Routing\ResponseFactory; class MaintenanceMiddleware { - /** - * @var \Illuminate\Contracts\Routing\ResponseFactory - */ - private $response; - /** * MaintenanceMiddleware constructor. */ - public function __construct(ResponseFactory $response) + public function __construct(private ResponseFactory $response) { - $this->response = $response; } /** * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * - * @return mixed */ - public function handle($request, Closure $next) + public function handle(Request $request, Closure $next): mixed { /** @var \Pterodactyl\Models\Server $server */ $server = $request->attributes->get('server'); diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index 6c4019af4..c1efd927d 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -8,25 +8,17 @@ use Illuminate\Auth\AuthManager; class RedirectIfAuthenticated { - /** - * @var \Illuminate\Auth\AuthManager - */ - private $authManager; - /** * RedirectIfAuthenticated constructor. */ - public function __construct(AuthManager $authManager) + public function __construct(private AuthManager $authManager) { - $this->authManager = $authManager; } /** * Handle an incoming request. - * - * @return mixed */ - public function handle(Request $request, Closure $next, string $guard = null) + public function handle(Request $request, Closure $next, string $guard = null): mixed { if ($this->authManager->guard($guard)->check()) { return redirect()->route('index'); diff --git a/app/Http/Middleware/RequireTwoFactorAuthentication.php b/app/Http/Middleware/RequireTwoFactorAuthentication.php index 6691179a3..e3307727f 100644 --- a/app/Http/Middleware/RequireTwoFactorAuthentication.php +++ b/app/Http/Middleware/RequireTwoFactorAuthentication.php @@ -15,23 +15,15 @@ class RequireTwoFactorAuthentication public const LEVEL_ALL = 2; /** - * @var \Prologue\Alerts\AlertsMessageBag + * The route to redirect a user to enable 2FA. */ - private $alert; - - /** - * The route to redirect a user to to enable 2FA. - * - * @var string - */ - protected $redirectRoute = '/account'; + protected string $redirectRoute = '/account'; /** * RequireTwoFactorAuthentication constructor. */ - public function __construct(AlertsMessageBag $alert) + public function __construct(private AlertsMessageBag $alert) { - $this->alert = $alert; } /** @@ -40,11 +32,9 @@ 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. * - * @return mixed - * * @throws \Pterodactyl\Exceptions\Http\TwoFactorAuthRequiredException */ - public function handle(Request $request, Closure $next) + public function handle(Request $request, Closure $next): mixed { /** @var \Pterodactyl\Models\User $user */ $user = $request->user(); diff --git a/app/Http/Middleware/TrimStrings.php b/app/Http/Middleware/TrimStrings.php index 04f434b98..af5382e8c 100644 --- a/app/Http/Middleware/TrimStrings.php +++ b/app/Http/Middleware/TrimStrings.php @@ -8,8 +8,6 @@ class TrimStrings extends BaseTrimmer { /** * The names of the attributes that should not be trimmed. - * - * @var array */ protected $except = [ 'password', diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php index ee5a3d216..d951fe77b 100644 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ b/app/Http/Middleware/VerifyCsrfToken.php @@ -10,8 +10,6 @@ class VerifyCsrfToken extends BaseVerifier * The URIs that should be excluded from CSRF verification. These are * never hit by the front-end, and require specific token validation * to work. - * - * @var string[] */ protected $except = ['remote/*', 'daemon/*']; } diff --git a/app/Http/Middleware/VerifyReCaptcha.php b/app/Http/Middleware/VerifyReCaptcha.php index c0841f2c9..45ae4bb23 100644 --- a/app/Http/Middleware/VerifyReCaptcha.php +++ b/app/Http/Middleware/VerifyReCaptcha.php @@ -14,33 +14,17 @@ use Symfony\Component\HttpKernel\Exception\HttpException; class VerifyReCaptcha { - /** - * @var \Illuminate\Contracts\Config\Repository - */ - private $config; - - /** - * @var \Illuminate\Contracts\Events\Dispatcher - */ - private $dispatcher; - /** * VerifyReCaptcha constructor. */ - public function __construct(Dispatcher $dispatcher, Repository $config) + public function __construct(private Dispatcher $dispatcher, private Repository $config) { - $this->config = $config; - $this->dispatcher = $dispatcher; } /** * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * - * @return \Illuminate\Http\RedirectResponse|mixed */ - public function handle($request, Closure $next) + public function handle(Request $request, Closure $next): mixed { if (!$this->config->get('recaptcha.enabled')) { return $next($request); diff --git a/app/Http/Requests/Admin/AdminFormRequest.php b/app/Http/Requests/Admin/AdminFormRequest.php index e3107e26d..8597e1d93 100644 --- a/app/Http/Requests/Admin/AdminFormRequest.php +++ b/app/Http/Requests/Admin/AdminFormRequest.php @@ -8,18 +8,14 @@ abstract class AdminFormRequest extends FormRequest { /** * The rules to apply to the incoming form request. - * - * @return array */ - abstract public function rules(); + abstract public function rules(): array; /** * Determine if the user is an admin and has permission to access this * form controller in the first place. - * - * @return bool */ - public function authorize() + public function authorize(): bool { if (is_null($this->user())) { return false; @@ -31,10 +27,8 @@ 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. - * - * @return array */ - public function normalize(array $only = null) + public function normalize(array $only = null): array { return $this->only($only ?? array_keys($this->rules())); } diff --git a/app/Http/Requests/Admin/Api/StoreApplicationApiKeyRequest.php b/app/Http/Requests/Admin/Api/StoreApplicationApiKeyRequest.php index 40aa732f2..f451239e6 100644 --- a/app/Http/Requests/Admin/Api/StoreApplicationApiKeyRequest.php +++ b/app/Http/Requests/Admin/Api/StoreApplicationApiKeyRequest.php @@ -9,12 +9,10 @@ use Pterodactyl\Http\Requests\Admin\AdminFormRequest; class StoreApplicationApiKeyRequest extends AdminFormRequest { /** - * @return array - * * @throws \ReflectionException * @throws \ReflectionException */ - public function rules() + public function rules(): array { $modelRules = ApiKey::getRules(); @@ -23,10 +21,7 @@ class StoreApplicationApiKeyRequest extends AdminFormRequest })->merge(['memo' => $modelRules['memo']])->toArray(); } - /** - * @return array - */ - public function attributes() + public function attributes(): array { return [ 'memo' => 'Description', diff --git a/app/Http/Requests/Admin/BaseFormRequest.php b/app/Http/Requests/Admin/BaseFormRequest.php index dff6b9fb2..cd2c78e4d 100644 --- a/app/Http/Requests/Admin/BaseFormRequest.php +++ b/app/Http/Requests/Admin/BaseFormRequest.php @@ -1,17 +1,10 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Http\Requests\Admin; class BaseFormRequest extends AdminFormRequest { - public function rules() + public function rules(): array { return [ 'company' => 'required|between:1,256', diff --git a/app/Http/Requests/Admin/DatabaseHostFormRequest.php b/app/Http/Requests/Admin/DatabaseHostFormRequest.php index 7fdd0cdc3..2e581478e 100644 --- a/app/Http/Requests/Admin/DatabaseHostFormRequest.php +++ b/app/Http/Requests/Admin/DatabaseHostFormRequest.php @@ -3,13 +3,11 @@ namespace Pterodactyl\Http\Requests\Admin; use Pterodactyl\Models\DatabaseHost; +use Illuminate\Contracts\Validation\Validator; class DatabaseHostFormRequest extends AdminFormRequest { - /** - * @return mixed - */ - public function rules() + public function rules(): array { if ($this->method() !== 'POST') { return DatabaseHost::getRulesForUpdate($this->route()->parameter('host')); @@ -20,10 +18,8 @@ class DatabaseHostFormRequest extends AdminFormRequest /** * Modify submitted data before it is passed off to the validator. - * - * @return \Illuminate\Contracts\Validation\Validator */ - protected function getValidatorInstance() + protected function getValidatorInstance(): Validator { 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 2dbc01b51..0f153393f 100644 --- a/app/Http/Requests/Admin/Egg/EggFormRequest.php +++ b/app/Http/Requests/Admin/Egg/EggFormRequest.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Http\Requests\Admin\Egg; @@ -13,10 +6,7 @@ use Pterodactyl\Http\Requests\Admin\AdminFormRequest; class EggFormRequest extends AdminFormRequest { - /** - * {@inheritdoc} - */ - public function rules() + public function rules(): array { $rules = [ 'name' => 'required|string|max:191', @@ -39,9 +29,6 @@ class EggFormRequest extends AdminFormRequest return $rules; } - /** - * @param \Illuminate\Contracts\Validation\Validator $validator - */ public function withValidator($validator) { $validator->sometimes('config_from', 'exists:eggs,id', function () { @@ -49,7 +36,7 @@ class EggFormRequest extends AdminFormRequest }); } - public function validated(): array + public function validated($key = null, $default = null): array { $data = parent::validated(); diff --git a/app/Http/Requests/Admin/Egg/EggImportFormRequest.php b/app/Http/Requests/Admin/Egg/EggImportFormRequest.php index b6adb768e..7718480e9 100644 --- a/app/Http/Requests/Admin/Egg/EggImportFormRequest.php +++ b/app/Http/Requests/Admin/Egg/EggImportFormRequest.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Http\Requests\Admin\Egg; @@ -13,10 +6,7 @@ use Pterodactyl\Http\Requests\Admin\AdminFormRequest; class EggImportFormRequest extends AdminFormRequest { - /** - * @return array - */ - public function rules() + public function rules(): array { $rules = [ 'import_file' => 'bail|required|file|max:1000|mimetypes:application/json,text/plain', diff --git a/app/Http/Requests/Admin/Egg/EggScriptFormRequest.php b/app/Http/Requests/Admin/Egg/EggScriptFormRequest.php index 3f522e96f..b93a63c63 100644 --- a/app/Http/Requests/Admin/Egg/EggScriptFormRequest.php +++ b/app/Http/Requests/Admin/Egg/EggScriptFormRequest.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Http\Requests\Admin\Egg; @@ -14,11 +7,9 @@ use Pterodactyl\Http\Requests\Admin\AdminFormRequest; class EggScriptFormRequest extends AdminFormRequest { /** - * Return the rules to be used when validating the sent data in the request. - * - * @return array + * Return the rules to be used when validating the data sent in the request. */ - public function rules() + public function rules(): array { return [ 'script_install' => 'sometimes|nullable|string', diff --git a/app/Http/Requests/Admin/Egg/EggVariableFormRequest.php b/app/Http/Requests/Admin/Egg/EggVariableFormRequest.php index d52fe94d2..d232254ea 100644 --- a/app/Http/Requests/Admin/Egg/EggVariableFormRequest.php +++ b/app/Http/Requests/Admin/Egg/EggVariableFormRequest.php @@ -9,10 +9,8 @@ class EggVariableFormRequest extends AdminFormRequest { /** * Define rules for validation of this request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'name' => 'required|string|min:1|max:191', diff --git a/app/Http/Requests/Admin/LocationFormRequest.php b/app/Http/Requests/Admin/LocationFormRequest.php index 2ad202f9c..b10e304a0 100644 --- a/app/Http/Requests/Admin/LocationFormRequest.php +++ b/app/Http/Requests/Admin/LocationFormRequest.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Http\Requests\Admin; @@ -14,11 +7,9 @@ use Pterodactyl\Models\Location; class LocationFormRequest extends AdminFormRequest { /** - * Setup the validation rules to use for these requests. - * - * @return array + * Set up the validation rules to use for these requests. */ - public function rules() + public function rules(): array { if ($this->method() === 'PATCH') { return Location::getRulesForUpdate($this->route()->parameter('location')->id); diff --git a/app/Http/Requests/Admin/MountFormRequest.php b/app/Http/Requests/Admin/MountFormRequest.php index bd94a633a..074ea4a50 100644 --- a/app/Http/Requests/Admin/MountFormRequest.php +++ b/app/Http/Requests/Admin/MountFormRequest.php @@ -7,11 +7,9 @@ use Pterodactyl\Models\Mount; class MountFormRequest extends AdminFormRequest { /** - * Setup the validation rules to use for these requests. - * - * @return array + * Set up the validation rules to use for these requests. */ - public function rules() + public function rules(): array { if ($this->method() === 'PATCH') { return Mount::getRulesForUpdate($this->route()->parameter('mount')->id); diff --git a/app/Http/Requests/Admin/Nest/StoreNestFormRequest.php b/app/Http/Requests/Admin/Nest/StoreNestFormRequest.php index 2f01dfe9e..193f8676c 100644 --- a/app/Http/Requests/Admin/Nest/StoreNestFormRequest.php +++ b/app/Http/Requests/Admin/Nest/StoreNestFormRequest.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Http\Requests\Admin\Nest; @@ -13,10 +6,7 @@ use Pterodactyl\Http\Requests\Admin\AdminFormRequest; class StoreNestFormRequest extends AdminFormRequest { - /** - * @return array - */ - public function rules() + public function rules(): array { return [ 'name' => 'required|string|min:1|max:191', diff --git a/app/Http/Requests/Admin/Node/AllocationAliasFormRequest.php b/app/Http/Requests/Admin/Node/AllocationAliasFormRequest.php index 2552114ab..f388203a0 100644 --- a/app/Http/Requests/Admin/Node/AllocationAliasFormRequest.php +++ b/app/Http/Requests/Admin/Node/AllocationAliasFormRequest.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Http\Requests\Admin\Node; @@ -13,10 +6,7 @@ use Pterodactyl\Http\Requests\Admin\AdminFormRequest; class AllocationAliasFormRequest extends AdminFormRequest { - /** - * @return array - */ - public function rules() + public function rules(): array { return [ 'alias' => 'present|nullable|string', diff --git a/app/Http/Requests/Admin/Node/AllocationFormRequest.php b/app/Http/Requests/Admin/Node/AllocationFormRequest.php index 3c580c026..641b8d08a 100644 --- a/app/Http/Requests/Admin/Node/AllocationFormRequest.php +++ b/app/Http/Requests/Admin/Node/AllocationFormRequest.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Http\Requests\Admin\Node; @@ -13,10 +6,7 @@ use Pterodactyl\Http\Requests\Admin\AdminFormRequest; class AllocationFormRequest extends AdminFormRequest { - /** - * @return array - */ - public function rules() + public function rules(): array { return [ 'allocation_ip' => 'required|string', diff --git a/app/Http/Requests/Admin/Node/NodeFormRequest.php b/app/Http/Requests/Admin/Node/NodeFormRequest.php index c4a294cad..f95189f29 100644 --- a/app/Http/Requests/Admin/Node/NodeFormRequest.php +++ b/app/Http/Requests/Admin/Node/NodeFormRequest.php @@ -11,7 +11,7 @@ class NodeFormRequest extends AdminFormRequest /** * Get rules to apply to data in this request. */ - public function rules() + public function rules(): array { if ($this->method() === 'PATCH') { return Node::getRulesForUpdate($this->route()->parameter('node')); diff --git a/app/Http/Requests/Admin/ServerFormRequest.php b/app/Http/Requests/Admin/ServerFormRequest.php index e20210b35..bf461dc95 100644 --- a/app/Http/Requests/Admin/ServerFormRequest.php +++ b/app/Http/Requests/Admin/ServerFormRequest.php @@ -4,15 +4,14 @@ namespace Pterodactyl\Http\Requests\Admin; use Pterodactyl\Models\Server; use Illuminate\Validation\Rule; +use Illuminate\Validation\Validator; class ServerFormRequest extends AdminFormRequest { /** * Rules to be applied to this request. - * - * @return array */ - public function rules() + public function rules(): array { $rules = Server::getRules(); $rules['description'][] = 'nullable'; @@ -23,14 +22,12 @@ class ServerFormRequest extends AdminFormRequest /** * Run validation after the rules above have been applied. - * - * @param \Illuminate\Validation\Validator $validator */ - public function withValidator($validator) + public function withValidator(Validator $validator): void { $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 +39,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 +51,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/Settings/AdvancedSettingsFormRequest.php b/app/Http/Requests/Admin/Settings/AdvancedSettingsFormRequest.php index c53825ffe..17608d9f2 100644 --- a/app/Http/Requests/Admin/Settings/AdvancedSettingsFormRequest.php +++ b/app/Http/Requests/Admin/Settings/AdvancedSettingsFormRequest.php @@ -7,11 +7,9 @@ use Pterodactyl\Http\Requests\Admin\AdminFormRequest; class AdvancedSettingsFormRequest extends AdminFormRequest { /** - * Return all of the rules to apply to this request's data. - * - * @return array + * Return all the rules to apply to this request's data. */ - public function rules() + public function rules(): array { return [ 'recaptcha:enabled' => 'required|in:true,false', @@ -36,10 +34,7 @@ class AdvancedSettingsFormRequest extends AdminFormRequest ]; } - /** - * @return array - */ - public function attributes() + public function attributes(): array { return [ 'recaptcha:enabled' => 'reCAPTCHA Enabled', diff --git a/app/Http/Requests/Admin/Settings/BaseSettingsFormRequest.php b/app/Http/Requests/Admin/Settings/BaseSettingsFormRequest.php index 05d0f9d48..8a24dd0ac 100644 --- a/app/Http/Requests/Admin/Settings/BaseSettingsFormRequest.php +++ b/app/Http/Requests/Admin/Settings/BaseSettingsFormRequest.php @@ -10,10 +10,7 @@ class BaseSettingsFormRequest extends AdminFormRequest { use AvailableLanguages; - /** - * @return array - */ - public function rules() + public function rules(): array { return [ 'app:name' => 'required|string|max:191', @@ -22,10 +19,7 @@ class BaseSettingsFormRequest extends AdminFormRequest ]; } - /** - * @return array - */ - public function attributes() + public function attributes(): array { return [ 'app:name' => 'Company Name', diff --git a/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php b/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php index 0ad24181a..4475b08fd 100644 --- a/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php +++ b/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php @@ -9,10 +9,8 @@ class MailSettingsFormRequest extends AdminFormRequest { /** * Return rules to validate mail settings POST data against. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'mail:host' => 'required|string', @@ -28,12 +26,8 @@ class MailSettingsFormRequest extends AdminFormRequest /** * Override the default normalization function for this type of request * as we need to accept empty values on the keys. - * - * @param array $only - * - * @return array */ - public function normalize(array $only = null) + public function normalize(array $only = null): array { $keys = array_flip(array_keys($this->rules())); diff --git a/app/Http/Requests/Admin/UserFormRequest.php b/app/Http/Requests/Admin/UserFormRequest.php index 4203e65d9..ae5b5f346 100644 --- a/app/Http/Requests/Admin/UserFormRequest.php +++ b/app/Http/Requests/Admin/UserFormRequest.php @@ -11,7 +11,7 @@ class UserFormRequest extends AdminFormRequest * Rules to apply to requests for updating or creating a user * in the Admin CP. */ - public function rules() + public function rules(): array { return Collection::make( User::getRulesForUpdate($this->route()->parameter('user')) diff --git a/app/Http/Requests/Api/Application/Allocations/DeleteAllocationRequest.php b/app/Http/Requests/Api/Application/Allocations/DeleteAllocationRequest.php index 900534858..6529a9a5a 100644 --- a/app/Http/Requests/Api/Application/Allocations/DeleteAllocationRequest.php +++ b/app/Http/Requests/Api/Application/Allocations/DeleteAllocationRequest.php @@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class DeleteAllocationRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_ALLOCATIONS; + protected ?string $resource = AdminAcl::RESOURCE_ALLOCATIONS; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; + protected int $permission = AdminAcl::WRITE; } diff --git a/app/Http/Requests/Api/Application/Allocations/GetAllocationsRequest.php b/app/Http/Requests/Api/Application/Allocations/GetAllocationsRequest.php index 50afcf960..f03223f2d 100644 --- a/app/Http/Requests/Api/Application/Allocations/GetAllocationsRequest.php +++ b/app/Http/Requests/Api/Application/Allocations/GetAllocationsRequest.php @@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetAllocationsRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_ALLOCATIONS; + protected ?string $resource = AdminAcl::RESOURCE_ALLOCATIONS; - /** - * @var int - */ - protected $permission = AdminAcl::READ; + protected int $permission = AdminAcl::READ; } diff --git a/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php b/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php index d1f5415a6..a7e0c4da2 100644 --- a/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php +++ b/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php @@ -7,15 +7,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class StoreAllocationRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_ALLOCATIONS; + protected ?string $resource = AdminAcl::RESOURCE_ALLOCATIONS; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; + protected int $permission = AdminAcl::WRITE; public function rules(): array { @@ -27,10 +21,7 @@ class StoreAllocationRequest extends ApplicationApiRequest ]; } - /** - * @return array - */ - public function validated() + public function validated($key = null, $default = null): array { $data = parent::validated(); diff --git a/app/Http/Requests/Api/Application/ApplicationApiRequest.php b/app/Http/Requests/Api/Application/ApplicationApiRequest.php index f3960b306..2e0ed133a 100644 --- a/app/Http/Requests/Api/Application/ApplicationApiRequest.php +++ b/app/Http/Requests/Api/Application/ApplicationApiRequest.php @@ -16,18 +16,14 @@ abstract class ApplicationApiRequest extends FormRequest /** * The resource that should be checked when performing the authorization * function for this request. - * - * @var string|null */ - protected $resource; + protected ?string $resource; /** * The permission level that a given API key should have for accessing * the defined $resource during the request cycle. - * - * @var int */ - protected $permission = AdminAcl::NONE; + protected int $permission = AdminAcl::NONE; /** * Determine if the current user is authorized to perform @@ -80,7 +76,7 @@ abstract class ApplicationApiRequest extends FormRequest * @param class-string $expect * * @return T - * @noinspection PhpUndefinedClassInspection + * * @noinspection PhpDocSignatureInspection */ public function parameter(string $key, string $expect) diff --git a/app/Http/Requests/Api/Application/Locations/DeleteLocationRequest.php b/app/Http/Requests/Api/Application/Locations/DeleteLocationRequest.php index 880a58d1a..3c41e1166 100644 --- a/app/Http/Requests/Api/Application/Locations/DeleteLocationRequest.php +++ b/app/Http/Requests/Api/Application/Locations/DeleteLocationRequest.php @@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class DeleteLocationRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_LOCATIONS; + protected ?string $resource = AdminAcl::RESOURCE_LOCATIONS; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; + protected int $permission = AdminAcl::WRITE; } diff --git a/app/Http/Requests/Api/Application/Locations/GetLocationsRequest.php b/app/Http/Requests/Api/Application/Locations/GetLocationsRequest.php index 5edf00462..65157dc47 100644 --- a/app/Http/Requests/Api/Application/Locations/GetLocationsRequest.php +++ b/app/Http/Requests/Api/Application/Locations/GetLocationsRequest.php @@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetLocationsRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_LOCATIONS; + protected ?string $resource = AdminAcl::RESOURCE_LOCATIONS; - /** - * @var int - */ - protected $permission = AdminAcl::READ; + protected int $permission = AdminAcl::READ; } diff --git a/app/Http/Requests/Api/Application/Locations/StoreLocationRequest.php b/app/Http/Requests/Api/Application/Locations/StoreLocationRequest.php index c5586ead1..cf0b12629 100644 --- a/app/Http/Requests/Api/Application/Locations/StoreLocationRequest.php +++ b/app/Http/Requests/Api/Application/Locations/StoreLocationRequest.php @@ -8,15 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class StoreLocationRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_LOCATIONS; + protected ?string $resource = AdminAcl::RESOURCE_LOCATIONS; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; + protected int $permission = AdminAcl::WRITE; /** * Rules to validate the request against. @@ -31,10 +25,8 @@ class StoreLocationRequest extends ApplicationApiRequest /** * Rename fields to be more clear in error messages. - * - * @return array */ - public function attributes() + public function attributes(): array { return [ 'long' => 'Location Description', diff --git a/app/Http/Requests/Api/Application/Nests/Eggs/GetEggRequest.php b/app/Http/Requests/Api/Application/Nests/Eggs/GetEggRequest.php index e2ae0fc80..7c6eb5412 100644 --- a/app/Http/Requests/Api/Application/Nests/Eggs/GetEggRequest.php +++ b/app/Http/Requests/Api/Application/Nests/Eggs/GetEggRequest.php @@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetEggRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_EGGS; + protected ?string $resource = AdminAcl::RESOURCE_EGGS; - /** - * @var int - */ - protected $permission = AdminAcl::READ; + protected int $permission = AdminAcl::READ; } diff --git a/app/Http/Requests/Api/Application/Nests/Eggs/GetEggsRequest.php b/app/Http/Requests/Api/Application/Nests/Eggs/GetEggsRequest.php index a6aadf904..b504af5b8 100644 --- a/app/Http/Requests/Api/Application/Nests/Eggs/GetEggsRequest.php +++ b/app/Http/Requests/Api/Application/Nests/Eggs/GetEggsRequest.php @@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetEggsRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_EGGS; + protected ?string $resource = AdminAcl::RESOURCE_EGGS; - /** - * @var int - */ - protected $permission = AdminAcl::READ; + protected int $permission = AdminAcl::READ; } diff --git a/app/Http/Requests/Api/Application/Nests/GetNestsRequest.php b/app/Http/Requests/Api/Application/Nests/GetNestsRequest.php index b90c45748..b4a990f9f 100644 --- a/app/Http/Requests/Api/Application/Nests/GetNestsRequest.php +++ b/app/Http/Requests/Api/Application/Nests/GetNestsRequest.php @@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetNestsRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_NESTS; + protected ?string $resource = AdminAcl::RESOURCE_NESTS; - /** - * @var int - */ - protected $permission = AdminAcl::READ; + protected int $permission = AdminAcl::READ; } diff --git a/app/Http/Requests/Api/Application/Nodes/DeleteNodeRequest.php b/app/Http/Requests/Api/Application/Nodes/DeleteNodeRequest.php index 5b9bebf27..01f503f3f 100644 --- a/app/Http/Requests/Api/Application/Nodes/DeleteNodeRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/DeleteNodeRequest.php @@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class DeleteNodeRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_NODES; + protected ?string $resource = AdminAcl::RESOURCE_NODES; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; + protected int $permission = AdminAcl::WRITE; } diff --git a/app/Http/Requests/Api/Application/Nodes/GetDeployableNodesRequest.php b/app/Http/Requests/Api/Application/Nodes/GetDeployableNodesRequest.php index 0eae14008..fd077ecd5 100644 --- a/app/Http/Requests/Api/Application/Nodes/GetDeployableNodesRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/GetDeployableNodesRequest.php @@ -4,9 +4,6 @@ namespace Pterodactyl\Http\Requests\Api\Application\Nodes; class GetDeployableNodesRequest extends GetNodesRequest { - /** - * @return string[] - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Application/Nodes/GetNodesRequest.php b/app/Http/Requests/Api/Application/Nodes/GetNodesRequest.php index fc5f5a38e..5c8524b94 100644 --- a/app/Http/Requests/Api/Application/Nodes/GetNodesRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/GetNodesRequest.php @@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetNodesRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_NODES; + protected ?string $resource = AdminAcl::RESOURCE_NODES; - /** - * @var int - */ - protected $permission = AdminAcl::READ; + protected int $permission = AdminAcl::READ; } diff --git a/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php b/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php index 8c05c5a37..bc559083e 100644 --- a/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php @@ -8,15 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class StoreNodeRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_NODES; + protected ?string $resource = AdminAcl::RESOURCE_NODES; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; + protected int $permission = AdminAcl::WRITE; /** * Validation rules to apply to this request. @@ -47,10 +41,8 @@ class StoreNodeRequest extends ApplicationApiRequest /** * Fields to rename for clarity in the API response. - * - * @return array */ - public function attributes() + public function attributes(): array { return [ 'daemon_base' => 'Daemon Base Path', @@ -63,10 +55,8 @@ class StoreNodeRequest extends ApplicationApiRequest /** * Change the formatting of some data keys in the validated response data * to match what the application expects in the services. - * - * @return array */ - public function validated() + public function validated($key = null, $default = null): array { $response = parent::validated(); $response['daemonListen'] = $response['daemon_listen']; diff --git a/app/Http/Requests/Api/Application/Servers/Databases/GetServerDatabaseRequest.php b/app/Http/Requests/Api/Application/Servers/Databases/GetServerDatabaseRequest.php index 776162440..01df4af32 100644 --- a/app/Http/Requests/Api/Application/Servers/Databases/GetServerDatabaseRequest.php +++ b/app/Http/Requests/Api/Application/Servers/Databases/GetServerDatabaseRequest.php @@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetServerDatabaseRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_SERVER_DATABASES; + protected ?string $resource = AdminAcl::RESOURCE_SERVER_DATABASES; - /** - * @var int - */ - protected $permission = AdminAcl::READ; + protected int $permission = AdminAcl::READ; } diff --git a/app/Http/Requests/Api/Application/Servers/Databases/GetServerDatabasesRequest.php b/app/Http/Requests/Api/Application/Servers/Databases/GetServerDatabasesRequest.php index 3e6cfc6fe..ce72bbc20 100644 --- a/app/Http/Requests/Api/Application/Servers/Databases/GetServerDatabasesRequest.php +++ b/app/Http/Requests/Api/Application/Servers/Databases/GetServerDatabasesRequest.php @@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetServerDatabasesRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_SERVER_DATABASES; + protected ?string $resource = AdminAcl::RESOURCE_SERVER_DATABASES; - /** - * @var int - */ - protected $permission = AdminAcl::READ; + protected int $permission = AdminAcl::READ; } diff --git a/app/Http/Requests/Api/Application/Servers/Databases/ServerDatabaseWriteRequest.php b/app/Http/Requests/Api/Application/Servers/Databases/ServerDatabaseWriteRequest.php index 917a5313f..66cec82c3 100644 --- a/app/Http/Requests/Api/Application/Servers/Databases/ServerDatabaseWriteRequest.php +++ b/app/Http/Requests/Api/Application/Servers/Databases/ServerDatabaseWriteRequest.php @@ -6,8 +6,5 @@ use Pterodactyl\Services\Acl\Api\AdminAcl; class ServerDatabaseWriteRequest extends GetServerDatabasesRequest { - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; + protected int $permission = AdminAcl::WRITE; } diff --git a/app/Http/Requests/Api/Application/Servers/Databases/StoreServerDatabaseRequest.php b/app/Http/Requests/Api/Application/Servers/Databases/StoreServerDatabaseRequest.php index c37de870d..d53a0a75e 100644 --- a/app/Http/Requests/Api/Application/Servers/Databases/StoreServerDatabaseRequest.php +++ b/app/Http/Requests/Api/Application/Servers/Databases/StoreServerDatabaseRequest.php @@ -12,15 +12,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class StoreServerDatabaseRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_SERVER_DATABASES; + protected ?string $resource = AdminAcl::RESOURCE_SERVER_DATABASES; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; + protected int $permission = AdminAcl::WRITE; /** * Validation rules for database creation. @@ -46,10 +40,8 @@ class StoreServerDatabaseRequest extends ApplicationApiRequest /** * Return data formatted in the correct format for the service to consume. - * - * @return array */ - public function validated() + public function validated($key = null, $default = null): array { return [ 'database' => $this->input('database'), @@ -60,10 +52,8 @@ class StoreServerDatabaseRequest extends ApplicationApiRequest /** * Format error messages in a more understandable format for API output. - * - * @return array */ - public function attributes() + public function attributes(): array { return [ 'host' => 'Database Host Server ID', diff --git a/app/Http/Requests/Api/Application/Servers/GetExternalServerRequest.php b/app/Http/Requests/Api/Application/Servers/GetExternalServerRequest.php index 39ec449d2..50c9dabf8 100644 --- a/app/Http/Requests/Api/Application/Servers/GetExternalServerRequest.php +++ b/app/Http/Requests/Api/Application/Servers/GetExternalServerRequest.php @@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetExternalServerRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_SERVERS; + protected ?string $resource = AdminAcl::RESOURCE_SERVERS; - /** - * @var int - */ - protected $permission = AdminAcl::READ; + protected int $permission = AdminAcl::READ; } diff --git a/app/Http/Requests/Api/Application/Servers/GetServerRequest.php b/app/Http/Requests/Api/Application/Servers/GetServerRequest.php index 82d12687c..63c4ea86a 100644 --- a/app/Http/Requests/Api/Application/Servers/GetServerRequest.php +++ b/app/Http/Requests/Api/Application/Servers/GetServerRequest.php @@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetServerRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_SERVERS; + protected ?string $resource = AdminAcl::RESOURCE_SERVERS; - /** - * @var int - */ - protected $permission = AdminAcl::READ; + protected int $permission = AdminAcl::READ; } diff --git a/app/Http/Requests/Api/Application/Servers/ServerWriteRequest.php b/app/Http/Requests/Api/Application/Servers/ServerWriteRequest.php index 07c201336..df2d76cd3 100644 --- a/app/Http/Requests/Api/Application/Servers/ServerWriteRequest.php +++ b/app/Http/Requests/Api/Application/Servers/ServerWriteRequest.php @@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class ServerWriteRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_SERVERS; + protected ?string $resource = AdminAcl::RESOURCE_SERVERS; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; + protected int $permission = AdminAcl::WRITE; } diff --git a/app/Http/Requests/Api/Application/Servers/StoreServerRequest.php b/app/Http/Requests/Api/Application/Servers/StoreServerRequest.php index ab2ec52f8..a9d0ecbed 100644 --- a/app/Http/Requests/Api/Application/Servers/StoreServerRequest.php +++ b/app/Http/Requests/Api/Application/Servers/StoreServerRequest.php @@ -11,15 +11,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class StoreServerRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_SERVERS; + protected ?string $resource = AdminAcl::RESOURCE_SERVERS; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; + protected int $permission = AdminAcl::WRITE; /** * Rules to be applied to this request. @@ -73,10 +67,8 @@ class StoreServerRequest extends ApplicationApiRequest /** * Normalize the data into a format that can be consumed by the service. - * - * @return array */ - public function validated() + public function validated($key = null, $default = null): array { $data = parent::validated(); @@ -119,7 +111,7 @@ class StoreServerRequest extends ApplicationApiRequest $query->whereNull('server_id'); }), ], function ($input) { - return !($input->deploy); + return !$input->deploy; }); $validator->sometimes('allocation.additional.*', [ @@ -128,7 +120,7 @@ class StoreServerRequest extends ApplicationApiRequest $query->whereNull('server_id'); }), ], function ($input) { - return !($input->deploy); + return !$input->deploy; }); $validator->sometimes('deploy.locations', 'present', function ($input) { @@ -142,10 +134,8 @@ class StoreServerRequest extends ApplicationApiRequest /** * Return a deployment object that can be passed to the server creation service. - * - * @return \Pterodactyl\Models\Objects\DeploymentObject|null */ - public function getDeploymentObject() + public function getDeploymentObject(): ?DeploymentObject { if (is_null($this->input('deploy'))) { return null; diff --git a/app/Http/Requests/Api/Application/Servers/UpdateServerBuildConfigurationRequest.php b/app/Http/Requests/Api/Application/Servers/UpdateServerBuildConfigurationRequest.php index f043f82b4..f1c977f11 100644 --- a/app/Http/Requests/Api/Application/Servers/UpdateServerBuildConfigurationRequest.php +++ b/app/Http/Requests/Api/Application/Servers/UpdateServerBuildConfigurationRequest.php @@ -51,10 +51,8 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest /** * Convert the allocation field into the expected format for the service handler. - * - * @return array */ - public function validated() + public function validated($key = null, $default = null): array { $data = parent::validated(); @@ -78,10 +76,8 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest /** * Custom attributes to use in error message responses. - * - * @return array */ - public function attributes() + public function attributes(): array { return [ 'add_allocations' => 'allocations to add', @@ -99,11 +95,9 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest * compatability with the old API endpoint while also supporting a more correct API * call. * - * @return array - * * @see https://github.com/pterodactyl/panel/issues/1500 */ - protected function requiredToOptional(string $field, array $rules, bool $limits = false) + protected function requiredToOptional(string $field, array $rules, bool $limits = false): array { 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 3540b88cf..aecc1cf02 100644 --- a/app/Http/Requests/Api/Application/Servers/UpdateServerDetailsRequest.php +++ b/app/Http/Requests/Api/Application/Servers/UpdateServerDetailsRequest.php @@ -25,7 +25,7 @@ class UpdateServerDetailsRequest extends ServerWriteRequest * Convert the posted data into the correct format that is expected * by the application. */ - public function validated(): array + public function validated($key = null, $default = null): array { return [ 'external_id' => $this->input('external_id'), @@ -36,7 +36,7 @@ class UpdateServerDetailsRequest extends ServerWriteRequest } /** - * Rename some of the attributes in error messages to clarify the field + * Rename some attributes in error messages to clarify the field * being discussed. */ 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 c9b3c6ad0..985b10a6f 100644 --- a/app/Http/Requests/Api/Application/Servers/UpdateServerStartupRequest.php +++ b/app/Http/Requests/Api/Application/Servers/UpdateServerStartupRequest.php @@ -8,15 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class UpdateServerStartupRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_SERVERS; + protected ?string $resource = AdminAcl::RESOURCE_SERVERS; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; + protected int $permission = AdminAcl::WRITE; /** * Validation rules to run the input against. @@ -36,10 +30,8 @@ class UpdateServerStartupRequest extends ApplicationApiRequest /** * Return the validated data in a format that is expected by the service. - * - * @return array */ - public function validated() + public function validated($key = null, $default = null): array { $data = parent::validated(); diff --git a/app/Http/Requests/Api/Application/Users/DeleteUserRequest.php b/app/Http/Requests/Api/Application/Users/DeleteUserRequest.php index c7592e693..5e840a1c0 100644 --- a/app/Http/Requests/Api/Application/Users/DeleteUserRequest.php +++ b/app/Http/Requests/Api/Application/Users/DeleteUserRequest.php @@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class DeleteUserRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_USERS; + protected ?string $resource = AdminAcl::RESOURCE_USERS; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; + protected int $permission = AdminAcl::WRITE; } diff --git a/app/Http/Requests/Api/Application/Users/GetExternalUserRequest.php b/app/Http/Requests/Api/Application/Users/GetExternalUserRequest.php index a3bd7c9cf..0f44aed3f 100644 --- a/app/Http/Requests/Api/Application/Users/GetExternalUserRequest.php +++ b/app/Http/Requests/Api/Application/Users/GetExternalUserRequest.php @@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetExternalUserRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_USERS; + protected ?string $resource = AdminAcl::RESOURCE_USERS; - /** - * @var int - */ - protected $permission = AdminAcl::READ; + protected int $permission = AdminAcl::READ; } diff --git a/app/Http/Requests/Api/Application/Users/GetUsersRequest.php b/app/Http/Requests/Api/Application/Users/GetUsersRequest.php index 8736a8e9d..71ea30d33 100644 --- a/app/Http/Requests/Api/Application/Users/GetUsersRequest.php +++ b/app/Http/Requests/Api/Application/Users/GetUsersRequest.php @@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetUsersRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = Acl::RESOURCE_USERS; + protected ?string $resource = Acl::RESOURCE_USERS; - /** - * @var int - */ - protected $permission = Acl::READ; + protected int $permission = Acl::READ; } diff --git a/app/Http/Requests/Api/Application/Users/StoreUserRequest.php b/app/Http/Requests/Api/Application/Users/StoreUserRequest.php index 10a2d6b28..569dba340 100644 --- a/app/Http/Requests/Api/Application/Users/StoreUserRequest.php +++ b/app/Http/Requests/Api/Application/Users/StoreUserRequest.php @@ -8,15 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class StoreUserRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_USERS; + protected ?string $resource = AdminAcl::RESOURCE_USERS; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; + protected int $permission = AdminAcl::WRITE; /** * Return the validation rules for this request. @@ -40,10 +34,7 @@ class StoreUserRequest extends ApplicationApiRequest return $response; } - /** - * @return array - */ - public function validated() + public function validated($key = null, $default = null): array { $data = parent::validated(); @@ -57,10 +48,8 @@ class StoreUserRequest extends ApplicationApiRequest /** * Rename some fields to be more user friendly. - * - * @return array */ - public function attributes() + public function attributes(): array { return [ 'external_id' => 'Third Party Identifier', diff --git a/app/Http/Requests/Api/Client/Servers/Backups/StoreBackupRequest.php b/app/Http/Requests/Api/Client/Servers/Backups/StoreBackupRequest.php index 5fbdaf728..2871c039c 100644 --- a/app/Http/Requests/Api/Client/Servers/Backups/StoreBackupRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Backups/StoreBackupRequest.php @@ -7,10 +7,7 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class StoreBackupRequest extends ClientApiRequest { - /** - * @return string - */ - public function permission() + public function permission(): string { return Permission::ACTION_BACKUP_CREATE; } diff --git a/app/Http/Requests/Api/Client/Servers/Databases/StoreDatabaseRequest.php b/app/Http/Requests/Api/Client/Servers/Databases/StoreDatabaseRequest.php index 5258062f7..be4f4a719 100644 --- a/app/Http/Requests/Api/Client/Servers/Databases/StoreDatabaseRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Databases/StoreDatabaseRequest.php @@ -43,10 +43,7 @@ class StoreDatabaseRequest extends ClientApiRequest implements ClientPermissions ]; } - /** - * @return array - */ - public function messages() + public function messages(): array { return [ 'database.unique' => 'The database name you have selected is already in use by this server.', diff --git a/app/Http/Requests/Api/Client/Servers/Files/ListFilesRequest.php b/app/Http/Requests/Api/Client/Servers/Files/ListFilesRequest.php index cc66d69b8..25443148f 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/ListFilesRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/ListFilesRequest.php @@ -9,7 +9,7 @@ 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. + * the files that exist for a given server. */ public function permission(): string { diff --git a/app/Http/Requests/Api/Client/Servers/Files/PullFileRequest.php b/app/Http/Requests/Api/Client/Servers/Files/PullFileRequest.php index 710ffcc7d..5f7648247 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/PullFileRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/PullFileRequest.php @@ -13,9 +13,6 @@ class PullFileRequest extends ClientApiRequest implements ClientPermissionsReque return Permission::ACTION_FILE_CREATE; } - /** - * @return string[] - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Files/UploadFileRequest.php b/app/Http/Requests/Api/Client/Servers/Files/UploadFileRequest.php index 6808a5497..a591fdf68 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/UploadFileRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/UploadFileRequest.php @@ -7,10 +7,7 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class UploadFileRequest extends ClientApiRequest { - /** - * @return string - */ - public function permission() + public function permission(): string { return Permission::ACTION_FILE_CREATE; } diff --git a/app/Http/Requests/Api/Client/Servers/Settings/ReinstallServerRequest.php b/app/Http/Requests/Api/Client/Servers/Settings/ReinstallServerRequest.php index 9edc8ad1c..63f01dbae 100644 --- a/app/Http/Requests/Api/Client/Servers/Settings/ReinstallServerRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Settings/ReinstallServerRequest.php @@ -7,10 +7,7 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class ReinstallServerRequest extends ClientApiRequest { - /** - * @return string - */ - public function permission() + public function permission(): string { return Permission::ACTION_SETTINGS_REINSTALL; } diff --git a/app/Http/Requests/Api/Client/Servers/Settings/SetDockerImageRequest.php b/app/Http/Requests/Api/Client/Servers/Settings/SetDockerImageRequest.php index abe5d0436..f618de370 100644 --- a/app/Http/Requests/Api/Client/Servers/Settings/SetDockerImageRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Settings/SetDockerImageRequest.php @@ -16,9 +16,6 @@ class SetDockerImageRequest extends ClientApiRequest implements ClientPermission return Permission::ACTION_STARTUP_DOCKER_IMAGE; } - /** - * @return array[] - */ public function rules(): array { /** @var \Pterodactyl\Models\Server $server */ diff --git a/app/Http/Requests/Api/Client/Servers/Startup/GetStartupRequest.php b/app/Http/Requests/Api/Client/Servers/Startup/GetStartupRequest.php index 25ab2ce21..fee92bcbc 100644 --- a/app/Http/Requests/Api/Client/Servers/Startup/GetStartupRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Startup/GetStartupRequest.php @@ -7,10 +7,7 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class GetStartupRequest extends ClientApiRequest { - /** - * @return string - */ - public function permission() + public function permission(): string { return Permission::ACTION_STARTUP_READ; } diff --git a/app/Http/Requests/Api/Client/Servers/Startup/UpdateStartupVariableRequest.php b/app/Http/Requests/Api/Client/Servers/Startup/UpdateStartupVariableRequest.php index b46e6ea9a..2c32f4df6 100644 --- a/app/Http/Requests/Api/Client/Servers/Startup/UpdateStartupVariableRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Startup/UpdateStartupVariableRequest.php @@ -7,18 +7,13 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class UpdateStartupVariableRequest extends ClientApiRequest { - /** - * @return string - */ - public function permission() + public function permission(): string { return Permission::ACTION_STARTUP_UPDATE; } /** * The actual validation of the variable's value will happen inside the controller. - * - * @return array|string[] */ public function rules(): array { diff --git a/app/Http/Requests/Api/Client/Servers/Subusers/DeleteSubuserRequest.php b/app/Http/Requests/Api/Client/Servers/Subusers/DeleteSubuserRequest.php index ef0a09aaa..eabd84e61 100644 --- a/app/Http/Requests/Api/Client/Servers/Subusers/DeleteSubuserRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Subusers/DeleteSubuserRequest.php @@ -6,10 +6,7 @@ use Pterodactyl\Models\Permission; class DeleteSubuserRequest extends SubuserRequest { - /** - * @return string - */ - public function permission() + public function permission(): string { return Permission::ACTION_USER_DELETE; } diff --git a/app/Http/Requests/Api/Client/Servers/Subusers/StoreSubuserRequest.php b/app/Http/Requests/Api/Client/Servers/Subusers/StoreSubuserRequest.php index 5bc93ab2f..6e8722516 100644 --- a/app/Http/Requests/Api/Client/Servers/Subusers/StoreSubuserRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Subusers/StoreSubuserRequest.php @@ -6,10 +6,7 @@ use Pterodactyl\Models\Permission; class StoreSubuserRequest extends SubuserRequest { - /** - * @return string - */ - public function permission() + public function permission(): string { return Permission::ACTION_USER_CREATE; } diff --git a/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php b/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php index 5a20084d3..7c4fab9d2 100644 --- a/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php @@ -4,16 +4,14 @@ namespace Pterodactyl\Http\Requests\Api\Client\Servers\Subusers; use Illuminate\Http\Request; use Pterodactyl\Models\User; +use Pterodactyl\Models\Subuser; use Pterodactyl\Exceptions\Http\HttpForbiddenException; use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; use Pterodactyl\Services\Servers\GetUserPermissionsService; abstract class SubuserRequest extends ClientApiRequest { - /** - * @var \Pterodactyl\Models\Subuser|null - */ - protected $model; + protected ?Subuser $model; /** * Authorize the request and ensure that a user is not trying to modify themselves. diff --git a/app/Http/Requests/Api/Client/Servers/Subusers/UpdateSubuserRequest.php b/app/Http/Requests/Api/Client/Servers/Subusers/UpdateSubuserRequest.php index 997b2daee..bd8929a98 100644 --- a/app/Http/Requests/Api/Client/Servers/Subusers/UpdateSubuserRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Subusers/UpdateSubuserRequest.php @@ -6,10 +6,7 @@ use Pterodactyl\Models\Permission; class UpdateSubuserRequest extends SubuserRequest { - /** - * @return string - */ - public function permission() + public function permission(): string { return Permission::ACTION_USER_UPDATE; } diff --git a/app/Http/Requests/Api/Remote/ActivityEventRequest.php b/app/Http/Requests/Api/Remote/ActivityEventRequest.php index 795fe32e6..32ad11ad3 100644 --- a/app/Http/Requests/Api/Remote/ActivityEventRequest.php +++ b/app/Http/Requests/Api/Remote/ActivityEventRequest.php @@ -27,9 +27,7 @@ class ActivityEventRequest extends FormRequest } /** - * Returns all of the unique server UUIDs that were recieved in this request. - * - * @return string[] + * Returns all the unique server UUIDs that were received in this request. */ public function servers(): array { @@ -37,9 +35,7 @@ class ActivityEventRequest extends FormRequest } /** - * Returns all of the unique user UUIDs that were submitted in this request. - * - * @return string[] + * Returns all the unique user UUIDs that were submitted in this request. */ public function users(): array { diff --git a/app/Http/Requests/Api/Remote/AuthenticateWebsocketDetailsRequest.php b/app/Http/Requests/Api/Remote/AuthenticateWebsocketDetailsRequest.php index 885e19239..1bae01dd7 100644 --- a/app/Http/Requests/Api/Remote/AuthenticateWebsocketDetailsRequest.php +++ b/app/Http/Requests/Api/Remote/AuthenticateWebsocketDetailsRequest.php @@ -6,18 +6,12 @@ use Illuminate\Foundation\Http\FormRequest; class AuthenticateWebsocketDetailsRequest extends FormRequest { - /** - * @return bool - */ - public function authorize() + public function authorize(): bool { return true; } - /** - * @return array - */ - public function rules() + public function rules(): array { return [ 'server_uuid' => 'required|string', diff --git a/app/Http/Requests/Api/Remote/InstallationDataRequest.php b/app/Http/Requests/Api/Remote/InstallationDataRequest.php index 0737d71b4..c5d1973ec 100644 --- a/app/Http/Requests/Api/Remote/InstallationDataRequest.php +++ b/app/Http/Requests/Api/Remote/InstallationDataRequest.php @@ -6,18 +6,12 @@ use Illuminate\Foundation\Http\FormRequest; class InstallationDataRequest extends FormRequest { - /** - * @return bool - */ - public function authorize() + public function authorize(): bool { return true; } - /** - * @return array - */ - public function rules() + public function rules(): array { return [ 'successful' => 'present|boolean', diff --git a/app/Http/Requests/Api/Remote/ReportBackupCompleteRequest.php b/app/Http/Requests/Api/Remote/ReportBackupCompleteRequest.php index dcf7435c7..d0dd3090b 100644 --- a/app/Http/Requests/Api/Remote/ReportBackupCompleteRequest.php +++ b/app/Http/Requests/Api/Remote/ReportBackupCompleteRequest.php @@ -6,10 +6,7 @@ use Illuminate\Foundation\Http\FormRequest; class ReportBackupCompleteRequest extends FormRequest { - /** - * @return string[] - */ - public function rules() + public function rules(): array { return [ 'successful' => 'required|boolean', diff --git a/app/Http/Requests/Api/Remote/SftpAuthenticationFormRequest.php b/app/Http/Requests/Api/Remote/SftpAuthenticationFormRequest.php index f1e06cb3f..964c27974 100644 --- a/app/Http/Requests/Api/Remote/SftpAuthenticationFormRequest.php +++ b/app/Http/Requests/Api/Remote/SftpAuthenticationFormRequest.php @@ -8,20 +8,16 @@ class SftpAuthenticationFormRequest extends FormRequest { /** * Authenticate the request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Rules to apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'type' => ['nullable', 'in:password,public_key'], @@ -33,10 +29,8 @@ class SftpAuthenticationFormRequest extends FormRequest /** * Return only the fields that we are interested in from the request. * This will include empty fields as a null value. - * - * @return array */ - public function normalize() + public function normalize(): array { return $this->only( array_keys($this->rules()) diff --git a/app/Http/Requests/FrontendUserFormRequest.php b/app/Http/Requests/FrontendUserFormRequest.php index b5553dc16..66d13d8c5 100644 --- a/app/Http/Requests/FrontendUserFormRequest.php +++ b/app/Http/Requests/FrontendUserFormRequest.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Http\Requests; @@ -13,14 +6,12 @@ use Illuminate\Foundation\Http\FormRequest; abstract class FrontendUserFormRequest extends FormRequest { - abstract public function rules(); + abstract public function rules(): array; /** * Determine if a user is authorized to access this endpoint. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return !is_null($this->user()); } @@ -28,10 +19,8 @@ abstract class FrontendUserFormRequest extends FormRequest /** * Return only the fields that we are interested in from the request. * This will include empty fields as a null value. - * - * @return array */ - public function normalize() + public function normalize(): array { return $this->only( array_keys($this->rules()) diff --git a/app/Http/Resources/Wings/ServerConfigurationCollection.php b/app/Http/Resources/Wings/ServerConfigurationCollection.php index fe352301c..84fc2f811 100644 --- a/app/Http/Resources/Wings/ServerConfigurationCollection.php +++ b/app/Http/Resources/Wings/ServerConfigurationCollection.php @@ -14,13 +14,9 @@ class ServerConfigurationCollection extends ResourceCollection * Converts a collection of Server models into an array of configuration responses * that can be understood by Wings. Make sure you've properly loaded the required * relationships on the Server models before calling this function, otherwise you'll - * have some serious performance issues from all of the N+1 queries. - * - * @param \Illuminate\Http\Request $request - * - * @return array + * have some serious performance issues from all the N+1 queries. */ - public function toArray($request) + public function toArray($request): array { $egg = Container::getInstance()->make(EggConfigurationService::class); $configuration = Container::getInstance()->make(ServerConfigurationStructureService::class); diff --git a/app/Http/ViewComposers/AssetComposer.php b/app/Http/ViewComposers/AssetComposer.php index 902c237b7..d42f8a80a 100644 --- a/app/Http/ViewComposers/AssetComposer.php +++ b/app/Http/ViewComposers/AssetComposer.php @@ -7,23 +7,17 @@ use Pterodactyl\Services\Helpers\AssetHashService; class AssetComposer { - /** - * @var \Pterodactyl\Services\Helpers\AssetHashService - */ - private $assetHashService; - /** * AssetComposer constructor. */ - public function __construct(AssetHashService $assetHashService) + public function __construct(private AssetHashService $assetHashService) { - $this->assetHashService = $assetHashService; } /** * Provide access to the asset service in the views. */ - public function compose(View $view) + public function compose(View $view): void { $view->with('asset', $this->assetHashService); $view->with('siteConfiguration', [ diff --git a/app/Jobs/Schedule/RunTaskJob.php b/app/Jobs/Schedule/RunTaskJob.php index 0b0f9e075..1e1ab2bb3 100644 --- a/app/Jobs/Schedule/RunTaskJob.php +++ b/app/Jobs/Schedule/RunTaskJob.php @@ -22,24 +22,12 @@ class RunTaskJob extends Job implements ShouldQueue use InteractsWithQueue; use SerializesModels; - /** - * @var \Pterodactyl\Models\Task - */ - public $task; - - /** - * @var bool - */ - public $manualRun; - /** * RunTaskJob constructor. */ - public function __construct(Task $task, $manualRun = false) + public function __construct(public Task $task, public bool $manualRun = false) { - $this->queue = config('pterodactyl.queues.standard'); - $this->task = $task; - $this->manualRun = $manualRun; + $this->queue = 'standard'; } /** diff --git a/app/Listeners/Auth/AuthenticationListener.php b/app/Listeners/Auth/AuthenticationListener.php index 888cf1d93..ec25b19c5 100644 --- a/app/Listeners/Auth/AuthenticationListener.php +++ b/app/Listeners/Auth/AuthenticationListener.php @@ -2,9 +2,9 @@ namespace Pterodactyl\Listeners\Auth; -use Illuminate\Auth\Events\Login; use Pterodactyl\Facades\Activity; use Illuminate\Auth\Events\Failed; +use Pterodactyl\Events\Auth\DirectLogin; use Illuminate\Contracts\Events\Dispatcher; use Pterodactyl\Extensions\Illuminate\Events\Contracts\SubscribesToEvents; @@ -13,10 +13,8 @@ class AuthenticationListener implements SubscribesToEvents /** * Handles an authentication event by logging the user and information about * the request. - * - * @param \Illuminate\Auth\Events\Login|\Illuminate\Auth\Events\Failed $event */ - public function handle($event): void + public function handle(Failed|DirectLogin $event): void { $activity = Activity::withRequestMetadata(); if ($event->user) { @@ -35,6 +33,6 @@ class AuthenticationListener implements SubscribesToEvents public function subscribe(Dispatcher $events): void { $events->listen(Failed::class, self::class); - $events->listen(Login::class, self::class); + $events->listen(DirectLogin::class, self::class); } } diff --git a/app/Listeners/Auth/PasswordResetListener.php b/app/Listeners/Auth/PasswordResetListener.php index 7521a689b..27ed19c69 100644 --- a/app/Listeners/Auth/PasswordResetListener.php +++ b/app/Listeners/Auth/PasswordResetListener.php @@ -15,7 +15,7 @@ class PasswordResetListener $this->request = $request; } - public function handle(PasswordReset $event) + public function handle(PasswordReset $event): void { Activity::event('event:password-reset') ->withRequestMetadata() diff --git a/app/Listeners/Auth/TwoFactorListener.php b/app/Listeners/Auth/TwoFactorListener.php index b9ab4c19a..91d920887 100644 --- a/app/Listeners/Auth/TwoFactorListener.php +++ b/app/Listeners/Auth/TwoFactorListener.php @@ -7,7 +7,7 @@ use Pterodactyl\Events\Auth\ProvidedAuthenticationToken; class TwoFactorListener { - public function handle(ProvidedAuthenticationToken $event) + public function handle(ProvidedAuthenticationToken $event): void { Activity::event($event->recovery ? 'auth:recovery-token' : 'auth:token') ->withRequestMetadata() diff --git a/app/Models/APILog.php b/app/Models/APILog.php index 359daa4ed..673f94e73 100644 --- a/app/Models/APILog.php +++ b/app/Models/APILog.php @@ -8,29 +8,21 @@ class APILog extends Model { /** * The table associated with the model. - * - * @var string */ protected $table = 'api_logs'; /** * The attributes excluded from the model's JSON form. - * - * @var array */ protected $hidden = []; /** * Fields that are not mass assignable. - * - * @var array */ protected $guarded = ['id', 'created_at', 'updated_at']; /** * Cast values to correct type. - * - * @var array */ protected $casts = [ 'authorized' => 'boolean', diff --git a/app/Models/ActivityLog.php b/app/Models/ActivityLog.php index 36987c167..7d900427a 100644 --- a/app/Models/ActivityLog.php +++ b/app/Models/ActivityLog.php @@ -9,6 +9,7 @@ use Pterodactyl\Events\ActivityLogged; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\MassPrunable; use Illuminate\Database\Eloquent\Relations\HasOne; +use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\MorphTo; use Illuminate\Database\Eloquent\Model as IlluminateModel; @@ -45,6 +46,7 @@ use Illuminate\Database\Eloquent\Model as IlluminateModel; * @method static Builder|ActivityLog whereIp($value) * @method static Builder|ActivityLog whereProperties($value) * @method static Builder|ActivityLog whereTimestamp($value) + * * @mixin \Eloquent */ class ActivityLog extends Model @@ -54,7 +56,7 @@ class ActivityLog extends Model public const RESOURCE_NAME = 'activity_log'; /** - * Tracks all of the events we no longer wish to display to users. These are either legacy + * Tracks all the events we no longer wish to display to users. These are either legacy * events or just events where we never ended up using the associated data. */ public const DISABLED_EVENTS = ['server:file.upload']; @@ -73,7 +75,7 @@ class ActivityLog extends Model protected $with = ['subjects']; - public static $validationRules = [ + public static array $validationRules = [ 'event' => ['required', 'string'], 'batch' => ['nullable', 'uuid'], 'ip' => ['required', 'string'], @@ -91,7 +93,7 @@ class ActivityLog extends Model return $morph; } - public function subjects() + public function subjects(): HasMany { return $this->hasMany(ActivityLogSubject::class); } diff --git a/app/Models/ActivityLogSubject.php b/app/Models/ActivityLogSubject.php index 314776034..6629b3e7d 100644 --- a/app/Models/ActivityLogSubject.php +++ b/app/Models/ActivityLogSubject.php @@ -17,6 +17,7 @@ use Illuminate\Database\Eloquent\Relations\Pivot; * @method static \Illuminate\Database\Eloquent\Builder|ActivityLogSubject newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|ActivityLogSubject newQuery() * @method static \Illuminate\Database\Eloquent\Builder|ActivityLogSubject query() + * * @mixin \Eloquent */ class ActivityLogSubject extends Pivot diff --git a/app/Models/Allocation.php b/app/Models/Allocation.php index 44b4f5bf1..d16e3150c 100644 --- a/app/Models/Allocation.php +++ b/app/Models/Allocation.php @@ -2,6 +2,8 @@ namespace Pterodactyl\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; + /** * Pterodactyl\Models\Allocation. * @@ -33,6 +35,7 @@ namespace Pterodactyl\Models; * @method static \Illuminate\Database\Eloquent\Builder|Allocation wherePort($value) * @method static \Illuminate\Database\Eloquent\Builder|Allocation whereServerId($value) * @method static \Illuminate\Database\Eloquent\Builder|Allocation whereUpdatedAt($value) + * * @mixin \Eloquent */ class Allocation extends Model @@ -45,22 +48,16 @@ class Allocation extends Model /** * The table associated with the model. - * - * @var string */ protected $table = 'allocations'; /** * Fields that are not mass assignable. - * - * @var array */ protected $guarded = ['id', 'created_at', 'updated_at']; /** * Cast values to correct type. - * - * @var array */ protected $casts = [ 'node_id' => 'integer', @@ -68,10 +65,7 @@ class Allocation extends Model 'server_id' => 'integer', ]; - /** - * @var array - */ - public static $validationRules = [ + public static array $validationRules = [ 'node_id' => 'required|exists:nodes,id', 'ip' => 'required|ip', 'port' => 'required|numeric|between:1024,65535', @@ -90,34 +84,24 @@ class Allocation extends Model /** * Return a hashid encoded string to represent the ID of the allocation. - * - * @return string */ - public function getHashidAttribute() + public function getHashidAttribute(): string { return app()->make('hashids')->encode($this->id); } /** * Accessor to automatically provide the IP alias if defined. - * - * @param string|null $value - * - * @return string */ - public function getAliasAttribute($value) + public function getAliasAttribute(?string $value): string { return (is_null($this->ip_alias)) ? $this->ip : $this->ip_alias; } /** * Accessor to quickly determine if this allocation has an alias. - * - * @param string|null $value - * - * @return bool */ - public function getHasAliasAttribute($value) + public function getHasAliasAttribute(?string $value): bool { return !is_null($this->ip_alias); } @@ -129,20 +113,16 @@ class Allocation extends Model /** * Gets information for the server associated with this allocation. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function server() + public function server(): BelongsTo { return $this->belongsTo(Server::class); } /** * Return the Node model associated with this allocation. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function node() + public function node(): BelongsTo { return $this->belongsTo(Node::class); } diff --git a/app/Models/ApiKey.php b/app/Models/ApiKey.php index e7f2f8efd..5bfb89549 100644 --- a/app/Models/ApiKey.php +++ b/app/Models/ApiKey.php @@ -55,6 +55,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; * @method static \Illuminate\Database\Eloquent\Builder|ApiKey whereToken($value) * @method static \Illuminate\Database\Eloquent\Builder|ApiKey whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|ApiKey whereUserId($value) + * * @mixin \Eloquent */ class ApiKey extends Model @@ -87,15 +88,11 @@ class ApiKey extends Model /** * The table associated with the model. - * - * @var string */ protected $table = 'api_keys'; /** * Cast values to correct type. - * - * @var array */ protected $casts = [ 'allowed_ips' => 'array', @@ -113,8 +110,6 @@ class ApiKey extends Model /** * Fields that are mass assignable. - * - * @var array */ protected $fillable = [ 'identifier', @@ -127,17 +122,13 @@ class ApiKey extends Model /** * Fields that should not be included when calling toArray() or toJson() * on this model. - * - * @var array */ protected $hidden = ['token']; /** * Rules to protect against invalid data entry to DB. - * - * @var array */ - public static $validationRules = [ + public static array $validationRules = [ 'user_id' => 'required|exists:users,id', 'key_type' => 'present|integer|min:0|max:4', 'identifier' => 'required|string|size:16|unique:api_keys,identifier', @@ -157,9 +148,6 @@ class ApiKey extends Model 'r_' . AdminAcl::RESOURCE_SERVERS => 'integer|min:0|max:3', ]; - /** - * @var array - */ protected $dates = [ self::CREATED_AT, self::UPDATED_AT, @@ -177,23 +165,17 @@ class ApiKey extends Model /** * Required for support with Laravel Sanctum. * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - * * @see \Laravel\Sanctum\Guard::supportsTokens() */ - public function tokenable() + public function tokenable(): BelongsTo { return $this->user(); } /** * Finds the model matching the provided token. - * - * @param string $token - * - * @return self|null */ - public static function findToken($token) + public static function findToken(string $token): ?self { $identifier = substr($token, 0, self::IDENTIFIER_LENGTH); diff --git a/app/Models/AuditLog.php b/app/Models/AuditLog.php index 6dea11f3c..f42acbfff 100644 --- a/app/Models/AuditLog.php +++ b/app/Models/AuditLog.php @@ -5,6 +5,7 @@ namespace Pterodactyl\Models; use Ramsey\Uuid\Uuid; use Illuminate\Http\Request; use Illuminate\Container\Container; +use Illuminate\Database\Eloquent\Relations\BelongsTo; /** * @deprecated — this class will be dropped in a future version, use the activity log @@ -13,10 +14,7 @@ class AuditLog extends Model { public const UPDATED_AT = null; - /** - * @var string[] - */ - public static $validationRules = [ + public static array $validationRules = [ 'uuid' => 'required|uuid', 'action' => 'required|string|max:191', 'subaction' => 'nullable|string|max:191', @@ -26,45 +24,27 @@ class AuditLog extends Model 'metadata' => 'array', ]; - /** - * @var string - */ protected $table = 'audit_logs'; - /** - * @var bool - */ - protected $immutableDates = true; + protected bool $immutableDates = true; - /** - * @var string[] - */ protected $casts = [ 'is_system' => 'bool', 'device' => 'array', 'metadata' => 'array', ]; - /** - * @var string[] - */ protected $guarded = [ 'id', 'created_at', ]; - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function user() + public function user(): BelongsTo { return $this->belongsTo(User::class); } - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function server() + public function server(): BelongsTo { return $this->belongsTo(Server::class); } @@ -74,11 +54,9 @@ class AuditLog extends Model * currently authenticated user if available. This model is not saved at this point, so * you can always make modifications to it as needed before saving. * - * @return $this - * * @deprecated */ - public static function instance(string $action, array $metadata, bool $isSystem = false) + public static function instance(string $action, array $metadata, bool $isSystem = false): self { /** @var \Illuminate\Http\Request $request */ $request = Container::getInstance()->make('request'); diff --git a/app/Models/Backup.php b/app/Models/Backup.php index 84ba680a2..41c94fee2 100644 --- a/app/Models/Backup.php +++ b/app/Models/Backup.php @@ -3,6 +3,7 @@ namespace Pterodactyl\Models; use Illuminate\Database\Eloquent\SoftDeletes; +use Illuminate\Database\Eloquent\Relations\BelongsTo; /** * @property int $id @@ -32,19 +33,10 @@ class Backup extends Model public const ADAPTER_WINGS = 'wings'; public const ADAPTER_AWS_S3 = 's3'; - /** - * @var string - */ protected $table = 'backups'; - /** - * @var bool - */ - protected $immutableDates = true; + protected bool $immutableDates = true; - /** - * @var array - */ protected $casts = [ 'id' => 'int', 'is_successful' => 'bool', @@ -53,16 +45,10 @@ class Backup extends Model 'bytes' => 'int', ]; - /** - * @var array - */ protected $dates = [ 'completed_at', ]; - /** - * @var array - */ protected $attributes = [ 'is_successful' => false, 'is_locked' => false, @@ -71,15 +57,9 @@ class Backup extends Model 'upload_id' => null, ]; - /** - * @var string[] - */ protected $guarded = ['id', 'created_at', 'updated_at', 'deleted_at']; - /** - * @var array - */ - public static $validationRules = [ + public static array $validationRules = [ 'server_id' => 'bail|required|numeric|exists:servers,id', 'uuid' => 'required|uuid', 'is_successful' => 'boolean', @@ -92,10 +72,7 @@ class Backup extends Model 'upload_id' => 'nullable|string', ]; - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function server() + public function server(): BelongsTo { return $this->belongsTo(Server::class); } diff --git a/app/Models/Database.php b/app/Models/Database.php index e54d9f5ce..e3856a4e2 100644 --- a/app/Models/Database.php +++ b/app/Models/Database.php @@ -3,6 +3,7 @@ namespace Pterodactyl\Models; use Illuminate\Container\Container; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Pterodactyl\Contracts\Extensions\HashidsInterface; /** @@ -29,22 +30,16 @@ class Database extends Model /** * The table associated with the model. - * - * @var string */ protected $table = 'databases'; /** * The attributes excluded from the model's JSON form. - * - * @var array */ protected $hidden = ['password']; /** * Fields that are mass assignable. - * - * @var array */ protected $fillable = [ 'server_id', 'database_host_id', 'database', 'username', 'password', 'remote', 'max_connections', @@ -52,8 +47,6 @@ class Database extends Model /** * Cast values to correct type. - * - * @var array */ protected $casts = [ 'server_id' => 'integer', @@ -61,10 +54,7 @@ class Database extends Model 'max_connections' => 'integer', ]; - /** - * @var array - */ - public static $validationRules = [ + public static array $validationRules = [ 'server_id' => 'required|numeric|exists:servers,id', 'database_host_id' => 'required|exists:database_hosts,id', 'database' => 'required|string|alpha_dash|between:3,48', @@ -89,11 +79,9 @@ class Database extends Model * @param mixed $value * @param string|null $field * - * @return \Illuminate\Database\Eloquent\Model|null - * * @throws \Illuminate\Contracts\Container\BindingResolutionException */ - public function resolveRouteBinding($value, $field = null) + public function resolveRouteBinding($value, $field = null): ?\Illuminate\Database\Eloquent\Model { if (is_scalar($value) && ($field ?? $this->getRouteKeyName()) === 'id') { $value = ctype_digit((string) $value) @@ -106,20 +94,16 @@ class Database extends Model /** * Gets the host database server associated with a database. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function host() + public function host(): BelongsTo { return $this->belongsTo(DatabaseHost::class, 'database_host_id'); } /** * Gets the server associated with a database. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function server() + public function server(): BelongsTo { return $this->belongsTo(Server::class); } diff --git a/app/Models/DatabaseHost.php b/app/Models/DatabaseHost.php index eda5f84b8..df56eb7c7 100644 --- a/app/Models/DatabaseHost.php +++ b/app/Models/DatabaseHost.php @@ -2,6 +2,9 @@ namespace Pterodactyl\Models; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\BelongsTo; + /** * @property int $id * @property string $name @@ -22,29 +25,20 @@ class DatabaseHost extends Model */ public const RESOURCE_NAME = 'database_host'; - /** - * @var bool - */ - protected $immutableDates = true; + protected bool $immutableDates = true; /** * The table associated with the model. - * - * @var string */ protected $table = 'database_hosts'; /** * The attributes excluded from the model's JSON form. - * - * @var array */ protected $hidden = ['password']; /** * Fields that are mass assignable. - * - * @var array */ protected $fillable = [ 'name', 'host', 'port', 'username', 'password', 'max_databases', 'node_id', @@ -52,8 +46,6 @@ class DatabaseHost extends Model /** * Cast values to correct type. - * - * @var array */ protected $casts = [ 'id' => 'integer', @@ -63,10 +55,8 @@ class DatabaseHost extends Model /** * Validation rules to assign to this model. - * - * @var array */ - public static $validationRules = [ + public static array $validationRules = [ 'name' => 'required|string|max:191', 'host' => 'required|string', 'port' => 'required|numeric|between:1,65535', @@ -77,20 +67,16 @@ class DatabaseHost extends Model /** * Gets the node associated with a database host. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function node() + public function node(): BelongsTo { return $this->belongsTo(Node::class); } /** * Gets the databases associated with this host. - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function databases() + public function databases(): HasMany { return $this->hasMany(Database::class); } diff --git a/app/Models/Egg.php b/app/Models/Egg.php index c7c08f117..31c3e3420 100644 --- a/app/Models/Egg.php +++ b/app/Models/Egg.php @@ -2,6 +2,9 @@ namespace Pterodactyl\Models; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\BelongsTo; + /** * @property int $id * @property string $uuid @@ -70,15 +73,11 @@ class Egg extends Model /** * The table associated with the model. - * - * @var string */ protected $table = 'eggs'; /** * Fields that are not mass assignable. - * - * @var array */ protected $fillable = [ 'name', @@ -102,8 +101,6 @@ class Egg extends Model /** * Cast values to correct type. - * - * @var array */ protected $casts = [ 'nest_id' => 'integer', @@ -116,10 +113,7 @@ class Egg extends Model 'file_denylist' => 'array', ]; - /** - * @var array - */ - public static $validationRules = [ + public static array $validationRules = [ 'nest_id' => 'required|bail|numeric|exists:nests,id', 'uuid' => 'required|string|size:36', 'name' => 'required|string|max:191', @@ -140,9 +134,6 @@ class Egg extends Model 'force_outgoing_ip' => 'sometimes|boolean', ]; - /** - * @var array - */ protected $attributes = [ 'features' => null, 'file_denylist' => null, @@ -156,10 +147,8 @@ class Egg extends Model /** * Returns the install script for the egg; if egg is copying from another * it will return the copied script. - * - * @return string */ - public function getCopyScriptInstallAttribute() + public function getCopyScriptInstallAttribute(): ?string { if (!is_null($this->script_install) || is_null($this->copy_script_from)) { return $this->script_install; @@ -171,10 +160,8 @@ class Egg extends Model /** * Returns the entry command for the egg; if egg is copying from another * it will return the copied entry command. - * - * @return string */ - public function getCopyScriptEntryAttribute() + public function getCopyScriptEntryAttribute(): string { if (!is_null($this->script_entry) || is_null($this->copy_script_from)) { return $this->script_entry; @@ -186,10 +173,8 @@ class Egg extends Model /** * Returns the install container for the egg; if egg is copying from another * it will return the copied install container. - * - * @return string */ - public function getCopyScriptContainerAttribute() + public function getCopyScriptContainerAttribute(): string { if (!is_null($this->script_container) || is_null($this->copy_script_from)) { return $this->script_container; @@ -200,10 +185,8 @@ class Egg extends Model /** * Return the file configuration for an egg. - * - * @return string */ - public function getInheritConfigFilesAttribute() + public function getInheritConfigFilesAttribute(): ?string { if (!is_null($this->config_files) || is_null($this->config_from)) { return $this->config_files; @@ -214,10 +197,8 @@ class Egg extends Model /** * Return the startup configuration for an egg. - * - * @return string */ - public function getInheritConfigStartupAttribute() + public function getInheritConfigStartupAttribute(): ?string { if (!is_null($this->config_startup) || is_null($this->config_from)) { return $this->config_startup; @@ -228,10 +209,8 @@ class Egg extends Model /** * Return the log reading configuration for an egg. - * - * @return string */ - public function getInheritConfigLogsAttribute() + public function getInheritConfigLogsAttribute(): ?string { if (!is_null($this->config_logs) || is_null($this->config_from)) { return $this->config_logs; @@ -242,10 +221,8 @@ class Egg extends Model /** * Return the stop command configuration for an egg. - * - * @return string */ - public function getInheritConfigStopAttribute() + public function getInheritConfigStopAttribute(): ?string { if (!is_null($this->config_stop) || is_null($this->config_from)) { return $this->config_stop; @@ -257,10 +234,8 @@ class Egg extends Model /** * Returns the features available to this egg from the parent configuration if there are * no features defined for this egg specifically and there is a parent egg configured. - * - * @return array|null */ - public function getInheritFeaturesAttribute() + public function getInheritFeaturesAttribute(): ?array { if (!is_null($this->features) || is_null($this->config_from)) { return $this->features; @@ -272,10 +247,8 @@ class Egg extends Model /** * Returns the features available to this egg from the parent configuration if there are * no features defined for this egg specifically and there is a parent egg configured. - * - * @return string[]|null */ - public function getInheritFileDenylistAttribute() + public function getInheritFileDenylistAttribute(): ?array { if (is_null($this->config_from)) { return $this->file_denylist; @@ -286,50 +259,40 @@ class Egg extends Model /** * Gets nest associated with an egg. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function nest() + public function nest(): BelongsTo { return $this->belongsTo(Nest::class); } /** * Gets all servers associated with this egg. - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function servers() + public function servers(): HasMany { return $this->hasMany(Server::class, 'egg_id'); } /** * Gets all variables associated with this egg. - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function variables() + public function variables(): HasMany { return $this->hasMany(EggVariable::class, 'egg_id'); } /** * Get the parent egg from which to copy scripts. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function scriptFrom() + public function scriptFrom(): BelongsTo { return $this->belongsTo(self::class, 'copy_script_from'); } /** * Get the parent egg from which to copy configuration settings. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function configFrom() + public function configFrom(): BelongsTo { return $this->belongsTo(self::class, 'config_from'); } diff --git a/app/Models/EggMount.php b/app/Models/EggMount.php index cd85673ce..ed494a13e 100644 --- a/app/Models/EggMount.php +++ b/app/Models/EggMount.php @@ -4,18 +4,9 @@ namespace Pterodactyl\Models; class EggMount extends Model { - /** - * @var string - */ protected $table = 'egg_mount'; - /** - * @var null - */ protected $primaryKey = null; - /** - * @var bool - */ public $incrementing = false; } diff --git a/app/Models/EggVariable.php b/app/Models/EggVariable.php index 99966da3a..8c34bb398 100644 --- a/app/Models/EggVariable.php +++ b/app/Models/EggVariable.php @@ -2,6 +2,9 @@ namespace Pterodactyl\Models; +use Illuminate\Database\Eloquent\Relations\HasOne; +use Illuminate\Database\Eloquent\Relations\HasMany; + /** * @property int $id * @property int $egg_id @@ -32,34 +35,23 @@ class EggVariable extends Model /** * Reserved environment variable names. - * - * @var string */ public const RESERVED_ENV_NAMES = 'SERVER_MEMORY,SERVER_IP,SERVER_PORT,ENV,HOME,USER,STARTUP,SERVER_UUID,UUID'; - /** - * @var bool - */ - protected $immutableDates = true; + protected bool $immutableDates = true; /** * The table associated with the model. - * - * @var string */ protected $table = 'egg_variables'; /** * Fields that are not mass assignable. - * - * @var array */ protected $guarded = ['id', 'created_at', 'updated_at']; /** * Cast values to correct type. - * - * @var array */ protected $casts = [ 'egg_id' => 'integer', @@ -67,10 +59,7 @@ class EggVariable extends Model 'user_editable' => 'bool', ]; - /** - * @var array - */ - public static $validationRules = [ + public static array $validationRules = [ 'egg_id' => 'exists:eggs,id', 'name' => 'required|string|between:1,191', 'description' => 'string', @@ -81,36 +70,25 @@ class EggVariable extends Model 'rules' => 'required|string', ]; - /** - * @var array - */ protected $attributes = [ 'user_editable' => 0, 'user_viewable' => 0, ]; - /** - * @return bool - */ - public function getRequiredAttribute() + public function getRequiredAttribute(): bool { return in_array('required', explode('|', $this->rules)); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasOne - */ - public function egg() + public function egg(): HasOne { return $this->hasOne(Egg::class); } /** * Return server variables associated with this variable. - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function serverVariable() + public function serverVariable(): HasMany { return $this->hasMany(ServerVariable::class, 'variable_id'); } diff --git a/app/Models/Location.php b/app/Models/Location.php index c490e56ca..47a30354b 100644 --- a/app/Models/Location.php +++ b/app/Models/Location.php @@ -2,6 +2,9 @@ namespace Pterodactyl\Models; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\HasManyThrough; + /** * @property int $id * @property string $short @@ -21,24 +24,18 @@ class Location extends Model /** * The table associated with the model. - * - * @var string */ protected $table = 'locations'; /** * Fields that are not mass assignable. - * - * @var array */ protected $guarded = ['id', 'created_at', 'updated_at']; /** * Rules ensuring that the raw data stored in the database meets expectations. - * - * @var array */ - public static $validationRules = [ + public static array $validationRules = [ 'short' => 'required|string|between:1,60|unique:locations,short', 'long' => 'string|nullable|between:1,191', ]; @@ -53,20 +50,16 @@ class Location extends Model /** * Gets the nodes in a specified location. - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function nodes() + public function nodes(): HasMany { return $this->hasMany(Node::class); } /** * Gets the servers within a given location. - * - * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough */ - public function servers() + public function servers(): HasManyThrough { return $this->hasManyThrough(Server::class, Node::class); } diff --git a/app/Models/Model.php b/app/Models/Model.php index 5c3488728..5b028c67c 100644 --- a/app/Models/Model.php +++ b/app/Models/Model.php @@ -4,13 +4,16 @@ namespace Pterodactyl\Models; use Illuminate\Support\Arr; use Illuminate\Support\Str; +use Carbon\CarbonImmutable; +use Illuminate\Support\Carbon; use Illuminate\Validation\Rule; use Illuminate\Container\Container; -use Illuminate\Contracts\Validation\Factory; +use Illuminate\Contracts\Validation\Validator; use Illuminate\Validation\ValidationException; use Illuminate\Database\Eloquent\Factories\HasFactory; use Pterodactyl\Exceptions\Model\DataValidationException; use Illuminate\Database\Eloquent\Model as IlluminateModel; +use Illuminate\Contracts\Validation\Factory as ValidationFactory; abstract class Model extends IlluminateModel { @@ -18,28 +21,18 @@ abstract class Model extends IlluminateModel /** * Set to true to return immutable Carbon date instances from the model. - * - * @var bool */ - protected $immutableDates = false; + protected bool $immutableDates = false; /** * Determines if the model should undergo data validation before it is saved * to the database. - * - * @var bool */ - protected $skipValidation = false; + protected bool $skipValidation = false; - /** - * @var \Illuminate\Contracts\Validation\Factory - */ - protected static $validatorFactory; + protected static ValidationFactory $validatorFactory; - /** - * @var array - */ - public static $validationRules = []; + public static array $validationRules = []; /** * Listen for the model saving event and fire off the validation @@ -51,7 +44,7 @@ abstract class Model extends IlluminateModel { parent::boot(); - static::$validatorFactory = Container::getInstance()->make(Factory::class); + static::$validatorFactory = Container::getInstance()->make(ValidationFactory::class); static::saving(function (Model $model) { try { @@ -65,7 +58,7 @@ abstract class Model extends IlluminateModel } /** - * Returns the model key to use for route model binding. By default we'll + * Returns the model key to use for route model binding. By default, we'll * assume every model uses a UUID field for this. If the model does not have * a UUID and is using a different key it should be specified on the model * itself. @@ -80,10 +73,8 @@ abstract class Model extends IlluminateModel /** * Set the model to skip validation when saving. - * - * @return $this */ - public function skipValidation() + public function skipValidation(): self { $this->skipValidation = true; @@ -92,10 +83,8 @@ abstract class Model extends IlluminateModel /** * Returns the validator instance used by this model. - * - * @return \Illuminate\Validation\Validator|\Illuminate\Contracts\Validation\Validator */ - public function getValidator() + public function getValidator(): Validator { $rules = $this->exists ? static::getRulesForUpdate($this) : static::getRules(); @@ -104,10 +93,8 @@ abstract class Model extends IlluminateModel /** * Returns the rules associated with this model. - * - * @return array */ - public static function getRules() + public static function getRules(): array { $rules = static::$validationRules; foreach ($rules as $key => &$rule) { @@ -129,12 +116,8 @@ abstract class Model extends IlluminateModel /** * Returns the rules associated with the model, specifically for updating the given model * rather than just creating it. - * - * @param \Illuminate\Database\Eloquent\Model|int|string $model - * - * @return array */ - public static function getRulesForUpdate($model, string $column = 'id') + public static function getRulesForUpdate(IlluminateModel|int|string $model, string $column = 'id'): array { if ($model instanceof Model) { [$id, $column] = [$model->getKey(), $model->getKeyName()]; @@ -144,7 +127,7 @@ abstract class Model extends IlluminateModel foreach ($rules as $key => &$data) { // For each rule in a given field, iterate over it and confirm if the rule // is one for a unique field. If that is the case, append the ID of the current - // working model so we don't run into errors due to the way that field validation + // 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')) { @@ -163,6 +146,8 @@ abstract class Model extends IlluminateModel /** * Determines if the model is in a valid state or not. + * + * @throws \Illuminate\Validation\ValidationException */ public function validate(): void { @@ -172,9 +157,9 @@ abstract class Model extends IlluminateModel $validator = $this->getValidator(); $validator->setData( - // Trying to do self::toArray() here will leave out keys based on the whitelist/blacklist - // for that model. Doing this will return all of the attributes in a format that can - // properly be validated. + // Trying to do self::toArray() here will leave out keys based on the whitelist/blacklist + // for that model. Doing this will return all the attributes in a format that can + // properly be validated. $this->addCastAttributesToArray( $this->getAttributes(), $this->getMutatedAttributes() @@ -190,10 +175,8 @@ abstract class Model extends IlluminateModel * Return a timestamp as DateTime object. * * @param mixed $value - * - * @return \Illuminate\Support\Carbon|\Carbon\CarbonImmutable */ - protected function asDateTime($value) + protected function asDateTime($value): Carbon|CarbonImmutable { if (!$this->immutableDates) { return parent::asDateTime($value); diff --git a/app/Models/Mount.php b/app/Models/Mount.php index c1eb7a3a1..475b3cb7f 100644 --- a/app/Models/Mount.php +++ b/app/Models/Mount.php @@ -3,6 +3,7 @@ namespace Pterodactyl\Models; use Illuminate\Validation\Rules\NotIn; +use Illuminate\Database\Eloquent\Relations\BelongsToMany; /** * @property int $id @@ -27,22 +28,16 @@ class Mount extends Model /** * The table associated with the model. - * - * @var string */ protected $table = 'mounts'; /** * Fields that are not mass assignable. - * - * @var array */ protected $guarded = ['id', 'uuid']; /** * Default values for specific fields in the database. - * - * @var array */ protected $casts = [ 'id' => 'int', @@ -52,10 +47,8 @@ class Mount extends Model /** * Rules verifying that the data being stored matches the expectations of the database. - * - * @var string */ - public static $validationRules = [ + public static array $validationRules = [ 'name' => 'required|string|min:2|max:64|unique:mounts,name', 'description' => 'nullable|string|max:191', 'source' => 'required|string', @@ -68,7 +61,7 @@ class Mount extends Model * Implement language verification by overriding Eloquence's gather * rules function. */ - public static function getRules() + public static function getRules(): array { $rules = parent::getRules(); @@ -80,15 +73,11 @@ class Mount extends Model /** * Disable timestamps on this model. - * - * @var bool */ public $timestamps = false; /** * Blacklisted source paths. - * - * @var string[] */ public static $invalidSourcePaths = [ '/etc/pterodactyl', @@ -98,8 +87,6 @@ class Mount extends Model /** * Blacklisted target paths. - * - * @var string[] */ public static $invalidTargetPaths = [ '/home/container', @@ -107,30 +94,24 @@ class Mount extends Model /** * Returns all eggs that have this mount assigned. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ - public function eggs() + public function eggs(): BelongsToMany { return $this->belongsToMany(Egg::class); } /** * Returns all nodes that have this mount assigned. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ - public function nodes() + public function nodes(): BelongsToMany { return $this->belongsToMany(Node::class); } /** * Returns all servers that have this mount assigned. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ - public function servers() + public function servers(): BelongsToMany { return $this->belongsToMany(Server::class); } diff --git a/app/Models/MountNode.php b/app/Models/MountNode.php index a897dd6dd..3a189c46b 100644 --- a/app/Models/MountNode.php +++ b/app/Models/MountNode.php @@ -6,18 +6,9 @@ use Illuminate\Database\Eloquent\Model; class MountNode extends Model { - /** - * @var string - */ protected $table = 'mount_node'; - /** - * @var null - */ protected $primaryKey = null; - /** - * @var bool - */ public $incrementing = false; } diff --git a/app/Models/MountServer.php b/app/Models/MountServer.php index 21bf8fe2d..b9c0219e3 100644 --- a/app/Models/MountServer.php +++ b/app/Models/MountServer.php @@ -6,23 +6,11 @@ use Illuminate\Database\Eloquent\Model; class MountServer extends Model { - /** - * @var string - */ protected $table = 'mount_server'; - /** - * @var bool - */ public $timestamps = false; - /** - * @var null - */ protected $primaryKey = null; - /** - * @var bool - */ public $incrementing = false; } diff --git a/app/Models/Nest.php b/app/Models/Nest.php index 165817159..9a06ba299 100644 --- a/app/Models/Nest.php +++ b/app/Models/Nest.php @@ -2,6 +2,8 @@ namespace Pterodactyl\Models; +use Illuminate\Database\Eloquent\Relations\HasMany; + /** * @property int $id * @property string $uuid @@ -23,25 +25,18 @@ class Nest extends Model /** * The table associated with the model. - * - * @var string */ protected $table = 'nests'; /** * Fields that are mass assignable. - * - * @var array */ protected $fillable = [ 'name', 'description', ]; - /** - * @var array - */ - public static $validationRules = [ + public static array $validationRules = [ 'author' => 'required|string|email', 'name' => 'required|string|max:191', 'description' => 'nullable|string', @@ -49,20 +44,16 @@ class Nest extends Model /** * Gets all eggs associated with this service. - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function eggs() + public function eggs(): HasMany { return $this->hasMany(Egg::class); } /** * Gets all servers associated with this nest. - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function servers() + public function servers(): HasMany { return $this->hasMany(Server::class); } diff --git a/app/Models/Node.php b/app/Models/Node.php index bb7783466..37aec760d 100644 --- a/app/Models/Node.php +++ b/app/Models/Node.php @@ -7,6 +7,9 @@ use Symfony\Component\Yaml\Yaml; use Illuminate\Container\Container; use Illuminate\Notifications\Notifiable; use Illuminate\Contracts\Encryption\Encrypter; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasManyThrough; /** * @property int $id @@ -51,22 +54,16 @@ class Node extends Model /** * The table associated with the model. - * - * @var string */ protected $table = 'nodes'; /** * The attributes excluded from the model's JSON form. - * - * @var array */ protected $hidden = ['daemon_token_id', 'daemon_token']; /** * Cast values to correct type. - * - * @var array */ protected $casts = [ 'location_id' => 'integer', @@ -81,8 +78,6 @@ class Node extends Model /** * Fields that are mass assignable. - * - * @var array */ protected $fillable = [ 'public', 'name', 'location_id', @@ -93,10 +88,7 @@ class Node extends Model 'description', 'maintenance_mode', ]; - /** - * @var array - */ - public static $validationRules = [ + public static array $validationRules = [ 'name' => 'required|regex:/^([\w .-]{1,100})$/', 'description' => 'string|nullable', 'location_id' => 'required|exists:locations,id', @@ -117,8 +109,6 @@ class Node extends Model /** * Default values for specific columns that are generally not changed on base installs. - * - * @var array */ protected $attributes = [ 'public' => true, @@ -141,10 +131,8 @@ class Node extends Model /** * Returns the configuration as an array. - * - * @return array */ - public function getConfiguration() + public function getConfiguration(): array { return [ 'debug' => false, @@ -174,20 +162,16 @@ class Node extends Model /** * Returns the configuration in Yaml format. - * - * @return string */ - public function getYamlConfiguration() + public function getYamlConfiguration(): string { return Yaml::dump($this->getConfiguration(), 4, 2, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE); } /** * Returns the configuration in JSON format. - * - * @return string */ - public function getJsonConfiguration(bool $pretty = false) + public function getJsonConfiguration(bool $pretty = false): string { return json_encode($this->getConfiguration(), $pretty ? JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT : JSON_UNESCAPED_SLASHES); } @@ -202,40 +186,31 @@ class Node extends Model ); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough - */ - public function mounts() + public function mounts(): HasManyThrough { return $this->hasManyThrough(Mount::class, MountNode::class, 'node_id', 'id', 'id', 'mount_id'); } /** * Gets the location associated with a node. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function location() + public function location(): BelongsTo { return $this->belongsTo(Location::class); } /** * Gets the servers associated with a node. - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function servers() + public function servers(): HasMany { return $this->hasMany(Server::class); } /** * Gets the allocations associated with a node. - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function allocations() + public function allocations(): HasMany { return $this->hasMany(Allocation::class); } diff --git a/app/Models/Objects/DeploymentObject.php b/app/Models/Objects/DeploymentObject.php index 3c62f0bae..0c44be08e 100644 --- a/app/Models/Objects/DeploymentObject.php +++ b/app/Models/Objects/DeploymentObject.php @@ -4,30 +4,18 @@ namespace Pterodactyl\Models\Objects; class DeploymentObject { - /** - * @var bool - */ - private $dedicated = false; + private bool $dedicated = false; - /** - * @var array - */ - private $locations = []; + private array $locations = []; - /** - * @var array - */ - private $ports = []; + private array $ports = []; public function isDedicated(): bool { return $this->dedicated; } - /** - * @return $this - */ - public function setDedicated(bool $dedicated) + public function setDedicated(bool $dedicated): self { $this->dedicated = $dedicated; @@ -39,10 +27,7 @@ class DeploymentObject return $this->locations; } - /** - * @return $this - */ - public function setLocations(array $locations) + public function setLocations(array $locations): self { $this->locations = $locations; @@ -54,10 +39,7 @@ class DeploymentObject return $this->ports; } - /** - * @return $this - */ - public function setPorts(array $ports) + public function setPorts(array $ports): self { $this->ports = $ports; diff --git a/app/Models/Permission.php b/app/Models/Permission.php index 26dc610dc..6d27a90d3 100644 --- a/app/Models/Permission.php +++ b/app/Models/Permission.php @@ -67,51 +67,38 @@ class Permission extends Model /** * Should timestamps be used on this model. - * - * @var bool */ public $timestamps = false; /** * The table associated with the model. - * - * @var string */ protected $table = 'permissions'; /** * Fields that are not mass assignable. - * - * @var array */ protected $guarded = ['id', 'created_at', 'updated_at']; /** * Cast values to correct type. - * - * @var array */ protected $casts = [ 'subuser_id' => 'integer', ]; - /** - * @var array - */ - public static $validationRules = [ + public static array $validationRules = [ 'subuser_id' => 'required|numeric|min:1', 'permission' => 'required|string', ]; /** - * All of the permissions available on the system. You should use self::permissions() + * All the permissions available on the system. You should use self::permissions() * 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 = [ + protected static array $permissions = [ 'websocket' => [ 'description' => 'Allows the user to connect to the server websocket, giving them access to view console output and realtime server stats.', 'keys' => [ @@ -222,10 +209,8 @@ class Permission extends Model ]; /** - * Returns all of the permissions available on the system for a user to + * Returns all the permissions available on the system for a user to * have when controlling a server. - * - * @return \Illuminate\Database\Eloquent\Collection */ public static function permissions(): Collection { diff --git a/app/Models/RecoveryToken.php b/app/Models/RecoveryToken.php index 0244c7bca..d4ca764a0 100644 --- a/app/Models/RecoveryToken.php +++ b/app/Models/RecoveryToken.php @@ -2,6 +2,8 @@ namespace Pterodactyl\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; + /** * @property int $id * @property int $user_id @@ -16,27 +18,15 @@ class RecoveryToken extends Model */ public const UPDATED_AT = null; - /** - * @var bool - */ public $timestamps = true; - /** - * @var bool - */ - protected $immutableDates = true; + protected bool $immutableDates = true; - /** - * @var string[] - */ - public static $validationRules = [ + public static array $validationRules = [ 'token' => 'required|string', ]; - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function user() + public function user(): BelongsTo { return $this->belongsTo(User::class); } diff --git a/app/Models/Schedule.php b/app/Models/Schedule.php index 81c30768c..183ebb82b 100644 --- a/app/Models/Schedule.php +++ b/app/Models/Schedule.php @@ -5,6 +5,8 @@ namespace Pterodactyl\Models; use Cron\CronExpression; use Carbon\CarbonImmutable; use Illuminate\Container\Container; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Pterodactyl\Contracts\Extensions\HashidsInterface; /** @@ -37,22 +39,16 @@ class Schedule extends Model /** * The table associated with the model. - * - * @var string */ protected $table = 'schedules'; /** * Always return the tasks associated with this schedule. - * - * @var array */ protected $with = ['tasks']; /** * Mass assignable attributes on this model. - * - * @var array */ protected $fillable = [ 'server_id', @@ -69,9 +65,6 @@ class Schedule extends Model 'next_run_at', ]; - /** - * @var array - */ protected $casts = [ 'id' => 'integer', 'server_id' => 'integer', @@ -82,17 +75,12 @@ class Schedule extends Model /** * Columns to mutate to a date. - * - * @var array */ protected $dates = [ 'last_run_at', 'next_run_at', ]; - /** - * @var array - */ protected $attributes = [ 'name' => null, 'cron_day_of_week' => '*', @@ -105,10 +93,7 @@ class Schedule extends Model 'only_when_online' => false, ]; - /** - * @var array - */ - public static $validationRules = [ + public static array $validationRules = [ 'server_id' => 'required|exists:servers,id', 'name' => 'required|string|max:191', 'cron_day_of_week' => 'required|string', @@ -134,11 +119,9 @@ class Schedule extends Model /** * Returns the schedule's execution crontab entry as a string. * - * @return \Carbon\CarbonImmutable - * * @throws \Exception */ - public function getNextRunDate() + public function getNextRunDate(): CarbonImmutable { $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); @@ -149,30 +132,24 @@ class Schedule extends Model /** * Return a hashid encoded string to represent the ID of the schedule. - * - * @return string */ - public function getHashidAttribute() + public function getHashidAttribute(): string { return Container::getInstance()->make(HashidsInterface::class)->encode($this->id); } /** * Return tasks belonging to a schedule. - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function tasks() + public function tasks(): HasMany { return $this->hasMany(Task::class); } /** * Return the server model that a schedule belongs to. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function server() + public function server(): BelongsTo { return $this->belongsTo(Server::class); } diff --git a/app/Models/Server.php b/app/Models/Server.php index b1560bb28..5ad99151a 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -5,7 +5,11 @@ namespace Pterodactyl\Models; use Illuminate\Notifications\Notifiable; use Illuminate\Database\Query\JoinClause; use Znck\Eloquent\Traits\BelongsToThrough; +use Illuminate\Database\Eloquent\Relations\HasOne; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\MorphToMany; +use Illuminate\Database\Eloquent\Relations\HasManyThrough; use Pterodactyl\Exceptions\Http\Server\ServerStateConflictException; /** @@ -95,6 +99,7 @@ use Pterodactyl\Exceptions\Http\Server\ServerStateConflictException; * @method static \Illuminate\Database\Eloquent\Builder|Server whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|Server whereUuid($value) * @method static \Illuminate\Database\Eloquent\Builder|Server whereUuidShort($value) + * * @mixin \Eloquent */ class Server extends Model @@ -115,16 +120,12 @@ class Server extends Model /** * The table associated with the model. - * - * @var string */ protected $table = 'servers'; /** * Default values when creating the model. We want to switch to disabling OOM killer * on server instances unless the user specifies otherwise in the request. - * - * @var array */ protected $attributes = [ 'status' => self::STATUS_INSTALLING, @@ -134,29 +135,20 @@ class Server extends Model /** * The default relationships to load for all server models. - * - * @var string[] */ protected $with = ['allocation']; /** * The attributes that should be mutated to dates. - * - * @var array */ protected $dates = [self::CREATED_AT, self::UPDATED_AT, 'deleted_at', 'installed_at']; /** * Fields that are not mass assignable. - * - * @var array */ protected $guarded = ['id', self::CREATED_AT, self::UPDATED_AT, 'deleted_at', 'installed_at']; - /** - * @var array - */ - public static $validationRules = [ + public static array $validationRules = [ 'external_id' => 'sometimes|nullable|string|between:1,191|unique:servers', 'owner_id' => 'required|integer|exists:users,id', 'name' => 'required|string|min:1|max:191', @@ -183,8 +175,6 @@ class Server extends Model /** * Cast values to correct type. - * - * @var array */ protected $casts = [ 'node_id' => 'integer', @@ -226,76 +216,62 @@ class Server extends Model /** * Gets the user who owns the server. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function user() + public function user(): BelongsTo { return $this->belongsTo(User::class, 'owner_id'); } /** * Gets the subusers associated with a server. - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function subusers() + public function subusers(): HasMany { return $this->hasMany(Subuser::class, 'server_id', 'id'); } /** * Gets the default allocation for a server. - * - * @return \Illuminate\Database\Eloquent\Relations\HasOne */ - public function allocation() + public function allocation(): HasOne { return $this->hasOne(Allocation::class, 'id', 'allocation_id'); } /** * Gets all allocations associated with this server. - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function allocations() + public function allocations(): HasMany { return $this->hasMany(Allocation::class, 'server_id'); } /** * Gets information for the nest associated with this server. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function nest() + public function nest(): BelongsTo { return $this->belongsTo(Nest::class); } /** * Gets information for the egg associated with this server. - * - * @return \Illuminate\Database\Eloquent\Relations\HasOne */ - public function egg() + public function egg(): HasOne { return $this->hasOne(Egg::class, 'id', 'egg_id'); } /** * Gets information for the service variables associated with this server. - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function variables() + public function variables(): HasMany { return $this->hasMany(EggVariable::class, 'egg_id', 'egg_id') ->select(['egg_variables.*', 'server_variables.variable_value as server_value']) ->leftJoin('server_variables', function (JoinClause $join) { // Don't forget to join against the server ID as well since the way we're using this relationship - // would actually return all of the variables and their values for _all_ servers using that egg,\ + // would actually return all the variables and their values for _all_ servers using that egg, // rather than only the server for this model. // // @see https://github.com/pterodactyl/panel/issues/2250 @@ -306,30 +282,24 @@ class Server extends Model /** * Gets information for the node associated with this server. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function node() + public function node(): BelongsTo { return $this->belongsTo(Node::class); } /** * Gets information for the tasks associated with this server. - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function schedules() + public function schedules(): HasMany { return $this->hasMany(Schedule::class); } /** * Gets all databases associated with a server. - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function databases() + public function databases(): HasMany { return $this->hasMany(Database::class); } @@ -337,39 +307,30 @@ class Server extends Model /** * Returns the location that a server belongs to. * - * @return \Znck\Eloquent\Relations\BelongsToThrough - * * @throws \Exception */ - public function location() + public function location(): \Znck\Eloquent\Relations\BelongsToThrough { return $this->belongsToThrough(Location::class, Node::class); } /** * Returns the associated server transfer. - * - * @return \Illuminate\Database\Eloquent\Relations\HasOne */ - public function transfer() + public function transfer(): HasOne { return $this->hasOne(ServerTransfer::class)->whereNull('successful')->orderByDesc('id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function backups() + public function backups(): HasMany { return $this->hasMany(Backup::class); } /** * Returns all mounts that have this server has mounted. - * - * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough */ - public function mounts() + public function mounts(): HasManyThrough { return $this->hasManyThrough(Mount::class, MountServer::class, 'server_id', 'id', 'id', 'mount_id'); } diff --git a/app/Models/ServerTransfer.php b/app/Models/ServerTransfer.php index 7e297b601..da4618828 100644 --- a/app/Models/ServerTransfer.php +++ b/app/Models/ServerTransfer.php @@ -2,6 +2,9 @@ namespace Pterodactyl\Models; +use Illuminate\Database\Eloquent\Relations\HasOne; +use Illuminate\Database\Eloquent\Relations\BelongsTo; + /** * @property int $id * @property int $server_id @@ -29,22 +32,16 @@ class ServerTransfer extends Model /** * The table associated with the model. - * - * @var string */ protected $table = 'server_transfers'; /** * Fields that are not mass assignable. - * - * @var array */ protected $guarded = ['id', 'created_at', 'updated_at']; /** * Cast values to correct type. - * - * @var array */ protected $casts = [ 'server_id' => 'int', @@ -58,10 +55,7 @@ class ServerTransfer extends Model 'archived' => 'bool', ]; - /** - * @var array - */ - public static $validationRules = [ + public static array $validationRules = [ 'server_id' => 'required|numeric|exists:servers,id', 'old_node' => 'required|numeric', 'new_node' => 'required|numeric', @@ -76,30 +70,24 @@ class ServerTransfer extends Model /** * Gets the server associated with a server transfer. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function server() + public function server(): BelongsTo { return $this->belongsTo(Server::class); } /** * Gets the source node associated with a server transfer. - * - * @return \Illuminate\Database\Eloquent\Relations\HasOne */ - public function oldNode() + public function oldNode(): HasOne { return $this->hasOne(Node::class, 'id', 'old_node'); } /** * Gets the target node associated with a server transfer. - * - * @return \Illuminate\Database\Eloquent\Relations\HasOne */ - public function newNode() + public function newNode(): HasOne { return $this->hasOne(Node::class, 'id', 'new_node'); } diff --git a/app/Models/ServerVariable.php b/app/Models/ServerVariable.php index 9b3ad81fa..46ae57dd4 100644 --- a/app/Models/ServerVariable.php +++ b/app/Models/ServerVariable.php @@ -2,6 +2,8 @@ namespace Pterodactyl\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; + /** * @property int $id * @property int $server_id @@ -20,23 +22,18 @@ class ServerVariable extends Model */ public const RESOURCE_NAME = 'server_variable'; - /** @var bool */ - protected $immutableDates = true; + protected bool $immutableDates = true; - /** @var string */ protected $table = 'server_variables'; - /** @var string[] */ protected $guarded = ['id', 'created_at', 'updated_at']; - /** @var string[] */ protected $casts = [ 'server_id' => 'integer', 'variable_id' => 'integer', ]; - /** @var string[] */ - public static $validationRules = [ + public static array $validationRules = [ 'server_id' => 'required|int', 'variable_id' => 'required|int', 'variable_value' => 'string', @@ -44,20 +41,16 @@ class ServerVariable extends Model /** * Returns the server this variable is associated with. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function server() + public function server(): BelongsTo { return $this->belongsTo(Server::class); } /** * Returns information about a given variables parent. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function variable() + public function variable(): BelongsTo { return $this->belongsTo(EggVariable::class, 'variable_id'); } diff --git a/app/Models/Session.php b/app/Models/Session.php index 535afc801..baacdb875 100644 --- a/app/Models/Session.php +++ b/app/Models/Session.php @@ -8,15 +8,11 @@ class Session extends Model { /** * The table associated with the model. - * - * @var string */ protected $table = 'sessions'; /** * Cast values to correct type. - * - * @var array */ protected $casts = [ 'id' => 'string', diff --git a/app/Models/Setting.php b/app/Models/Setting.php index 458248628..52c7f1cff 100644 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -6,25 +6,14 @@ class Setting extends Model { /** * The table associated with the model. - * - * @var string */ protected $table = 'settings'; - /** - * @var bool - */ public $timestamps = false; - /** - * @var array - */ protected $fillable = ['key', 'value']; - /** - * @var array - */ - public static $validationRules = [ + public static array $validationRules = [ 'key' => 'required|string|between:1,191', 'value' => 'string', ]; diff --git a/app/Models/Subuser.php b/app/Models/Subuser.php index 8dcdaf37c..40950d5b2 100644 --- a/app/Models/Subuser.php +++ b/app/Models/Subuser.php @@ -3,6 +3,8 @@ namespace Pterodactyl\Models; use Illuminate\Notifications\Notifiable; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\BelongsTo; /** * @property int $id @@ -26,22 +28,16 @@ class Subuser extends Model /** * The table associated with the model. - * - * @var string */ protected $table = 'subusers'; /** * Fields that are not mass assignable. - * - * @var array */ protected $guarded = ['id', 'created_at', 'updated_at']; /** * Cast values to correct type. - * - * @var array */ protected $casts = [ 'user_id' => 'int', @@ -49,10 +45,7 @@ class Subuser extends Model 'permissions' => 'array', ]; - /** - * @var array - */ - public static $validationRules = [ + public static array $validationRules = [ 'user_id' => 'required|numeric|exists:users,id', 'server_id' => 'required|numeric|exists:servers,id', 'permissions' => 'nullable|array', @@ -61,40 +54,32 @@ class Subuser extends Model /** * Return a hashid encoded string to represent the ID of the subuser. - * - * @return string */ - public function getHashidAttribute() + public function getHashidAttribute(): string { return app()->make('hashids')->encode($this->id); } /** * Gets the server associated with a subuser. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function server() + public function server(): BelongsTo { return $this->belongsTo(Server::class); } /** * Gets the user associated with a subuser. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function user() + public function user(): BelongsTo { return $this->belongsTo(User::class); } /** * Gets the permissions associated with a subuser. - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function permissions() + public function permissions(): HasMany { return $this->hasMany(Permission::class); } diff --git a/app/Models/Task.php b/app/Models/Task.php index b02503286..8e772731e 100644 --- a/app/Models/Task.php +++ b/app/Models/Task.php @@ -4,6 +4,7 @@ namespace Pterodactyl\Models; use Illuminate\Container\Container; use Znck\Eloquent\Traits\BelongsToThrough; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Pterodactyl\Contracts\Extensions\HashidsInterface; /** @@ -40,22 +41,16 @@ class Task extends Model /** * The table associated with the model. - * - * @var string */ protected $table = 'tasks'; /** * Relationships to be updated when this model is updated. - * - * @var array */ protected $touches = ['schedule']; /** * Fields that are mass assignable. - * - * @var array */ protected $fillable = [ 'schedule_id', @@ -69,8 +64,6 @@ class Task extends Model /** * Cast values to correct type. - * - * @var array */ protected $casts = [ 'id' => 'integer', @@ -83,8 +76,6 @@ class Task extends Model /** * Default attributes when creating a new model. - * - * @var array */ protected $attributes = [ 'time_offset' => 0, @@ -92,10 +83,7 @@ class Task extends Model 'continue_on_failure' => false, ]; - /** - * @var array - */ - public static $validationRules = [ + public static array $validationRules = [ 'schedule_id' => 'required|numeric|exists:schedules,id', 'sequence_id' => 'required|numeric|min:1', 'action' => 'required|string', @@ -115,32 +103,24 @@ class Task extends Model /** * Return a hashid encoded string to represent the ID of the task. - * - * @return string */ - public function getHashidAttribute() + public function getHashidAttribute(): string { return Container::getInstance()->make(HashidsInterface::class)->encode($this->id); } /** * Return the schedule that a task belongs to. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function schedule() + public function schedule(): BelongsTo { return $this->belongsTo(Schedule::class); } /** * Return the server a task is assigned to, acts as a belongsToThrough. - * - * @return \Znck\Eloquent\Relations\BelongsToThrough - * - * @throws \Exception */ - public function server() + public function server(): \Znck\Eloquent\Relations\BelongsToThrough { return $this->belongsToThrough(Server::class, Schedule::class); } diff --git a/app/Models/TaskLog.php b/app/Models/TaskLog.php index eabfde604..0efd77ff4 100644 --- a/app/Models/TaskLog.php +++ b/app/Models/TaskLog.php @@ -8,22 +8,16 @@ class TaskLog extends Model { /** * The table associated with the model. - * - * @var string */ protected $table = 'tasks_log'; /** * Fields that are not mass assignable. - * - * @var array */ protected $guarded = ['id', 'created_at', 'updated_at']; /** * Cast values to correct type. - * - * @var array */ protected $casts = [ 'id' => 'integer', @@ -33,8 +27,6 @@ class TaskLog extends Model /** * The attributes that should be mutated to dates. - * - * @var array */ protected $dates = ['run_time', 'created_at', 'updated_at']; } diff --git a/app/Models/User.php b/app/Models/User.php index b75039819..df8271cf4 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -75,6 +75,7 @@ use Pterodactyl\Notifications\SendPasswordReset as ResetPasswordNotification; * @method static Builder|User whereUseTotp($value) * @method static Builder|User whereUsername($value) * @method static Builder|User whereUuid($value) + * * @mixin \Eloquent */ class User extends Model implements @@ -100,22 +101,16 @@ class User extends Model implements /** * Level of servers to display when using access() on a user. - * - * @var string */ - protected $accessLevel = 'all'; + protected string $accessLevel = 'all'; /** * The table associated with the model. - * - * @var string */ protected $table = 'users'; /** * A list of mass-assignable variables. - * - * @var array */ protected $fillable = [ 'external_id', @@ -134,8 +129,6 @@ class User extends Model implements /** * Cast values to correct type. - * - * @var array */ protected $casts = [ 'root_admin' => 'boolean', @@ -143,22 +136,15 @@ class User extends Model implements 'gravatar' => 'boolean', ]; - /** - * @var array - */ protected $dates = ['totp_authenticated_at']; /** * The attributes excluded from the model's JSON form. - * - * @var array */ protected $hidden = ['password', 'remember_token', 'totp_secret', 'totp_authenticated_at']; /** * Default values for specific fields in the database. - * - * @var array */ protected $attributes = [ 'external_id' => null, @@ -170,10 +156,8 @@ class User extends Model implements /** * Rules verifying that the data being stored matches the expectations of the database. - * - * @var array */ - public static $validationRules = [ + public static array $validationRules = [ 'uuid' => 'required|string|size:36|unique:users,uuid', 'email' => 'required|email|between:1,191|unique:users,email', 'external_id' => 'sometimes|nullable|string|max:191|unique:users,external_id', @@ -191,7 +175,7 @@ class User extends Model implements * Implement language verification by overriding Eloquence's gather * rules function. */ - public static function getRules() + public static function getRules(): array { $rules = parent::getRules(); @@ -234,37 +218,27 @@ class User extends Model implements /** * Return a concatenated result for the accounts full name. - * - * @return string */ - public function getNameAttribute() + public function getNameAttribute(): string { return trim($this->name_first . ' ' . $this->name_last); } /** * Returns all servers that a user owns. - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function servers() + public function servers(): HasMany { return $this->hasMany(Server::class, 'owner_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function apiKeys() + public function apiKeys(): HasMany { return $this->hasMany(ApiKey::class) ->where('key_type', ApiKey::TYPE_ACCOUNT); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function recoveryTokens() + public function recoveryTokens(): HasMany { return $this->hasMany(RecoveryToken::class); } @@ -275,7 +249,7 @@ class User extends Model implements } /** - * Returns all of the activity logs where this user is the subject — not to + * Returns all the activity logs where this user is the subject — not to * be confused by activity logs where this user is the _actor_. */ public function activity(): MorphToMany @@ -284,12 +258,10 @@ class User extends Model implements } /** - * Returns all of the servers that a user can access by way of being the owner of the + * Returns all the servers that a user can access by way of being the owner of the * server, or because they are assigned as a subuser for that server. - * - * @return \Illuminate\Database\Eloquent\Builder */ - public function accessibleServers() + public function accessibleServers(): Builder { return Server::query() ->select('servers.*') diff --git a/app/Models/UserSSHKey.php b/app/Models/UserSSHKey.php index 658bac6c0..0aac52310 100644 --- a/app/Models/UserSSHKey.php +++ b/app/Models/UserSSHKey.php @@ -50,7 +50,7 @@ class UserSSHKey extends Model 'fingerprint', ]; - public static $validationRules = [ + public static array $validationRules = [ 'name' => ['required', 'string'], 'fingerprint' => ['required', 'string'], 'public_key' => ['required', 'string'], diff --git a/app/Notifications/AccountCreated.php b/app/Notifications/AccountCreated.php index e52bed5fe..fb1338012 100644 --- a/app/Notifications/AccountCreated.php +++ b/app/Notifications/AccountCreated.php @@ -12,50 +12,25 @@ class AccountCreated extends Notification implements ShouldQueue { use Queueable; - /** - * The authentication token to be used for the user to set their - * password for the first time. - * - * @var string|null - */ - public $token; - - /** - * The user model for the created user. - * - * @var \Pterodactyl\Models\User - */ - public $user; - /** * Create a new notification instance. */ - public function __construct(User $user, string $token = null) + public function __construct(public User $user, public ?string $token = null) { - $this->token = $token; - $this->user = $user; } /** * Get the notification's delivery channels. - * - * @param mixed $notifiable - * - * @return array */ - public function via($notifiable) + public function via(): array { return ['mail']; } /** * Get the mail representation of the notification. - * - * @param mixed $notifiable - * - * @return \Illuminate\Notifications\Messages\MailMessage */ - public function toMail($notifiable) + public function toMail(): MailMessage { $message = (new MailMessage()) ->greeting('Hello ' . $this->user->name . '!') diff --git a/app/Notifications/AddedToServer.php b/app/Notifications/AddedToServer.php index c116a2e29..c78c7db8b 100644 --- a/app/Notifications/AddedToServer.php +++ b/app/Notifications/AddedToServer.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Notifications; @@ -18,10 +11,7 @@ class AddedToServer extends Notification implements ShouldQueue { use Queueable; - /** - * @var object - */ - public $server; + public object $server; /** * Create a new notification instance. @@ -33,24 +23,16 @@ class AddedToServer extends Notification implements ShouldQueue /** * Get the notification's delivery channels. - * - * @param mixed $notifiable - * - * @return array */ - public function via($notifiable) + public function via(): array { return ['mail']; } /** * Get the mail representation of the notification. - * - * @param mixed $notifiable - * - * @return \Illuminate\Notifications\Messages\MailMessage */ - public function toMail($notifiable) + public function toMail(): MailMessage { return (new MailMessage()) ->greeting('Hello ' . $this->server->user . '!') diff --git a/app/Notifications/MailTested.php b/app/Notifications/MailTested.php index d0f083acc..892ff7b0a 100644 --- a/app/Notifications/MailTested.php +++ b/app/Notifications/MailTested.php @@ -8,22 +8,16 @@ use Illuminate\Notifications\Messages\MailMessage; class MailTested extends Notification { - /** - * @var \Pterodactyl\Models\User - */ - private $user; - - public function __construct(User $user) + public function __construct(private User $user) { - $this->user = $user; } - public function via() + public function via(): array { return ['mail']; } - public function toMail() + public function toMail(): MailMessage { return (new MailMessage()) ->subject('Pterodactyl Test Message') diff --git a/app/Notifications/RemovedFromServer.php b/app/Notifications/RemovedFromServer.php index 24418e51c..492dc60e6 100644 --- a/app/Notifications/RemovedFromServer.php +++ b/app/Notifications/RemovedFromServer.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Notifications; @@ -18,10 +11,7 @@ class RemovedFromServer extends Notification implements ShouldQueue { use Queueable; - /** - * @var object - */ - public $server; + public object $server; /** * Create a new notification instance. @@ -33,24 +23,16 @@ class RemovedFromServer extends Notification implements ShouldQueue /** * Get the notification's delivery channels. - * - * @param mixed $notifiable - * - * @return array */ - public function via($notifiable) + public function via(): array { return ['mail']; } /** * Get the mail representation of the notification. - * - * @param mixed $notifiable - * - * @return \Illuminate\Notifications\Messages\MailMessage */ - public function toMail($notifiable) + public function toMail(): MailMessage { return (new MailMessage()) ->error() diff --git a/app/Notifications/SendPasswordReset.php b/app/Notifications/SendPasswordReset.php index cd6d46050..b424c8293 100644 --- a/app/Notifications/SendPasswordReset.php +++ b/app/Notifications/SendPasswordReset.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Notifications; @@ -18,43 +11,25 @@ class SendPasswordReset extends Notification implements ShouldQueue { use Queueable; - /** - * The password reset token. - * - * @var string - */ - public $token; - /** * Create a new notification instance. - * - * @param string $token */ - public function __construct($token) + public function __construct(public string $token) { - $this->token = $token; } /** * Get the notification's delivery channels. - * - * @param mixed $notifiable - * - * @return array */ - public function via($notifiable) + public function via(): array { return ['mail']; } /** * Get the mail representation of the notification. - * - * @param mixed $notifiable - * - * @return \Illuminate\Notifications\Messages\MailMessage */ - public function toMail($notifiable) + public function toMail(mixed $notifiable): MailMessage { return (new MailMessage()) ->subject('Reset Password') diff --git a/app/Notifications/ServerInstalled.php b/app/Notifications/ServerInstalled.php index cc5a94313..46f38ff84 100644 --- a/app/Notifications/ServerInstalled.php +++ b/app/Notifications/ServerInstalled.php @@ -2,9 +2,12 @@ namespace Pterodactyl\Notifications; +use Pterodactyl\Models\User; use Illuminate\Bus\Queueable; use Pterodactyl\Events\Event; +use Pterodactyl\Models\Server; use Illuminate\Container\Container; +use Pterodactyl\Events\Server\Installed; use Illuminate\Notifications\Notification; use Illuminate\Contracts\Queue\ShouldQueue; use Pterodactyl\Contracts\Core\ReceivesEvents; @@ -15,23 +18,15 @@ class ServerInstalled extends Notification implements ShouldQueue, ReceivesEvent { use Queueable; - /** - * @var \Pterodactyl\Models\Server - */ - public $server; + public Server $server; - /** - * @var \Pterodactyl\Models\User - */ - public $user; + public User $user; /** * Handle a direct call to this notification from the server installed event. This is configured * in the event service provider. - * - * @param \Pterodactyl\Events\Event|\Pterodactyl\Events\Server\Installed $event */ - public function handle(Event $event): void + public function handle(Event|Installed $event): void { $event->server->loadMissing('user'); @@ -45,20 +40,16 @@ class ServerInstalled extends Notification implements ShouldQueue, ReceivesEvent /** * Get the notification's delivery channels. - * - * @return array */ - public function via() + public function via(): array { return ['mail']; } /** * Get the mail representation of the notification. - * - * @return \Illuminate\Notifications\Messages\MailMessage */ - public function toMail() + public function toMail(): MailMessage { return (new MailMessage()) ->greeting('Hello ' . $this->user->username . '.') diff --git a/app/Observers/ServerObserver.php b/app/Observers/ServerObserver.php index c6a621204..51276523e 100644 --- a/app/Observers/ServerObserver.php +++ b/app/Observers/ServerObserver.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Observers; @@ -20,7 +13,7 @@ class ServerObserver /** * Listen to the Server creating event. */ - public function creating(Server $server) + public function creating(Server $server): void { event(new Events\Server\Creating($server)); } @@ -28,7 +21,7 @@ class ServerObserver /** * Listen to the Server created event. */ - public function created(Server $server) + public function created(Server $server): void { event(new Events\Server\Created($server)); } @@ -36,7 +29,7 @@ class ServerObserver /** * Listen to the Server deleting event. */ - public function deleting(Server $server) + public function deleting(Server $server): void { event(new Events\Server\Deleting($server)); } @@ -44,7 +37,7 @@ class ServerObserver /** * Listen to the Server deleted event. */ - public function deleted(Server $server) + public function deleted(Server $server): void { event(new Events\Server\Deleted($server)); } @@ -52,7 +45,7 @@ class ServerObserver /** * Listen to the Server saving event. */ - public function saving(Server $server) + public function saving(Server $server): void { event(new Events\Server\Saving($server)); } @@ -60,7 +53,7 @@ class ServerObserver /** * Listen to the Server saved event. */ - public function saved(Server $server) + public function saved(Server $server): void { event(new Events\Server\Saved($server)); } @@ -68,7 +61,7 @@ class ServerObserver /** * Listen to the Server updating event. */ - public function updating(Server $server) + public function updating(Server $server): void { event(new Events\Server\Updating($server)); } @@ -76,7 +69,7 @@ class ServerObserver /** * Listen to the Server saved event. */ - public function updated(Server $server) + public function updated(Server $server): void { event(new Events\Server\Updated($server)); } diff --git a/app/Observers/SubuserObserver.php b/app/Observers/SubuserObserver.php index 128de77fb..f1e028b96 100644 --- a/app/Observers/SubuserObserver.php +++ b/app/Observers/SubuserObserver.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Observers; @@ -19,7 +12,7 @@ class SubuserObserver /** * Listen to the Subuser creating event. */ - public function creating(Subuser $subuser) + public function creating(Subuser $subuser): void { event(new Events\Subuser\Creating($subuser)); } @@ -27,21 +20,21 @@ class SubuserObserver /** * Listen to the Subuser created event. */ - public function created(Subuser $subuser) + public function created(Subuser $subuser): void { event(new Events\Subuser\Created($subuser)); - $subuser->user->notify((new AddedToServer([ + $subuser->user->notify(new AddedToServer([ 'user' => $subuser->user->name_first, 'name' => $subuser->server->name, 'uuidShort' => $subuser->server->uuidShort, - ]))); + ])); } /** * Listen to the Subuser deleting event. */ - public function deleting(Subuser $subuser) + public function deleting(Subuser $subuser): void { event(new Events\Subuser\Deleting($subuser)); } @@ -49,13 +42,13 @@ class SubuserObserver /** * Listen to the Subuser deleted event. */ - public function deleted(Subuser $subuser) + public function deleted(Subuser $subuser): void { event(new Events\Subuser\Deleted($subuser)); - $subuser->user->notify((new RemovedFromServer([ + $subuser->user->notify(new RemovedFromServer([ 'user' => $subuser->user->name_first, 'name' => $subuser->server->name, - ]))); + ])); } } diff --git a/app/Observers/UserObserver.php b/app/Observers/UserObserver.php index 18d73bc10..dd017a22d 100644 --- a/app/Observers/UserObserver.php +++ b/app/Observers/UserObserver.php @@ -7,12 +7,12 @@ use Pterodactyl\Models\User; class UserObserver { - protected $uuid; + protected string $uuid; /** * Listen to the User creating event. */ - public function creating(User $user) + public function creating(User $user): void { event(new Events\User\Creating($user)); } @@ -20,7 +20,7 @@ class UserObserver /** * Listen to the User created event. */ - public function created(User $user) + public function created(User $user): void { event(new Events\User\Created($user)); } @@ -28,7 +28,7 @@ class UserObserver /** * Listen to the User deleting event. */ - public function deleting(User $user) + public function deleting(User $user): void { event(new Events\User\Deleting($user)); } @@ -36,7 +36,7 @@ class UserObserver /** * Listen to the User deleted event. */ - public function deleted(User $user) + public function deleted(User $user): void { event(new Events\User\Deleted($user)); } diff --git a/app/Policies/ServerPolicy.php b/app/Policies/ServerPolicy.php index d72b7bd14..e3565bb25 100644 --- a/app/Policies/ServerPolicy.php +++ b/app/Policies/ServerPolicy.php @@ -22,12 +22,8 @@ class ServerPolicy /** * Runs before any of the functions are called. Used to determine if user is root admin, if so, ignore permissions. - * - * @param string $ability - * - * @return bool */ - public function before(User $user, $ability, Server $server) + public function before(User $user, string $ability, Server $server): bool { if ($user->root_admin || $server->owner_id === $user->id) { return true; @@ -40,11 +36,8 @@ class ServerPolicy * This is a horrendous hack to avoid Laravel's "smart" behavior that does * not call the before() function if there isn't a function matching the * policy permission. - * - * @param string $name - * @param mixed $arguments */ - public function __call($name, $arguments) + public function __call(string $name, mixed $arguments) { // do nothing } diff --git a/app/Providers/ActivityLogServiceProvider.php b/app/Providers/ActivityLogServiceProvider.php index b410b4c80..7a3de759c 100644 --- a/app/Providers/ActivityLogServiceProvider.php +++ b/app/Providers/ActivityLogServiceProvider.php @@ -3,7 +3,7 @@ namespace Pterodactyl\Providers; use Illuminate\Support\ServiceProvider; -use Pterodactyl\Services\Activity\AcitvityLogBatchService; +use Pterodactyl\Services\Activity\ActivityLogBatchService; use Pterodactyl\Services\Activity\ActivityLogTargetableService; class ActivityLogServiceProvider extends ServiceProvider @@ -14,7 +14,7 @@ class ActivityLogServiceProvider extends ServiceProvider */ public function register() { - $this->app->scoped(AcitvityLogBatchService::class); + $this->app->scoped(ActivityLogBatchService::class); $this->app->scoped(ActivityLogTargetableService::class); } } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 5b38a4175..d4ffdadbb 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -69,10 +69,8 @@ class AppServiceProvider extends ServiceProvider /** * Return version information for the footer. - * - * @return array */ - protected function versionData() + protected function versionData(): array { return Cache::remember('git-version', 5, function () { if (file_exists(base_path('.git/HEAD'))) { diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index bc95e9206..fed77e15a 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -11,9 +11,7 @@ use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvid class AuthServiceProvider extends ServiceProvider { /** - * The policy mappings for the application. - * - * @var array + * The model to policy mappings for the application. */ protected $policies = [ Server::class => ServerPolicy::class, diff --git a/app/Providers/BackupsServiceProvider.php b/app/Providers/BackupsServiceProvider.php index 999dfa90d..3b22a2069 100644 --- a/app/Providers/BackupsServiceProvider.php +++ b/app/Providers/BackupsServiceProvider.php @@ -18,10 +18,7 @@ class BackupsServiceProvider extends ServiceProvider implements DeferrableProvid }); } - /** - * @return string[] - */ - public function provides() + public function provides(): array { return [BackupManager::class]; } diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 9a02cca3d..6f91f24f5 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -18,9 +18,7 @@ use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvi class EventServiceProvider extends ServiceProvider { /** - * The event listener mappings for the application. - * - * @var array + * The event to listener mappings for the application. */ protected $listen = [ ServerInstalledEvent::class => [ServerInstalledNotification::class], @@ -31,9 +29,9 @@ class EventServiceProvider extends ServiceProvider ]; /** - * Boots the service provider and registers model event listeners. + * Register any events for your application. */ - public function boot() + public function boot(): void { parent::boot(); @@ -42,9 +40,4 @@ class EventServiceProvider extends ServiceProvider Subuser::observe(SubuserObserver::class); EggVariable::observe(EggVariableObserver::class); } - - public function shouldDiscoverEvents() - { - return true; - } } diff --git a/app/Providers/HashidsServiceProvider.php b/app/Providers/HashidsServiceProvider.php index f2b3935d8..f094878d0 100644 --- a/app/Providers/HashidsServiceProvider.php +++ b/app/Providers/HashidsServiceProvider.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Providers; diff --git a/app/Providers/SettingsServiceProvider.php b/app/Providers/SettingsServiceProvider.php index 447ac3db1..5508ee0fb 100644 --- a/app/Providers/SettingsServiceProvider.php +++ b/app/Providers/SettingsServiceProvider.php @@ -15,10 +15,8 @@ class SettingsServiceProvider extends ServiceProvider /** * An array of configuration keys to override with database values * if they exist. - * - * @var array */ - protected $keys = [ + protected array $keys = [ 'app:name', 'app:locale', 'recaptcha:enabled', @@ -37,10 +35,8 @@ class SettingsServiceProvider extends ServiceProvider /** * Keys specific to the mail driver that are only grabbed from the database * when using the SMTP driver. - * - * @var array */ - protected $emailKeys = [ + protected array $emailKeys = [ 'mail:host', 'mail:port', 'mail:from:address', @@ -53,10 +49,8 @@ class SettingsServiceProvider extends ServiceProvider /** * Keys that are encrypted and should be decrypted when set in the * configuration array. - * - * @var array */ - protected static $encrypted = [ + protected static array $encrypted = [ 'mail:password', ]; diff --git a/app/Repositories/Eloquent/AllocationRepository.php b/app/Repositories/Eloquent/AllocationRepository.php index 3723c1d1f..6eb8b6d1e 100644 --- a/app/Repositories/Eloquent/AllocationRepository.php +++ b/app/Repositories/Eloquent/AllocationRepository.php @@ -10,16 +10,14 @@ class AllocationRepository extends EloquentRepository implements AllocationRepos { /** * Return the model backing this repository. - * - * @return string */ - public function model() + public function model(): string { return Allocation::class; } /** - * Return all of the allocations that exist for a node that are not currently + * Return all the allocations that exist for a node that are not currently * allocated. */ public function getUnassignedAllocationIds(int $node): array @@ -57,10 +55,8 @@ class AllocationRepository extends EloquentRepository implements AllocationRepos /** * Return a single allocation from those meeting the requirements. - * - * @return \Pterodactyl\Models\Allocation|null */ - public function getRandomAllocation(array $nodes, array $ports, bool $dedicated = false) + public function getRandomAllocation(array $nodes, array $ports, bool $dedicated = false): ?Allocation { $query = Allocation::query()->whereNull('server_id'); diff --git a/app/Repositories/Eloquent/ApiKeyRepository.php b/app/Repositories/Eloquent/ApiKeyRepository.php index 67a7e6e6e..eb1a362ae 100644 --- a/app/Repositories/Eloquent/ApiKeyRepository.php +++ b/app/Repositories/Eloquent/ApiKeyRepository.php @@ -11,16 +11,14 @@ class ApiKeyRepository extends EloquentRepository implements ApiKeyRepositoryInt { /** * Return the model backing this repository. - * - * @return string */ - public function model() + public function model(): string { return ApiKey::class; } /** - * Get all of the account API keys that exist for a specific user. + * Get all the account API keys that exist for a specific user. */ public function getAccountKeys(User $user): Collection { @@ -30,7 +28,7 @@ class ApiKeyRepository extends EloquentRepository implements ApiKeyRepositoryInt } /** - * Get all of the application API keys that exist for a specific user. + * Get all the application API keys that exist for a specific user. */ public function getApplicationKeys(User $user): Collection { diff --git a/app/Repositories/Eloquent/BackupRepository.php b/app/Repositories/Eloquent/BackupRepository.php index 051d0ce42..bbc5d2cd9 100644 --- a/app/Repositories/Eloquent/BackupRepository.php +++ b/app/Repositories/Eloquent/BackupRepository.php @@ -5,24 +5,20 @@ namespace Pterodactyl\Repositories\Eloquent; use Carbon\Carbon; use Pterodactyl\Models\Backup; use Pterodactyl\Models\Server; +use Illuminate\Support\Collection; use Illuminate\Database\Eloquent\Relations\HasMany; class BackupRepository extends EloquentRepository { - /** - * @return string - */ - public function model() + public function model(): string { return Backup::class; } /** * Determines if too many backups have been generated by the server. - * - * @return \Pterodactyl\Models\Backup[]|\Illuminate\Support\Collection */ - public function getBackupsGeneratedDuringTimespan(int $server, int $seconds = 600) + public function getBackupsGeneratedDuringTimespan(int $server, int $seconds = 600): array|Collection { return $this->getBuilder() ->withTrashed() diff --git a/app/Repositories/Eloquent/DatabaseHostRepository.php b/app/Repositories/Eloquent/DatabaseHostRepository.php index c55b03232..2c2b9dcde 100644 --- a/app/Repositories/Eloquent/DatabaseHostRepository.php +++ b/app/Repositories/Eloquent/DatabaseHostRepository.php @@ -10,10 +10,8 @@ class DatabaseHostRepository extends EloquentRepository implements DatabaseHostR { /** * Return the model backing this repository. - * - * @return string */ - public function model() + public function model(): string { return DatabaseHost::class; } diff --git a/app/Repositories/Eloquent/DatabaseRepository.php b/app/Repositories/Eloquent/DatabaseRepository.php index 53e590df9..9bc33d035 100644 --- a/app/Repositories/Eloquent/DatabaseRepository.php +++ b/app/Repositories/Eloquent/DatabaseRepository.php @@ -11,48 +11,24 @@ use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface; class DatabaseRepository extends EloquentRepository implements DatabaseRepositoryInterface { - /** - * @var string - */ - protected $connection = self::DEFAULT_CONNECTION_NAME; - - /** - * @var \Illuminate\Database\DatabaseManager - */ - protected $database; + protected string $connection = self::DEFAULT_CONNECTION_NAME; /** * DatabaseRepository constructor. */ - public function __construct(Application $application, DatabaseManager $database) + public function __construct(Application $application, private DatabaseManager $database) { parent::__construct($application); - - $this->database = $database; } /** * Return the model backing this repository. - * - * @return string */ - public function model() + public function model(): string { return Database::class; } - /** - * Set the connection name to execute statements against. - * - * @return $this - */ - public function setConnection(string $connection) - { - $this->connection = $connection; - - return $this; - } - /** * Return the connection to execute statements against. */ @@ -62,7 +38,17 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor } /** - * Return all of the databases belonging to a server. + * Set the connection name to execute statements against. + */ + public function setConnection(string $connection): self + { + $this->connection = $connection; + + return $this; + } + + /** + * Return all the databases belonging to a server. */ public function getDatabasesForServer(int $server): Collection { @@ -70,7 +56,7 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor } /** - * Return all of the databases for a given host with the server relationship loaded. + * Return all the databases for a given host with the server relationship loaded. */ public function getDatabasesForHost(int $host, int $count = 25): LengthAwarePaginator { @@ -89,16 +75,18 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * Create a new database user on a given connection. - * - * @param $max_connections */ - public function createUser(string $username, string $remote, string $password, $max_connections): bool + public function createUser(string $username, string $remote, string $password, ?int $max_connections): bool { - 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)); + $args = [$username, $remote, $password]; + $command = 'CREATE USER `%s`@`%s` IDENTIFIED BY \'%s\''; + + if (!empty($max_connections)) { + $args[] = $max_connections; + $command .= ' WITH MAX_USER_CONNECTIONS %s'; } + + return $this->run(sprintf($command, ...$args)); } /** @@ -132,8 +120,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * Drop a given user on a specific connection. - * - * @return mixed */ public function dropUser(string $username, string $remote): bool { diff --git a/app/Repositories/Eloquent/EggRepository.php b/app/Repositories/Eloquent/EggRepository.php index 98b7db453..8c4a01a27 100644 --- a/app/Repositories/Eloquent/EggRepository.php +++ b/app/Repositories/Eloquent/EggRepository.php @@ -13,10 +13,8 @@ class EggRepository extends EloquentRepository implements EggRepositoryInterface { /** * Return the model backing this repository. - * - * @return string */ - public function model() + public function model(): string { return Egg::class; } @@ -30,7 +28,7 @@ class EggRepository extends EloquentRepository implements EggRepositoryInterface { try { return $this->getBuilder()->with('variables')->findOrFail($id, $this->getColumns()); - } catch (ModelNotFoundException $exception) { + } catch (ModelNotFoundException) { throw new RecordNotFoundException(); } } @@ -52,17 +50,17 @@ class EggRepository extends EloquentRepository implements EggRepositoryInterface */ public function getWithCopyAttributes($value, string $column = 'id'): Egg { - Assert::true((is_digit($value) || is_string($value)), 'First argument passed to getWithCopyAttributes must be an integer or string, received %s.'); + Assert::true(is_digit($value) || is_string($value), 'First argument passed to getWithCopyAttributes must be an integer or string, received %s.'); try { return $this->getBuilder()->with('scriptFrom', 'configFrom')->where($column, '=', $value)->firstOrFail($this->getColumns()); - } catch (ModelNotFoundException $exception) { + } catch (ModelNotFoundException) { throw new RecordNotFoundException(); } } /** - * Return all of the data needed to export a service. + * Return all the data needed to export a service. * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -70,7 +68,7 @@ class EggRepository extends EloquentRepository implements EggRepositoryInterface { try { return $this->getBuilder()->with('scriptFrom', 'configFrom', 'variables')->findOrFail($id, $this->getColumns()); - } catch (ModelNotFoundException $exception) { + } catch (ModelNotFoundException) { throw new RecordNotFoundException(); } } diff --git a/app/Repositories/Eloquent/EggVariableRepository.php b/app/Repositories/Eloquent/EggVariableRepository.php index ce79a65f6..8ca35debb 100644 --- a/app/Repositories/Eloquent/EggVariableRepository.php +++ b/app/Repositories/Eloquent/EggVariableRepository.php @@ -10,10 +10,8 @@ class EggVariableRepository extends EloquentRepository implements EggVariableRep { /** * Return the model backing this repository. - * - * @return string */ - public function model() + public function model(): string { return EggVariable::class; } diff --git a/app/Repositories/Eloquent/EloquentRepository.php b/app/Repositories/Eloquent/EloquentRepository.php index 6403d2764..a4e7f2fd7 100644 --- a/app/Repositories/Eloquent/EloquentRepository.php +++ b/app/Repositories/Eloquent/EloquentRepository.php @@ -5,6 +5,7 @@ namespace Pterodactyl\Repositories\Eloquent; use Illuminate\Http\Request; use Webmozart\Assert\Assert; use Illuminate\Support\Collection; +use Illuminate\Database\Eloquent\Model; use Pterodactyl\Repositories\Repository; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Query\Expression; @@ -16,21 +17,14 @@ use Pterodactyl\Exceptions\Repository\RecordNotFoundException; abstract class EloquentRepository extends Repository implements RepositoryInterface { - /** - * @var bool - */ - protected $useRequestFilters = false; + protected bool $useRequestFilters = false; /** * Determines if the repository function should use filters off the request object * present when returning results. This allows repository methods to be called in API * 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) + public function usingRequestFilters(bool $usingFilters = true): self { $this->useRequestFilters = $usingFilters; @@ -39,20 +33,16 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Returns the request instance. - * - * @return \Illuminate\Http\Request */ - protected function request() + protected function request(): Request { return $this->app->make(Request::class); } /** * Paginate the response data based on the page para. - * - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator */ - protected function paginate(Builder $instance, int $default = 50) + protected function paginate(Builder $instance, int $default = 50): LengthAwarePaginator { if (!$this->useRequestFilters) { return $instance->paginate($default); @@ -64,20 +54,16 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Return an instance of the eloquent model bound to this * repository instance. - * - * @return \Illuminate\Database\Eloquent\Model */ - public function getModel() + public function getModel(): Model { return $this->model; } /** * Return an instance of the builder to use for this repository. - * - * @return \Illuminate\Database\Eloquent\Builder */ - public function getBuilder() + public function getBuilder(): Builder { return $this->getModel()->newQuery(); } @@ -85,11 +71,9 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Create a new record in the database and return the associated model. * - * @return \Illuminate\Database\Eloquent\Model|bool - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ - public function create(array $fields, bool $validate = true, bool $force = false) + public function create(array $fields, bool $validate = true, bool $force = false): Model|bool { $instance = $this->getBuilder()->newModelInstance(); ($force) ? $instance->forceFill($fields) : $instance->fill($fields); @@ -108,15 +92,13 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Find a model that has the specific ID passed. * - * @return \Illuminate\Database\Eloquent\Model - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function find(int $id) + public function find(int $id): Model { try { return $this->getBuilder()->findOrFail($id, $this->getColumns()); - } catch (ModelNotFoundException $exception) { + } catch (ModelNotFoundException) { throw new RecordNotFoundException(); } } @@ -132,15 +114,13 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Find and return the first matching instance for the given fields. * - * @return \Illuminate\Database\Eloquent\Model - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function findFirstWhere(array $fields) + public function findFirstWhere(array $fields): Model { try { return $this->getBuilder()->where($fields)->firstOrFail($this->getColumns()); - } catch (ModelNotFoundException $exception) { + } catch (ModelNotFoundException) { throw new RecordNotFoundException(); } } @@ -174,18 +154,14 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Update a given ID with the passed array of fields. * - * @param int $id - * - * @return \Illuminate\Database\Eloquent\Model|bool - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function update($id, array $fields, bool $validate = true, bool $force = false) + public function update(int $id, array $fields, bool $validate = true, bool $force = false): Model|bool { try { $instance = $this->getBuilder()->where('id', $id)->firstOrFail(); - } catch (ModelNotFoundException $exception) { + } catch (ModelNotFoundException) { throw new RecordNotFoundException(); } @@ -204,12 +180,8 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Update a model using the attributes passed. - * - * @param array|\Closure $attributes - * - * @return int */ - public function updateWhere($attributes, array $values) + public function updateWhere(array $attributes, array $values): int { return $this->getBuilder()->where($attributes)->update($values); } @@ -228,12 +200,10 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Update a record if it exists in the database, otherwise create it. * - * @return \Illuminate\Database\Eloquent\Model - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function updateOrCreate(array $where, array $fields, bool $validate = true, bool $force = false) + public function updateOrCreate(array $where, array $fields, bool $validate = true, bool $force = false): Model|bool { foreach ($where as $item) { Assert::true(is_scalar($item) || is_null($item), 'First argument passed to updateOrCreate should be an array of scalar or null values, received an array value of %s.'); @@ -241,7 +211,7 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf try { $instance = $this->setColumns('id')->findFirstWhere($where); - } catch (RecordNotFoundException $exception) { + } catch (RecordNotFoundException) { return $this->create(array_merge($where, $fields), $validate, $force); } diff --git a/app/Repositories/Eloquent/LocationRepository.php b/app/Repositories/Eloquent/LocationRepository.php index c06d10a9f..e25737cb3 100644 --- a/app/Repositories/Eloquent/LocationRepository.php +++ b/app/Repositories/Eloquent/LocationRepository.php @@ -12,10 +12,8 @@ class LocationRepository extends EloquentRepository implements LocationRepositor { /** * Return the model backing this repository. - * - * @return string */ - public function model() + public function model(): string { return Location::class; } @@ -29,7 +27,7 @@ class LocationRepository extends EloquentRepository implements LocationRepositor } /** - * Return all of the available locations with the nodes as a relationship. + * Return all the available locations with the nodes as a relationship. */ public function getAllWithNodes(): Collection { @@ -37,9 +35,7 @@ class LocationRepository extends EloquentRepository implements LocationRepositor } /** - * Return all of the nodes and their respective count of servers for a location. - * - * @return mixed + * Return all the nodes and their respective count of servers for a location. * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -47,7 +43,7 @@ class LocationRepository extends EloquentRepository implements LocationRepositor { try { return $this->getBuilder()->with('nodes.servers')->findOrFail($id, $this->getColumns()); - } catch (ModelNotFoundException $exception) { + } catch (ModelNotFoundException) { throw new RecordNotFoundException(); } } @@ -55,15 +51,13 @@ class LocationRepository extends EloquentRepository implements LocationRepositor /** * Return a location and the count of nodes in that location. * - * @return mixed - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function getWithNodeCount(int $id): Location { try { return $this->getBuilder()->withCount('nodes')->findOrFail($id, $this->getColumns()); - } catch (ModelNotFoundException $exception) { + } catch (ModelNotFoundException) { throw new RecordNotFoundException(); } } diff --git a/app/Repositories/Eloquent/MountRepository.php b/app/Repositories/Eloquent/MountRepository.php index 490f76b64..b33e6cb24 100644 --- a/app/Repositories/Eloquent/MountRepository.php +++ b/app/Repositories/Eloquent/MountRepository.php @@ -12,10 +12,8 @@ class MountRepository extends EloquentRepository { /** * Return the model backing this repository. - * - * @return string */ - public function model() + public function model(): string { return Mount::class; } @@ -29,9 +27,7 @@ class MountRepository extends EloquentRepository } /** - * Return all of the mounts and their respective relations. - * - * @return mixed + * Return all the mounts and their respective relations. * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ diff --git a/app/Repositories/Eloquent/NestRepository.php b/app/Repositories/Eloquent/NestRepository.php index 6d4992e45..f472e4b80 100644 --- a/app/Repositories/Eloquent/NestRepository.php +++ b/app/Repositories/Eloquent/NestRepository.php @@ -1,15 +1,9 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Repositories\Eloquent; use Pterodactyl\Models\Nest; +use Illuminate\Database\Eloquent\Collection; use Pterodactyl\Contracts\Repository\NestRepositoryInterface; use Pterodactyl\Exceptions\Repository\RecordNotFoundException; @@ -17,10 +11,8 @@ class NestRepository extends EloquentRepository implements NestRepositoryInterfa { /** * Return the model backing this repository. - * - * @return string */ - public function model() + public function model(): string { return Nest::class; } @@ -28,13 +20,9 @@ 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 */ - public function getWithEggs(int $id = null) + public function getWithEggs(int $id = null): Collection|Nest { $instance = $this->getBuilder()->with('eggs', 'eggs.variables'); @@ -53,11 +41,9 @@ class NestRepository extends EloquentRepository implements NestRepositoryInterfa /** * Return a nest or all nests and the count of eggs and servers for that nest. * - * @return \Pterodactyl\Models\Nest|\Illuminate\Database\Eloquent\Collection - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function getWithCounts(int $id = null) + public function getWithCounts(int $id = null): Collection|Nest { $instance = $this->getBuilder()->withCount(['eggs', 'servers']); diff --git a/app/Repositories/Eloquent/NodeRepository.php b/app/Repositories/Eloquent/NodeRepository.php index 5d1a8bcac..fe019e50a 100644 --- a/app/Repositories/Eloquent/NodeRepository.php +++ b/app/Repositories/Eloquent/NodeRepository.php @@ -10,10 +10,8 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa { /** * Return the model backing this repository. - * - * @return string */ - public function model() + public function model(): string { return Node::class; } @@ -105,7 +103,7 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa $node->allocations() ->orderByRaw('server_id IS NOT NULL DESC, server_id IS NULL') ->orderByRaw('INET_ATON(ip) ASC') - ->orderBy('port', 'asc') + ->orderBy('port') ->with('server:id,name') ->paginate(50) ); diff --git a/app/Repositories/Eloquent/PermissionRepository.php b/app/Repositories/Eloquent/PermissionRepository.php index bcd971408..780ff3439 100644 --- a/app/Repositories/Eloquent/PermissionRepository.php +++ b/app/Repositories/Eloquent/PermissionRepository.php @@ -10,11 +10,9 @@ class PermissionRepository extends EloquentRepository implements PermissionRepos /** * Return the model backing this repository. * - * @return string - * * @throws \Exception */ - public function model() + public function model(): string { throw new Exception('This functionality is not implemented.'); } diff --git a/app/Repositories/Eloquent/RecoveryTokenRepository.php b/app/Repositories/Eloquent/RecoveryTokenRepository.php index 5dfeeacfe..5d4dc4850 100644 --- a/app/Repositories/Eloquent/RecoveryTokenRepository.php +++ b/app/Repositories/Eloquent/RecoveryTokenRepository.php @@ -6,10 +6,7 @@ use Pterodactyl\Models\RecoveryToken; class RecoveryTokenRepository extends EloquentRepository { - /** - * @return string - */ - public function model() + public function model(): string { return RecoveryToken::class; } diff --git a/app/Repositories/Eloquent/ScheduleRepository.php b/app/Repositories/Eloquent/ScheduleRepository.php index 5c999df87..145333f45 100644 --- a/app/Repositories/Eloquent/ScheduleRepository.php +++ b/app/Repositories/Eloquent/ScheduleRepository.php @@ -12,16 +12,14 @@ class ScheduleRepository extends EloquentRepository implements ScheduleRepositor { /** * Return the model backing this repository. - * - * @return string */ - public function model() + public function model(): string { return Schedule::class; } /** - * Return all of the schedules for a given server. + * Return all the schedules for a given server. */ public function findServerSchedules(int $server): Collection { @@ -29,7 +27,7 @@ class ScheduleRepository extends EloquentRepository implements ScheduleRepositor } /** - * Return a schedule model with all of the associated tasks as a relationship. + * Return a schedule model with all the associated tasks as a relationship. * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -37,7 +35,7 @@ class ScheduleRepository extends EloquentRepository implements ScheduleRepositor { try { return $this->getBuilder()->with('tasks')->findOrFail($schedule, $this->getColumns()); - } catch (ModelNotFoundException $exception) { + } catch (ModelNotFoundException) { throw new RecordNotFoundException(); } } diff --git a/app/Repositories/Eloquent/ServerRepository.php b/app/Repositories/Eloquent/ServerRepository.php index 8bb79c10f..a353dba46 100644 --- a/app/Repositories/Eloquent/ServerRepository.php +++ b/app/Repositories/Eloquent/ServerRepository.php @@ -14,10 +14,8 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt { /** * Return the model backing this repository. - * - * @return string */ - public function model() + public function model(): string { return Server::class; } @@ -77,7 +75,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt return $this->getBuilder()->with('egg.variables', 'variables') ->where($this->getModel()->getKeyName(), '=', $id) ->firstOrFail($this->getColumns()); - } catch (ModelNotFoundException $exception) { + } catch (ModelNotFoundException) { throw new RecordNotFoundException(); } } @@ -155,7 +153,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt ->firstOrFail($this->getColumns()); return $model; - } catch (ModelNotFoundException $exception) { + } catch (ModelNotFoundException) { throw new RecordNotFoundException(); } } @@ -169,7 +167,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt } /** - * Returns all of the servers that exist for a given node in a paginated response. + * Returns all the servers that exist for a given node in a paginated response. */ public function loadAllServersForNode(int $node, int $limit): LengthAwarePaginator { diff --git a/app/Repositories/Eloquent/ServerVariableRepository.php b/app/Repositories/Eloquent/ServerVariableRepository.php index d0d5e4dba..26ded2cf6 100644 --- a/app/Repositories/Eloquent/ServerVariableRepository.php +++ b/app/Repositories/Eloquent/ServerVariableRepository.php @@ -9,10 +9,8 @@ class ServerVariableRepository extends EloquentRepository implements ServerVaria { /** * Return the model backing this repository. - * - * @return string */ - public function model() + public function model(): string { return ServerVariable::class; } diff --git a/app/Repositories/Eloquent/SessionRepository.php b/app/Repositories/Eloquent/SessionRepository.php index ad069abb8..5aa355dc0 100644 --- a/app/Repositories/Eloquent/SessionRepository.php +++ b/app/Repositories/Eloquent/SessionRepository.php @@ -10,16 +10,14 @@ class SessionRepository extends EloquentRepository implements SessionRepositoryI { /** * Return the model backing this repository. - * - * @return string */ - public function model() + public function model(): string { return Session::class; } /** - * Return all of the active sessions for a user. + * Return all the active sessions for a user. */ public function getUserSessions(int $user): Collection { @@ -28,10 +26,8 @@ class SessionRepository extends EloquentRepository implements SessionRepositoryI /** * Delete a session for a given user. - * - * @return int|null */ - public function deleteUserSession(int $user, string $session) + public function deleteUserSession(int $user, string $session): ?int { return $this->getBuilder()->where('user_id', $user)->where('id', $session)->delete(); } diff --git a/app/Repositories/Eloquent/SettingsRepository.php b/app/Repositories/Eloquent/SettingsRepository.php index b39d3a2e1..df22fce59 100644 --- a/app/Repositories/Eloquent/SettingsRepository.php +++ b/app/Repositories/Eloquent/SettingsRepository.php @@ -7,22 +7,14 @@ use Pterodactyl\Contracts\Repository\SettingsRepositoryInterface; class SettingsRepository extends EloquentRepository implements SettingsRepositoryInterface { - /** - * @var array - */ - private static $cache = []; + private static array $cache = []; - /** - * @var array - */ - private static $databaseMiss = []; + private static array $databaseMiss = []; /** * Return the model backing this repository. - * - * @return string */ - public function model() + public function model(): string { return Setting::class; } @@ -31,7 +23,6 @@ class SettingsRepository extends EloquentRepository implements SettingsRepositor * Store a new persistent setting in the database. * * @throws \Pterodactyl\Exceptions\Model\DataValidationException - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function set(string $key, string $value = null) { @@ -44,12 +35,8 @@ class SettingsRepository extends EloquentRepository implements SettingsRepositor /** * Retrieve a persistent setting from the database. - * - * @param mixed $default - * - * @return mixed */ - public function get(string $key, $default = null) + public function get(string $key, mixed $default = null): mixed { // If item has already been requested return it from the cache. If // we already know it is missing, immediately return the default value. diff --git a/app/Repositories/Eloquent/SubuserRepository.php b/app/Repositories/Eloquent/SubuserRepository.php index d40ed9fda..141378753 100644 --- a/app/Repositories/Eloquent/SubuserRepository.php +++ b/app/Repositories/Eloquent/SubuserRepository.php @@ -10,10 +10,8 @@ class SubuserRepository extends EloquentRepository implements SubuserRepositoryI { /** * Return the model backing this repository. - * - * @return string */ - public function model() + public function model(): string { return Subuser::class; } diff --git a/app/Repositories/Eloquent/TaskRepository.php b/app/Repositories/Eloquent/TaskRepository.php index a375939ad..942c54d47 100644 --- a/app/Repositories/Eloquent/TaskRepository.php +++ b/app/Repositories/Eloquent/TaskRepository.php @@ -11,10 +11,8 @@ class TaskRepository extends EloquentRepository implements TaskRepositoryInterfa { /** * Return the model backing this repository. - * - * @return string */ - public function model() + public function model(): string { return Task::class; } @@ -28,20 +26,18 @@ class TaskRepository extends EloquentRepository implements TaskRepositoryInterfa { try { return $this->getBuilder()->with('server.user', 'schedule')->findOrFail($id, $this->getColumns()); - } catch (ModelNotFoundException $exception) { + } catch (ModelNotFoundException) { throw new RecordNotFoundException(); } } /** * Returns the next task in a schedule. - * - * @return \Pterodactyl\Models\Task|null */ - public function getNextTask(int $schedule, int $index) + public function getNextTask(int $schedule, int $index): ?Task { return $this->getBuilder()->where('schedule_id', '=', $schedule) - ->orderBy('sequence_id', 'asc') + ->orderBy('sequence_id') ->where('sequence_id', '>', $index) ->first($this->getColumns()); } diff --git a/app/Repositories/Eloquent/UserRepository.php b/app/Repositories/Eloquent/UserRepository.php index 72a88efb0..444534625 100644 --- a/app/Repositories/Eloquent/UserRepository.php +++ b/app/Repositories/Eloquent/UserRepository.php @@ -9,10 +9,8 @@ class UserRepository extends EloquentRepository implements UserRepositoryInterfa { /** * Return the model backing this repository. - * - * @return string */ - public function model() + public function model(): string { return User::class; } diff --git a/app/Repositories/Repository.php b/app/Repositories/Repository.php index a80051942..00683f6d7 100644 --- a/app/Repositories/Repository.php +++ b/app/Repositories/Repository.php @@ -4,53 +4,34 @@ namespace Pterodactyl\Repositories; use InvalidArgumentException; use Illuminate\Foundation\Application; +use Illuminate\Database\Eloquent\Model; use Pterodactyl\Contracts\Repository\RepositoryInterface; abstract class Repository implements RepositoryInterface { - /** - * @var \Illuminate\Foundation\Application - */ - protected $app; + protected array $columns = ['*']; - /** - * @var array - */ - protected $columns = ['*']; + protected Model $model; - /** - * @var mixed - */ - protected $model; - - /** - * @var bool - */ - protected $withFresh = true; + protected bool $withFresh = true; /** * Repository constructor. */ - public function __construct(Application $application) + public function __construct(protected Application $app) { - $this->app = $application; - $this->initializeModel($this->model()); } /** * Return the model backing this repository. - * - * @return string|\Closure|object */ - abstract public function model(); + abstract public function model(): string; /** * Return the model being used for this repository. - * - * @return mixed */ - public function getModel() + public function getModel(): Model { return $this->model; } @@ -59,10 +40,8 @@ abstract class Repository implements RepositoryInterface * Setup column selection functionality. * * @param array|string $columns - * - * @return $this */ - public function setColumns($columns = ['*']) + public function setColumns($columns = ['*']): self { $clone = clone $this; $clone->columns = is_array($columns) ? $columns : func_get_args(); @@ -72,10 +51,8 @@ abstract class Repository implements RepositoryInterface /** * Return the columns to be selected in the repository call. - * - * @return array */ - public function getColumns() + public function getColumns(): array { return $this->columns; } @@ -83,31 +60,25 @@ abstract class Repository implements RepositoryInterface /** * Stop repository update functions from returning a fresh * model when changes are committed. - * - * @return $this */ - public function withoutFreshModel() + public function withoutFreshModel(): self { return $this->setFreshModel(false); } /** * Return a fresh model with a repository updates a model. - * - * @return $this */ - public function withFreshModel() + public function withFreshModel(): self { - return $this->setFreshModel(true); + return $this->setFreshModel(); } /** - * Set whether or not the repository should return a fresh model + * Set whether the repository should return a fresh model * when changes are committed. - * - * @return $this */ - public function setFreshModel(bool $fresh = true) + public function setFreshModel(bool $fresh = true): self { $clone = clone $this; $clone->withFresh = $fresh; @@ -117,12 +88,8 @@ 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) + protected function initializeModel(string ...$model): mixed { switch (count($model)) { case 1: diff --git a/app/Repositories/Wings/DaemonBackupRepository.php b/app/Repositories/Wings/DaemonBackupRepository.php index 571775fa5..4c164ee6b 100644 --- a/app/Repositories/Wings/DaemonBackupRepository.php +++ b/app/Repositories/Wings/DaemonBackupRepository.php @@ -11,17 +11,12 @@ use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; class DaemonBackupRepository extends DaemonRepository { - /** - * @var string|null - */ - protected $adapter; + protected ?string $adapter; /** * Sets the backup adapter for this execution instance. - * - * @return $this */ - public function setBackupAdapter(string $adapter) + public function setBackupAdapter(string $adapter): self { $this->adapter = $adapter; diff --git a/app/Repositories/Wings/DaemonCommandRepository.php b/app/Repositories/Wings/DaemonCommandRepository.php index 390434bff..cde29ff36 100644 --- a/app/Repositories/Wings/DaemonCommandRepository.php +++ b/app/Repositories/Wings/DaemonCommandRepository.php @@ -13,11 +13,9 @@ class DaemonCommandRepository extends DaemonRepository /** * Sends a command or multiple commands to a running server instance. * - * @param string|string[] $command - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ - public function send($command): ResponseInterface + public function send(array|string $command): ResponseInterface { Assert::isInstanceOf($this->server, Server::class); diff --git a/app/Repositories/Wings/DaemonConfigurationRepository.php b/app/Repositories/Wings/DaemonConfigurationRepository.php index f2672ddfa..d24fb7e50 100644 --- a/app/Repositories/Wings/DaemonConfigurationRepository.php +++ b/app/Repositories/Wings/DaemonConfigurationRepository.php @@ -3,6 +3,7 @@ namespace Pterodactyl\Repositories\Wings; use Pterodactyl\Models\Node; +use Psr\Http\Message\ResponseInterface; use GuzzleHttp\Exception\TransferException; use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; @@ -29,11 +30,9 @@ 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. * - * @return \Psr\Http\Message\ResponseInterface - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ - public function update(Node $node) + public function update(Node $node): ResponseInterface { try { return $this->getHttpClient()->post( diff --git a/app/Repositories/Wings/DaemonRepository.php b/app/Repositories/Wings/DaemonRepository.php index 268a4a213..512626d73 100644 --- a/app/Repositories/Wings/DaemonRepository.php +++ b/app/Repositories/Wings/DaemonRepository.php @@ -10,35 +10,21 @@ use Illuminate\Contracts\Foundation\Application; abstract class DaemonRepository { - /** - * @var \Illuminate\Contracts\Foundation\Application - */ - protected $app; + protected ?Server $server; + + protected ?Node $node; /** - * @var \Pterodactyl\Models\Server|null + * DaemonRepository constructor. */ - protected $server; - - /** - * @var \Pterodactyl\Models\Node|null - */ - protected $node; - - /** - * BaseWingsRepository constructor. - */ - public function __construct(Application $application) + public function __construct(protected Application $app) { - $this->app = $application; } /** * Set the server model this request is stemming from. - * - * @return $this */ - public function setServer(Server $server) + public function setServer(Server $server): self { $this->server = $server; @@ -49,10 +35,8 @@ abstract class DaemonRepository /** * Set the node model this request is stemming from. - * - * @return $this */ - public function setNode(Node $node) + public function setNode(Node $node): self { $this->node = $node; diff --git a/app/Rules/Fqdn.php b/app/Rules/Fqdn.php index 4f4a04dac..47baf510d 100644 --- a/app/Rules/Fqdn.php +++ b/app/Rules/Fqdn.php @@ -28,9 +28,8 @@ class Fqdn implements Rule, DataAwareRule * * @param string $attribute * @param mixed $value - * @return bool */ - public function passes($attribute, $value) + public function passes($attribute, $value): bool { if (filter_var($value, FILTER_VALIDATE_IP)) { // Check if the scheme is set to HTTPS. diff --git a/app/Rules/Username.php b/app/Rules/Username.php index bae204952..b89184e9a 100644 --- a/app/Rules/Username.php +++ b/app/Rules/Username.php @@ -13,7 +13,7 @@ class Username implements Rule /** * Validate that a username contains only the allowed characters and starts/ends - * with alpha-numeric characters. + * with alphanumeric characters. * * Allowed characters: a-z0-9_-. * @@ -37,10 +37,8 @@ class Username implements Rule /** * Convert the rule to a validation string. This is necessary to avoid * issues with Eloquence which tries to use this rule as a string. - * - * @return string */ - public function __toString() + public function __toString(): string { return 'p_username'; } diff --git a/app/Services/Acl/Api/AdminAcl.php b/app/Services/Acl/Api/AdminAcl.php index 880794adc..59c910c19 100644 --- a/app/Services/Acl/Api/AdminAcl.php +++ b/app/Services/Acl/Api/AdminAcl.php @@ -37,10 +37,8 @@ class AdminAcl /** * Determine if an API key has permission to perform a specific read/write operation. - * - * @return bool */ - public static function can(int $permission, int $action = self::READ) + public static function can(int $permission, int $action = self::READ): bool { if ($permission & $action) { return true; @@ -52,10 +50,8 @@ class AdminAcl /** * Determine if an API Key model has permission to access a given resource * at a specific action level. - * - * @return bool */ - public static function check(ApiKey $key, string $resource, int $action = self::READ) + public static function check(ApiKey $key, string $resource, int $action = self::READ): bool { return self::can(data_get($key, self::COLUMN_IDENTIFIER . $resource, self::NONE), $action); } diff --git a/app/Services/Activity/AcitvityLogBatchService.php b/app/Services/Activity/ActivityLogBatchService.php similarity index 91% rename from app/Services/Activity/AcitvityLogBatchService.php rename to app/Services/Activity/ActivityLogBatchService.php index 8e2d142f0..f4206ea56 100644 --- a/app/Services/Activity/AcitvityLogBatchService.php +++ b/app/Services/Activity/ActivityLogBatchService.php @@ -4,7 +4,7 @@ namespace Pterodactyl\Services\Activity; use Ramsey\Uuid\Uuid; -class AcitvityLogBatchService +class ActivityLogBatchService { protected int $transaction = 0; protected ?string $uuid = null; @@ -47,10 +47,8 @@ class AcitvityLogBatchService /** * Executes the logic provided within the callback in the scope of an activity * log batch transaction. - * - * @return mixed */ - public function transaction(\Closure $callback) + public function transaction(\Closure $callback): mixed { $this->start(); $result = $callback($this->uuid()); diff --git a/app/Services/Activity/ActivityLogService.php b/app/Services/Activity/ActivityLogService.php index cfdd5a9cd..fa4f46936 100644 --- a/app/Services/Activity/ActivityLogService.php +++ b/app/Services/Activity/ActivityLogService.php @@ -7,11 +7,11 @@ use Webmozart\Assert\Assert; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; use Pterodactyl\Models\ActivityLog; -use Illuminate\Contracts\Auth\Factory; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\Request; use Pterodactyl\Models\ActivityLogSubject; use Illuminate\Database\ConnectionInterface; +use Illuminate\Contracts\Auth\Factory as AuthFactory; class ActivityLogService { @@ -19,24 +19,12 @@ class ActivityLogService protected array $subjects = []; - protected Factory $manager; - - protected ConnectionInterface $connection; - - protected AcitvityLogBatchService $batch; - - protected ActivityLogTargetableService $targetable; - public function __construct( - Factory $manager, - AcitvityLogBatchService $batch, - ActivityLogTargetableService $targetable, - ConnectionInterface $connection + protected AuthFactory $manager, + protected ActivityLogBatchService $batch, + protected ActivityLogTargetableService $targetable, + protected ConnectionInterface $connection ) { - $this->manager = $manager; - $this->batch = $batch; - $this->targetable = $targetable; - $this->connection = $connection; } /** @@ -75,11 +63,17 @@ class ActivityLogService /** * Sets the subject model instance. * - * @param \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Model[] $subjects + * @template T extends \Illuminate\Database\Eloquent\Model|\Illuminate\Contracts\Auth\Authenticatable + * + * @param T|T[]|null $subjects */ public function subject(...$subjects): self { foreach (Arr::wrap($subjects) as $subject) { + if (is_null($subject)) { + continue; + } + foreach ($this->subjects as $entry) { // If this subject is already tracked in our array of subjects just skip over // it and move on to the next one in the list. @@ -170,11 +164,9 @@ class ActivityLogService /** * Executes the provided callback within the scope of a database transaction - * and will only save the activity log entry if everything else succesfully + * and will only save the activity log entry if everything else successfully * settles. * - * @return mixed - * * @throws \Throwable */ public function transaction(\Closure $callback) diff --git a/app/Services/Allocations/AllocationDeletionService.php b/app/Services/Allocations/AllocationDeletionService.php index 4b1bfec3b..8ea677245 100644 --- a/app/Services/Allocations/AllocationDeletionService.php +++ b/app/Services/Allocations/AllocationDeletionService.php @@ -8,28 +8,20 @@ use Pterodactyl\Exceptions\Service\Allocation\ServerUsingAllocationException; class AllocationDeletionService { - /** - * @var \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface - */ - private $repository; - /** * AllocationDeletionService constructor. */ - public function __construct(AllocationRepositoryInterface $repository) + public function __construct(private AllocationRepositoryInterface $repository) { - $this->repository = $repository; } /** * Delete an allocation from the database only if it does not have a server * that is actively attached to it. * - * @return int - * * @throws \Pterodactyl\Exceptions\Service\Allocation\ServerUsingAllocationException */ - public function handle(Allocation $allocation) + public function handle(Allocation $allocation): int { 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 a7563eb28..ec79d18f1 100644 --- a/app/Services/Allocations/AssignmentService.php +++ b/app/Services/Allocations/AssignmentService.php @@ -22,23 +22,11 @@ class AssignmentService public const PORT_RANGE_LIMIT = 1000; public const PORT_RANGE_REGEX = '/^(\d{4,5})-(\d{4,5})$/'; - /** - * @var \Illuminate\Database\ConnectionInterface - */ - protected $connection; - - /** - * @var \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface - */ - protected $repository; - /** * AssignmentService constructor. */ - public function __construct(AllocationRepositoryInterface $repository, ConnectionInterface $connection) + public function __construct(protected AllocationRepositoryInterface $repository, protected ConnectionInterface $connection) { - $this->connection = $connection; - $this->repository = $repository; } /** @@ -50,7 +38,7 @@ class AssignmentService * @throws \Pterodactyl\Exceptions\Service\Allocation\PortOutOfRangeException * @throws \Pterodactyl\Exceptions\Service\Allocation\TooManyPortsInRangeException */ - public function handle(Node $node, array $data) + public function handle(Node $node, array $data): void { $explode = explode('/', $data['allocation_ip']); if (count($explode) !== 1) { diff --git a/app/Services/Allocations/FindAssignableAllocationService.php b/app/Services/Allocations/FindAssignableAllocationService.php index 29c37123f..3374fa07e 100644 --- a/app/Services/Allocations/FindAssignableAllocationService.php +++ b/app/Services/Allocations/FindAssignableAllocationService.php @@ -10,19 +10,11 @@ use Pterodactyl\Exceptions\Service\Allocation\NoAutoAllocationSpaceAvailableExce class FindAssignableAllocationService { - /** - * @var \Pterodactyl\Services\Allocations\AssignmentService - */ - private $service; - /** * FindAssignableAllocationService constructor. - * - * @param \Pterodactyl\Services\Allocations\AssignmentService $service */ - public function __construct(AssignmentService $service) + public function __construct(private AssignmentService $service) { - $this->service = $service; } /** @@ -30,15 +22,13 @@ class FindAssignableAllocationService * no allocation can be found, a new one will be created with a random port between the defined * range from the configuration. * - * @return \Pterodactyl\Models\Allocation - * * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Service\Allocation\CidrOutOfRangeException * @throws \Pterodactyl\Exceptions\Service\Allocation\InvalidPortMappingException * @throws \Pterodactyl\Exceptions\Service\Allocation\PortOutOfRangeException * @throws \Pterodactyl\Exceptions\Service\Allocation\TooManyPortsInRangeException */ - public function handle(Server $server) + public function handle(Server $server): Allocation { if (!config('pterodactyl.client_features.allocations.enabled')) { throw new AutoAllocationNotEnabledException(); diff --git a/app/Services/Api/KeyCreationService.php b/app/Services/Api/KeyCreationService.php index 29f079c81..f026b9f22 100644 --- a/app/Services/Api/KeyCreationService.php +++ b/app/Services/Api/KeyCreationService.php @@ -8,37 +8,20 @@ use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface; class KeyCreationService { - /** - * @var \Illuminate\Contracts\Encryption\Encrypter - */ - private $encrypter; - - /** - * @var int - */ - private $keyType = ApiKey::TYPE_NONE; - - /** - * @var \Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface - */ - private $repository; + private int $keyType = ApiKey::TYPE_NONE; /** * ApiKeyService constructor. */ - public function __construct(ApiKeyRepositoryInterface $repository, Encrypter $encrypter) + public function __construct(private ApiKeyRepositoryInterface $repository, private Encrypter $encrypter) { - $this->encrypter = $encrypter; - $this->repository = $repository; } /** * 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. - * - * @return \Pterodactyl\Services\Api\KeyCreationService */ - public function setKeyType(int $type) + public function setKeyType(int $type): self { $this->keyType = $type; diff --git a/app/Services/Backups/DeleteBackupService.php b/app/Services/Backups/DeleteBackupService.php index 66eefe675..fd65969c1 100644 --- a/app/Services/Backups/DeleteBackupService.php +++ b/app/Services/Backups/DeleteBackupService.php @@ -7,46 +7,17 @@ use Pterodactyl\Models\Backup; use GuzzleHttp\Exception\ClientException; use Illuminate\Database\ConnectionInterface; use Pterodactyl\Extensions\Backups\BackupManager; -use Pterodactyl\Repositories\Eloquent\BackupRepository; use Pterodactyl\Repositories\Wings\DaemonBackupRepository; use Pterodactyl\Exceptions\Service\Backup\BackupLockedException; use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; class DeleteBackupService { - /** - * @var \Pterodactyl\Repositories\Eloquent\BackupRepository - */ - private $repository; - - /** - * @var \Pterodactyl\Repositories\Wings\DaemonBackupRepository - */ - private $daemonBackupRepository; - - /** - * @var \Illuminate\Database\ConnectionInterface - */ - private $connection; - - /** - * @var \Pterodactyl\Extensions\Backups\BackupManager - */ - private $manager; - - /** - * DeleteBackupService constructor. - */ public function __construct( - ConnectionInterface $connection, - BackupRepository $repository, - BackupManager $manager, - DaemonBackupRepository $daemonBackupRepository + private ConnectionInterface $connection, + private BackupManager $manager, + private DaemonBackupRepository $daemonBackupRepository ) { - $this->repository = $repository; - $this->daemonBackupRepository = $daemonBackupRepository; - $this->connection = $connection; - $this->manager = $manager; } /** @@ -55,7 +26,7 @@ class DeleteBackupService * * @throws \Throwable */ - public function handle(Backup $backup) + public function handle(Backup $backup): void { // If the backup is marked as failed it can still be deleted, even if locked // since the UI doesn't allow you to unlock a failed backup in the first place. @@ -79,13 +50,13 @@ class DeleteBackupService } catch (DaemonConnectionException $exception) { $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. + // doesn't actually exist and remove its reference from the Panel as well. if (!$previous instanceof ClientException || $previous->getResponse()->getStatusCode() !== Response::HTTP_NOT_FOUND) { throw $exception; } } - $this->repository->delete($backup->id); + $backup->delete(); }); } @@ -94,12 +65,12 @@ class DeleteBackupService * * @throws \Throwable */ - protected function deleteFromS3(Backup $backup) + protected function deleteFromS3(Backup $backup): void { $this->connection->transaction(function () use ($backup) { - $this->repository->delete($backup->id); + $backup->delete(); - /** @var \League\Flysystem\AwsS3v3\AwsS3Adapter $adapter */ + /** @var \Pterodactyl\Extensions\Filesystem\S3Filesystem $adapter */ $adapter = $this->manager->adapter(Backup::ADAPTER_AWS_S3); $adapter->getClient()->deleteObject([ diff --git a/app/Services/Backups/DownloadLinkService.php b/app/Services/Backups/DownloadLinkService.php index 1a3812968..f3f76c845 100644 --- a/app/Services/Backups/DownloadLinkService.php +++ b/app/Services/Backups/DownloadLinkService.php @@ -10,23 +10,11 @@ use Pterodactyl\Extensions\Backups\BackupManager; class DownloadLinkService { - /** - * @var \Pterodactyl\Extensions\Backups\BackupManager - */ - private $backupManager; - - /** - * @var \Pterodactyl\Services\Nodes\NodeJWTService - */ - private $jwtService; - /** * DownloadLinkService constructor. */ - public function __construct(BackupManager $backupManager, NodeJWTService $jwtService) + public function __construct(private BackupManager $backupManager, private NodeJWTService $jwtService) { - $this->backupManager = $backupManager; - $this->jwtService = $jwtService; } /** @@ -54,12 +42,10 @@ class DownloadLinkService /** * Returns a signed URL that allows us to download a file directly out of a non-public * S3 bucket by using a signed URL. - * - * @return string */ - protected function getS3BackupUrl(Backup $backup) + protected function getS3BackupUrl(Backup $backup): string { - /** @var \League\Flysystem\AwsS3v3\AwsS3Adapter $adapter */ + /** @var \Pterodactyl\Extensions\Filesystem\S3Filesystem $adapter */ $adapter = $this->backupManager->adapter(Backup::ADAPTER_AWS_S3); $request = $adapter->getClient()->createPresignedRequest( diff --git a/app/Services/Backups/InitiateBackupService.php b/app/Services/Backups/InitiateBackupService.php index 705bdf428..be8f96632 100644 --- a/app/Services/Backups/InitiateBackupService.php +++ b/app/Services/Backups/InitiateBackupService.php @@ -16,65 +16,25 @@ use Symfony\Component\HttpKernel\Exception\TooManyRequestsHttpException; class InitiateBackupService { - /** - * @var string[]|null - */ - private $ignoredFiles; + private ?array $ignoredFiles; - /** - * @var bool - */ - private $isLocked = false; - - /** - * @var \Pterodactyl\Repositories\Eloquent\BackupRepository - */ - private $repository; - - /** - * @var \Illuminate\Database\ConnectionInterface - */ - private $connection; - - /** - * @var \Pterodactyl\Repositories\Wings\DaemonBackupRepository - */ - private $daemonBackupRepository; - - /** - * @var \Pterodactyl\Extensions\Backups\BackupManager - */ - private $backupManager; - - /** - * @var \Pterodactyl\Services\Backups\DeleteBackupService - */ - private $deleteBackupService; + private bool $isLocked = false; /** * InitiateBackupService constructor. - * - * @param \Pterodactyl\Services\Backups\DeleteBackupService $deleteBackupService */ public function __construct( - BackupRepository $repository, - ConnectionInterface $connection, - DaemonBackupRepository $daemonBackupRepository, - DeleteBackupService $deleteBackupService, - BackupManager $backupManager + private BackupRepository $repository, + private ConnectionInterface $connection, + private DaemonBackupRepository $daemonBackupRepository, + private DeleteBackupService $deleteBackupService, + private BackupManager $backupManager ) { - $this->repository = $repository; - $this->connection = $connection; - $this->daemonBackupRepository = $daemonBackupRepository; - $this->backupManager = $backupManager; - $this->deleteBackupService = $deleteBackupService; } /** * Set if the backup should be locked once it is created which will prevent * its deletion by users or automated system processes. - * - * @return $this */ public function setIsLocked(bool $isLocked): self { @@ -87,10 +47,8 @@ class InitiateBackupService * Sets the files to be ignored by this backup. * * @param string[]|null $ignored - * - * @return $this */ - public function setIgnoredFiles(?array $ignored) + public function setIgnoredFiles(?array $ignored): self { if (is_array($ignored)) { foreach ($ignored as $value) { diff --git a/app/Services/Databases/DatabaseManagementService.php b/app/Services/Databases/DatabaseManagementService.php index a10b22719..b70cb8b4d 100644 --- a/app/Services/Databases/DatabaseManagementService.php +++ b/app/Services/Databases/DatabaseManagementService.php @@ -25,49 +25,20 @@ class DatabaseManagementService */ private const MATCH_NAME_REGEX = '/^(s[\d]+_)(.*)$/'; - /** - * @var \Illuminate\Database\ConnectionInterface - */ - private $connection; - - /** - * @var \Pterodactyl\Extensions\DynamicDatabaseConnection - */ - private $dynamic; - - /** - * @var \Illuminate\Contracts\Encryption\Encrypter - */ - private $encrypter; - - /** - * @var \Pterodactyl\Repositories\Eloquent\DatabaseRepository - */ - private $repository; - /** * Determines if the service should validate the user's ability to create an additional * database for this server. In almost all cases this should be true, but to keep things * flexible you can also set it to false and create more databases than the server is * allocated. - * - * @var bool */ - protected $validateDatabaseLimit = true; + protected bool $validateDatabaseLimit = true; - /** - * CreationService constructor. - */ public function __construct( - ConnectionInterface $connection, - DynamicDatabaseConnection $dynamic, - DatabaseRepository $repository, - Encrypter $encrypter + protected ConnectionInterface $connection, + protected DynamicDatabaseConnection $dynamic, + protected Encrypter $encrypter, + protected DatabaseRepository $repository ) { - $this->connection = $connection; - $this->dynamic = $dynamic; - $this->encrypter = $encrypter; - $this->repository = $repository; } /** @@ -82,10 +53,8 @@ class DatabaseManagementService } /** - * Set wether or not this class should validate that the server has enough slots + * Set whether this class should validate that the server has enough slots * left before creating the new database. - * - * @return $this */ public function setValidateDatabaseLimit(bool $validate): self { @@ -97,13 +66,11 @@ class DatabaseManagementService /** * Create a new database that is linked to a specific host. * - * @return \Pterodactyl\Models\Database - * * @throws \Throwable * @throws \Pterodactyl\Exceptions\Service\Database\TooManyDatabasesException * @throws \Pterodactyl\Exceptions\Service\Database\DatabaseClientFeatureNotEnabledException */ - public function create(Server $server, array $data) + public function create(Server $server, array $data): Database { if (!config('pterodactyl.client_features.databases.enabled')) { throw new DatabaseClientFeatureNotEnabledException(); @@ -169,11 +136,9 @@ class DatabaseManagementService /** * Delete a database from the given host server. * - * @return bool|null - * * @throws \Exception */ - public function delete(Database $database) + public function delete(Database $database): ?bool { $this->dynamic->set('dynamic', $database->database_host_id); diff --git a/app/Services/Databases/DatabasePasswordService.php b/app/Services/Databases/DatabasePasswordService.php index aabe98388..3862b2393 100644 --- a/app/Services/Databases/DatabasePasswordService.php +++ b/app/Services/Databases/DatabasePasswordService.php @@ -11,49 +11,23 @@ use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface; class DatabasePasswordService { - /** - * @var \Illuminate\Database\ConnectionInterface - */ - private $connection; - - /** - * @var \Pterodactyl\Extensions\DynamicDatabaseConnection - */ - private $dynamic; - - /** - * @var \Illuminate\Contracts\Encryption\Encrypter - */ - private $encrypter; - - /** - * @var \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface - */ - private $repository; - /** * DatabasePasswordService constructor. */ public function __construct( - ConnectionInterface $connection, - DatabaseRepositoryInterface $repository, - DynamicDatabaseConnection $dynamic, - Encrypter $encrypter + private ConnectionInterface $connection, + private DynamicDatabaseConnection $dynamic, + private Encrypter $encrypter, + private DatabaseRepositoryInterface $repository ) { - $this->connection = $connection; - $this->dynamic = $dynamic; - $this->encrypter = $encrypter; - $this->repository = $repository; } /** * Updates a password for a given database. * - * @param \Pterodactyl\Models\Database|int $database - * * @throws \Throwable */ - public function handle(Database $database): string + public function handle(Database|int $database): string { $password = Utilities::randomStringWithSpecialCharacters(24); diff --git a/app/Services/Databases/DeployServerDatabaseService.php b/app/Services/Databases/DeployServerDatabaseService.php index 3946cb83f..e22eba51d 100644 --- a/app/Services/Databases/DeployServerDatabaseService.php +++ b/app/Services/Databases/DeployServerDatabaseService.php @@ -11,18 +11,10 @@ use Pterodactyl\Exceptions\Service\Database\NoSuitableDatabaseHostException; class DeployServerDatabaseService { /** - * @var \Pterodactyl\Services\Databases\DatabaseManagementService + * DeployServerDatabaseService constructor. */ - private $managementService; - - /** - * ServerDatabaseCreationService constructor. - * - * @param \Pterodactyl\Services\Databases\DatabaseManagementService $managementService - */ - public function __construct(DatabaseManagementService $managementService) + public function __construct(private DatabaseManagementService $managementService) { - $this->managementService = $managementService; } /** diff --git a/app/Services/Databases/Hosts/HostCreationService.php b/app/Services/Databases/Hosts/HostCreationService.php index 275f4d294..d33a15856 100644 --- a/app/Services/Databases/Hosts/HostCreationService.php +++ b/app/Services/Databases/Hosts/HostCreationService.php @@ -11,46 +11,16 @@ use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface; class HostCreationService { - /** - * @var \Illuminate\Database\ConnectionInterface - */ - private $connection; - - /** - * @var \Illuminate\Database\DatabaseManager - */ - private $databaseManager; - - /** - * @var \Pterodactyl\Extensions\DynamicDatabaseConnection - */ - private $dynamic; - - /** - * @var \Illuminate\Contracts\Encryption\Encrypter - */ - private $encrypter; - - /** - * @var \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface - */ - private $repository; - /** * HostCreationService constructor. */ public function __construct( - ConnectionInterface $connection, - DatabaseManager $databaseManager, - DatabaseHostRepositoryInterface $repository, - DynamicDatabaseConnection $dynamic, - Encrypter $encrypter + private ConnectionInterface $connection, + private DatabaseManager $databaseManager, + private DynamicDatabaseConnection $dynamic, + private Encrypter $encrypter, + private DatabaseHostRepositoryInterface $repository ) { - $this->connection = $connection; - $this->databaseManager = $databaseManager; - $this->dynamic = $dynamic; - $this->encrypter = $encrypter; - $this->repository = $repository; } /** diff --git a/app/Services/Databases/Hosts/HostDeletionService.php b/app/Services/Databases/Hosts/HostDeletionService.php index 1538d4823..4a06af8da 100644 --- a/app/Services/Databases/Hosts/HostDeletionService.php +++ b/app/Services/Databases/Hosts/HostDeletionService.php @@ -8,25 +8,13 @@ use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface; class HostDeletionService { - /** - * @var \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface - */ - private $databaseRepository; - - /** - * @var \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface - */ - private $repository; - /** * HostDeletionService constructor. */ public function __construct( - DatabaseRepositoryInterface $databaseRepository, - DatabaseHostRepositoryInterface $repository + private DatabaseRepositoryInterface $databaseRepository, + private DatabaseHostRepositoryInterface $repository ) { - $this->databaseRepository = $databaseRepository; - $this->repository = $repository; } /** diff --git a/app/Services/Databases/Hosts/HostUpdateService.php b/app/Services/Databases/Hosts/HostUpdateService.php index 4a281b851..363deb1b3 100644 --- a/app/Services/Databases/Hosts/HostUpdateService.php +++ b/app/Services/Databases/Hosts/HostUpdateService.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Services\Databases\Hosts; @@ -19,45 +12,15 @@ use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface; class HostUpdateService { /** - * @var \Illuminate\Database\ConnectionInterface - */ - private $connection; - - /** - * @var \Illuminate\Database\DatabaseManager - */ - private $databaseManager; - - /** - * @var \Pterodactyl\Extensions\DynamicDatabaseConnection - */ - private $dynamic; - - /** - * @var \Illuminate\Contracts\Encryption\Encrypter - */ - private $encrypter; - - /** - * @var \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface - */ - private $repository; - - /** - * DatabaseHostService constructor. + * HostUpdateService constructor. */ public function __construct( - ConnectionInterface $connection, - DatabaseManager $databaseManager, - DatabaseHostRepositoryInterface $repository, - DynamicDatabaseConnection $dynamic, - Encrypter $encrypter + private ConnectionInterface $connection, + private DatabaseManager $databaseManager, + private DynamicDatabaseConnection $dynamic, + private Encrypter $encrypter, + private DatabaseHostRepositoryInterface $repository ) { - $this->connection = $connection; - $this->databaseManager = $databaseManager; - $this->dynamic = $dynamic; - $this->encrypter = $encrypter; - $this->repository = $repository; } /** diff --git a/app/Services/Deployment/AllocationSelectionService.php b/app/Services/Deployment/AllocationSelectionService.php index d714700b5..ae334edd2 100644 --- a/app/Services/Deployment/AllocationSelectionService.php +++ b/app/Services/Deployment/AllocationSelectionService.php @@ -10,42 +10,25 @@ use Pterodactyl\Exceptions\Service\Deployment\NoViableAllocationException; class AllocationSelectionService { - /** - * @var \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface - */ - private $repository; + protected bool $dedicated = false; - /** - * @var bool - */ - protected $dedicated = false; + protected array $nodes = []; - /** - * @var array - */ - protected $nodes = []; - - /** - * @var array - */ - protected $ports = []; + protected array $ports = []; /** * AllocationSelectionService constructor. */ - public function __construct(AllocationRepositoryInterface $repository) + public function __construct(private AllocationRepositoryInterface $repository) { - $this->repository = $repository; } /** * Toggle if the selected allocation should be the only allocation belonging * 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. - * - * @return $this */ - public function setDedicated(bool $dedicated) + public function setDedicated(bool $dedicated): self { $this->dedicated = $dedicated; @@ -55,10 +38,8 @@ 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. - * - * @return $this */ - public function setNodes(array $nodes) + public function setNodes(array $nodes): self { $this->nodes = $nodes; @@ -70,11 +51,9 @@ 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. * - * @return $this - * * @throws \Pterodactyl\Exceptions\DisplayException */ - public function setPorts(array $ports) + public function setPorts(array $ports): self { $stored = []; foreach ($ports as $port) { diff --git a/app/Services/Deployment/FindViableNodesService.php b/app/Services/Deployment/FindViableNodesService.php index 5c5a5138e..71c830bf9 100644 --- a/app/Services/Deployment/FindViableNodesService.php +++ b/app/Services/Deployment/FindViableNodesService.php @@ -4,29 +4,18 @@ namespace Pterodactyl\Services\Deployment; use Pterodactyl\Models\Node; use Webmozart\Assert\Assert; +use Illuminate\Support\Collection; +use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Pterodactyl\Exceptions\Service\Deployment\NoViableNodeException; class FindViableNodesService { - /** - * @var array - */ - protected $locations = []; - - /** - * @var int - */ - protected $disk; - - /** - * @var int - */ - protected $memory; + protected array $locations = []; + protected ?int $disk = null; + protected ?int $memory = null; /** * Set the locations that should be searched through to locate available nodes. - * - * @return $this */ public function setLocations(array $locations): self { @@ -41,8 +30,6 @@ class FindViableNodesService * Set the amount of disk that will be used by the server being created. Nodes will be * filtered out if they do not have enough available free disk space for this server * to be placed on. - * - * @return $this */ public function setDisk(int $disk): self { @@ -54,8 +41,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. - * - * @return $this */ public function setMemory(int $memory): self { @@ -79,11 +64,9 @@ class FindViableNodesService * 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 */ - public function handle(int $perPage = null, int $page = null) + public function handle(int $perPage = null, int $page = null): LengthAwarePaginator|Collection { Assert::integer($this->disk, 'Disk space must be an int, got %s'); Assert::integer($this->memory, 'Memory usage must be an int, got %s'); diff --git a/app/Services/Eggs/EggConfigurationService.php b/app/Services/Eggs/EggConfigurationService.php index bfcdc1eee..4a61c2ea6 100644 --- a/app/Services/Eggs/EggConfigurationService.php +++ b/app/Services/Eggs/EggConfigurationService.php @@ -9,17 +9,11 @@ use Pterodactyl\Services\Servers\ServerConfigurationStructureService; class EggConfigurationService { - /** - * @var \Pterodactyl\Services\Servers\ServerConfigurationStructureService - */ - private $configurationStructureService; - /** * EggConfigurationService constructor. */ - public function __construct(ServerConfigurationStructureService $configurationStructureService) + public function __construct(private ServerConfigurationStructureService $configurationStructureService) { - $this->configurationStructureService = $configurationStructureService; } /** @@ -41,10 +35,8 @@ class EggConfigurationService /** * Convert the "done" variable into an array if it is not currently one. - * - * @return array */ - protected function convertStartupToNewFormat(array $startup) + protected function convertStartupToNewFormat(array $startup): array { $done = Arr::get($startup, 'done'); @@ -85,10 +77,7 @@ class EggConfigurationService ]; } - /** - * @return array - */ - protected function replacePlaceholders(Server $server, object $configs) + protected function replacePlaceholders(Server $server, object $configs): array { // Get the legacy configuration structure for the server so that we // can property map the egg placeholders to values. @@ -161,20 +150,15 @@ class EggConfigurationService case 'env.SERVER_PORT': $replace = 'server.build.default.port'; break; - // By default we don't need to change anything, only if we ended up matching a specific legacy item. default: + // By default, we don't need to change anything, only if we ended up matching a specific legacy item. $replace = $key; } return str_replace("{{{$key}}}", "{{{$replace}}}", $value); } - /** - * @param mixed $value - * - * @return mixed|null - */ - protected function matchAndReplaceKeys($value, array $structure) + protected function matchAndReplaceKeys(mixed $value, array $structure): mixed { preg_match_all('/{{(?[\w.-]*)}}/', $value, $matches); @@ -229,12 +213,8 @@ class EggConfigurationService * Iterates over a set of "find" values for a given file in the parser configuration. If * the value of the line match is something iterable, continue iterating, otherwise perform * a match & replace. - * - * @param mixed $data - * - * @return mixed */ - private function iterate($data, array $structure) + private function iterate(mixed $data, array $structure): mixed { if (!is_iterable($data) && !is_object($data)) { return $data; diff --git a/app/Services/Eggs/EggCreationService.php b/app/Services/Eggs/EggCreationService.php index d7b5bb42b..b084b0cca 100644 --- a/app/Services/Eggs/EggCreationService.php +++ b/app/Services/Eggs/EggCreationService.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Services\Eggs; @@ -18,23 +11,11 @@ use Pterodactyl\Exceptions\Service\Egg\NoParentConfigurationFoundException; // When a mommy and a daddy pterodactyl really like each other... class EggCreationService { - /** - * @var \Illuminate\Contracts\Config\Repository - */ - protected $config; - - /** - * @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface - */ - protected $repository; - /** * EggCreationService constructor. */ - public function __construct(ConfigRepository $config, EggRepositoryInterface $repository) + public function __construct(private ConfigRepository $config, private EggRepositoryInterface $repository) { - $this->config = $config; - $this->repository = $repository; } /** diff --git a/app/Services/Eggs/EggDeletionService.php b/app/Services/Eggs/EggDeletionService.php index 1c8f8cf66..7e4013351 100644 --- a/app/Services/Eggs/EggDeletionService.php +++ b/app/Services/Eggs/EggDeletionService.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Services\Eggs; @@ -16,25 +9,13 @@ use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; class EggDeletionService { - /** - * @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface - */ - protected $repository; - - /** - * @var \Pterodactyl\Contracts\Repository\ServerRepositoryInterface - */ - protected $serverRepository; - /** * EggDeletionService constructor. */ public function __construct( - ServerRepositoryInterface $serverRepository, - EggRepositoryInterface $repository + protected ServerRepositoryInterface $serverRepository, + protected EggRepositoryInterface $repository ) { - $this->repository = $repository; - $this->serverRepository = $serverRepository; } /** diff --git a/app/Services/Eggs/EggParserService.php b/app/Services/Eggs/EggParserService.php index ff84fdfd8..6d8545bc2 100644 --- a/app/Services/Eggs/EggParserService.php +++ b/app/Services/Eggs/EggParserService.php @@ -13,6 +13,7 @@ class EggParserService /** * Takes an uploaded file and parses out the egg configuration from within. * + * @throws \JsonException * @throws \Pterodactyl\Exceptions\Service\InvalidFileUploadException */ public function handle(UploadedFile $file): array diff --git a/app/Services/Eggs/EggUpdateService.php b/app/Services/Eggs/EggUpdateService.php index e0cabbb05..7ca442ba3 100644 --- a/app/Services/Eggs/EggUpdateService.php +++ b/app/Services/Eggs/EggUpdateService.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Services\Eggs; @@ -15,17 +8,11 @@ use Pterodactyl\Exceptions\Service\Egg\NoParentConfigurationFoundException; class EggUpdateService { - /** - * @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface - */ - protected $repository; - /** * EggUpdateService constructor. */ - public function __construct(EggRepositoryInterface $repository) + public function __construct(protected EggRepositoryInterface $repository) { - $this->repository = $repository; } /** @@ -35,7 +22,7 @@ class EggUpdateService * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Service\Egg\NoParentConfigurationFoundException */ - public function handle(Egg $egg, array $data) + public function handle(Egg $egg, array $data): void { if (!is_null(array_get($data, 'config_from'))) { $results = $this->repository->findCountWhere([ diff --git a/app/Services/Eggs/Scripts/InstallScriptService.php b/app/Services/Eggs/Scripts/InstallScriptService.php index ecd1dc1f3..334157236 100644 --- a/app/Services/Eggs/Scripts/InstallScriptService.php +++ b/app/Services/Eggs/Scripts/InstallScriptService.php @@ -8,29 +8,21 @@ use Pterodactyl\Exceptions\Service\Egg\InvalidCopyFromException; class InstallScriptService { - /** - * @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface - */ - protected $repository; - /** * InstallScriptService constructor. */ - public function __construct(EggRepositoryInterface $repository) + public function __construct(protected EggRepositoryInterface $repository) { - $this->repository = $repository; } /** * Modify the install script for a given Egg. * - * @param int|\Pterodactyl\Models\Egg $egg - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Service\Egg\InvalidCopyFromException */ - public function handle(Egg $egg, array $data) + public function handle(Egg $egg, array $data): void { if (!is_null(array_get($data, 'copy_script_from'))) { if (!$this->repository->isCopyableScript(array_get($data, 'copy_script_from'), $egg->nest_id)) { diff --git a/app/Services/Eggs/Sharing/EggExporterService.php b/app/Services/Eggs/Sharing/EggExporterService.php index 26723747a..706297b3d 100644 --- a/app/Services/Eggs/Sharing/EggExporterService.php +++ b/app/Services/Eggs/Sharing/EggExporterService.php @@ -10,17 +10,11 @@ use Pterodactyl\Contracts\Repository\EggRepositoryInterface; class EggExporterService { - /** - * @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface - */ - protected $repository; - /** * EggExporterService constructor. */ - public function __construct(EggRepositoryInterface $repository) + public function __construct(protected EggRepositoryInterface $repository) { - $this->repository = $repository; } /** @@ -38,7 +32,7 @@ class EggExporterService 'version' => Egg::EXPORT_VERSION, 'update_url' => $egg->update_url, ], - 'exported_at' => Carbon::now()->toIso8601String(), + 'exported_at' => Carbon::now()->toAtomString(), 'name' => $egg->name, 'author' => $egg->author, 'description' => $egg->description, diff --git a/app/Services/Eggs/Sharing/EggImporterService.php b/app/Services/Eggs/Sharing/EggImporterService.php index 746ce26be..ecd6eadb6 100644 --- a/app/Services/Eggs/Sharing/EggImporterService.php +++ b/app/Services/Eggs/Sharing/EggImporterService.php @@ -13,14 +13,8 @@ use Pterodactyl\Services\Eggs\EggParserService; class EggImporterService { - protected ConnectionInterface $connection; - - protected EggParserService $parser; - - public function __construct(ConnectionInterface $connection, EggParserService $parser) + public function __construct(protected ConnectionInterface $connection, protected EggParserService $parser) { - $this->connection = $connection; - $this->parser = $parser; } /** diff --git a/app/Services/Eggs/Sharing/EggUpdateImporterService.php b/app/Services/Eggs/Sharing/EggUpdateImporterService.php index 7d2811642..89a1f9287 100644 --- a/app/Services/Eggs/Sharing/EggUpdateImporterService.php +++ b/app/Services/Eggs/Sharing/EggUpdateImporterService.php @@ -11,17 +11,11 @@ use Pterodactyl\Services\Eggs\EggParserService; class EggUpdateImporterService { - protected ConnectionInterface $connection; - - protected EggParserService $parser; - /** * EggUpdateImporterService constructor. */ - public function __construct(ConnectionInterface $connection, EggParserService $parser) + public function __construct(protected ConnectionInterface $connection, protected EggParserService $parser) { - $this->connection = $connection; - $this->parser = $parser; } /** diff --git a/app/Services/Eggs/Variables/VariableCreationService.php b/app/Services/Eggs/Variables/VariableCreationService.php index fa758265b..a7e19f6ba 100644 --- a/app/Services/Eggs/Variables/VariableCreationService.php +++ b/app/Services/Eggs/Variables/VariableCreationService.php @@ -3,8 +3,8 @@ namespace Pterodactyl\Services\Eggs\Variables; use Pterodactyl\Models\EggVariable; -use Illuminate\Contracts\Validation\Factory; use Pterodactyl\Traits\Services\ValidatesValidationRules; +use Illuminate\Contracts\Validation\Factory as ValidationFactory; use Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface; use Pterodactyl\Exceptions\Service\Egg\Variable\ReservedVariableNameException; @@ -12,30 +12,18 @@ class VariableCreationService { use ValidatesValidationRules; - /** - * @var \Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface - */ - private $repository; - - /** - * @var \Illuminate\Contracts\Validation\Factory - */ - private $validator; - /** * VariableCreationService constructor. */ - public function __construct(EggVariableRepositoryInterface $repository, Factory $validator) + public function __construct(private EggVariableRepositoryInterface $repository, private ValidationFactory $validator) { - $this->repository = $repository; - $this->validator = $validator; } /** * Return the validation factory instance to be used by rule validation * checking in the trait. */ - protected function getValidator(): Factory + protected function getValidator(): ValidationFactory { return $this->validator; } diff --git a/app/Services/Eggs/Variables/VariableUpdateService.php b/app/Services/Eggs/Variables/VariableUpdateService.php index da4426c33..ed70b260f 100644 --- a/app/Services/Eggs/Variables/VariableUpdateService.php +++ b/app/Services/Eggs/Variables/VariableUpdateService.php @@ -4,9 +4,9 @@ namespace Pterodactyl\Services\Eggs\Variables; use Illuminate\Support\Str; use Pterodactyl\Models\EggVariable; -use Illuminate\Contracts\Validation\Factory; use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Traits\Services\ValidatesValidationRules; +use Illuminate\Contracts\Validation\Factory as ValidationFactory; use Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface; use Pterodactyl\Exceptions\Service\Egg\Variable\ReservedVariableNameException; @@ -14,30 +14,18 @@ class VariableUpdateService { use ValidatesValidationRules; - /** - * @var \Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface - */ - private $repository; - - /** - * @var \Illuminate\Contracts\Validation\Factory - */ - private $validator; - /** * VariableUpdateService constructor. */ - public function __construct(EggVariableRepositoryInterface $repository, Factory $validator) + public function __construct(private EggVariableRepositoryInterface $repository, private ValidationFactory $validator) { - $this->repository = $repository; - $this->validator = $validator; } /** * Return the validation factory instance to be used by rule validation * checking in the trait. */ - protected function getValidator(): Factory + protected function getValidator(): ValidationFactory { return $this->validator; } @@ -45,14 +33,12 @@ class VariableUpdateService /** * Update a specific egg variable. * - * @return mixed - * * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Service\Egg\Variable\ReservedVariableNameException */ - public function handle(EggVariable $variable, array $data) + public function handle(EggVariable $variable, array $data): mixed { if (!is_null(array_get($data, 'env_variable'))) { if (in_array(strtoupper(array_get($data, 'env_variable')), explode(',', EggVariable::RESERVED_ENV_NAMES))) { diff --git a/app/Services/Helpers/ApiAllowedIpsValidatorService.php b/app/Services/Helpers/ApiAllowedIpsValidatorService.php deleted file mode 100644 index 7051cd539..000000000 --- a/app/Services/Helpers/ApiAllowedIpsValidatorService.php +++ /dev/null @@ -1,8 +0,0 @@ -. - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ diff --git a/app/Services/Helpers/AssetHashService.php b/app/Services/Helpers/AssetHashService.php index 4b1bf7e0b..ef29c03a9 100644 --- a/app/Services/Helpers/AssetHashService.php +++ b/app/Services/Helpers/AssetHashService.php @@ -4,7 +4,7 @@ namespace Pterodactyl\Services\Helpers; use Illuminate\Support\Arr; use Illuminate\Filesystem\FilesystemManager; -use Illuminate\Contracts\Foundation\Application; +use Illuminate\Contracts\Filesystem\Filesystem; class AssetHashService { @@ -13,34 +13,20 @@ class AssetHashService */ public const MANIFEST_PATH = './assets/manifest.json'; - /** - * @var \Illuminate\Contracts\Filesystem\Filesystem - */ - private $filesystem; + private Filesystem $filesystem; - /** - * @var \Illuminate\Contracts\Foundation\Application - */ - private $application; - - /** - * @var array|null - */ - protected static $manifest; + protected static mixed $manifest; /** * AssetHashService constructor. */ - public function __construct(Application $application, FilesystemManager $filesystem) + public function __construct(FilesystemManager $filesystem) { - $this->application = $application; $this->filesystem = $filesystem->createLocalDriver(['root' => public_path()]); } /** * Modify a URL to append the asset hash. - * - * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ public function url(string $resource): string { @@ -52,8 +38,6 @@ class AssetHashService /** * Return the data integrity hash for a resource. - * - * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ public function integrity(string $resource): string { @@ -65,8 +49,6 @@ class AssetHashService /** * Return a built CSS import using the provided URL. - * - * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ public function css(string $resource): string { @@ -92,8 +74,6 @@ class AssetHashService /** * Return a built JS import using the provided URL. - * - * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ public function js(string $resource): string { @@ -116,8 +96,6 @@ class AssetHashService /** * Get the asset manifest and store it in the cache for quicker lookups. - * - * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ protected function manifest(): array { diff --git a/app/Services/Helpers/SoftwareVersionService.php b/app/Services/Helpers/SoftwareVersionService.php index 14a2b437d..2122b397b 100644 --- a/app/Services/Helpers/SoftwareVersionService.php +++ b/app/Services/Helpers/SoftwareVersionService.php @@ -13,98 +13,68 @@ class SoftwareVersionService { public const VERSION_CACHE_KEY = 'pterodactyl:versioning_data'; - /** - * @var array - */ - private static $result; - - /** - * @var \Illuminate\Contracts\Cache\Repository - */ - protected $cache; - - /** - * @var \GuzzleHttp\Client - */ - protected $client; + private static array $result; /** * SoftwareVersionService constructor. */ public function __construct( - CacheRepository $cache, - Client $client + protected CacheRepository $cache, + protected Client $client ) { - $this->cache = $cache; - $this->client = $client; - self::$result = $this->cacheVersionData(); } /** * Get the latest version of the panel from the CDN servers. - * - * @return string */ - public function getPanel() + public function getPanel(): string { return Arr::get(self::$result, 'panel') ?? 'error'; } /** * Get the latest version of the daemon from the CDN servers. - * - * @return string */ - public function getDaemon() + public function getDaemon(): string { return Arr::get(self::$result, 'wings') ?? 'error'; } /** * Get the URL to the discord server. - * - * @return string */ - public function getDiscord() + public function getDiscord(): string { return Arr::get(self::$result, 'discord') ?? 'https://pterodactyl.io/discord'; } /** * Get the URL for donations. - * - * @return string */ - public function getDonations() + public function getDonations(): string { - return Arr::get(self::$result, 'donations') ?? 'https://paypal.me/PterodactylSoftware'; + return Arr::get(self::$result, 'donations') ?? 'https://github.com/sponsors/matthewpi'; } /** * Determine if the current version of the panel is the latest. - * - * @return bool */ - public function isLatestPanel() + public function isLatestPanel(): bool { - if (config()->get('app.version') === 'canary') { + if (config('app.version') === 'canary') { return true; } - return version_compare(config()->get('app.version'), $this->getPanel()) >= 0; + return version_compare(config('app.version'), $this->getPanel()) >= 0; } /** * Determine if a passed daemon version string is the latest. - * - * @param string $version - * - * @return bool */ - public function isLatestDaemon($version) + public function isLatestDaemon(string $version): bool { - if ($version === '0.0.0-canary') { + if ($version === 'develop') { return true; } @@ -113,21 +83,19 @@ class SoftwareVersionService /** * Keeps the versioning cache up-to-date with the latest results from the CDN. - * - * @return array */ - protected function cacheVersionData() + protected function cacheVersionData(): array { - return $this->cache->remember(self::VERSION_CACHE_KEY, CarbonImmutable::now()->addMinutes(config()->get('pterodactyl.cdn.cache_time', 60)), function () { + return $this->cache->remember(self::VERSION_CACHE_KEY, CarbonImmutable::now()->addMinutes(config('pterodactyl.cdn.cache_time', 60)), function () { try { - $response = $this->client->request('GET', config()->get('pterodactyl.cdn.url')); + $response = $this->client->request('GET', config('pterodactyl.cdn.url')); if ($response->getStatusCode() === 200) { return json_decode($response->getBody(), true); } throw new CdnVersionFetchingException(); - } catch (Exception $exception) { + } catch (Exception) { return []; } }); diff --git a/app/Services/Locations/LocationCreationService.php b/app/Services/Locations/LocationCreationService.php index cff493a8b..b1a3ec995 100644 --- a/app/Services/Locations/LocationCreationService.php +++ b/app/Services/Locations/LocationCreationService.php @@ -1,39 +1,25 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Services\Locations; +use Pterodactyl\Models\Location; use Pterodactyl\Contracts\Repository\LocationRepositoryInterface; class LocationCreationService { - /** - * @var \Pterodactyl\Contracts\Repository\LocationRepositoryInterface - */ - protected $repository; - /** * LocationCreationService constructor. */ - public function __construct(LocationRepositoryInterface $repository) + public function __construct(protected LocationRepositoryInterface $repository) { - $this->repository = $repository; } /** * Create a new location. * - * @return \Pterodactyl\Models\Location - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ - public function handle(array $data) + public function handle(array $data): Location { return $this->repository->create($data); } diff --git a/app/Services/Locations/LocationDeletionService.php b/app/Services/Locations/LocationDeletionService.php index 2ffd38187..5b4b9eba4 100644 --- a/app/Services/Locations/LocationDeletionService.php +++ b/app/Services/Locations/LocationDeletionService.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Services\Locations; @@ -17,37 +10,21 @@ use Pterodactyl\Exceptions\Service\Location\HasActiveNodesException; class LocationDeletionService { - /** - * @var \Pterodactyl\Contracts\Repository\NodeRepositoryInterface - */ - protected $nodeRepository; - - /** - * @var \Pterodactyl\Contracts\Repository\LocationRepositoryInterface - */ - protected $repository; - /** * LocationDeletionService constructor. */ public function __construct( - LocationRepositoryInterface $repository, - NodeRepositoryInterface $nodeRepository + protected LocationRepositoryInterface $repository, + protected NodeRepositoryInterface $nodeRepository ) { - $this->nodeRepository = $nodeRepository; - $this->repository = $repository; } /** * Delete an existing location. * - * @param int|\Pterodactyl\Models\Location $location - * - * @return int|null - * * @throws \Pterodactyl\Exceptions\Service\Location\HasActiveNodesException */ - public function handle($location) + public function handle(Location|int $location): ?int { $location = ($location instanceof Location) ? $location->id : $location; diff --git a/app/Services/Locations/LocationUpdateService.php b/app/Services/Locations/LocationUpdateService.php index 87399201f..cf24459e9 100644 --- a/app/Services/Locations/LocationUpdateService.php +++ b/app/Services/Locations/LocationUpdateService.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Services\Locations; @@ -14,30 +7,20 @@ use Pterodactyl\Contracts\Repository\LocationRepositoryInterface; class LocationUpdateService { - /** - * @var \Pterodactyl\Contracts\Repository\LocationRepositoryInterface - */ - protected $repository; - /** * LocationUpdateService constructor. */ - public function __construct(LocationRepositoryInterface $repository) + public function __construct(protected LocationRepositoryInterface $repository) { - $this->repository = $repository; } /** * Update an existing location. * - * @param int|\Pterodactyl\Models\Location $location - * - * @return \Pterodactyl\Models\Location - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function handle($location, array $data) + public function handle(Location|int $location, array $data): Location { $location = ($location instanceof Location) ? $location->id : $location; diff --git a/app/Services/Nests/NestCreationService.php b/app/Services/Nests/NestCreationService.php index af56496d1..c3513aefe 100644 --- a/app/Services/Nests/NestCreationService.php +++ b/app/Services/Nests/NestCreationService.php @@ -9,23 +9,11 @@ use Illuminate\Contracts\Config\Repository as ConfigRepository; class NestCreationService { - /** - * @var \Illuminate\Contracts\Config\Repository - */ - private $config; - - /** - * @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface - */ - private $repository; - /** * NestCreationService constructor. */ - public function __construct(ConfigRepository $config, NestRepositoryInterface $repository) + public function __construct(private ConfigRepository $config, private NestRepositoryInterface $repository) { - $this->config = $config; - $this->repository = $repository; } /** diff --git a/app/Services/Nests/NestDeletionService.php b/app/Services/Nests/NestDeletionService.php index 777a41b68..6babf45c3 100644 --- a/app/Services/Nests/NestDeletionService.php +++ b/app/Services/Nests/NestDeletionService.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Services\Nests; @@ -15,25 +8,13 @@ use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; class NestDeletionService { - /** - * @var \Pterodactyl\Contracts\Repository\ServerRepositoryInterface - */ - protected $serverRepository; - - /** - * @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface - */ - protected $repository; - /** * NestDeletionService constructor. */ public function __construct( - ServerRepositoryInterface $serverRepository, - NestRepositoryInterface $repository + protected ServerRepositoryInterface $serverRepository, + protected NestRepositoryInterface $repository ) { - $this->serverRepository = $serverRepository; - $this->repository = $repository; } /** diff --git a/app/Services/Nests/NestUpdateService.php b/app/Services/Nests/NestUpdateService.php index 7772ff380..772421e42 100644 --- a/app/Services/Nests/NestUpdateService.php +++ b/app/Services/Nests/NestUpdateService.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Services\Nests; @@ -13,17 +6,11 @@ use Pterodactyl\Contracts\Repository\NestRepositoryInterface; class NestUpdateService { - /** - * @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface - */ - protected $repository; - /** * NestUpdateService constructor. */ - public function __construct(NestRepositoryInterface $repository) + public function __construct(protected NestRepositoryInterface $repository) { - $this->repository = $repository; } /** @@ -32,7 +19,7 @@ class NestUpdateService * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function handle(int $nest, array $data) + public function handle(int $nest, array $data): void { 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 e8ea5b0d8..e4946bc20 100644 --- a/app/Services/Nodes/NodeCreationService.php +++ b/app/Services/Nodes/NodeCreationService.php @@ -11,32 +11,18 @@ use Pterodactyl\Contracts\Repository\NodeRepositoryInterface; class NodeCreationService { /** - * @var \Pterodactyl\Contracts\Repository\NodeRepositoryInterface + * NodeCreationService constructor. */ - protected $repository; - - /** - * @var \Illuminate\Contracts\Encryption\Encrypter - */ - private $encrypter; - - /** - * CreationService constructor. - */ - public function __construct(Encrypter $encrypter, NodeRepositoryInterface $repository) + public function __construct(private Encrypter $encrypter, protected NodeRepositoryInterface $repository) { - $this->repository = $repository; - $this->encrypter = $encrypter; } /** * Create a new node on the panel. * - * @return \Pterodactyl\Models\Node - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ - public function handle(array $data) + public function handle(array $data): Node { $data['uuid'] = Uuid::uuid4()->toString(); $data['daemon_token'] = $this->encrypter->encrypt(Str::random(Node::DAEMON_TOKEN_LENGTH)); diff --git a/app/Services/Nodes/NodeDeletionService.php b/app/Services/Nodes/NodeDeletionService.php index e77104e09..adb9a0628 100644 --- a/app/Services/Nodes/NodeDeletionService.php +++ b/app/Services/Nodes/NodeDeletionService.php @@ -1,13 +1,5 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ - namespace Pterodactyl\Services\Nodes; use Pterodactyl\Models\Node; @@ -19,43 +11,21 @@ use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; class NodeDeletionService { /** - * @var \Pterodactyl\Contracts\Repository\NodeRepositoryInterface - */ - protected $repository; - - /** - * @var \Pterodactyl\Contracts\Repository\ServerRepositoryInterface - */ - protected $serverRepository; - - /** - * @var \Illuminate\Contracts\Translation\Translator - */ - protected $translator; - - /** - * DeletionService constructor. + * NodeDeletionService constructor. */ public function __construct( - NodeRepositoryInterface $repository, - ServerRepositoryInterface $serverRepository, - Translator $translator + protected NodeRepositoryInterface $repository, + protected ServerRepositoryInterface $serverRepository, + protected Translator $translator ) { - $this->repository = $repository; - $this->serverRepository = $serverRepository; - $this->translator = $translator; } /** * 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 */ - public function handle($node) + public function handle(int|Node $node): int { if ($node instanceof Node) { $node = $node->id; diff --git a/app/Services/Nodes/NodeJWTService.php b/app/Services/Nodes/NodeJWTService.php index d9473d90a..fc34494e2 100644 --- a/app/Services/Nodes/NodeJWTService.php +++ b/app/Services/Nodes/NodeJWTService.php @@ -7,6 +7,7 @@ use Carbon\CarbonImmutable; use Illuminate\Support\Str; use Pterodactyl\Models\Node; use Pterodactyl\Models\User; +use Lcobucci\JWT\Token\Plain; use Lcobucci\JWT\Configuration; use Lcobucci\JWT\Signer\Hmac\Sha256; use Lcobucci\JWT\Signer\Key\InMemory; @@ -18,19 +19,14 @@ class NodeJWTService private ?User $user = null; - /** - * @var \DateTimeImmutable|null - */ - private $expiresAt; + private ?DateTimeImmutable $expiresAt; private ?string $subject = null; /** * Set the claims to include in this JWT. - * - * @return $this */ - public function setClaims(array $claims) + public function setClaims(array $claims): self { $this->claims = $claims; @@ -48,20 +44,14 @@ class NodeJWTService return $this; } - /** - * @return $this - */ - public function setExpiresAt(DateTimeImmutable $date) + public function setExpiresAt(DateTimeImmutable $date): self { $this->expiresAt = $date; return $this; } - /** - * @return $this - */ - public function setSubject(string $subject) + public function setSubject(string $subject): self { $this->subject = $subject; @@ -70,12 +60,8 @@ class NodeJWTService /** * Generate a new JWT for a given node. - * - * @param string|null $identifiedBy - * - * @return \Lcobucci\JWT\Token\Plain */ - public function handle(Node $node, string $identifiedBy, string $algo = 'md5') + public function handle(Node $node, ?string $identifiedBy, string $algo = 'md5'): Plain { $identifier = hash($algo, $identifiedBy); $config = Configuration::forSymmetricSigner(new Sha256(), InMemory::plainText($node->getDecryptedKey())); @@ -112,7 +98,7 @@ class NodeJWTService } return $builder - ->withClaim('unique_id', Str::random(16)) + ->withClaim('unique_id', Str::random()) ->getToken($config->signer(), $config->signingKey()); } } diff --git a/app/Services/Nodes/NodeUpdateService.php b/app/Services/Nodes/NodeUpdateService.php index 9ba56fb4e..28733e35a 100644 --- a/app/Services/Nodes/NodeUpdateService.php +++ b/app/Services/Nodes/NodeUpdateService.php @@ -15,48 +15,22 @@ use Pterodactyl\Exceptions\Service\Node\ConfigurationNotPersistedException; class NodeUpdateService { /** - * @var \Illuminate\Database\ConnectionInterface - */ - private $connection; - - /** - * @var \Pterodactyl\Repositories\Wings\DaemonConfigurationRepository - */ - private $configurationRepository; - - /** - * @var \Illuminate\Contracts\Encryption\Encrypter - */ - private $encrypter; - - /** - * @var \Pterodactyl\Repositories\Eloquent\NodeRepository - */ - private $repository; - - /** - * UpdateService constructor. + * NodeUpdateService constructor. */ public function __construct( - ConnectionInterface $connection, - Encrypter $encrypter, - DaemonConfigurationRepository $configurationRepository, - NodeRepository $repository + private ConnectionInterface $connection, + private DaemonConfigurationRepository $configurationRepository, + private Encrypter $encrypter, + private NodeRepository $repository ) { - $this->connection = $connection; - $this->configurationRepository = $configurationRepository; - $this->encrypter = $encrypter; - $this->repository = $repository; } /** * Update the configuration values for a given node on the machine. * - * @return \Pterodactyl\Models\Node - * * @throws \Throwable */ - public function handle(Node $node, array $data, bool $resetToken = false) + public function handle(Node $node, array $data, bool $resetToken = false): Node { if ($resetToken) { $data['daemon_token'] = $this->encrypter->encrypt(Str::random(Node::DAEMON_TOKEN_LENGTH)); @@ -87,7 +61,7 @@ class NodeUpdateService // but something went wrong with Wings we just want to store the update and let the user manually // make changes as needed. // - // This avoids issues with proxies such as CloudFlare which will see Wings as offline and then + // This avoids issues with proxies such as Cloudflare which will see Wings as offline and then // inject their own response pages, causing this logic to get fucked up. // // @see https://github.com/pterodactyl/panel/issues/2712 diff --git a/app/Services/Schedules/ProcessScheduleService.php b/app/Services/Schedules/ProcessScheduleService.php index a131ad573..cfbc7e5ca 100644 --- a/app/Services/Schedules/ProcessScheduleService.php +++ b/app/Services/Schedules/ProcessScheduleService.php @@ -13,29 +13,11 @@ use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; class ProcessScheduleService { - /** - * @var \Illuminate\Contracts\Bus\Dispatcher - */ - private $dispatcher; - - /** - * @var \Illuminate\Database\ConnectionInterface - */ - private $connection; - - /** - * @var \Pterodactyl\Repositories\Wings\DaemonServerRepository - */ - private $serverRepository; - /** * ProcessScheduleService constructor. */ - public function __construct(ConnectionInterface $connection, DaemonServerRepository $serverRepository, Dispatcher $dispatcher) + public function __construct(private ConnectionInterface $connection, private Dispatcher $dispatcher, private DaemonServerRepository $serverRepository) { - $this->dispatcher = $dispatcher; - $this->connection = $connection; - $this->serverRepository = $serverRepository; } /** @@ -43,7 +25,7 @@ class ProcessScheduleService * * @throws \Throwable */ - public function handle(Schedule $schedule, bool $now = false) + public function handle(Schedule $schedule, bool $now = false): void { /** @var \Pterodactyl\Models\Task $task */ $task = $schedule->tasks()->orderBy('sequence_id')->first(); diff --git a/app/Services/Servers/BuildModificationService.php b/app/Services/Servers/BuildModificationService.php index 224abc12f..05553d7f1 100644 --- a/app/Services/Servers/BuildModificationService.php +++ b/app/Services/Servers/BuildModificationService.php @@ -14,45 +14,23 @@ use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; class BuildModificationService { - /** - * @var \Illuminate\Database\ConnectionInterface - */ - private $connection; - - /** - * @var \Pterodactyl\Repositories\Wings\DaemonServerRepository - */ - private $daemonServerRepository; - - /** - * @var \Pterodactyl\Services\Servers\ServerConfigurationStructureService - */ - private $structureService; - /** * BuildModificationService constructor. - * - * @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $structureService */ public function __construct( - ServerConfigurationStructureService $structureService, - ConnectionInterface $connection, - DaemonServerRepository $daemonServerRepository + private ConnectionInterface $connection, + private DaemonServerRepository $daemonServerRepository, + private ServerConfigurationStructureService $structureService ) { - $this->daemonServerRepository = $daemonServerRepository; - $this->connection = $connection; - $this->structureService = $structureService; } /** * Change the build details for a specified server. * - * @return \Pterodactyl\Models\Server - * * @throws \Throwable * @throws \Pterodactyl\Exceptions\DisplayException */ - public function handle(Server $server, array $data) + public function handle(Server $server, array $data): Server { /** @var \Pterodactyl\Models\Server $server */ $server = $this->connection->transaction(function () use ($server, $data) { @@ -61,7 +39,7 @@ class BuildModificationService if (isset($data['allocation_id']) && $data['allocation_id'] != $server->allocation_id) { try { Allocation::query()->where('id', $data['allocation_id'])->where('server_id', $server->id)->firstOrFail(); - } catch (ModelNotFoundException $ex) { + } catch (ModelNotFoundException) { throw new DisplayException('The requested default allocation is not currently assigned to this server.'); } } @@ -101,7 +79,7 @@ class BuildModificationService * * @throws \Pterodactyl\Exceptions\DisplayException */ - private function processAllocations(Server $server, array &$data) + private function processAllocations(Server $server, array &$data): void { if (empty($data['add_allocations']) && empty($data['remove_allocations'])) { return; diff --git a/app/Services/Servers/DetailsModificationService.php b/app/Services/Servers/DetailsModificationService.php index cbe2a6ed9..d135c0495 100644 --- a/app/Services/Servers/DetailsModificationService.php +++ b/app/Services/Servers/DetailsModificationService.php @@ -13,23 +13,11 @@ class DetailsModificationService { use ReturnsUpdatedModels; - /** - * @var \Illuminate\Database\ConnectionInterface - */ - private $connection; - - /** - * @var \Pterodactyl\Repositories\Wings\DaemonServerRepository - */ - private $serverRepository; - /** * DetailsModificationService constructor. */ - public function __construct(ConnectionInterface $connection, DaemonServerRepository $serverRepository) + public function __construct(private ConnectionInterface $connection, private DaemonServerRepository $serverRepository) { - $this->connection = $connection; - $this->serverRepository = $serverRepository; } /** @@ -57,7 +45,7 @@ class DetailsModificationService $this->serverRepository->setServer($server)->revokeUserJTI($owner); } catch (DaemonConnectionException $exception) { // Do nothing. A failure here is not ideal, but it is likely to be caused by Wings - // being offline, or in an entirely broken state. Remeber, these tokens reset every + // being offline, or in an entirely broken state. Remember, these tokens reset every // few minutes by default, we're just trying to help it along a little quicker. } } diff --git a/app/Services/Servers/EnvironmentService.php b/app/Services/Servers/EnvironmentService.php index 54b82bab3..8f45bab2d 100644 --- a/app/Services/Servers/EnvironmentService.php +++ b/app/Services/Servers/EnvironmentService.php @@ -7,16 +7,13 @@ use Pterodactyl\Models\EggVariable; class EnvironmentService { - /** - * @var array - */ - private $additional = []; + private array $additional = []; /** * Dynamically configure additional environment variables to be assigned * with a specific server. */ - public function setEnvironmentKey(string $key, callable $closure) + public function setEnvironmentKey(string $key, callable $closure): void { $this->additional[$key] = $closure; } diff --git a/app/Services/Servers/GetUserPermissionsService.php b/app/Services/Servers/GetUserPermissionsService.php index fdac03bfd..ae91cb33f 100644 --- a/app/Services/Servers/GetUserPermissionsService.php +++ b/app/Services/Servers/GetUserPermissionsService.php @@ -11,10 +11,8 @@ class GetUserPermissionsService * Returns the server specific permissions that a user has. This checks * if they are an admin or a subuser for the server. If no permissions are * found, an empty array is returned. - * - * @return string[] */ - public function handle(Server $server, User $user) + public function handle(Server $server, User $user): array { if ($user->root_admin || $user->id === $server->owner_id) { $permissions = ['*']; diff --git a/app/Services/Servers/ReinstallServerService.php b/app/Services/Servers/ReinstallServerService.php index 561512b37..5881d1fc6 100644 --- a/app/Services/Servers/ReinstallServerService.php +++ b/app/Services/Servers/ReinstallServerService.php @@ -8,35 +8,21 @@ use Pterodactyl\Repositories\Wings\DaemonServerRepository; class ReinstallServerService { - /** - * @var \Pterodactyl\Repositories\Wings\DaemonServerRepository - */ - private $daemonServerRepository; - - /** - * @var \Illuminate\Database\ConnectionInterface - */ - private $connection; - /** * ReinstallService constructor. */ public function __construct( - ConnectionInterface $connection, - DaemonServerRepository $daemonServerRepository + private ConnectionInterface $connection, + private DaemonServerRepository $daemonServerRepository ) { - $this->daemonServerRepository = $daemonServerRepository; - $this->connection = $connection; } /** * Reinstall a server on the remote daemon. * - * @return \Pterodactyl\Models\Server - * * @throws \Throwable */ - public function handle(Server $server) + public function handle(Server $server): Server { return $this->connection->transaction(function () use ($server) { $server->fill(['status' => Server::STATUS_INSTALLING])->save(); diff --git a/app/Services/Servers/ServerConfigurationStructureService.php b/app/Services/Servers/ServerConfigurationStructureService.php index 0625f6891..72f327796 100644 --- a/app/Services/Servers/ServerConfigurationStructureService.php +++ b/app/Services/Servers/ServerConfigurationStructureService.php @@ -7,14 +7,11 @@ use Pterodactyl\Models\Server; class ServerConfigurationStructureService { - private EnvironmentService $environment; - /** * ServerConfigurationStructureService constructor. */ - public function __construct(EnvironmentService $environment) + public function __construct(private EnvironmentService $environment) { - $this->environment = $environment; } /** diff --git a/app/Services/Servers/ServerCreationService.php b/app/Services/Servers/ServerCreationService.php index 48fa8cc33..2c9b4cf84 100644 --- a/app/Services/Servers/ServerCreationService.php +++ b/app/Services/Servers/ServerCreationService.php @@ -12,7 +12,6 @@ use Illuminate\Support\Collection; use Pterodactyl\Models\Allocation; use Illuminate\Database\ConnectionInterface; use Pterodactyl\Models\Objects\DeploymentObject; -use Pterodactyl\Repositories\Eloquent\EggRepository; use Pterodactyl\Repositories\Eloquent\ServerRepository; use Pterodactyl\Repositories\Wings\DaemonServerRepository; use Pterodactyl\Services\Deployment\FindViableNodesService; @@ -23,84 +22,18 @@ use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; class ServerCreationService { /** - * @var \Pterodactyl\Services\Deployment\AllocationSelectionService - */ - private $allocationSelectionService; - - /** - * @var \Pterodactyl\Services\Servers\ServerConfigurationStructureService - */ - private $configurationStructureService; - - /** - * @var \Illuminate\Database\ConnectionInterface - */ - private $connection; - - /** - * @var \Pterodactyl\Services\Deployment\FindViableNodesService - */ - private $findViableNodesService; - - /** - * @var \Pterodactyl\Services\Servers\VariableValidatorService - */ - private $validatorService; - - /** - * @var \Pterodactyl\Repositories\Eloquent\EggRepository - */ - private $eggRepository; - - /** - * @var \Pterodactyl\Repositories\Eloquent\ServerRepository - */ - private $repository; - - /** - * @var \Pterodactyl\Repositories\Eloquent\ServerVariableRepository - */ - private $serverVariableRepository; - - /** - * @var \Pterodactyl\Repositories\Wings\DaemonServerRepository - */ - private $daemonServerRepository; - - /** - * @var \Pterodactyl\Services\Servers\ServerDeletionService - */ - private $serverDeletionService; - - /** - * CreationService constructor. - * - * @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $configurationStructureService - * @param \Pterodactyl\Services\Servers\ServerDeletionService $serverDeletionService - * @param \Pterodactyl\Services\Servers\VariableValidatorService $validatorService + * ServerCreationService constructor. */ public function __construct( - AllocationSelectionService $allocationSelectionService, - ConnectionInterface $connection, - DaemonServerRepository $daemonServerRepository, - EggRepository $eggRepository, - FindViableNodesService $findViableNodesService, - ServerConfigurationStructureService $configurationStructureService, - ServerDeletionService $serverDeletionService, - ServerRepository $repository, - ServerVariableRepository $serverVariableRepository, - VariableValidatorService $validatorService + private AllocationSelectionService $allocationSelectionService, + private ConnectionInterface $connection, + private DaemonServerRepository $daemonServerRepository, + private FindViableNodesService $findViableNodesService, + private ServerRepository $repository, + private ServerDeletionService $serverDeletionService, + private ServerVariableRepository $serverVariableRepository, + private VariableValidatorService $validatorService ) { - $this->allocationSelectionService = $allocationSelectionService; - $this->configurationStructureService = $configurationStructureService; - $this->connection = $connection; - $this->findViableNodesService = $findViableNodesService; - $this->validatorService = $validatorService; - $this->eggRepository = $eggRepository; - $this->repository = $repository; - $this->serverVariableRepository = $serverVariableRepository; - $this->daemonServerRepository = $daemonServerRepository; - $this->serverDeletionService = $serverDeletionService; } /** @@ -237,7 +170,7 @@ class ServerCreationService /** * Configure the allocations assigned to this server. */ - private function storeAssignedAllocations(Server $server, array $data) + private function storeAssignedAllocations(Server $server, array $data): void { $records = [$data['allocation_id']]; if (isset($data['allocation_additional']) && is_array($data['allocation_additional'])) { @@ -252,7 +185,7 @@ class ServerCreationService /** * Process environment variables passed for this server and store them in the database. */ - private function storeEggVariables(Server $server, Collection $variables) + private function storeEggVariables(Server $server, Collection $variables): void { $records = $variables->map(function ($result) use ($server) { return [ diff --git a/app/Services/Servers/ServerDeletionService.php b/app/Services/Servers/ServerDeletionService.php index cc973ff84..be52b0cf4 100644 --- a/app/Services/Servers/ServerDeletionService.php +++ b/app/Services/Servers/ServerDeletionService.php @@ -13,47 +13,22 @@ use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; class ServerDeletionService { - /** - * @var bool - */ - protected $force = false; + protected bool $force = false; /** - * @var \Illuminate\Database\ConnectionInterface - */ - private $connection; - - /** - * @var \Pterodactyl\Repositories\Wings\DaemonServerRepository - */ - private $daemonServerRepository; - - /** - * @var \Pterodactyl\Services\Databases\DatabaseManagementService - */ - private $databaseManagementService; - - /** - * DeletionService constructor. + * ServerDeletionService constructor. */ public function __construct( - ConnectionInterface $connection, - DaemonServerRepository $daemonServerRepository, - DatabaseManagementService $databaseManagementService + private ConnectionInterface $connection, + private DaemonServerRepository $daemonServerRepository, + private DatabaseManagementService $databaseManagementService ) { - $this->connection = $connection; - $this->daemonServerRepository = $daemonServerRepository; - $this->databaseManagementService = $databaseManagementService; } /** * 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) + public function withForce(bool $bool = true): self { $this->force = $bool; @@ -66,7 +41,7 @@ class ServerDeletionService * @throws \Throwable * @throws \Pterodactyl\Exceptions\DisplayException */ - public function handle(Server $server) + public function handle(Server $server): void { try { $this->daemonServerRepository->setServer($server)->delete(); diff --git a/app/Services/Servers/StartupModificationService.php b/app/Services/Servers/StartupModificationService.php index 66645e4f2..a0a5c4cb7 100644 --- a/app/Services/Servers/StartupModificationService.php +++ b/app/Services/Servers/StartupModificationService.php @@ -14,25 +14,11 @@ class StartupModificationService { use HasUserLevels; - /** - * @var \Illuminate\Database\ConnectionInterface - */ - private $connection; - - /** - * @var \Pterodactyl\Services\Servers\VariableValidatorService - */ - private $validatorService; - /** * StartupModificationService constructor. - * - * @param \Pterodactyl\Services\Servers\VariableValidatorService $validatorService */ - public function __construct(ConnectionInterface $connection, VariableValidatorService $validatorService) + public function __construct(private ConnectionInterface $connection, private VariableValidatorService $validatorService) { - $this->connection = $connection; - $this->validatorService = $validatorService; } /** @@ -79,7 +65,7 @@ class StartupModificationService /** * Update certain administrative settings for a server in the DB. */ - protected function updateAdministrativeSettings(array $data, Server &$server) + protected function updateAdministrativeSettings(array $data, Server &$server): void { $eggId = Arr::get($data, 'egg_id'); diff --git a/app/Services/Servers/SuspensionService.php b/app/Services/Servers/SuspensionService.php index 27bc622f5..d11ace22c 100644 --- a/app/Services/Servers/SuspensionService.php +++ b/app/Services/Servers/SuspensionService.php @@ -4,7 +4,6 @@ namespace Pterodactyl\Services\Servers; use Webmozart\Assert\Assert; use Pterodactyl\Models\Server; -use Illuminate\Database\ConnectionInterface; use Pterodactyl\Repositories\Wings\DaemonServerRepository; use Symfony\Component\HttpKernel\Exception\ConflictHttpException; @@ -13,42 +12,27 @@ class SuspensionService public const ACTION_SUSPEND = 'suspend'; public const ACTION_UNSUSPEND = 'unsuspend'; - /** - * @var \Illuminate\Database\ConnectionInterface - */ - private $connection; - - /** - * @var \Pterodactyl\Repositories\Wings\DaemonServerRepository - */ - private $daemonServerRepository; - /** * SuspensionService constructor. */ public function __construct( - ConnectionInterface $connection, - DaemonServerRepository $daemonServerRepository + private DaemonServerRepository $daemonServerRepository ) { - $this->connection = $connection; - $this->daemonServerRepository = $daemonServerRepository; } /** * Suspends a server on the system. * - * @param string $action - * * @throws \Throwable */ - public function toggle(Server $server, $action = self::ACTION_SUSPEND) + public function toggle(Server $server, string $action = self::ACTION_SUSPEND): void { Assert::oneOf($action, [self::ACTION_SUSPEND, self::ACTION_UNSUSPEND]); $isSuspending = $action === self::ACTION_SUSPEND; - // Nothing needs to happen if we're suspending the server and it is already + // Nothing needs to happen if we're suspending the server, and it is already // suspended in the database. Additionally, nothing needs to happen if the server - // is not suspended and we try to un-suspend the instance. + // is not suspended, and we try to un-suspend the instance. if ($isSuspending === $server->isSuspended()) { return; } diff --git a/app/Services/Servers/TransferService.php b/app/Services/Servers/TransferService.php index 35aed0659..24ef0a588 100644 --- a/app/Services/Servers/TransferService.php +++ b/app/Services/Servers/TransferService.php @@ -4,39 +4,23 @@ namespace Pterodactyl\Services\Servers; use Pterodactyl\Models\Server; use Pterodactyl\Repositories\Wings\DaemonServerRepository; -use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; class TransferService { - /** - * @var \Pterodactyl\Contracts\Repository\ServerRepositoryInterface - */ - private $repository; - - /** - * @var \Pterodactyl\Repositories\Wings\DaemonServerRepository - */ - private $daemonServerRepository; - /** * TransferService constructor. */ public function __construct( - DaemonServerRepository $daemonServerRepository, - ServerRepositoryInterface $repository + private DaemonServerRepository $daemonServerRepository ) { - $this->repository = $repository; - $this->daemonServerRepository = $daemonServerRepository; } /** * Requests an archive from the daemon. * - * @param int|\Pterodactyl\Models\Server $server - * - * @throws \Throwable + * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ - public function requestArchive(Server $server) + public function requestArchive(Server $server): void { $this->daemonServerRepository->setServer($server)->requestArchive(); } diff --git a/app/Services/Servers/VariableValidatorService.php b/app/Services/Servers/VariableValidatorService.php index 2ac3879a5..a19869265 100644 --- a/app/Services/Servers/VariableValidatorService.php +++ b/app/Services/Servers/VariableValidatorService.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Services\Servers; @@ -20,17 +13,11 @@ class VariableValidatorService { use HasUserLevels; - /** - * @var \Illuminate\Contracts\Validation\Factory - */ - private $validator; - /** * VariableValidatorService constructor. */ - public function __construct(ValidationFactory $validator) + public function __construct(private ValidationFactory $validator) { - $this->validator = $validator; } /** @@ -42,7 +29,7 @@ class VariableValidatorService { $query = EggVariable::query()->where('egg_id', $egg); if (!$this->isUserLevel(User::USER_LEVEL_ADMIN)) { - // Don't attempt to validate variables if they aren't user editable + // 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); } diff --git a/app/Services/Subusers/SubuserCreationService.php b/app/Services/Subusers/SubuserCreationService.php index b1affd3f3..c207b0d07 100644 --- a/app/Services/Subusers/SubuserCreationService.php +++ b/app/Services/Subusers/SubuserCreationService.php @@ -15,39 +15,15 @@ use Pterodactyl\Exceptions\Service\Subuser\ServerSubuserExistsException; class SubuserCreationService { - /** - * @var \Illuminate\Database\ConnectionInterface - */ - private $connection; - - /** - * @var \Pterodactyl\Repositories\Eloquent\SubuserRepository - */ - private $subuserRepository; - - /** - * @var \Pterodactyl\Services\Users\UserCreationService - */ - private $userCreationService; - - /** - * @var \Pterodactyl\Contracts\Repository\UserRepositoryInterface - */ - private $userRepository; - /** * SubuserCreationService constructor. */ public function __construct( - ConnectionInterface $connection, - SubuserRepository $subuserRepository, - UserCreationService $userCreationService, - UserRepositoryInterface $userRepository + private ConnectionInterface $connection, + private SubuserRepository $subuserRepository, + private UserCreationService $userCreationService, + private UserRepositoryInterface $userRepository ) { - $this->connection = $connection; - $this->subuserRepository = $subuserRepository; - $this->userRepository = $userRepository; - $this->userCreationService = $userCreationService; } /** @@ -74,7 +50,7 @@ class SubuserCreationService if ($subuserCount !== 0) { throw new ServerSubuserExistsException(trans('exceptions.subusers.subuser_exists')); } - } catch (RecordNotFoundException $exception) { + } catch (RecordNotFoundException) { // Just cap the username generated at 64 characters at most and then append a random string // to the end to make it "unique"... $username = substr(preg_replace('/([^\w\.-]+)/', '', strtok($email, '@')), 0, 64) . Str::random(3); diff --git a/app/Services/Users/ToggleTwoFactorService.php b/app/Services/Users/ToggleTwoFactorService.php index 28faff7f1..a91615b1c 100644 --- a/app/Services/Users/ToggleTwoFactorService.php +++ b/app/Services/Users/ToggleTwoFactorService.php @@ -14,53 +14,21 @@ use Pterodactyl\Exceptions\Service\User\TwoFactorAuthenticationTokenInvalid; class ToggleTwoFactorService { - /** - * @var \Illuminate\Contracts\Encryption\Encrypter - */ - private $encrypter; - - /** - * @var \PragmaRX\Google2FA\Google2FA - */ - private $google2FA; - - /** - * @var \Pterodactyl\Contracts\Repository\UserRepositoryInterface - */ - private $repository; - - /** - * @var \Pterodactyl\Repositories\Eloquent\RecoveryTokenRepository - */ - private $recoveryTokenRepository; - - /** - * @var \Illuminate\Database\ConnectionInterface - */ - private $connection; - /** * ToggleTwoFactorService constructor. */ public function __construct( - ConnectionInterface $connection, - Encrypter $encrypter, - Google2FA $google2FA, - RecoveryTokenRepository $recoveryTokenRepository, - UserRepositoryInterface $repository + private ConnectionInterface $connection, + private Encrypter $encrypter, + private Google2FA $google2FA, + private RecoveryTokenRepository $recoveryTokenRepository, + private UserRepositoryInterface $repository ) { - $this->encrypter = $encrypter; - $this->google2FA = $google2FA; - $this->repository = $repository; - $this->recoveryTokenRepository = $recoveryTokenRepository; - $this->connection = $connection; } /** * Toggle 2FA on an account only if the token provided is valid. * - * @return string[] - * * @throws \Throwable * @throws \PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException * @throws \PragmaRX\Google2FA\Exceptions\InvalidCharactersException diff --git a/app/Services/Users/TwoFactorSetupService.php b/app/Services/Users/TwoFactorSetupService.php index be234d467..87f1e5443 100644 --- a/app/Services/Users/TwoFactorSetupService.php +++ b/app/Services/Users/TwoFactorSetupService.php @@ -13,32 +13,14 @@ class TwoFactorSetupService { public const VALID_BASE32_CHARACTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'; - /** - * @var \Illuminate\Contracts\Config\Repository - */ - private $config; - - /** - * @var \Illuminate\Contracts\Encryption\Encrypter - */ - private $encrypter; - - /** - * @var \Pterodactyl\Contracts\Repository\UserRepositoryInterface - */ - private $repository; - /** * TwoFactorSetupService constructor. */ public function __construct( - ConfigRepository $config, - Encrypter $encrypter, - UserRepositoryInterface $repository + private ConfigRepository $config, + private Encrypter $encrypter, + private UserRepositoryInterface $repository ) { - $this->config = $config; - $this->encrypter = $encrypter; - $this->repository = $repository; } /** diff --git a/app/Services/Users/UserCreationService.php b/app/Services/Users/UserCreationService.php index 2d0abcb9f..130ae1a4e 100644 --- a/app/Services/Users/UserCreationService.php +++ b/app/Services/Users/UserCreationService.php @@ -3,6 +3,7 @@ namespace Pterodactyl\Services\Users; use Ramsey\Uuid\Uuid; +use Pterodactyl\Models\User; use Illuminate\Contracts\Hashing\Hasher; use Illuminate\Database\ConnectionInterface; use Illuminate\Contracts\Auth\PasswordBroker; @@ -12,49 +13,23 @@ use Pterodactyl\Contracts\Repository\UserRepositoryInterface; class UserCreationService { /** - * @var \Illuminate\Database\ConnectionInterface - */ - private $connection; - - /** - * @var \Illuminate\Contracts\Hashing\Hasher - */ - private $hasher; - - /** - * @var \Illuminate\Contracts\Auth\PasswordBroker - */ - private $passwordBroker; - - /** - * @var \Pterodactyl\Contracts\Repository\UserRepositoryInterface - */ - private $repository; - - /** - * CreationService constructor. + * UserCreationService constructor. */ public function __construct( - ConnectionInterface $connection, - Hasher $hasher, - PasswordBroker $passwordBroker, - UserRepositoryInterface $repository + private ConnectionInterface $connection, + private Hasher $hasher, + private PasswordBroker $passwordBroker, + private UserRepositoryInterface $repository ) { - $this->connection = $connection; - $this->hasher = $hasher; - $this->passwordBroker = $passwordBroker; - $this->repository = $repository; } /** * Create a new user on the system. * - * @return \Pterodactyl\Models\User - * * @throws \Exception * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ - public function handle(array $data) + public function handle(array $data): User { if (array_key_exists('password', $data) && !empty($data['password'])) { $data['password'] = $this->hasher->make($data['password']); diff --git a/app/Services/Users/UserDeletionService.php b/app/Services/Users/UserDeletionService.php index fe02bc72c..f7f060cee 100644 --- a/app/Services/Users/UserDeletionService.php +++ b/app/Services/Users/UserDeletionService.php @@ -1,13 +1,5 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ - namespace Pterodactyl\Services\Users; use Pterodactyl\Models\User; @@ -19,43 +11,21 @@ use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; class UserDeletionService { /** - * @var \Pterodactyl\Contracts\Repository\UserRepositoryInterface - */ - protected $repository; - - /** - * @var \Illuminate\Contracts\Translation\Translator - */ - protected $translator; - - /** - * @var \Pterodactyl\Contracts\Repository\ServerRepositoryInterface - */ - protected $serverRepository; - - /** - * DeletionService constructor. + * UserDeletionService constructor. */ public function __construct( - ServerRepositoryInterface $serverRepository, - Translator $translator, - UserRepositoryInterface $repository + protected UserRepositoryInterface $repository, + protected ServerRepositoryInterface $serverRepository, + protected Translator $translator ) { - $this->repository = $repository; - $this->translator = $translator; - $this->serverRepository = $serverRepository; } /** * 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 */ - public function handle($user) + public function handle(int|User $user): ?bool { if ($user instanceof User) { $user = $user->id; diff --git a/app/Services/Users/UserUpdateService.php b/app/Services/Users/UserUpdateService.php index 31f4010b6..770fbdf0b 100644 --- a/app/Services/Users/UserUpdateService.php +++ b/app/Services/Users/UserUpdateService.php @@ -11,16 +11,10 @@ class UserUpdateService use HasUserLevels; /** - * @var \Illuminate\Contracts\Hashing\Hasher + * UserUpdateService constructor. */ - private $hasher; - - /** - * UpdateService constructor. - */ - public function __construct(Hasher $hasher) + public function __construct(private Hasher $hasher) { - $this->hasher = $hasher; } /** diff --git a/app/Traits/Commands/EnvironmentWriterTrait.php b/app/Traits/Commands/EnvironmentWriterTrait.php index 5435dc321..3d1aa0899 100644 --- a/app/Traits/Commands/EnvironmentWriterTrait.php +++ b/app/Traits/Commands/EnvironmentWriterTrait.php @@ -8,7 +8,7 @@ trait EnvironmentWriterTrait { /** * Escapes an environment value by looking for any characters that could - * reasonablly cause environment parsing issues. Those values are then wrapped + * reasonably cause environment parsing issues. Those values are then wrapped * in quotes before being returned. */ public function escapeEnvironmentValue(string $value): string @@ -25,7 +25,7 @@ trait EnvironmentWriterTrait * * @throws \Pterodactyl\Exceptions\PterodactylException */ - public function writeToEnvironment(array $values = []) + public function writeToEnvironment(array $values = []): void { $path = base_path('.env'); if (!file_exists($path)) { diff --git a/app/Traits/Controllers/JavascriptInjection.php b/app/Traits/Controllers/JavascriptInjection.php index 4e7e0a120..206d5ed5f 100644 --- a/app/Traits/Controllers/JavascriptInjection.php +++ b/app/Traits/Controllers/JavascriptInjection.php @@ -1,30 +1,18 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Traits\Controllers; -use Javascript; +use JavaScript; use Illuminate\Http\Request; trait JavascriptInjection { - /** - * @var \Illuminate\Http\Request - */ - private $request; + private Request $request; /** * Set the request object to use when injecting JS. - * - * @return $this */ - public function setRequest(Request $request) + public function setRequest(Request $request): self { $this->request = $request; @@ -33,13 +21,9 @@ trait JavascriptInjection /** * Injects the exact array passed in, nothing more. - * - * @param array $args - * - * @return array */ - public function plainInject($args = []) + public function plainInject(array $args = []): string { - return Javascript::put($args); + return JavaScript::put($args); } } diff --git a/app/Traits/Controllers/PlainJavascriptInjection.php b/app/Traits/Controllers/PlainJavascriptInjection.php index f514eb1af..eb2f6559f 100644 --- a/app/Traits/Controllers/PlainJavascriptInjection.php +++ b/app/Traits/Controllers/PlainJavascriptInjection.php @@ -1,10 +1,4 @@ getFilesystemInstance()->directories(resource_path('lang')))->mapWithKeys(function ($path) use ($localize) { $code = basename($path); diff --git a/app/Traits/Services/HasUserLevels.php b/app/Traits/Services/HasUserLevels.php index 293e7fce7..33be0fbf1 100644 --- a/app/Traits/Services/HasUserLevels.php +++ b/app/Traits/Services/HasUserLevels.php @@ -6,17 +6,12 @@ use Pterodactyl\Models\User; trait HasUserLevels { - /** - * @var int - */ - private $userLevel = User::USER_LEVEL_USER; + private int $userLevel = User::USER_LEVEL_USER; /** * Set the access level for running this function. - * - * @return $this */ - public function setUserLevel(int $level) + public function setUserLevel(int $level): self { $this->userLevel = $level; diff --git a/app/Traits/Services/ReturnsUpdatedModels.php b/app/Traits/Services/ReturnsUpdatedModels.php index 07e4f4fde..055e8971e 100644 --- a/app/Traits/Services/ReturnsUpdatedModels.php +++ b/app/Traits/Services/ReturnsUpdatedModels.php @@ -4,15 +4,9 @@ namespace Pterodactyl\Traits\Services; trait ReturnsUpdatedModels { - /** - * @var bool - */ - private $updatedModel = false; + private bool $updatedModel = false; - /** - * @return bool - */ - public function getUpdatedModel() + public function getUpdatedModel(): bool { return $this->updatedModel; } @@ -21,10 +15,8 @@ trait ReturnsUpdatedModels * If called a fresh model will be returned from the database. This is used * for API calls, but is unnecessary for UI based updates where the page is * being reloaded and a fresh model will be pulled anyways. - * - * @return $this */ - public function returnUpdatedModel(bool $toggle = true) + public function returnUpdatedModel(bool $toggle = true): self { $this->updatedModel = $toggle; diff --git a/app/Traits/Services/ValidatesValidationRules.php b/app/Traits/Services/ValidatesValidationRules.php index f4c1ea188..32265da74 100644 --- a/app/Traits/Services/ValidatesValidationRules.php +++ b/app/Traits/Services/ValidatesValidationRules.php @@ -4,22 +4,20 @@ namespace Pterodactyl\Traits\Services; use BadMethodCallException; use Illuminate\Support\Str; -use Illuminate\Contracts\Validation\Factory; +use Illuminate\Contracts\Validation\Factory as ValidationFactory; use Pterodactyl\Exceptions\Service\Egg\Variable\BadValidationRuleException; trait ValidatesValidationRules { - abstract protected function getValidator(): Factory; + abstract protected function getValidator(): ValidationFactory; /** * Validate that the rules being provided are valid for Laravel and can * be resolved. * - * @param array|string $rules - * * @throws \Pterodactyl\Exceptions\Service\Egg\Variable\BadValidationRuleException */ - public function validateRules($rules) + public function validateRules(array|string $rules): void { try { $this->getValidator()->make(['__TEST' => 'test'], ['__TEST' => $rules])->fails(); diff --git a/app/Transformers/Api/Application/AllocationTransformer.php b/app/Transformers/Api/Application/AllocationTransformer.php index 3584d8683..fcd65f98f 100644 --- a/app/Transformers/Api/Application/AllocationTransformer.php +++ b/app/Transformers/Api/Application/AllocationTransformer.php @@ -4,7 +4,9 @@ namespace Pterodactyl\Transformers\Api\Application; use Pterodactyl\Models\Node; use Pterodactyl\Models\Server; +use League\Fractal\Resource\Item; use Pterodactyl\Models\Allocation; +use League\Fractal\Resource\NullResource; use Pterodactyl\Services\Acl\Api\AdminAcl; class AllocationTransformer extends BaseTransformer @@ -24,10 +26,8 @@ class AllocationTransformer extends BaseTransformer /** * Return a generic transformed allocation array. - * - * @return array */ - public function transform(Allocation $allocation) + public function transform(Allocation $allocation): array { return [ 'id' => $allocation->id, @@ -42,11 +42,9 @@ class AllocationTransformer extends BaseTransformer /** * Load the node relationship onto a given transformation. * - * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeNode(Allocation $allocation) + public function includeNode(Allocation $allocation): Item|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_NODES)) { return $this->null(); @@ -62,11 +60,9 @@ class AllocationTransformer extends BaseTransformer /** * Load the server relationship onto a given transformation. * - * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeServer(Allocation $allocation) + public function includeServer(Allocation $allocation): Item|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_SERVERS) || !$allocation->server) { return $this->null(); diff --git a/app/Transformers/Api/Application/BaseTransformer.php b/app/Transformers/Api/Application/BaseTransformer.php index dce0b1442..723caa3b8 100644 --- a/app/Transformers/Api/Application/BaseTransformer.php +++ b/app/Transformers/Api/Application/BaseTransformer.php @@ -3,6 +3,7 @@ namespace Pterodactyl\Transformers\Api\Application; use Carbon\CarbonImmutable; +use Carbon\CarbonInterface; use Illuminate\Http\Request; use Webmozart\Assert\Assert; use Pterodactyl\Models\ApiKey; @@ -38,8 +39,6 @@ abstract class BaseTransformer extends TransformerAbstract /** * Sets the request on the instance. - * - * @return static */ public function setRequest(Request $request): self { @@ -50,10 +49,8 @@ abstract class BaseTransformer extends TransformerAbstract /** * Returns a new transformer instance with the request set on the instance. - * - * @return \Pterodactyl\Transformers\Api\Application\BaseTransformer */ - public static function fromRequest(Request $request) + public static function fromRequest(Request $request): BaseTransformer { return app(static::class)->setRequest($request); } @@ -81,7 +78,7 @@ abstract class BaseTransformer extends TransformerAbstract return $this->request->user()->root_admin; } - return AdminAcl::check($token, $resource, AdminAcl::READ); + return AdminAcl::check($token, $resource); } /** @@ -96,7 +93,6 @@ abstract class BaseTransformer extends TransformerAbstract * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException * - * @noinspection PhpUndefinedClassInspection * @noinspection PhpDocSignatureInspection */ protected function makeTransformer(string $abstract) @@ -111,8 +107,8 @@ abstract class BaseTransformer extends TransformerAbstract */ protected function formatTimestamp(string $timestamp): string { - return CarbonImmutable::createFromFormat(CarbonImmutable::DEFAULT_TO_STRING_FORMAT, $timestamp) + return CarbonImmutable::createFromFormat(CarbonInterface::DEFAULT_TO_STRING_FORMAT, $timestamp) ->setTimezone(self::RESPONSE_TIMEZONE) - ->toIso8601String(); + ->toAtomString(); } } diff --git a/app/Transformers/Api/Application/DatabaseHostTransformer.php b/app/Transformers/Api/Application/DatabaseHostTransformer.php index 08d635a03..019fdf261 100644 --- a/app/Transformers/Api/Application/DatabaseHostTransformer.php +++ b/app/Transformers/Api/Application/DatabaseHostTransformer.php @@ -4,6 +4,8 @@ namespace Pterodactyl\Transformers\Api\Application; use Pterodactyl\Models\Database; use Pterodactyl\Models\DatabaseHost; +use League\Fractal\Resource\Collection; +use League\Fractal\Resource\NullResource; use Pterodactyl\Services\Acl\Api\AdminAcl; class DatabaseHostTransformer extends BaseTransformer @@ -22,10 +24,8 @@ class DatabaseHostTransformer extends BaseTransformer /** * Transform database host into a representation for the application API. - * - * @return array */ - public function transform(DatabaseHost $model) + public function transform(DatabaseHost $model): array { return [ 'id' => $model->id, @@ -34,19 +34,17 @@ class DatabaseHostTransformer extends BaseTransformer 'port' => $model->port, 'username' => $model->username, 'node' => $model->node_id, - 'created_at' => $model->created_at->toIso8601String(), - 'updated_at' => $model->updated_at->toIso8601String(), + 'created_at' => $model->created_at->toAtomString(), + 'updated_at' => $model->updated_at->toAtomString(), ]; } /** * Include the databases associated with this host. * - * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeDatabases(DatabaseHost $model) + public function includeDatabases(DatabaseHost $model): Collection|NullResource { 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 7215d6d4a..9ed5736b4 100644 --- a/app/Transformers/Api/Application/EggTransformer.php +++ b/app/Transformers/Api/Application/EggTransformer.php @@ -6,7 +6,10 @@ use Illuminate\Support\Arr; use Pterodactyl\Models\Egg; use Pterodactyl\Models\Nest; use Pterodactyl\Models\Server; +use League\Fractal\Resource\Item; use Pterodactyl\Models\EggVariable; +use League\Fractal\Resource\Collection; +use League\Fractal\Resource\NullResource; use Pterodactyl\Services\Acl\Api\AdminAcl; class EggTransformer extends BaseTransformer @@ -34,9 +37,9 @@ class EggTransformer extends BaseTransformer * Transform an Egg model into a representation that can be consumed by * the application api. * - * @return array + * @throws \JsonException */ - public function transform(Egg $model) + public function transform(Egg $model): array { $files = json_decode($model->config_files, true, 512, JSON_THROW_ON_ERROR); if (empty($files)) { @@ -79,11 +82,9 @@ class EggTransformer extends BaseTransformer /** * Include the Nest relationship for the given Egg in the transformation. * - * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeNest(Egg $model) + public function includeNest(Egg $model): Item|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_NESTS)) { return $this->null(); @@ -97,11 +98,9 @@ class EggTransformer extends BaseTransformer /** * Include the Servers relationship for the given Egg in the transformation. * - * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeServers(Egg $model) + public function includeServers(Egg $model): Collection|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) { return $this->null(); @@ -115,10 +114,8 @@ class EggTransformer extends BaseTransformer /** * Include more detailed information about the configuration if this Egg is * extending another. - * - * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource */ - public function includeConfig(Egg $model) + public function includeConfig(Egg $model): Item|NullResource { if (is_null($model->config_from)) { return $this->null(); @@ -139,10 +136,8 @@ class EggTransformer extends BaseTransformer /** * Include more detailed information about the script configuration if the * Egg is extending another. - * - * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource */ - public function includeScript(Egg $model) + public function includeScript(Egg $model): Item|NullResource { if (is_null($model->copy_script_from)) { return $this->null(); @@ -163,11 +158,9 @@ class EggTransformer extends BaseTransformer /** * Include the variables that are defined for this Egg. * - * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeVariables(Egg $model) + public function includeVariables(Egg $model): Collection|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_EGGS)) { return $this->null(); diff --git a/app/Transformers/Api/Application/LocationTransformer.php b/app/Transformers/Api/Application/LocationTransformer.php index 90564d81d..8fea3feb3 100644 --- a/app/Transformers/Api/Application/LocationTransformer.php +++ b/app/Transformers/Api/Application/LocationTransformer.php @@ -3,6 +3,8 @@ namespace Pterodactyl\Transformers\Api\Application; use Pterodactyl\Models\Location; +use League\Fractal\Resource\Collection; +use League\Fractal\Resource\NullResource; use Pterodactyl\Services\Acl\Api\AdminAcl; class LocationTransformer extends BaseTransformer @@ -37,11 +39,9 @@ class LocationTransformer extends BaseTransformer /** * Return the nodes associated with this location. * - * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeServers(Location $location) + public function includeServers(Location $location): Collection|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) { return $this->null(); @@ -55,11 +55,9 @@ class LocationTransformer extends BaseTransformer /** * Return the nodes associated with this location. * - * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeNodes(Location $location) + public function includeNodes(Location $location): Collection|NullResource { 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 1274901a7..2f530d44e 100644 --- a/app/Transformers/Api/Application/NestTransformer.php +++ b/app/Transformers/Api/Application/NestTransformer.php @@ -5,6 +5,8 @@ namespace Pterodactyl\Transformers\Api\Application; use Pterodactyl\Models\Egg; use Pterodactyl\Models\Nest; use Pterodactyl\Models\Server; +use League\Fractal\Resource\Collection; +use League\Fractal\Resource\NullResource; use Pterodactyl\Services\Acl\Api\AdminAcl; class NestTransformer extends BaseTransformer @@ -27,10 +29,8 @@ class NestTransformer extends BaseTransformer /** * Transform a Nest model into a representation that can be consumed by the * application API. - * - * @return array */ - public function transform(Nest $model) + public function transform(Nest $model): array { $response = $model->toArray(); @@ -43,11 +43,9 @@ class NestTransformer extends BaseTransformer /** * Include the Eggs relationship on the given Nest model transformation. * - * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeEggs(Nest $model) + public function includeEggs(Nest $model): Collection|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_EGGS)) { return $this->null(); @@ -61,11 +59,9 @@ class NestTransformer extends BaseTransformer /** * Include the servers relationship on the given Nest model. * - * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeServers(Nest $model) + public function includeServers(Nest $model): Collection|NullResource { 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 c7c1fc93b..6347dfec3 100644 --- a/app/Transformers/Api/Application/NodeTransformer.php +++ b/app/Transformers/Api/Application/NodeTransformer.php @@ -3,6 +3,9 @@ namespace Pterodactyl\Transformers\Api\Application; use Pterodactyl\Models\Node; +use League\Fractal\Resource\Item; +use League\Fractal\Resource\Collection; +use League\Fractal\Resource\NullResource; use Pterodactyl\Services\Acl\Api\AdminAcl; class NodeTransformer extends BaseTransformer @@ -50,11 +53,9 @@ class NodeTransformer extends BaseTransformer /** * Return the nodes associated with this location. * - * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeAllocations(Node $node) + public function includeAllocations(Node $node): Collection|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_ALLOCATIONS)) { return $this->null(); @@ -72,11 +73,9 @@ class NodeTransformer extends BaseTransformer /** * Return the nodes associated with this location. * - * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeLocation(Node $node) + public function includeLocation(Node $node): Item|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_LOCATIONS)) { return $this->null(); @@ -94,11 +93,9 @@ class NodeTransformer extends BaseTransformer /** * Return the nodes associated with this location. * - * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeServers(Node $node) + public function includeServers(Node $node): Collection|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) { return $this->null(); diff --git a/app/Transformers/Api/Application/ServerDatabaseTransformer.php b/app/Transformers/Api/Application/ServerDatabaseTransformer.php index 4e425c9e4..2590482d9 100644 --- a/app/Transformers/Api/Application/ServerDatabaseTransformer.php +++ b/app/Transformers/Api/Application/ServerDatabaseTransformer.php @@ -3,7 +3,9 @@ namespace Pterodactyl\Transformers\Api\Application; use Pterodactyl\Models\Database; +use League\Fractal\Resource\Item; use Pterodactyl\Models\DatabaseHost; +use League\Fractal\Resource\NullResource; use Pterodactyl\Services\Acl\Api\AdminAcl; use Illuminate\Contracts\Encryption\Encrypter; @@ -11,10 +13,7 @@ class ServerDatabaseTransformer extends BaseTransformer { protected array $availableIncludes = ['password', 'host']; - /** - * @var Encrypter - */ - private $encrypter; + private Encrypter $encrypter; /** * Perform dependency injection. @@ -45,17 +44,15 @@ class ServerDatabaseTransformer extends BaseTransformer 'username' => $model->username, 'remote' => $model->remote, 'max_connections' => $model->max_connections, - 'created_at' => $model->created_at->toIso8601String(), - 'updated_at' => $model->updated_at->toIso8601String(), + 'created_at' => $model->created_at->toAtomString(), + 'updated_at' => $model->updated_at->toAtomString(), ]; } /** * Include the database password in the request. - * - * @return \League\Fractal\Resource\Item */ - public function includePassword(Database $model) + public function includePassword(Database $model): Item { return $this->item($model, function (Database $model) { return [ @@ -67,11 +64,9 @@ class ServerDatabaseTransformer extends BaseTransformer /** * Return the database host relationship for this server database. * - * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeHost(Database $model) + public function includeHost(Database $model): Item|NullResource { 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 33110ec7e..e5db01fb2 100644 --- a/app/Transformers/Api/Application/ServerTransformer.php +++ b/app/Transformers/Api/Application/ServerTransformer.php @@ -3,15 +3,15 @@ namespace Pterodactyl\Transformers\Api\Application; use Pterodactyl\Models\Server; +use League\Fractal\Resource\Item; +use League\Fractal\Resource\Collection; +use League\Fractal\Resource\NullResource; use Pterodactyl\Services\Acl\Api\AdminAcl; use Pterodactyl\Services\Servers\EnvironmentService; class ServerTransformer extends BaseTransformer { - /** - * @var \Pterodactyl\Services\Servers\EnvironmentService - */ - private $environmentService; + private EnvironmentService $environmentService; /** * List of resources that can be included. @@ -94,11 +94,9 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array of allocations for this server. * - * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeAllocations(Server $server) + public function includeAllocations(Server $server): Collection|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_ALLOCATIONS)) { return $this->null(); @@ -112,11 +110,9 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array of data about subusers for this server. * - * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeSubusers(Server $server) + public function includeSubusers(Server $server): Collection|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_USERS)) { return $this->null(); @@ -130,11 +126,9 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array of data about subusers for this server. * - * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeUser(Server $server) + public function includeUser(Server $server): Item|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_USERS)) { return $this->null(); @@ -148,11 +142,9 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array with nest information for this server. * - * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeNest(Server $server) + public function includeNest(Server $server): Item|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_NESTS)) { return $this->null(); @@ -166,11 +158,9 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array with egg information for this server. * - * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeEgg(Server $server) + public function includeEgg(Server $server): Item|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_EGGS)) { return $this->null(); @@ -184,11 +174,9 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array of data about subusers for this server. * - * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeVariables(Server $server) + public function includeVariables(Server $server): Collection|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) { return $this->null(); @@ -202,11 +190,9 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array with location information for this server. * - * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeLocation(Server $server) + public function includeLocation(Server $server): Item|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_LOCATIONS)) { return $this->null(); @@ -220,11 +206,9 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array with node information for this server. * - * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeNode(Server $server) + public function includeNode(Server $server): Item|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_NODES)) { return $this->null(); @@ -238,11 +222,9 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array with database information for this server. * - * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeDatabases(Server $server) + public function includeDatabases(Server $server): Collection|NullResource { 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 2b1d68876..25e8f879b 100644 --- a/app/Transformers/Api/Application/ServerVariableTransformer.php +++ b/app/Transformers/Api/Application/ServerVariableTransformer.php @@ -2,7 +2,9 @@ namespace Pterodactyl\Transformers\Api\Application; +use League\Fractal\Resource\Item; use Pterodactyl\Models\EggVariable; +use League\Fractal\Resource\NullResource; use Pterodactyl\Services\Acl\Api\AdminAcl; class ServerVariableTransformer extends BaseTransformer @@ -22,10 +24,8 @@ class ServerVariableTransformer extends BaseTransformer /** * Return a generic transformed server variable array. - * - * @return array */ - public function transform(EggVariable $variable) + public function transform(EggVariable $variable): array { return $variable->toArray(); } @@ -33,11 +33,9 @@ class ServerVariableTransformer extends BaseTransformer /** * Return the parent service variable data. * - * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeParent(EggVariable $variable) + public function includeParent(EggVariable $variable): Item|NullResource { 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 c7b8abd9e..0a51d61d9 100644 --- a/app/Transformers/Api/Application/SubuserTransformer.php +++ b/app/Transformers/Api/Application/SubuserTransformer.php @@ -3,6 +3,8 @@ namespace Pterodactyl\Transformers\Api\Application; use Pterodactyl\Models\Subuser; +use League\Fractal\Resource\Item; +use League\Fractal\Resource\NullResource; use Pterodactyl\Services\Acl\Api\AdminAcl; class SubuserTransformer extends BaseTransformer @@ -38,11 +40,9 @@ class SubuserTransformer extends BaseTransformer /** * Return a generic item of user for this subuser. * - * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeUser(Subuser $subuser) + public function includeUser(Subuser $subuser): Item|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_USERS)) { return $this->null(); @@ -56,11 +56,9 @@ class SubuserTransformer extends BaseTransformer /** * Return a generic item of server for this subuser. * - * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeServer(Subuser $subuser) + public function includeServer(Subuser $subuser): Item|NullResource { 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 9e2769a13..14e354b45 100644 --- a/app/Transformers/Api/Application/UserTransformer.php +++ b/app/Transformers/Api/Application/UserTransformer.php @@ -3,6 +3,8 @@ namespace Pterodactyl\Transformers\Api\Application; use Pterodactyl\Models\User; +use League\Fractal\Resource\Collection; +use League\Fractal\Resource\NullResource; use Pterodactyl\Services\Acl\Api\AdminAcl; class UserTransformer extends BaseTransformer @@ -44,11 +46,9 @@ class UserTransformer extends BaseTransformer /** * Return the servers associated with this user. * - * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeServers(User $user) + public function includeServers(User $user): Collection|NullResource { 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 405a4208a..1a14555d8 100644 --- a/app/Transformers/Api/Client/AccountTransformer.php +++ b/app/Transformers/Api/Client/AccountTransformer.php @@ -15,11 +15,9 @@ class AccountTransformer extends BaseClientTransformer } /** - * Return basic information about the currently logged in user. - * - * @return array + * Return basic information about the currently logged-in user. */ - public function transform(User $model) + public function transform(User $model): array { return [ 'id' => $model->id, diff --git a/app/Transformers/Api/Client/ActivityLogTransformer.php b/app/Transformers/Api/Client/ActivityLogTransformer.php index 8a79bce82..849fdc865 100644 --- a/app/Transformers/Api/Client/ActivityLogTransformer.php +++ b/app/Transformers/Api/Client/ActivityLogTransformer.php @@ -30,7 +30,7 @@ class ActivityLogTransformer extends BaseClientTransformer 'description' => $model->description, 'properties' => $this->properties($model), 'has_additional_metadata' => $this->hasAdditionalMetadata($model), - 'timestamp' => $model->timestamp->toIso8601String(), + 'timestamp' => $model->timestamp->toAtomString(), ]; } diff --git a/app/Transformers/Api/Client/AllocationTransformer.php b/app/Transformers/Api/Client/AllocationTransformer.php index 0d9bfec7c..2e63e2bc9 100644 --- a/app/Transformers/Api/Client/AllocationTransformer.php +++ b/app/Transformers/Api/Client/AllocationTransformer.php @@ -14,12 +14,7 @@ class AllocationTransformer extends BaseClientTransformer return 'allocation'; } - /** - * Return basic information about the currently logged in user. - * - * @return array - */ - public function transform(Allocation $model) + public function transform(Allocation $model): array { return [ 'id' => $model->id, diff --git a/app/Transformers/Api/Client/ApiKeyTransformer.php b/app/Transformers/Api/Client/ApiKeyTransformer.php index c7c39c2b4..92ee1a5c6 100644 --- a/app/Transformers/Api/Client/ApiKeyTransformer.php +++ b/app/Transformers/Api/Client/ApiKeyTransformer.php @@ -16,17 +16,15 @@ class ApiKeyTransformer extends BaseClientTransformer /** * Transform this model into a representation that can be consumed by a client. - * - * @return array */ - public function transform(ApiKey $model) + public function transform(ApiKey $model): array { return [ 'identifier' => $model->identifier, 'description' => $model->memo, 'allowed_ips' => $model->allowed_ips, - 'last_used_at' => $model->last_used_at ? $model->last_used_at->toIso8601String() : null, - 'created_at' => $model->created_at->toIso8601String(), + 'last_used_at' => $model->last_used_at ? $model->last_used_at->toAtomString() : null, + 'created_at' => $model->created_at->toAtomString(), ]; } } diff --git a/app/Transformers/Api/Client/BackupTransformer.php b/app/Transformers/Api/Client/BackupTransformer.php index ae6ae5213..298c99642 100644 --- a/app/Transformers/Api/Client/BackupTransformer.php +++ b/app/Transformers/Api/Client/BackupTransformer.php @@ -11,10 +11,7 @@ class BackupTransformer extends BaseClientTransformer return Backup::RESOURCE_NAME; } - /** - * @return array - */ - public function transform(Backup $backup) + public function transform(Backup $backup): array { return [ 'uuid' => $backup->uuid, @@ -24,8 +21,8 @@ class BackupTransformer extends BaseClientTransformer 'ignored_files' => $backup->ignored_files, 'checksum' => $backup->checksum, 'bytes' => $backup->bytes, - 'created_at' => $backup->created_at->toIso8601String(), - 'completed_at' => $backup->completed_at ? $backup->completed_at->toIso8601String() : null, + 'created_at' => $backup->created_at->toAtomString(), + 'completed_at' => $backup->completed_at ? $backup->completed_at->toAtomString() : null, ]; } } diff --git a/app/Transformers/Api/Client/DatabaseTransformer.php b/app/Transformers/Api/Client/DatabaseTransformer.php index bdabbeed5..23e966637 100644 --- a/app/Transformers/Api/Client/DatabaseTransformer.php +++ b/app/Transformers/Api/Client/DatabaseTransformer.php @@ -3,7 +3,9 @@ namespace Pterodactyl\Transformers\Api\Client; use Pterodactyl\Models\Database; +use League\Fractal\Resource\Item; use Pterodactyl\Models\Permission; +use League\Fractal\Resource\NullResource; use Illuminate\Contracts\Encryption\Encrypter; use Pterodactyl\Contracts\Extensions\HashidsInterface; @@ -11,15 +13,9 @@ class DatabaseTransformer extends BaseClientTransformer { protected array $availableIncludes = ['password']; - /** - * @var \Illuminate\Contracts\Encryption\Encrypter - */ - private $encrypter; + private Encrypter $encrypter; - /** - * @var \Pterodactyl\Contracts\Extensions\HashidsInterface - */ - private $hashids; + private HashidsInterface $hashids; /** * Handle dependency injection. @@ -54,10 +50,8 @@ class DatabaseTransformer extends BaseClientTransformer /** * Include the database password in the request. - * - * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource */ - public function includePassword(Database $database) + public function includePassword(Database $database): Item|NullResource { if (!$this->request->user()->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 25e135007..8e2e3474e 100644 --- a/app/Transformers/Api/Client/EggTransformer.php +++ b/app/Transformers/Api/Client/EggTransformer.php @@ -14,10 +14,7 @@ class EggTransformer extends BaseClientTransformer return Egg::RESOURCE_NAME; } - /** - * @return array - */ - public function transform(Egg $egg) + public function transform(Egg $egg): array { return [ 'uuid' => $egg->uuid, diff --git a/app/Transformers/Api/Client/EggVariableTransformer.php b/app/Transformers/Api/Client/EggVariableTransformer.php index c7725b978..129494251 100644 --- a/app/Transformers/Api/Client/EggVariableTransformer.php +++ b/app/Transformers/Api/Client/EggVariableTransformer.php @@ -12,10 +12,7 @@ class EggVariableTransformer extends BaseClientTransformer return EggVariable::RESOURCE_NAME; } - /** - * @return array - */ - public function transform(EggVariable $variable) + public function transform(EggVariable $variable): array { // This guards against someone incorrectly retrieving variables (haha, me) and then passing // them into the transformer and along to the user. Just throw an exception and break the entire diff --git a/app/Transformers/Api/Client/FileObjectTransformer.php b/app/Transformers/Api/Client/FileObjectTransformer.php index 634a7d46e..6278dad73 100644 --- a/app/Transformers/Api/Client/FileObjectTransformer.php +++ b/app/Transformers/Api/Client/FileObjectTransformer.php @@ -9,10 +9,8 @@ class FileObjectTransformer extends BaseClientTransformer { /** * Transform a file object response from the daemon into a standardized response. - * - * @return array */ - public function transform(array $item) + public function transform(array $item): array { return [ 'name' => Arr::get($item, 'name'), @@ -22,8 +20,8 @@ class FileObjectTransformer extends BaseClientTransformer 'is_file' => Arr::get($item, 'file', true), 'is_symlink' => Arr::get($item, 'symlink', false), 'mimetype' => Arr::get($item, 'mime', 'application/octet-stream'), - 'created_at' => Carbon::parse(Arr::get($item, 'created', ''))->toIso8601String(), - 'modified_at' => Carbon::parse(Arr::get($item, 'modified', ''))->toIso8601String(), + 'created_at' => Carbon::parse(Arr::get($item, 'created', ''))->toAtomString(), + 'modified_at' => Carbon::parse(Arr::get($item, 'modified', ''))->toAtomString(), ]; } diff --git a/app/Transformers/Api/Client/ScheduleTransformer.php b/app/Transformers/Api/Client/ScheduleTransformer.php index 07dbf77cb..98c783f45 100644 --- a/app/Transformers/Api/Client/ScheduleTransformer.php +++ b/app/Transformers/Api/Client/ScheduleTransformer.php @@ -4,7 +4,7 @@ namespace Pterodactyl\Transformers\Api\Client; use Pterodactyl\Models\Task; use Pterodactyl\Models\Schedule; -use Illuminate\Database\Eloquent\Model; +use League\Fractal\Resource\Collection; class ScheduleTransformer extends BaseClientTransformer { @@ -22,10 +22,8 @@ class ScheduleTransformer extends BaseClientTransformer /** * Returns a transformed schedule model such that a client can view the information. - * - * @return array */ - public function transform(Schedule $model) + public function transform(Schedule $model): array { return [ 'id' => $model->id, @@ -40,21 +38,19 @@ class ScheduleTransformer extends BaseClientTransformer 'is_active' => $model->is_active, 'is_processing' => $model->is_processing, 'only_when_online' => $model->only_when_online, - 'last_run_at' => $model->last_run_at ? $model->last_run_at->toIso8601String() : null, - 'next_run_at' => $model->next_run_at ? $model->next_run_at->toIso8601String() : null, - 'created_at' => $model->created_at->toIso8601String(), - 'updated_at' => $model->updated_at->toIso8601String(), + 'last_run_at' => $model->last_run_at?->toAtomString(), + 'next_run_at' => $model->next_run_at?->toAtomString(), + 'created_at' => $model->created_at->toAtomString(), + 'updated_at' => $model->updated_at->toAtomString(), ]; } /** * Allows attaching the tasks specific to the schedule in the response. * - * @return \League\Fractal\Resource\Collection - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeTasks(Schedule $model) + public function includeTasks(Schedule $model): Collection { return $this->collection( $model->tasks, diff --git a/app/Transformers/Api/Client/ServerTransformer.php b/app/Transformers/Api/Client/ServerTransformer.php index 53f4adf4b..8ae4ed4a6 100644 --- a/app/Transformers/Api/Client/ServerTransformer.php +++ b/app/Transformers/Api/Client/ServerTransformer.php @@ -5,17 +5,17 @@ namespace Pterodactyl\Transformers\Api\Client; use Pterodactyl\Models\Egg; use Pterodactyl\Models\Server; use Pterodactyl\Models\Subuser; +use League\Fractal\Resource\Item; use Pterodactyl\Models\Allocation; use Pterodactyl\Models\Permission; use Illuminate\Container\Container; use Pterodactyl\Models\EggVariable; +use League\Fractal\Resource\Collection; +use League\Fractal\Resource\NullResource; use Pterodactyl\Services\Servers\StartupCommandService; class ServerTransformer extends BaseClientTransformer { - /** - * @var string[] - */ protected array $defaultIncludes = ['allocations', 'variables']; protected array $availableIncludes = ['egg', 'subusers']; @@ -77,11 +77,9 @@ class ServerTransformer extends BaseClientTransformer /** * Returns the allocations associated with this server. * - * @return \League\Fractal\Resource\Collection - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeAllocations(Server $server) + public function includeAllocations(Server $server): Collection { $transformer = $this->makeTransformer(AllocationTransformer::class); @@ -104,11 +102,9 @@ class ServerTransformer extends BaseClientTransformer } /** - * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeVariables(Server $server) + public function includeVariables(Server $server): Collection|NullResource { if (!$this->request->user()->can(Permission::ACTION_STARTUP_READ, $server)) { return $this->null(); @@ -124,11 +120,9 @@ class ServerTransformer extends BaseClientTransformer /** * Returns the egg associated with this server. * - * @return \League\Fractal\Resource\Item - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeEgg(Server $server) + public function includeEgg(Server $server): Item { return $this->item($server->egg, $this->makeTransformer(EggTransformer::class), Egg::RESOURCE_NAME); } @@ -136,11 +130,9 @@ class ServerTransformer extends BaseClientTransformer /** * Returns the subusers associated with this server. * - * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function includeSubusers(Server $server) + public function includeSubusers(Server $server): Collection|NullResource { if (!$this->request->user()->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 66827bf36..6b323b315 100644 --- a/app/Transformers/Api/Client/StatsTransformer.php +++ b/app/Transformers/Api/Client/StatsTransformer.php @@ -14,10 +14,8 @@ class StatsTransformer extends BaseClientTransformer /** * Transform stats from the daemon into a result set that can be used in * the client API. - * - * @return array */ - public function transform(array $data) + public function transform(array $data): array { return [ 'current_state' => Arr::get($data, 'state', 'stopped'), diff --git a/app/Transformers/Api/Client/SubuserTransformer.php b/app/Transformers/Api/Client/SubuserTransformer.php index 7a8bfde0e..2902d1f7a 100644 --- a/app/Transformers/Api/Client/SubuserTransformer.php +++ b/app/Transformers/Api/Client/SubuserTransformer.php @@ -17,11 +17,9 @@ class SubuserTransformer extends BaseClientTransformer /** * Transforms a subuser into a model that can be shown to a front-end user. * - * @return array|void - * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ - public function transform(Subuser $model) + public function transform(Subuser $model): array { return array_merge( $this->makeTransformer(UserTransformer::class)->transform($model->user), diff --git a/app/Transformers/Api/Client/TaskTransformer.php b/app/Transformers/Api/Client/TaskTransformer.php index a2e62cf51..52f0e2b5d 100644 --- a/app/Transformers/Api/Client/TaskTransformer.php +++ b/app/Transformers/Api/Client/TaskTransformer.php @@ -16,10 +16,8 @@ class TaskTransformer extends BaseClientTransformer /** * Transforms a schedule's task into a client viewable format. - * - * @return array */ - public function transform(Task $model) + public function transform(Task $model): array { return [ 'id' => $model->id, @@ -29,8 +27,8 @@ class TaskTransformer extends BaseClientTransformer 'time_offset' => $model->time_offset, 'is_queued' => $model->is_queued, 'continue_on_failure' => $model->continue_on_failure, - 'created_at' => $model->created_at->toIso8601String(), - 'updated_at' => $model->updated_at->toIso8601String(), + 'created_at' => $model->created_at->toAtomString(), + 'updated_at' => $model->updated_at->toAtomString(), ]; } } diff --git a/app/Transformers/Api/Client/UserSSHKeyTransformer.php b/app/Transformers/Api/Client/UserSSHKeyTransformer.php index 1a9349e67..015a017b6 100644 --- a/app/Transformers/Api/Client/UserSSHKeyTransformer.php +++ b/app/Transformers/Api/Client/UserSSHKeyTransformer.php @@ -20,7 +20,7 @@ class UserSSHKeyTransformer extends BaseClientTransformer 'name' => $model->name, 'fingerprint' => $model->fingerprint, 'public_key' => $model->public_key, - 'created_at' => $model->created_at->toIso8601String(), + 'created_at' => $model->created_at->toAtomString(), ]; } } diff --git a/app/Transformers/Api/Client/UserTransformer.php b/app/Transformers/Api/Client/UserTransformer.php index 468232f8d..04bc70ea6 100644 --- a/app/Transformers/Api/Client/UserTransformer.php +++ b/app/Transformers/Api/Client/UserTransformer.php @@ -18,10 +18,8 @@ class UserTransformer extends BaseClientTransformer /** * Transforms a User model into a representation that can be shown to regular * users of the API. - * - * @return array */ - public function transform(User $model) + public function transform(User $model): array { return [ 'uuid' => $model->uuid, @@ -29,7 +27,7 @@ class UserTransformer extends BaseClientTransformer 'email' => $model->email, 'image' => 'https://gravatar.com/avatar/' . md5(Str::lower($model->email)), '2fa_enabled' => $model->use_totp, - 'created_at' => $model->created_at->toIso8601String(), + 'created_at' => $model->created_at->toAtomString(), ]; } } diff --git a/app/helpers.php b/app/helpers.php index 9c1b4ed1b..59aa7166a 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -4,14 +4,10 @@ if (!function_exists('is_digit')) { /** * Deal with normal (and irritating) PHP behavior to determine if * a value is a non-float positive integer. - * - * @param mixed $value - * - * @return bool */ - function is_digit($value) + function is_digit(mixed $value): bool { - return is_bool($value) ? false : ctype_digit(strval($value)); + return !is_bool($value) && ctype_digit(strval($value)); } } @@ -19,14 +15,8 @@ if (!function_exists('object_get_strict')) { /** * Get an object using dot notation. An object key with a value of null is still considered valid * and will not trigger the response of a default value (unlike object_get). - * - * @param object $object - * @param string $key - * @param null $default - * - * @return mixed */ - function object_get_strict($object, $key, $default = null) + function object_get_strict(object $object, ?string $key, $default = null): mixed { if (is_null($key) || trim($key) == '') { return $object; diff --git a/artisan b/artisan index 5c23e2e24..240ab7a91 100755 --- a/artisan +++ b/artisan @@ -11,13 +11,13 @@ define('LARAVEL_START', microtime(true)); | Composer provides a convenient, automatically generated class loader | for our application. We just need to utilize it! We'll require it | into the script here so that we do not have to worry about the -| loading of any our classes "manually". Feels great to relax. +| loading of our classes manually. It's great to relax. | */ -require __DIR__.'/vendor/autoload.php'; +require __DIR__ . '/vendor/autoload.php'; -$app = require_once __DIR__.'/bootstrap/app.php'; +$app = require_once __DIR__ . '/bootstrap/app.php'; /* |-------------------------------------------------------------------------- @@ -33,8 +33,8 @@ $app = require_once __DIR__.'/bootstrap/app.php'; $kernel = $app->make(Illuminate\Contracts\Console\Kernel::class); $status = $kernel->handle( - $input = new Symfony\Component\Console\Input\ArgvInput, - new Symfony\Component\Console\Output\ConsoleOutput + $input = new Symfony\Component\Console\Input\ArgvInput(), + new Symfony\Component\Console\Output\ConsoleOutput() ); /* diff --git a/composer.json b/composer.json index 985f64f3a..2d4026781 100644 --- a/composer.json +++ b/composer.json @@ -3,57 +3,66 @@ "description": "The free, open-source game management panel. Supporting Minecraft, Spigot, BungeeCord, and SRCDS servers.", "license": "MIT", "authors": [ + { + "name": "Matthew Penner", + "email": "matthew@pterodactyl.io", + "homepage": "https://github.com/matthewpi", + "role": "Lead Developer" + }, { "name": "Dane Everitt", "email": "dane@daneeveritt.com", "homepage": "https://github.com/DaneEveritt", - "role": "Lead Developer" + "role": "Developer" } ], "require": { - "php": "^7.4 || ^8.0 || ^8.1", + "php": "^8.0.2 || ^8.1", "ext-json": "*", "ext-mbstring": "*", "ext-pdo": "*", "ext-pdo_mysql": "*", + "ext-posix": "*", "ext-zip": "*", - "aws/aws-sdk-php": "^3.171", - "doctrine/dbal": "~2.13.9", - "fruitcake/laravel-cors": "~3.0.0", - "guzzlehttp/guzzle": "~7.4.4", + "aws/aws-sdk-php": "~3.238.2", + "doctrine/dbal": "~3.4.5", + "guzzlehttp/guzzle": "~7.5.0", "hashids/hashids": "~4.1.0", "laracasts/utilities": "~3.2.1", - "laravel/framework": "^8.83", + "laravel/framework": "^9.34.0", "laravel/helpers": "~1.5.0", "laravel/sanctum": "~2.15.1", "laravel/tinker": "~2.7.2", - "laravel/ui": "~3.4.5", - "lcobucci/jwt": "~4.1.5", - "league/flysystem-aws-s3-v3": "~1.0.29", - "league/flysystem-memory": "~1.0.2", - "matriphe/iso-639": "~1.2.0", + "laravel/ui": "~3.4.6", + "lcobucci/jwt": "~4.2.1", + "league/flysystem-aws-s3-v3": "~3.5.0", + "league/flysystem-memory": "~3.3.0", + "matriphe/iso-639": "~1.2", "phpseclib/phpseclib": "~3.0", "pragmarx/google2fa": "~5.0.0", - "predis/predis": "~1.1.10", - "prologue/alerts": "~0.4.8", - "psr/cache": "~1.0.1", + "predis/predis": "~2.0.2", + "prologue/alerts": "~1.0.0", + "psr/cache": "~3.0.0", "s1lentium/iptools": "~1.1.1", - "spatie/laravel-fractal": "~5.8.1", - "spatie/laravel-query-builder": "~3.6.2", - "staudenmeir/belongs-to-through": "~2.11.2", - "symfony/yaml": "~4.4.37", - "webmozart/assert": "~1.10.0" + "spatie/laravel-fractal": "~6.0.2", + "spatie/laravel-query-builder": "~5.0.3", + "staudenmeir/belongs-to-through": "~2.12.1", + "symfony/http-client": "~6.0", + "symfony/mailgun-mailer": "~6.0", + "symfony/postmark-mailer": "~6.0", + "symfony/yaml": "~5.4", + "webmozart/assert": "~1.11" }, "require-dev": { - "barryvdh/laravel-ide-helper": "^2.12", - "facade/ignition": "^2.17", - "fakerphp/faker": "^1.19", - "friendsofphp/php-cs-fixer": "^3.8", - "itsgoingd/clockwork": "^5.1", - "mockery/mockery": "^1.5", - "nunomaduro/collision": "^5.11", - "php-mock/php-mock-phpunit": "^2.6", - "phpunit/phpunit": "^9.5" + "barryvdh/laravel-ide-helper": "~2.12.3", + "fakerphp/faker": "~1.20", + "friendsofphp/php-cs-fixer": "~3.11", + "itsgoingd/clockwork": "~5.1", + "mockery/mockery": "~1.5", + "nunomaduro/collision": "~6.3", + "php-mock/php-mock-phpunit": "~2.6", + "phpunit/phpunit": "~9.5", + "spatie/laravel-ignition": "~1.5" }, "autoload": { "files": [ @@ -86,11 +95,11 @@ }, "prefer-stable": true, "config": { - "platform": { - "php": "7.4.0" - }, + "optimize-autoloader": true, "preferred-install": "dist", "sort-packages": true, - "optimize-autoloader": false + "platform": { + "php": "8.0.2" + } } } diff --git a/composer.lock b/composer.lock index b293911e7..3b0460586 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "29f7542c6f23a5941c840e1335923cc2", + "content-hash": "8244c912d7f8c69a2a29aa1ee45982cb", "packages": [ { "name": "aws/aws-crt-php", @@ -58,16 +58,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.224.0", + "version": "3.238.2", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "bc5eb18414ef703c5f39a5a009a437c74c228306" + "reference": "f2a1351b5eb5fe17508cc5c907a786955882b93c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/bc5eb18414ef703c5f39a5a009a437c74c228306", - "reference": "bc5eb18414ef703c5f39a5a009a437c74c228306", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/f2a1351b5eb5fe17508cc5c907a786955882b93c", + "reference": "f2a1351b5eb5fe17508cc5c907a786955882b93c", "shasum": "" }, "require": { @@ -75,9 +75,9 @@ "ext-json": "*", "ext-pcre": "*", "ext-simplexml": "*", - "guzzlehttp/guzzle": "^5.3.3 || ^6.2.1 || ^7.0", + "guzzlehttp/guzzle": "^6.5.8 || ^7.4.5", "guzzlehttp/promises": "^1.4.0", - "guzzlehttp/psr7": "^1.7.0 || ^2.1.1", + "guzzlehttp/psr7": "^1.8.5 || ^2.3", "mtdowling/jmespath.php": "^2.6", "php": ">=5.5" }, @@ -85,6 +85,8 @@ "andrewsville/php-token-reflection": "^1.4", "aws/aws-php-sns-message-validator": "~1.0", "behat/behat": "~3.0", + "composer/composer": "^1.10.22", + "dms/phpunit-arraysubset-asserts": "^0.4.0", "doctrine/cache": "~1.4", "ext-dom": "*", "ext-openssl": "*", @@ -92,10 +94,11 @@ "ext-sockets": "*", "nette/neon": "^2.3", "paragonie/random_compat": ">= 2", - "phpunit/phpunit": "^4.8.35 || ^5.6.3", + "phpunit/phpunit": "^4.8.35 || ^5.6.3 || ^9.5", "psr/cache": "^1.0", "psr/simple-cache": "^1.0", - "sebastian/comparator": "^1.2.3" + "sebastian/comparator": "^1.2.3 || ^4.0", + "yoast/phpunit-polyfills": "^1.0" }, "suggest": { "aws/aws-php-sns-message-validator": "To validate incoming SNS notifications", @@ -143,32 +146,32 @@ "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.224.0" + "source": "https://github.com/aws/aws-sdk-php/tree/3.238.2" }, - "time": "2022-05-27T20:23:28+00:00" + "time": "2022-10-06T18:29:40+00:00" }, { "name": "brick/math", - "version": "0.9.3", + "version": "0.10.2", "source": { "type": "git", "url": "https://github.com/brick/math.git", - "reference": "ca57d18f028f84f777b2168cd1911b0dee2343ae" + "reference": "459f2781e1a08d52ee56b0b1444086e038561e3f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/ca57d18f028f84f777b2168cd1911b0dee2343ae", - "reference": "ca57d18f028f84f777b2168cd1911b0dee2343ae", + "url": "https://api.github.com/repos/brick/math/zipball/459f2781e1a08d52ee56b0b1444086e038561e3f", + "reference": "459f2781e1a08d52ee56b0b1444086e038561e3f", "shasum": "" }, "require": { "ext-json": "*", - "php": "^7.1 || ^8.0" + "php": "^7.4 || ^8.0" }, "require-dev": { "php-coveralls/php-coveralls": "^2.2", - "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.0", - "vimeo/psalm": "4.9.2" + "phpunit/phpunit": "^9.0", + "vimeo/psalm": "4.25.0" }, "type": "library", "autoload": { @@ -193,19 +196,15 @@ ], "support": { "issues": "https://github.com/brick/math/issues", - "source": "https://github.com/brick/math/tree/0.9.3" + "source": "https://github.com/brick/math/tree/0.10.2" }, "funding": [ { "url": "https://github.com/BenMorel", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/brick/math", - "type": "tidelift" } ], - "time": "2021-08-15T20:50:18+00:00" + "time": "2022-08-10T22:54:19+00:00" }, { "name": "dflydev/dot-access-data", @@ -377,35 +376,38 @@ }, { "name": "doctrine/dbal", - "version": "2.13.9", + "version": "3.4.5", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "c480849ca3ad6706a39c970cdfe6888fa8a058b8" + "reference": "a5a58773109c0abb13e658c8ccd92aeec8d07f9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/c480849ca3ad6706a39c970cdfe6888fa8a058b8", - "reference": "c480849ca3ad6706a39c970cdfe6888fa8a058b8", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/a5a58773109c0abb13e658c8ccd92aeec8d07f9e", + "reference": "a5a58773109c0abb13e658c8ccd92aeec8d07f9e", "shasum": "" }, "require": { - "doctrine/cache": "^1.0|^2.0", + "composer-runtime-api": "^2", + "doctrine/cache": "^1.11|^2.0", "doctrine/deprecations": "^0.5.3|^1", "doctrine/event-manager": "^1.0", - "ext-pdo": "*", - "php": "^7.1 || ^8" + "php": "^7.4 || ^8.0", + "psr/cache": "^1|^2|^3", + "psr/log": "^1|^2|^3" }, "require-dev": { - "doctrine/coding-standard": "9.0.0", - "jetbrains/phpstorm-stubs": "2021.1", - "phpstan/phpstan": "1.4.6", - "phpunit/phpunit": "^7.5.20|^8.5|9.5.16", - "psalm/plugin-phpunit": "0.16.1", - "squizlabs/php_codesniffer": "3.6.2", - "symfony/cache": "^4.4", - "symfony/console": "^2.0.5|^3.0|^4.0|^5.0", - "vimeo/psalm": "4.22.0" + "doctrine/coding-standard": "10.0.0", + "jetbrains/phpstorm-stubs": "2022.2", + "phpstan/phpstan": "1.8.3", + "phpstan/phpstan-strict-rules": "^1.3", + "phpunit/phpunit": "9.5.24", + "psalm/plugin-phpunit": "0.17.0", + "squizlabs/php_codesniffer": "3.7.1", + "symfony/cache": "^5.4|^6.0", + "symfony/console": "^4.4|^5.4|^6.0", + "vimeo/psalm": "4.27.0" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." @@ -416,7 +418,7 @@ "type": "library", "autoload": { "psr-4": { - "Doctrine\\DBAL\\": "lib/Doctrine/DBAL" + "Doctrine\\DBAL\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -459,14 +461,13 @@ "queryobject", "sasql", "sql", - "sqlanywhere", "sqlite", "sqlserver", "sqlsrv" ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/2.13.9" + "source": "https://github.com/doctrine/dbal/tree/3.4.5" }, "funding": [ { @@ -482,7 +483,7 @@ "type": "tidelift" } ], - "time": "2022-05-02T20:28:55+00:00" + "time": "2022-09-23T17:48:57+00:00" }, { "name": "doctrine/deprecations", @@ -529,34 +530,31 @@ }, { "name": "doctrine/event-manager", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/doctrine/event-manager.git", - "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f" + "reference": "eb2ecf80e3093e8f3c2769ac838e27d8ede8e683" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/event-manager/zipball/41370af6a30faa9dc0368c4a6814d596e81aba7f", - "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/eb2ecf80e3093e8f3c2769ac838e27d8ede8e683", + "reference": "eb2ecf80e3093e8f3c2769ac838e27d8ede8e683", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "conflict": { - "doctrine/common": "<2.9@dev" + "doctrine/common": "<2.9" }, "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpunit/phpunit": "^7.0" + "doctrine/coding-standard": "^9", + "phpstan/phpstan": "~1.4.10 || ^1.5.4", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Common\\": "lib/Doctrine/Common" @@ -603,7 +601,7 @@ ], "support": { "issues": "https://github.com/doctrine/event-manager/issues", - "source": "https://github.com/doctrine/event-manager/tree/1.1.x" + "source": "https://github.com/doctrine/event-manager/tree/1.1.2" }, "funding": [ { @@ -619,32 +617,32 @@ "type": "tidelift" } ], - "time": "2020-05-29T18:28:51+00:00" + "time": "2022-07-27T22:18:11+00:00" }, { "name": "doctrine/inflector", - "version": "2.0.4", + "version": "2.0.5", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89" + "reference": "ade2b3bbfb776f27f0558e26eed43b5d9fe1b392" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", - "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/ade2b3bbfb776f27f0558e26eed43b5d9fe1b392", + "reference": "ade2b3bbfb776f27f0558e26eed43b5d9fe1b392", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^8.2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpstan/phpstan-strict-rules": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", - "vimeo/psalm": "^4.10" + "doctrine/coding-standard": "^9", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.3", + "phpunit/phpunit": "^8.5 || ^9.5", + "vimeo/psalm": "^4.25" }, "type": "library", "autoload": { @@ -694,7 +692,7 @@ ], "support": { "issues": "https://github.com/doctrine/inflector/issues", - "source": "https://github.com/doctrine/inflector/tree/2.0.4" + "source": "https://github.com/doctrine/inflector/tree/2.0.5" }, "funding": [ { @@ -710,7 +708,7 @@ "type": "tidelift" } ], - "time": "2021-10-22T20:16:43+00:00" + "time": "2022-09-07T09:01:28+00:00" }, { "name": "doctrine/lexer", @@ -790,16 +788,16 @@ }, { "name": "dragonmantank/cron-expression", - "version": "v3.3.1", + "version": "v3.3.2", "source": { "type": "git", "url": "https://github.com/dragonmantank/cron-expression.git", - "reference": "be85b3f05b46c39bbc0d95f6c071ddff669510fa" + "reference": "782ca5968ab8b954773518e9e49a6f892a34b2a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/be85b3f05b46c39bbc0d95f6c071ddff669510fa", - "reference": "be85b3f05b46c39bbc0d95f6c071ddff669510fa", + "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/782ca5968ab8b954773518e9e49a6f892a34b2a8", + "reference": "782ca5968ab8b954773518e9e49a6f892a34b2a8", "shasum": "" }, "require": { @@ -839,7 +837,7 @@ ], "support": { "issues": "https://github.com/dragonmantank/cron-expression/issues", - "source": "https://github.com/dragonmantank/cron-expression/tree/v3.3.1" + "source": "https://github.com/dragonmantank/cron-expression/tree/v3.3.2" }, "funding": [ { @@ -847,31 +845,31 @@ "type": "github" } ], - "time": "2022-01-18T15:43:28+00:00" + "time": "2022-09-10T18:51:20+00:00" }, { "name": "egulias/email-validator", - "version": "2.1.25", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "0dbf5d78455d4d6a41d186da50adc1122ec066f4" + "reference": "f88dcf4b14af14a98ad96b14b2b317969eab6715" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0dbf5d78455d4d6a41d186da50adc1122ec066f4", - "reference": "0dbf5d78455d4d6a41d186da50adc1122ec066f4", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/f88dcf4b14af14a98ad96b14b2b317969eab6715", + "reference": "f88dcf4b14af14a98ad96b14b2b317969eab6715", "shasum": "" }, "require": { - "doctrine/lexer": "^1.0.1", - "php": ">=5.5", - "symfony/polyfill-intl-idn": "^1.10" + "doctrine/lexer": "^1.2", + "php": ">=7.2", + "symfony/polyfill-intl-idn": "^1.15" }, "require-dev": { - "dominicsayers/isemail": "^3.0.7", - "phpunit/phpunit": "^4.8.36|^7.5.15", - "satooshi/php-coveralls": "^1.0.1" + "php-coveralls/php-coveralls": "^2.2", + "phpunit/phpunit": "^8.5.8|^9.3.3", + "vimeo/psalm": "^4" }, "suggest": { "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" @@ -879,7 +877,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -907,7 +905,7 @@ ], "support": { "issues": "https://github.com/egulias/EmailValidator/issues", - "source": "https://github.com/egulias/EmailValidator/tree/2.1.25" + "source": "https://github.com/egulias/EmailValidator/tree/3.2.1" }, "funding": [ { @@ -915,86 +913,7 @@ "type": "github" } ], - "time": "2020-12-29T14:50:06+00:00" - }, - { - "name": "fruitcake/laravel-cors", - "version": "v3.0.0", - "source": { - "type": "git", - "url": "https://github.com/fruitcake/laravel-cors.git", - "reference": "7c036ec08972d8d5d9db637e772af6887828faf5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/fruitcake/laravel-cors/zipball/7c036ec08972d8d5d9db637e772af6887828faf5", - "reference": "7c036ec08972d8d5d9db637e772af6887828faf5", - "shasum": "" - }, - "require": { - "fruitcake/php-cors": "^1.2", - "illuminate/contracts": "^6|^7|^8|^9", - "illuminate/support": "^6|^7|^8|^9", - "php": "^7.4|^8.0" - }, - "require-dev": { - "laravel/framework": "^6|^7.24|^8", - "orchestra/testbench-dusk": "^4|^5|^6|^7", - "phpunit/phpunit": "^9", - "squizlabs/php_codesniffer": "^3.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - }, - "laravel": { - "providers": [ - "Fruitcake\\Cors\\CorsServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "Fruitcake\\Cors\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fruitcake", - "homepage": "https://fruitcake.nl" - }, - { - "name": "Barry vd. Heuvel", - "email": "barryvdh@gmail.com" - } - ], - "description": "Adds CORS (Cross-Origin Resource Sharing) headers support in your Laravel application", - "keywords": [ - "api", - "cors", - "crossdomain", - "laravel" - ], - "support": { - "issues": "https://github.com/fruitcake/laravel-cors/issues", - "source": "https://github.com/fruitcake/laravel-cors/tree/v3.0.0" - }, - "funding": [ - { - "url": "https://fruitcake.nl", - "type": "custom" - }, - { - "url": "https://github.com/barryvdh", - "type": "github" - } - ], - "time": "2022-02-23T14:53:22+00:00" + "time": "2022-06-18T20:57:19+00:00" }, { "name": "fruitcake/php-cors", @@ -1069,24 +988,24 @@ }, { "name": "graham-campbell/result-type", - "version": "v1.0.4", + "version": "v1.1.0", "source": { "type": "git", "url": "https://github.com/GrahamCampbell/Result-Type.git", - "reference": "0690bde05318336c7221785f2a932467f98b64ca" + "reference": "a878d45c1914464426dc94da61c9e1d36ae262a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/0690bde05318336c7221785f2a932467f98b64ca", - "reference": "0690bde05318336c7221785f2a932467f98b64ca", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/a878d45c1914464426dc94da61c9e1d36ae262a8", + "reference": "a878d45c1914464426dc94da61c9e1d36ae262a8", "shasum": "" }, "require": { - "php": "^7.0 || ^8.0", - "phpoption/phpoption": "^1.8" + "php": "^7.2.5 || ^8.0", + "phpoption/phpoption": "^1.9" }, "require-dev": { - "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8" + "phpunit/phpunit": "^8.5.28 || ^9.5.21" }, "type": "library", "autoload": { @@ -1115,7 +1034,7 @@ ], "support": { "issues": "https://github.com/GrahamCampbell/Result-Type/issues", - "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.0.4" + "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.0" }, "funding": [ { @@ -1127,26 +1046,26 @@ "type": "tidelift" } ], - "time": "2021-11-21T21:41:47+00:00" + "time": "2022-07-30T15:56:11+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "7.4.4", + "version": "7.5.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "e3ff079b22820c2029d4c2a87796b6a0b8716ad8" + "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/e3ff079b22820c2029d4c2a87796b6a0b8716ad8", - "reference": "e3ff079b22820c2029d4c2a87796b6a0b8716ad8", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b50a2a1251152e43f6a37f0fa053e730a67d25ba", + "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba", "shasum": "" }, "require": { "ext-json": "*", "guzzlehttp/promises": "^1.5", - "guzzlehttp/psr7": "^1.8.3 || ^2.1", + "guzzlehttp/psr7": "^1.9 || ^2.4", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" @@ -1155,10 +1074,10 @@ "psr/http-client-implementation": "1.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", + "bamarni/composer-bin-plugin": "^1.8.1", "ext-curl": "*", "php-http/client-integration-tests": "^3.0", - "phpunit/phpunit": "^8.5.5 || ^9.3.5", + "phpunit/phpunit": "^8.5.29 || ^9.5.23", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "suggest": { @@ -1168,8 +1087,12 @@ }, "type": "library", "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, "branch-alias": { - "dev-master": "7.4-dev" + "dev-master": "7.5-dev" } }, "autoload": { @@ -1235,7 +1158,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.4.4" + "source": "https://github.com/guzzle/guzzle/tree/7.5.0" }, "funding": [ { @@ -1251,20 +1174,20 @@ "type": "tidelift" } ], - "time": "2022-06-09T21:39:15+00:00" + "time": "2022-08-28T15:39:27+00:00" }, { "name": "guzzlehttp/promises", - "version": "1.5.1", + "version": "1.5.2", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da" + "reference": "b94b2807d85443f9719887892882d0329d1e2598" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/fe752aedc9fd8fcca3fe7ad05d419d32998a06da", - "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da", + "url": "https://api.github.com/repos/guzzle/promises/zipball/b94b2807d85443f9719887892882d0329d1e2598", + "reference": "b94b2807d85443f9719887892882d0329d1e2598", "shasum": "" }, "require": { @@ -1319,7 +1242,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/1.5.1" + "source": "https://github.com/guzzle/promises/tree/1.5.2" }, "funding": [ { @@ -1335,20 +1258,20 @@ "type": "tidelift" } ], - "time": "2021-10-22T20:56:57+00:00" + "time": "2022-08-28T14:55:35+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.2.1", + "version": "2.4.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "c94a94f120803a18554c1805ef2e539f8285f9a2" + "reference": "69568e4293f4fa993f3b0e51c9723e1e17c41379" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/c94a94f120803a18554c1805ef2e539f8285f9a2", - "reference": "c94a94f120803a18554c1805ef2e539f8285f9a2", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/69568e4293f4fa993f3b0e51c9723e1e17c41379", + "reference": "69568e4293f4fa993f3b0e51c9723e1e17c41379", "shasum": "" }, "require": { @@ -1362,17 +1285,21 @@ "psr/http-message-implementation": "1.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", + "bamarni/composer-bin-plugin": "^1.8.1", "http-interop/http-factory-tests": "^0.9", - "phpunit/phpunit": "^8.5.8 || ^9.3.10" + "phpunit/phpunit": "^8.5.29 || ^9.5.23" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, "type": "library", "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, "branch-alias": { - "dev-master": "2.2-dev" + "dev-master": "2.4-dev" } }, "autoload": { @@ -1434,7 +1361,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.2.1" + "source": "https://github.com/guzzle/psr7/tree/2.4.1" }, "funding": [ { @@ -1450,7 +1377,7 @@ "type": "tidelift" } ], - "time": "2022-03-20T21:55:58+00:00" + "time": "2022-08-28T14:45:39+00:00" }, { "name": "hashids/hashids", @@ -1585,56 +1512,57 @@ }, { "name": "laravel/framework", - "version": "v8.83.14", + "version": "v9.34.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "141cf126f1746c7264f59aa78c923a84eaab501e" + "reference": "b7af7ff35497eb1c4e61652f522a862164dbba5a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/141cf126f1746c7264f59aa78c923a84eaab501e", - "reference": "141cf126f1746c7264f59aa78c923a84eaab501e", + "url": "https://api.github.com/repos/laravel/framework/zipball/b7af7ff35497eb1c4e61652f522a862164dbba5a", + "reference": "b7af7ff35497eb1c4e61652f522a862164dbba5a", "shasum": "" }, "require": { - "doctrine/inflector": "^1.4|^2.0", - "dragonmantank/cron-expression": "^3.0.2", - "egulias/email-validator": "^2.1.10", - "ext-json": "*", + "doctrine/inflector": "^2.0", + "dragonmantank/cron-expression": "^3.3.2", + "egulias/email-validator": "^3.2.1", "ext-mbstring": "*", "ext-openssl": "*", - "laravel/serializable-closure": "^1.0", - "league/commonmark": "^1.3|^2.0.2", - "league/flysystem": "^1.1", + "fruitcake/php-cors": "^1.2", + "laravel/serializable-closure": "^1.2.2", + "league/commonmark": "^2.2", + "league/flysystem": "^3.0.16", "monolog/monolog": "^2.0", - "nesbot/carbon": "^2.53.1", - "opis/closure": "^3.6", - "php": "^7.3|^8.0", - "psr/container": "^1.0", - "psr/log": "^1.0|^2.0", - "psr/simple-cache": "^1.0", + "nesbot/carbon": "^2.62.1", + "nunomaduro/termwind": "^1.13", + "php": "^8.0.2", + "psr/container": "^1.1.1|^2.0.1", + "psr/log": "^1.0|^2.0|^3.0", + "psr/simple-cache": "^1.0|^2.0|^3.0", "ramsey/uuid": "^4.2.2", - "swiftmailer/swiftmailer": "^6.3", - "symfony/console": "^5.4", - "symfony/error-handler": "^5.4", - "symfony/finder": "^5.4", - "symfony/http-foundation": "^5.4", - "symfony/http-kernel": "^5.4", - "symfony/mime": "^5.4", - "symfony/process": "^5.4", - "symfony/routing": "^5.4", - "symfony/var-dumper": "^5.4", - "tijsverkoyen/css-to-inline-styles": "^2.2.2", + "symfony/console": "^6.0.9", + "symfony/error-handler": "^6.0", + "symfony/finder": "^6.0", + "symfony/http-foundation": "^6.0", + "symfony/http-kernel": "^6.0", + "symfony/mailer": "^6.0", + "symfony/mime": "^6.0", + "symfony/process": "^6.0", + "symfony/routing": "^6.0", + "symfony/uid": "^6.0", + "symfony/var-dumper": "^6.0", + "tijsverkoyen/css-to-inline-styles": "^2.2.5", "vlucas/phpdotenv": "^5.4.1", - "voku/portable-ascii": "^1.6.1" + "voku/portable-ascii": "^2.0" }, "conflict": { "tightenco/collect": "<5.5.33" }, "provide": { - "psr/container-implementation": "1.0", - "psr/simple-cache-implementation": "1.0" + "psr/container-implementation": "1.1|2.0", + "psr/simple-cache-implementation": "1.0|2.0|3.0" }, "replace": { "illuminate/auth": "self.version", @@ -1642,6 +1570,7 @@ "illuminate/bus": "self.version", "illuminate/cache": "self.version", "illuminate/collections": "self.version", + "illuminate/conditionable": "self.version", "illuminate/config": "self.version", "illuminate/console": "self.version", "illuminate/container": "self.version", @@ -1670,21 +1599,27 @@ "illuminate/view": "self.version" }, "require-dev": { - "aws/aws-sdk-php": "^3.198.1", + "ably/ably-php": "^1.0", + "aws/aws-sdk-php": "^3.235.5", "doctrine/dbal": "^2.13.3|^3.1.4", - "filp/whoops": "^2.14.3", - "guzzlehttp/guzzle": "^6.5.5|^7.0.1", - "league/flysystem-cached-adapter": "^1.0", - "mockery/mockery": "^1.4.4", - "orchestra/testbench-core": "^6.27", + "fakerphp/faker": "^1.9.2", + "guzzlehttp/guzzle": "^7.5", + "league/flysystem-aws-s3-v3": "^3.0", + "league/flysystem-ftp": "^3.0", + "league/flysystem-path-prefixing": "^3.3", + "league/flysystem-read-only": "^3.3", + "league/flysystem-sftp-v3": "^3.0", + "mockery/mockery": "^1.5.1", + "orchestra/testbench-core": "^7.8", "pda/pheanstalk": "^4.0", - "phpunit/phpunit": "^8.5.19|^9.5.8", - "predis/predis": "^1.1.9", - "symfony/cache": "^5.4" + "phpstan/phpstan": "^1.4.7", + "phpunit/phpunit": "^9.5.8", + "predis/predis": "^1.1.9|^2.0.2", + "symfony/cache": "^6.0" }, "suggest": { "ably/ably-php": "Required to use the Ably broadcast driver (^1.0).", - "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.198.1).", + "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage, and SES mail driver (^3.235.5).", "brianium/paratest": "Required to run tests in parallel (^6.0).", "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.13.3|^3.1.4).", "ext-bcmath": "Required to use the multiple_of validation rule.", @@ -1696,27 +1631,31 @@ "ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).", "fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).", "filp/whoops": "Required for friendly error pages in development (^2.14.3).", - "guzzlehttp/guzzle": "Required to use the HTTP Client, Mailgun mail driver and the ping methods on schedules (^6.5.5|^7.0.1).", + "guzzlehttp/guzzle": "Required to use the HTTP Client and the ping methods on schedules (^7.5).", "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.4.4).", + "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^3.0).", + "league/flysystem-ftp": "Required to use the Flysystem FTP driver (^3.0).", + "league/flysystem-path-prefixing": "Required to use the scoped driver (^3.3).", + "league/flysystem-read-only": "Required to use read-only disks (^3.3)", + "league/flysystem-sftp-v3": "Required to use the Flysystem SFTP driver (^3.0).", + "mockery/mockery": "Required to use mocking (^1.5.1).", "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.5.19|^9.5.8).", - "predis/predis": "Required to use the predis connector (^1.1.9).", + "phpunit/phpunit": "Required to use assertions and run tests (^9.5.8).", + "predis/predis": "Required to use the predis connector (^1.1.9|^2.0.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|^5.0|^6.0|^7.0).", - "symfony/cache": "Required to PSR-6 cache bridge (^5.4).", - "symfony/filesystem": "Required to enable support for relative symbolic links (^5.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)." + "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^6.0|^7.0).", + "symfony/cache": "Required to PSR-6 cache bridge (^6.0).", + "symfony/filesystem": "Required to enable support for relative symbolic links (^6.0).", + "symfony/http-client": "Required to enable support for the Symfony API mail transports (^6.0).", + "symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^6.0).", + "symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^6.0).", + "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "8.x-dev" + "dev-master": "9.x-dev" } }, "autoload": { @@ -1730,7 +1669,8 @@ "Illuminate\\": "src/Illuminate/", "Illuminate\\Support\\": [ "src/Illuminate/Macroable/", - "src/Illuminate/Collections/" + "src/Illuminate/Collections/", + "src/Illuminate/Conditionable/" ] } }, @@ -1754,7 +1694,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-05-24T14:04:02+00:00" + "time": "2022-10-04T13:33:43+00:00" }, { "name": "laravel/helpers", @@ -1879,25 +1819,26 @@ }, { "name": "laravel/serializable-closure", - "version": "v1.2.0", + "version": "v1.2.2", "source": { "type": "git", "url": "https://github.com/laravel/serializable-closure.git", - "reference": "09f0e9fb61829f628205b7c94906c28740ff9540" + "reference": "47afb7fae28ed29057fdca37e16a84f90cc62fae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/09f0e9fb61829f628205b7c94906c28740ff9540", - "reference": "09f0e9fb61829f628205b7c94906c28740ff9540", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/47afb7fae28ed29057fdca37e16a84f90cc62fae", + "reference": "47afb7fae28ed29057fdca37e16a84f90cc62fae", "shasum": "" }, "require": { "php": "^7.3|^8.0" }, "require-dev": { - "pestphp/pest": "^1.18", - "phpstan/phpstan": "^0.12.98", - "symfony/var-dumper": "^5.3" + "nesbot/carbon": "^2.61", + "pestphp/pest": "^1.21.3", + "phpstan/phpstan": "^1.8.2", + "symfony/var-dumper": "^5.4.11" }, "type": "library", "extra": { @@ -1934,7 +1875,7 @@ "issues": "https://github.com/laravel/serializable-closure/issues", "source": "https://github.com/laravel/serializable-closure" }, - "time": "2022-05-16T17:09:47+00:00" + "time": "2022-09-08T13:45:54+00:00" }, { "name": "laravel/tinker", @@ -2067,31 +2008,31 @@ }, { "name": "lcobucci/clock", - "version": "2.0.0", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/lcobucci/clock.git", - "reference": "353d83fe2e6ae95745b16b3d911813df6a05bfb3" + "reference": "fb533e093fd61321bfcbac08b131ce805fe183d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lcobucci/clock/zipball/353d83fe2e6ae95745b16b3d911813df6a05bfb3", - "reference": "353d83fe2e6ae95745b16b3d911813df6a05bfb3", + "url": "https://api.github.com/repos/lcobucci/clock/zipball/fb533e093fd61321bfcbac08b131ce805fe183d3", + "reference": "fb533e093fd61321bfcbac08b131ce805fe183d3", "shasum": "" }, "require": { - "php": "^7.4 || ^8.0" + "php": "^8.0", + "stella-maris/clock": "^0.1.4" }, "require-dev": { - "infection/infection": "^0.17", - "lcobucci/coding-standard": "^6.0", - "phpstan/extension-installer": "^1.0", + "infection/infection": "^0.26", + "lcobucci/coding-standard": "^8.0", + "phpstan/extension-installer": "^1.1", "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" + "phpunit/phpunit": "^9.5" }, "type": "library", "autoload": { @@ -2112,7 +2053,7 @@ "description": "Yet another clock abstraction", "support": { "issues": "https://github.com/lcobucci/clock/issues", - "source": "https://github.com/lcobucci/clock/tree/2.0.x" + "source": "https://github.com/lcobucci/clock/tree/2.2.0" }, "funding": [ { @@ -2124,20 +2065,20 @@ "type": "patreon" } ], - "time": "2020-08-27T18:56:02+00:00" + "time": "2022-04-19T19:34:17+00:00" }, { "name": "lcobucci/jwt", - "version": "4.1.5", + "version": "4.2.1", "source": { "type": "git", "url": "https://github.com/lcobucci/jwt.git", - "reference": "fe2d89f2eaa7087af4aa166c6f480ef04e000582" + "reference": "72ac6d807ee51a70ad376ee03a2387e8646e10f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lcobucci/jwt/zipball/fe2d89f2eaa7087af4aa166c6f480ef04e000582", - "reference": "fe2d89f2eaa7087af4aa166c6f480ef04e000582", + "url": "https://api.github.com/repos/lcobucci/jwt/zipball/72ac6d807ee51a70ad376ee03a2387e8646e10f3", + "reference": "72ac6d807ee51a70ad376ee03a2387e8646e10f3", "shasum": "" }, "require": { @@ -2153,12 +2094,12 @@ "infection/infection": "^0.21", "lcobucci/coding-standard": "^6.0", "mikey179/vfsstream": "^1.6.7", - "phpbench/phpbench": "^1.0", + "phpbench/phpbench": "^1.2", "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", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-strict-rules": "^1.0", "phpunit/php-invoker": "^3.1", "phpunit/phpunit": "^9.5" }, @@ -2186,7 +2127,7 @@ ], "support": { "issues": "https://github.com/lcobucci/jwt/issues", - "source": "https://github.com/lcobucci/jwt/tree/4.1.5" + "source": "https://github.com/lcobucci/jwt/tree/4.2.1" }, "funding": [ { @@ -2198,20 +2139,20 @@ "type": "patreon" } ], - "time": "2021-09-28T19:34:56+00:00" + "time": "2022-08-19T23:14:07+00:00" }, { "name": "league/commonmark", - "version": "2.3.1", + "version": "2.3.5", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "cb36fee279f7fca01d5d9399ddd1b37e48e2eca1" + "reference": "84d74485fdb7074f4f9dd6f02ab957b1de513257" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/cb36fee279f7fca01d5d9399ddd1b37e48e2eca1", - "reference": "cb36fee279f7fca01d5d9399ddd1b37e48e2eca1", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/84d74485fdb7074f4f9dd6f02ab957b1de513257", + "reference": "84d74485fdb7074f4f9dd6f02ab957b1de513257", "shasum": "" }, "require": { @@ -2233,13 +2174,13 @@ "github/gfm": "0.29.0", "michelf/php-markdown": "^1.4", "nyholm/psr7": "^1.5", - "phpstan/phpstan": "^0.12.88 || ^1.0.0", - "phpunit/phpunit": "^9.5.5", + "phpstan/phpstan": "^1.8.2", + "phpunit/phpunit": "^9.5.21", "scrutinizer/ocular": "^1.8.1", - "symfony/finder": "^5.3", + "symfony/finder": "^5.3 | ^6.0", "symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0", - "unleashedtech/php-coding-standard": "^3.1", - "vimeo/psalm": "^4.7.3" + "unleashedtech/php-coding-standard": "^3.1.1", + "vimeo/psalm": "^4.24.0" }, "suggest": { "symfony/yaml": "v2.3+ required if using the Front Matter extension" @@ -2304,7 +2245,7 @@ "type": "tidelift" } ], - "time": "2022-05-14T15:37:39+00:00" + "time": "2022-07-29T10:59:45+00:00" }, { "name": "league/config", @@ -2390,54 +2331,49 @@ }, { "name": "league/flysystem", - "version": "1.1.9", + "version": "3.5.2", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "094defdb4a7001845300334e7c1ee2335925ef99" + "reference": "c73c4eb31f2e883b3897ab5591aa2dbc48112433" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/094defdb4a7001845300334e7c1ee2335925ef99", - "reference": "094defdb4a7001845300334e7c1ee2335925ef99", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/c73c4eb31f2e883b3897ab5591aa2dbc48112433", + "reference": "c73c4eb31f2e883b3897ab5591aa2dbc48112433", "shasum": "" }, "require": { - "ext-fileinfo": "*", - "league/mime-type-detection": "^1.3", - "php": "^7.2.5 || ^8.0" + "league/mime-type-detection": "^1.0.0", + "php": "^8.0.2" }, "conflict": { - "league/flysystem-sftp": "<1.0.6" + "aws/aws-sdk-php": "3.209.31 || 3.210.0", + "guzzlehttp/guzzle": "<7.0", + "guzzlehttp/ringphp": "<1.1.1", + "phpseclib/phpseclib": "3.0.15", + "symfony/http-client": "<5.2" }, "require-dev": { - "phpspec/prophecy": "^1.11.1", - "phpunit/phpunit": "^8.5.8" - }, - "suggest": { - "ext-ftp": "Allows you to use FTP server storage", - "ext-openssl": "Allows you to use FTPS server storage", - "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", - "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", - "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", - "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", - "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", - "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", - "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", - "league/flysystem-webdav": "Allows you to use WebDAV storage", - "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", - "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", - "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" + "async-aws/s3": "^1.5", + "async-aws/simple-s3": "^1.0", + "aws/aws-sdk-php": "^3.198.1", + "composer/semver": "^3.0", + "ext-fileinfo": "*", + "ext-ftp": "*", + "ext-zip": "*", + "friendsofphp/php-cs-fixer": "^3.5", + "google/cloud-storage": "^1.23", + "microsoft/azure-storage-blob": "^1.1", + "phpseclib/phpseclib": "^3.0.14", + "phpstan/phpstan": "^0.12.26", + "phpunit/phpunit": "^9.5.11", + "sabre/dav": "^4.3.1" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, "autoload": { "psr-4": { - "League\\Flysystem\\": "src/" + "League\\Flysystem\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -2447,73 +2383,71 @@ "authors": [ { "name": "Frank de Jonge", - "email": "info@frenky.net" + "email": "info@frankdejonge.nl" } ], - "description": "Filesystem abstraction: Many filesystems, one API.", + "description": "File storage abstraction for PHP", "keywords": [ - "Cloud Files", "WebDAV", - "abstraction", "aws", "cloud", - "copy.com", - "dropbox", - "file systems", + "file", "files", "filesystem", "filesystems", "ftp", - "rackspace", - "remote", "s3", "sftp", "storage" ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/1.1.9" + "source": "https://github.com/thephpleague/flysystem/tree/3.5.2" }, "funding": [ { - "url": "https://offset.earth/frankdejonge", - "type": "other" + "url": "https://ecologi.com/frankdejonge", + "type": "custom" + }, + { + "url": "https://github.com/frankdejonge", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/league/flysystem", + "type": "tidelift" } ], - "time": "2021-12-09T09:40:50+00:00" + "time": "2022-09-23T18:59:16+00:00" }, { "name": "league/flysystem-aws-s3-v3", - "version": "1.0.29", + "version": "3.5.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem-aws-s3-v3.git", - "reference": "4e25cc0582a36a786c31115e419c6e40498f6972" + "reference": "adb6633f325c934c15a099c363dc5362bdcb07a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/4e25cc0582a36a786c31115e419c6e40498f6972", - "reference": "4e25cc0582a36a786c31115e419c6e40498f6972", + "url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/adb6633f325c934c15a099c363dc5362bdcb07a2", + "reference": "adb6633f325c934c15a099c363dc5362bdcb07a2", "shasum": "" }, "require": { - "aws/aws-sdk-php": "^3.20.0", - "league/flysystem": "^1.0.40", - "php": ">=5.5.0" + "aws/aws-sdk-php": "^3.132.4", + "league/flysystem": "^3.0.0", + "league/mime-type-detection": "^1.0.0", + "php": "^8.0.2" }, - "require-dev": { - "henrikbjorn/phpspec-code-coverage": "~1.0.1", - "phpspec/phpspec": "^2.0.0" + "conflict": { + "guzzlehttp/guzzle": "<7.0", + "guzzlehttp/ringphp": "<1.1.1" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, "autoload": { "psr-4": { - "League\\Flysystem\\AwsS3v3\\": "src/" + "League\\Flysystem\\AwsS3V3\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -2523,45 +2457,62 @@ "authors": [ { "name": "Frank de Jonge", - "email": "info@frenky.net" + "email": "info@frankdejonge.nl" } ], - "description": "Flysystem adapter for the AWS S3 SDK v3.x", + "description": "AWS S3 filesystem adapter for Flysystem.", + "keywords": [ + "Flysystem", + "aws", + "file", + "files", + "filesystem", + "s3", + "storage" + ], "support": { "issues": "https://github.com/thephpleague/flysystem-aws-s3-v3/issues", - "source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/1.0.29" + "source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/3.5.0" }, - "time": "2020-10-08T18:58:37+00:00" + "funding": [ + { + "url": "https://ecologi.com/frankdejonge", + "type": "custom" + }, + { + "url": "https://github.com/frankdejonge", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/league/flysystem", + "type": "tidelift" + } + ], + "time": "2022-09-17T21:00:35+00:00" }, { "name": "league/flysystem-memory", - "version": "1.0.2", + "version": "3.3.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem-memory.git", - "reference": "d0e87477c32e29f999b4de05e64c1adcddb51757" + "reference": "d2a80fbfd3337fac39eeff64c6c0820b6a4902ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-memory/zipball/d0e87477c32e29f999b4de05e64c1adcddb51757", - "reference": "d0e87477c32e29f999b4de05e64c1adcddb51757", + "url": "https://api.github.com/repos/thephpleague/flysystem-memory/zipball/d2a80fbfd3337fac39eeff64c6c0820b6a4902ce", + "reference": "d2a80fbfd3337fac39eeff64c6c0820b6a4902ce", "shasum": "" }, "require": { - "league/flysystem": "~1.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7.10" + "ext-fileinfo": "*", + "league/flysystem": "^2.0.0 || ^3.0.0", + "php": "^8.0.2" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, "autoload": { "psr-4": { - "League\\Flysystem\\Memory\\": "src/" + "League\\Flysystem\\InMemory\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -2570,23 +2521,37 @@ ], "authors": [ { - "name": "Chris Leppanen", - "email": "chris.leppanen@gmail.com", - "role": "Developer" + "name": "Frank de Jonge", + "email": "info@frankdejonge.nl" } ], - "description": "An in-memory adapter for Flysystem.", - "homepage": "https://github.com/thephpleague/flysystem-memory", + "description": "In-memory filesystem adapter for Flysystem.", "keywords": [ "Flysystem", - "adapter", + "file", + "files", + "filesystem", "memory" ], "support": { "issues": "https://github.com/thephpleague/flysystem-memory/issues", - "source": "https://github.com/thephpleague/flysystem-memory/tree/1.0.2" + "source": "https://github.com/thephpleague/flysystem-memory/tree/3.3.0" }, - "time": "2019-05-30T21:34:13+00:00" + "funding": [ + { + "url": "https://ecologi.com/frankdejonge", + "type": "custom" + }, + { + "url": "https://github.com/frankdejonge", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/league/flysystem", + "type": "tidelift" + } + ], + "time": "2022-09-09T10:03:42+00:00" }, { "name": "league/fractal", @@ -2764,16 +2729,16 @@ }, { "name": "monolog/monolog", - "version": "2.6.0", + "version": "2.8.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "247918972acd74356b0a91dfaa5adcaec069b6c0" + "reference": "720488632c590286b88b80e62aa3d3d551ad4a50" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/247918972acd74356b0a91dfaa5adcaec069b6c0", - "reference": "247918972acd74356b0a91dfaa5adcaec069b6c0", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/720488632c590286b88b80e62aa3d3d551ad4a50", + "reference": "720488632c590286b88b80e62aa3d3d551ad4a50", "shasum": "" }, "require": { @@ -2793,11 +2758,10 @@ "guzzlehttp/psr7": "^2.2", "mongodb/mongodb": "^1.8", "php-amqplib/php-amqplib": "~2.4 || ^3", - "php-console/php-console": "^3.1.3", "phpspec/prophecy": "^1.15", "phpstan/phpstan": "^0.12.91", "phpunit/phpunit": "^8.5.14", - "predis/predis": "^1.1", + "predis/predis": "^1.1 || ^2.0", "rollbar/rollbar": "^1.3 || ^2 || ^3", "ruflin/elastica": "^7", "swiftmailer/swiftmailer": "^5.3|^6.0", @@ -2817,7 +2781,6 @@ "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", - "php-console/php-console": "Allow sending log messages to Google Chrome", "rollbar/rollbar": "Allow sending log messages to Rollbar", "ruflin/elastica": "Allow sending log messages to an Elastic Search server" }, @@ -2852,7 +2815,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/2.6.0" + "source": "https://github.com/Seldaek/monolog/tree/2.8.0" }, "funding": [ { @@ -2864,7 +2827,7 @@ "type": "tidelift" } ], - "time": "2022-05-10T09:36:00+00:00" + "time": "2022-07-24T11:55:47+00:00" }, { "name": "mtdowling/jmespath.php", @@ -2929,16 +2892,16 @@ }, { "name": "nesbot/carbon", - "version": "2.58.0", + "version": "2.62.1", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "97a34af22bde8d0ac20ab34b29d7bfe360902055" + "reference": "01bc4cdefe98ef58d1f9cb31bdbbddddf2a88f7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/97a34af22bde8d0ac20ab34b29d7bfe360902055", - "reference": "97a34af22bde8d0ac20ab34b29d7bfe360902055", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/01bc4cdefe98ef58d1f9cb31bdbbddddf2a88f7a", + "reference": "01bc4cdefe98ef58d1f9cb31bdbbddddf2a88f7a", "shasum": "" }, "require": { @@ -2953,11 +2916,12 @@ "doctrine/orm": "^2.7", "friendsofphp/php-cs-fixer": "^3.0", "kylekatarnls/multi-tester": "^2.0", + "ondrejmirtes/better-reflection": "*", "phpmd/phpmd": "^2.9", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12.54 || ^1.0", - "phpunit/php-file-iterator": "^2.0.5", - "phpunit/phpunit": "^7.5.20 || ^8.5.23", + "phpstan/phpstan": "^0.12.99 || ^1.7.14", + "phpunit/php-file-iterator": "^2.0.5 || ^3.0.6", + "phpunit/phpunit": "^7.5.20 || ^8.5.26 || ^9.5.20", "squizlabs/php_codesniffer": "^3.4" }, "bin": [ @@ -3014,15 +2978,19 @@ }, "funding": [ { - "url": "https://opencollective.com/Carbon", - "type": "open_collective" + "url": "https://github.com/sponsors/kylekatarnls", + "type": "github" }, { - "url": "https://tidelift.com/funding/github/packagist/nesbot/carbon", + "url": "https://opencollective.com/Carbon#sponsor", + "type": "opencollective" + }, + { + "url": "https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=readme", "type": "tidelift" } ], - "time": "2022-04-25T19:31:17+00:00" + "time": "2022-09-02T07:48:13+00:00" }, { "name": "nette/schema", @@ -3088,20 +3056,20 @@ }, { "name": "nette/utils", - "version": "v3.2.7", + "version": "v3.2.8", "source": { "type": "git", "url": "https://github.com/nette/utils.git", - "reference": "0af4e3de4df9f1543534beab255ccf459e7a2c99" + "reference": "02a54c4c872b99e4ec05c4aec54b5a06eb0f6368" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/0af4e3de4df9f1543534beab255ccf459e7a2c99", - "reference": "0af4e3de4df9f1543534beab255ccf459e7a2c99", + "url": "https://api.github.com/repos/nette/utils/zipball/02a54c4c872b99e4ec05c4aec54b5a06eb0f6368", + "reference": "02a54c4c872b99e4ec05c4aec54b5a06eb0f6368", "shasum": "" }, "require": { - "php": ">=7.2 <8.2" + "php": ">=7.2 <8.3" }, "conflict": { "nette/di": "<3.0.6" @@ -3167,22 +3135,22 @@ ], "support": { "issues": "https://github.com/nette/utils/issues", - "source": "https://github.com/nette/utils/tree/v3.2.7" + "source": "https://github.com/nette/utils/tree/v3.2.8" }, - "time": "2022-01-24T11:29:14+00:00" + "time": "2022-09-12T23:36:20+00:00" }, { "name": "nikic/php-parser", - "version": "v4.13.2", + "version": "v4.15.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077" + "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", + "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", "shasum": "" }, "require": { @@ -3223,43 +3191,55 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.1" }, - "time": "2021-11-30T19:35:32+00:00" + "time": "2022-09-04T07:30:47+00:00" }, { - "name": "opis/closure", - "version": "3.6.3", + "name": "nunomaduro/termwind", + "version": "v1.14.0", "source": { "type": "git", - "url": "https://github.com/opis/closure.git", - "reference": "3d81e4309d2a927abbe66df935f4bb60082805ad" + "url": "https://github.com/nunomaduro/termwind.git", + "reference": "10065367baccf13b6e30f5e9246fa4f63a79eb1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opis/closure/zipball/3d81e4309d2a927abbe66df935f4bb60082805ad", - "reference": "3d81e4309d2a927abbe66df935f4bb60082805ad", + "url": "https://api.github.com/repos/nunomaduro/termwind/zipball/10065367baccf13b6e30f5e9246fa4f63a79eb1d", + "reference": "10065367baccf13b6e30f5e9246fa4f63a79eb1d", "shasum": "" }, "require": { - "php": "^5.4 || ^7.0 || ^8.0" + "ext-mbstring": "*", + "php": "^8.0", + "symfony/console": "^5.3.0|^6.0.0" }, "require-dev": { - "jeremeamia/superclosure": "^2.0", - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + "ergebnis/phpstan-rules": "^1.0.", + "illuminate/console": "^8.0|^9.0", + "illuminate/support": "^8.0|^9.0", + "laravel/pint": "^1.0.0", + "pestphp/pest": "^1.21.0", + "pestphp/pest-plugin-mock": "^1.0", + "phpstan/phpstan": "^1.4.6", + "phpstan/phpstan-strict-rules": "^1.1.0", + "symfony/var-dumper": "^5.2.7|^6.0.0", + "thecodingmachine/phpstan-strict-rules": "^1.0.0" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "3.6.x-dev" + "laravel": { + "providers": [ + "Termwind\\Laravel\\TermwindServiceProvider" + ] } }, "autoload": { "files": [ - "functions.php" + "src/Functions.php" ], "psr-4": { - "Opis\\Closure\\": "src/" + "Termwind\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -3268,42 +3248,51 @@ ], "authors": [ { - "name": "Marius Sarca", - "email": "marius.sarca@gmail.com" - }, - { - "name": "Sorin Sarca", - "email": "sarca_sorin@hotmail.com" + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" } ], - "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.", - "homepage": "https://opis.io/closure", + "description": "Its like Tailwind CSS, but for the console.", "keywords": [ - "anonymous functions", - "closure", - "function", - "serializable", - "serialization", - "serialize" + "cli", + "console", + "css", + "package", + "php", + "style" ], "support": { - "issues": "https://github.com/opis/closure/issues", - "source": "https://github.com/opis/closure/tree/3.6.3" + "issues": "https://github.com/nunomaduro/termwind/issues", + "source": "https://github.com/nunomaduro/termwind/tree/v1.14.0" }, - "time": "2022-01-27T09:35:39+00:00" + "funding": [ + { + "url": "https://www.paypal.com/paypalme/enunomaduro", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + }, + { + "url": "https://github.com/xiCO2k", + "type": "github" + } + ], + "time": "2022-08-01T11:03:24+00:00" }, { "name": "paragonie/constant_time_encoding", - "version": "v2.5.0", + "version": "v2.6.3", "source": { "type": "git", "url": "https://github.com/paragonie/constant_time_encoding.git", - "reference": "9229e15f2e6ba772f0c55dd6986c563b937170a8" + "reference": "58c3f47f650c94ec05a151692652a868995d2938" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/9229e15f2e6ba772f0c55dd6986c563b937170a8", - "reference": "9229e15f2e6ba772f0c55dd6986c563b937170a8", + "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/58c3f47f650c94ec05a151692652a868995d2938", + "reference": "58c3f47f650c94ec05a151692652a868995d2938", "shasum": "" }, "require": { @@ -3357,7 +3346,7 @@ "issues": "https://github.com/paragonie/constant_time_encoding/issues", "source": "https://github.com/paragonie/constant_time_encoding" }, - "time": "2022-01-17T05:32:27+00:00" + "time": "2022-06-14T06:56:20+00:00" }, { "name": "paragonie/random_compat", @@ -3411,29 +3400,33 @@ }, { "name": "phpoption/phpoption", - "version": "1.8.1", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-option.git", - "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15" + "reference": "dc5ff11e274a90cc1c743f66c9ad700ce50db9ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", - "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/dc5ff11e274a90cc1c743f66c9ad700ce50db9ab", + "reference": "dc5ff11e274a90cc1c743f66c9ad700ce50db9ab", "shasum": "" }, "require": { - "php": "^7.0 || ^8.0" + "php": "^7.2.5 || ^8.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", - "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8" + "bamarni/composer-bin-plugin": "^1.8", + "phpunit/phpunit": "^8.5.28 || ^9.5.21" }, "type": "library", "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": true + }, "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -3466,7 +3459,7 @@ ], "support": { "issues": "https://github.com/schmittjoh/php-option/issues", - "source": "https://github.com/schmittjoh/php-option/tree/1.8.1" + "source": "https://github.com/schmittjoh/php-option/tree/1.9.0" }, "funding": [ { @@ -3478,20 +3471,20 @@ "type": "tidelift" } ], - "time": "2021-12-04T23:24:31+00:00" + "time": "2022-07-30T15:51:26+00:00" }, { "name": "phpseclib/phpseclib", - "version": "3.0.14", + "version": "3.0.16", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "2f0b7af658cbea265cbb4a791d6c29a6613f98ef" + "reference": "7181378909ed8890be4db53d289faac5b77f8b05" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/2f0b7af658cbea265cbb4a791d6c29a6613f98ef", - "reference": "2f0b7af658cbea265cbb4a791d6c29a6613f98ef", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/7181378909ed8890be4db53d289faac5b77f8b05", + "reference": "7181378909ed8890be4db53d289faac5b77f8b05", "shasum": "" }, "require": { @@ -3503,6 +3496,7 @@ "phpunit/phpunit": "*" }, "suggest": { + "ext-dom": "Install the DOM extension to load XML formatted public keys.", "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.", "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", @@ -3571,7 +3565,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.14" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.16" }, "funding": [ { @@ -3587,7 +3581,7 @@ "type": "tidelift" } ], - "time": "2022-04-04T05:15:45+00:00" + "time": "2022-09-05T18:03:08+00:00" }, { "name": "pragmarx/google2fa", @@ -3651,29 +3645,34 @@ }, { "name": "predis/predis", - "version": "v1.1.10", + "version": "v2.0.2", "source": { "type": "git", "url": "https://github.com/predis/predis.git", - "reference": "a2fb02d738bedadcffdbb07efa3a5e7bd57f8d6e" + "reference": "8b5fa928560b48a054fb1fd485fc65f2d8aa9e5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/predis/predis/zipball/a2fb02d738bedadcffdbb07efa3a5e7bd57f8d6e", - "reference": "a2fb02d738bedadcffdbb07efa3a5e7bd57f8d6e", + "url": "https://api.github.com/repos/predis/predis/zipball/8b5fa928560b48a054fb1fd485fc65f2d8aa9e5c", + "reference": "8b5fa928560b48a054fb1fd485fc65f2d8aa9e5c", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": "^7.2 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^8.0 || ~9.4.4" }, "suggest": { "ext-curl": "Allows access to Webdis when paired with phpiredis", "ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol" }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.0-dev" + } + }, "autoload": { "psr-4": { "Predis\\": "src/" @@ -3696,7 +3695,7 @@ "role": "Maintainer" } ], - "description": "Flexible and feature-complete Redis client for PHP and HHVM", + "description": "A flexible and feature-complete Redis client for PHP.", "homepage": "http://github.com/predis/predis", "keywords": [ "nosql", @@ -3705,7 +3704,7 @@ ], "support": { "issues": "https://github.com/predis/predis/issues", - "source": "https://github.com/predis/predis/tree/v1.1.10" + "source": "https://github.com/predis/predis/tree/v2.0.2" }, "funding": [ { @@ -3713,27 +3712,26 @@ "type": "github" } ], - "time": "2022-01-05T17:46:08+00:00" + "time": "2022-09-06T14:34:14+00:00" }, { "name": "prologue/alerts", - "version": "0.4.8", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/prologuephp/alerts.git", - "reference": "a6412e318c0171526bc8b25ef597f2cc61f5b800" + "reference": "b2880e28814b8dba8768e60e00511627381efe14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/prologuephp/alerts/zipball/a6412e318c0171526bc8b25ef597f2cc61f5b800", - "reference": "a6412e318c0171526bc8b25ef597f2cc61f5b800", + "url": "https://api.github.com/repos/prologuephp/alerts/zipball/b2880e28814b8dba8768e60e00511627381efe14", + "reference": "b2880e28814b8dba8768e60e00511627381efe14", "shasum": "" }, "require": { - "illuminate/config": "~5|~6|~7|~8", - "illuminate/session": "~5|~6|~7|~8", - "illuminate/support": "~5|~6|~7|~8", - "php": ">=5.4.0" + "illuminate/config": "~9", + "illuminate/session": "~9", + "illuminate/support": "~9" }, "require-dev": { "mockery/mockery": "~0.9", @@ -3781,26 +3779,26 @@ ], "support": { "issues": "https://github.com/prologuephp/alerts/issues", - "source": "https://github.com/prologuephp/alerts/tree/master" + "source": "https://github.com/prologuephp/alerts/tree/1.0.0" }, - "time": "2020-09-08T14:24:39+00:00" + "time": "2022-01-19T09:28:45+00:00" }, { "name": "psr/cache", - "version": "1.0.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/cache.git", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { @@ -3820,7 +3818,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for caching libraries", @@ -3830,28 +3828,33 @@ "psr-6" ], "support": { - "source": "https://github.com/php-fig/cache/tree/master" + "source": "https://github.com/php-fig/cache/tree/3.0.0" }, - "time": "2016-08-06T20:24:11+00:00" + "time": "2021-02-03T23:26:27+00:00" }, { "name": "psr/container", - "version": "1.1.2", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { "php": ">=7.4.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -3878,9 +3881,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.2" + "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2021-11-05T16:50:12+00:00" + "time": "2021-11-05T16:47:00+00:00" }, { "name": "psr/event-dispatcher", @@ -4094,30 +4097,30 @@ }, { "name": "psr/log", - "version": "1.1.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "3.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Log\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -4138,31 +4141,31 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" + "source": "https://github.com/php-fig/log/tree/3.0.0" }, - "time": "2021-05-03T11:20:27+00:00" + "time": "2021-07-14T16:46:02+00:00" }, { "name": "psr/simple-cache", - "version": "1.0.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/simple-cache.git", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" + "reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/764e0b3939f5ca87cb904f570ef9be2d78a07865", + "reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -4177,7 +4180,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interfaces for simple caching", @@ -4189,22 +4192,22 @@ "simple-cache" ], "support": { - "source": "https://github.com/php-fig/simple-cache/tree/master" + "source": "https://github.com/php-fig/simple-cache/tree/3.0.0" }, - "time": "2017-10-23T01:57:42+00:00" + "time": "2021-10-29T13:26:27+00:00" }, { "name": "psy/psysh", - "version": "v0.11.5", + "version": "v0.11.8", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "c23686f9c48ca202710dbb967df8385a952a2daf" + "reference": "f455acf3645262ae389b10e9beba0c358aa6994e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/c23686f9c48ca202710dbb967df8385a952a2daf", - "reference": "c23686f9c48ca202710dbb967df8385a952a2daf", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/f455acf3645262ae389b10e9beba0c358aa6994e", + "reference": "f455acf3645262ae389b10e9beba0c358aa6994e", "shasum": "" }, "require": { @@ -4265,9 +4268,9 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.11.5" + "source": "https://github.com/bobthecow/psysh/tree/v0.11.8" }, - "time": "2022-05-27T18:03:49+00:00" + "time": "2022-07-28T14:25:11+00:00" }, { "name": "ralouphie/getallheaders", @@ -4394,25 +4397,24 @@ }, { "name": "ramsey/uuid", - "version": "4.2.3", + "version": "4.5.1", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df" + "reference": "a161a26d917604dc6d3aa25100fddf2556e9f35d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df", - "reference": "fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/a161a26d917604dc6d3aa25100fddf2556e9f35d", + "reference": "a161a26d917604dc6d3aa25100fddf2556e9f35d", "shasum": "" }, "require": { - "brick/math": "^0.8 || ^0.9", + "brick/math": "^0.8.8 || ^0.9 || ^0.10", + "ext-ctype": "*", "ext-json": "*", - "php": "^7.2 || ^8.0", - "ramsey/collection": "^1.0", - "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-php80": "^1.14" + "php": "^8.0", + "ramsey/collection": "^1.0" }, "replace": { "rhumsaa/uuid": "self.version" @@ -4424,18 +4426,18 @@ "doctrine/annotations": "^1.8", "ergebnis/composer-normalize": "^2.15", "mockery/mockery": "^1.3", - "moontoast/math": "^1.1", "paragonie/random-lib": "^2", "php-mock/php-mock": "^2.2", "php-mock/php-mock-mockery": "^1.3", "php-parallel-lint/php-parallel-lint": "^1.1", "phpbench/phpbench": "^1.0", - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-mockery": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-mockery": "^1.1", + "phpstan/phpstan-phpunit": "^1.1", "phpunit/phpunit": "^8.5 || ^9", - "slevomat/coding-standard": "^7.0", + "ramsey/composer-repl": "^1.4", + "slevomat/coding-standard": "^8.4", "squizlabs/php_codesniffer": "^3.5", "vimeo/psalm": "^4.9" }, @@ -4449,9 +4451,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "4.x-dev" - }, "captainhook": { "force-install": true } @@ -4476,7 +4475,7 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.2.3" + "source": "https://github.com/ramsey/uuid/tree/4.5.1" }, "funding": [ { @@ -4488,7 +4487,7 @@ "type": "tidelift" } ], - "time": "2021-09-25T23:10:38+00:00" + "time": "2022-09-16T03:22:46+00:00" }, { "name": "s1lentium/iptools", @@ -4608,27 +4607,28 @@ }, { "name": "spatie/laravel-fractal", - "version": "5.8.1", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/spatie/laravel-fractal.git", - "reference": "be3ccd54e26742cd05b3637fb732fd9addfa28df" + "reference": "1e6b8114389fe8e55eec3a841db02c404458f869" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-fractal/zipball/be3ccd54e26742cd05b3637fb732fd9addfa28df", - "reference": "be3ccd54e26742cd05b3637fb732fd9addfa28df", + "url": "https://api.github.com/repos/spatie/laravel-fractal/zipball/1e6b8114389fe8e55eec3a841db02c404458f869", + "reference": "1e6b8114389fe8e55eec3a841db02c404458f869", "shasum": "" }, "require": { - "illuminate/contracts": "^7.0|^8.0", - "illuminate/support": "^7.0|^8.0", - "php": "^7.2|^8.0", - "spatie/fractalistic": "^2.5" + "illuminate/contracts": "^8.0|^9.0", + "illuminate/support": "^8.0|^9.0", + "php": "^8.0", + "spatie/fractalistic": "^2.5", + "spatie/laravel-package-tools": "^1.11" }, "require-dev": { "ext-json": "*", - "orchestra/testbench": "^5.0|^6.0" + "orchestra/testbench": "^7.0" }, "type": "library", "extra": { @@ -4637,7 +4637,7 @@ "Spatie\\Fractal\\FractalServiceProvider" ], "aliases": { - "Fractal": "Spatie\\Fractal\\FractalFacade" + "Fractal": "Spatie\\Fractal\\Facades\\Fractal" } } }, @@ -4674,7 +4674,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-fractal/issues", - "source": "https://github.com/spatie/laravel-fractal/tree/5.8.1" + "source": "https://github.com/spatie/laravel-fractal/tree/6.0.2" }, "funding": [ { @@ -4682,34 +4682,94 @@ "type": "custom" } ], - "time": "2020-11-12T18:46:53+00:00" + "time": "2022-04-04T07:53:13+00:00" }, { - "name": "spatie/laravel-query-builder", - "version": "3.6.2", + "name": "spatie/laravel-package-tools", + "version": "1.13.5", "source": { "type": "git", - "url": "https://github.com/spatie/laravel-query-builder.git", - "reference": "3768381e9f2f80b01f0088eca49f061c269e0e8b" + "url": "https://github.com/spatie/laravel-package-tools.git", + "reference": "163ee3bc6c0a987535d8a99722a7dbcc5471a140" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-query-builder/zipball/3768381e9f2f80b01f0088eca49f061c269e0e8b", - "reference": "3768381e9f2f80b01f0088eca49f061c269e0e8b", + "url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/163ee3bc6c0a987535d8a99722a7dbcc5471a140", + "reference": "163ee3bc6c0a987535d8a99722a7dbcc5471a140", "shasum": "" }, "require": { - "illuminate/database": "^6.20.13|^7.30.4|^8.22.2", - "illuminate/http": "^6.20.13|^7.30.4|^8.22.2", - "illuminate/support": "^6.20.13|^7.30.4|^8.22.2", - "php": "^7.3|^8.0" + "illuminate/contracts": "^9.28", + "php": "^8.0" + }, + "require-dev": { + "mockery/mockery": "^1.5", + "orchestra/testbench": "^7.7", + "phpunit/phpunit": "^9.5.24", + "spatie/test-time": "^1.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\LaravelPackageTools\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "role": "Developer" + } + ], + "description": "Tools for creating Laravel packages", + "homepage": "https://github.com/spatie/laravel-package-tools", + "keywords": [ + "laravel-package-tools", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/laravel-package-tools/issues", + "source": "https://github.com/spatie/laravel-package-tools/tree/1.13.5" + }, + "funding": [ + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2022-09-07T14:31:31+00:00" + }, + { + "name": "spatie/laravel-query-builder", + "version": "5.0.3", + "source": { + "type": "git", + "url": "https://github.com/spatie/laravel-query-builder.git", + "reference": "2243e3d60fc184ef20ad2b19765bc7006fa9dbfc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/laravel-query-builder/zipball/2243e3d60fc184ef20ad2b19765bc7006fa9dbfc", + "reference": "2243e3d60fc184ef20ad2b19765bc7006fa9dbfc", + "shasum": "" + }, + "require": { + "illuminate/database": "^9.0", + "illuminate/http": "^9.0", + "illuminate/support": "^9.0", + "php": "^8.0", + "spatie/laravel-package-tools": "^1.11" }, "require-dev": { "ext-json": "*", - "laravel/legacy-factories": "^1.0.4", "mockery/mockery": "^1.4", - "orchestra/testbench": "^4.9|^5.8|^6.3", - "phpunit/phpunit": "^9.0" + "orchestra/testbench": "^7.0", + "pestphp/pest": "^1.20", + "spatie/laravel-ray": "^1.28" }, "type": "library", "extra": { @@ -4721,7 +4781,8 @@ }, "autoload": { "psr-4": { - "Spatie\\QueryBuilder\\": "src" + "Spatie\\QueryBuilder\\": "src", + "Spatie\\QueryBuilder\\Database\\Factories\\": "database/factories" } }, "notification-url": "https://packagist.org/downloads/", @@ -4752,29 +4813,28 @@ "type": "custom" } ], - "time": "2022-01-09T15:39:13+00:00" + "time": "2022-07-29T14:19:59+00:00" }, { "name": "staudenmeir/belongs-to-through", - "version": "v2.11.2", + "version": "v2.12.1", "source": { "type": "git", "url": "https://github.com/staudenmeir/belongs-to-through.git", - "reference": "32d03527163a3edd7f88e4b74b03575e4bdb5db7" + "reference": "8316d274db603f63b16bb1c67379b0fa73209d98" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/staudenmeir/belongs-to-through/zipball/32d03527163a3edd7f88e4b74b03575e4bdb5db7", - "reference": "32d03527163a3edd7f88e4b74b03575e4bdb5db7", + "url": "https://api.github.com/repos/staudenmeir/belongs-to-through/zipball/8316d274db603f63b16bb1c67379b0fa73209d98", + "reference": "8316d274db603f63b16bb1c67379b0fa73209d98", "shasum": "" }, "require": { - "illuminate/database": "^8.0", - "php": "^7.3|^8.0" + "illuminate/database": "^9.0", + "php": "^8.0.2" }, "require-dev": { - "phpunit/phpunit": "^9.3", - "scrutinizer/ocular": "^1.8" + "phpunit/phpunit": "^9.5" }, "type": "library", "autoload": { @@ -4799,7 +4859,7 @@ "description": "Laravel Eloquent BelongsToThrough relationships", "support": { "issues": "https://github.com/staudenmeir/belongs-to-through/issues", - "source": "https://github.com/staudenmeir/belongs-to-through/tree/v2.11.2" + "source": "https://github.com/staudenmeir/belongs-to-through/tree/v2.12.1" }, "funding": [ { @@ -4807,46 +4867,30 @@ "type": "custom" } ], - "time": "2021-08-19T18:23:06+00:00" + "time": "2022-03-10T21:14:19+00:00" }, { - "name": "swiftmailer/swiftmailer", - "version": "v6.3.0", + "name": "stella-maris/clock", + "version": "0.1.6", "source": { "type": "git", - "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "8a5d5072dca8f48460fce2f4131fcc495eec654c" + "url": "https://github.com/stella-maris-solutions/clock.git", + "reference": "a94228dac03c9a8411198ce8c8dacbbe99c930c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/8a5d5072dca8f48460fce2f4131fcc495eec654c", - "reference": "8a5d5072dca8f48460fce2f4131fcc495eec654c", + "url": "https://api.github.com/repos/stella-maris-solutions/clock/zipball/a94228dac03c9a8411198ce8c8dacbbe99c930c3", + "reference": "a94228dac03c9a8411198ce8c8dacbbe99c930c3", "shasum": "" }, "require": { - "egulias/email-validator": "^2.0|^3.1", - "php": ">=7.0.0", - "symfony/polyfill-iconv": "^1.0", - "symfony/polyfill-intl-idn": "^1.10", - "symfony/polyfill-mbstring": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^1.0", - "symfony/phpunit-bridge": "^4.4|^5.4" - }, - "suggest": { - "ext-intl": "Needed to support internationalized email addresses" + "php": "^7.0|^8.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.2-dev" - } - }, "autoload": { - "files": [ - "lib/swift_required.php" - ] + "psr-4": { + "StellaMaris\\Clock\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4854,79 +4898,62 @@ ], "authors": [ { - "name": "Chris Corbyn" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Andreas Heigl", + "role": "Maintainer" } ], - "description": "Swiftmailer, free feature-rich PHP mailer", - "homepage": "https://swiftmailer.symfony.com", + "description": "A pre-release of the proposed PSR-20 Clock-Interface", + "homepage": "https://gitlab.com/stella-maris/clock", "keywords": [ - "email", - "mail", - "mailer" + "clock", + "datetime", + "point in time", + "psr20" ], "support": { - "issues": "https://github.com/swiftmailer/swiftmailer/issues", - "source": "https://github.com/swiftmailer/swiftmailer/tree/v6.3.0" + "issues": "https://github.com/stella-maris-solutions/clock/issues", + "source": "https://github.com/stella-maris-solutions/clock/tree/0.1.6" }, - "funding": [ - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/swiftmailer/swiftmailer", - "type": "tidelift" - } - ], - "abandoned": "symfony/mailer", - "time": "2021-10-18T15:26:12+00:00" + "time": "2022-09-27T15:03:11+00:00" }, { "name": "symfony/console", - "version": "v5.4.9", + "version": "v6.0.13", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "829d5d1bf60b2efeb0887b7436873becc71a45eb" + "reference": "8f14753b865651c2aad107ef97475740a9b0730f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/829d5d1bf60b2efeb0887b7436873becc71a45eb", - "reference": "829d5d1bf60b2efeb0887b7436873becc71a45eb", + "url": "https://api.github.com/repos/symfony/console/zipball/8f14753b865651c2aad107ef97475740a9b0730f", + "reference": "8f14753b865651c2aad107ef97475740a9b0730f", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", + "php": ">=8.0.2", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.16", "symfony/service-contracts": "^1.1|^2|^3", - "symfony/string": "^5.1|^6.0" + "symfony/string": "^5.4|^6.0" }, "conflict": { - "psr/log": ">=3", - "symfony/dependency-injection": "<4.4", - "symfony/dotenv": "<5.1", - "symfony/event-dispatcher": "<4.4", - "symfony/lock": "<4.4", - "symfony/process": "<4.4" + "symfony/dependency-injection": "<5.4", + "symfony/dotenv": "<5.4", + "symfony/event-dispatcher": "<5.4", + "symfony/lock": "<5.4", + "symfony/process": "<5.4" }, "provide": { - "psr/log-implementation": "1.0|2.0" + "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { - "psr/log": "^1|^2", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/event-dispatcher": "^4.4|^5.0|^6.0", - "symfony/lock": "^4.4|^5.0|^6.0", - "symfony/process": "^4.4|^5.0|^6.0", - "symfony/var-dumper": "^4.4|^5.0|^6.0" + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/lock": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/var-dumper": "^5.4|^6.0" }, "suggest": { "psr/log": "For using the console logger", @@ -4966,7 +4993,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.9" + "source": "https://github.com/symfony/console/tree/v6.0.13" }, "funding": [ { @@ -4982,25 +5009,24 @@ "type": "tidelift" } ], - "time": "2022-05-18T06:17:34+00:00" + "time": "2022-09-03T14:23:25+00:00" }, { "name": "symfony/css-selector", - "version": "v5.4.3", + "version": "v6.0.11", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "b0a190285cd95cb019237851205b8140ef6e368e" + "reference": "ab2746acddc4f03a7234c8441822ac5d5c63efe9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/b0a190285cd95cb019237851205b8140ef6e368e", - "reference": "b0a190285cd95cb019237851205b8140ef6e368e", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/ab2746acddc4f03a7234c8441822ac5d5c63efe9", + "reference": "ab2746acddc4f03a7234c8441822ac5d5c63efe9", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.0.2" }, "type": "library", "autoload": { @@ -5032,7 +5058,7 @@ "description": "Converts CSS selectors to XPath expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/css-selector/tree/v5.4.3" + "source": "https://github.com/symfony/css-selector/tree/v6.0.11" }, "funding": [ { @@ -5048,29 +5074,29 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2022-06-27T17:10:44+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.1", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -5099,7 +5125,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.2" }, "funding": [ { @@ -5115,31 +5141,31 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2022-01-02T09:55:41+00:00" }, { "name": "symfony/error-handler", - "version": "v5.4.9", + "version": "v6.0.11", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "c116cda1f51c678782768dce89a45f13c949455d" + "reference": "cb302377e1b862540436f22be9ff07079a5836ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/c116cda1f51c678782768dce89a45f13c949455d", - "reference": "c116cda1f51c678782768dce89a45f13c949455d", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/cb302377e1b862540436f22be9ff07079a5836ae", + "reference": "cb302377e1b862540436f22be9ff07079a5836ae", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "psr/log": "^1|^2|^3", - "symfony/var-dumper": "^4.4|^5.0|^6.0" + "symfony/var-dumper": "^5.4|^6.0" }, "require-dev": { "symfony/deprecation-contracts": "^2.1|^3", - "symfony/http-kernel": "^4.4|^5.0|^6.0", - "symfony/serializer": "^4.4|^5.0|^6.0" + "symfony/http-kernel": "^5.4|^6.0", + "symfony/serializer": "^5.4|^6.0" }, "bin": [ "Resources/bin/patch-type-declarations" @@ -5170,7 +5196,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v5.4.9" + "source": "https://github.com/symfony/error-handler/tree/v6.0.11" }, "funding": [ { @@ -5186,44 +5212,42 @@ "type": "tidelift" } ], - "time": "2022-05-21T13:57:48+00:00" + "time": "2022-07-29T07:39:48+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.4.9", + "version": "v6.0.9", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc" + "reference": "5c85b58422865d42c6eb46f7693339056db098a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc", - "reference": "8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/5c85b58422865d42c6eb46f7693339056db098a8", + "reference": "5c85b58422865d42c6eb46f7693339056db098a8", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/event-dispatcher-contracts": "^2|^3", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.0.2", + "symfony/event-dispatcher-contracts": "^2|^3" }, "conflict": { - "symfony/dependency-injection": "<4.4" + "symfony/dependency-injection": "<5.4" }, "provide": { "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "2.0" + "symfony/event-dispatcher-implementation": "2.0|3.0" }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/error-handler": "^4.4|^5.0|^6.0", - "symfony/expression-language": "^4.4|^5.0|^6.0", - "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/error-handler": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/http-foundation": "^5.4|^6.0", "symfony/service-contracts": "^1.1|^2|^3", - "symfony/stopwatch": "^4.4|^5.0|^6.0" + "symfony/stopwatch": "^5.4|^6.0" }, "suggest": { "symfony/dependency-injection": "", @@ -5255,7 +5279,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.9" + "source": "https://github.com/symfony/event-dispatcher/tree/v6.0.9" }, "funding": [ { @@ -5271,24 +5295,24 @@ "type": "tidelift" } ], - "time": "2022-05-05T16:45:39+00:00" + "time": "2022-05-05T16:45:52+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v2.5.1", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1" + "reference": "7bc61cc2db649b4637d331240c5346dcc7708051" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/f98b54df6ad059855739db6fcbc2d36995283fe1", - "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/7bc61cc2db649b4637d331240c5346dcc7708051", + "reference": "7bc61cc2db649b4637d331240c5346dcc7708051", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "psr/event-dispatcher": "^1" }, "suggest": { @@ -5297,7 +5321,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -5334,7 +5358,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.1" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.0.2" }, "funding": [ { @@ -5350,26 +5374,24 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2022-01-02T09:55:41+00:00" }, { "name": "symfony/finder", - "version": "v5.4.8", + "version": "v6.0.11", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "9b630f3427f3ebe7cd346c277a1408b00249dad9" + "reference": "09cb683ba5720385ea6966e5e06be2a34f2568b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/9b630f3427f3ebe7cd346c277a1408b00249dad9", - "reference": "9b630f3427f3ebe7cd346c277a1408b00249dad9", + "url": "https://api.github.com/repos/symfony/finder/zipball/09cb683ba5720385ea6966e5e06be2a34f2568b1", + "reference": "09cb683ba5720385ea6966e5e06be2a34f2568b1", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.0.2" }, "type": "library", "autoload": { @@ -5397,7 +5419,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.8" + "source": "https://github.com/symfony/finder/tree/v6.0.11" }, "funding": [ { @@ -5413,33 +5435,197 @@ "type": "tidelift" } ], - "time": "2022-04-15T08:07:45+00:00" + "time": "2022-07-29T07:39:48+00:00" }, { - "name": "symfony/http-foundation", - "version": "v5.4.9", + "name": "symfony/http-client", + "version": "v6.0.13", "source": { "type": "git", - "url": "https://github.com/symfony/http-foundation.git", - "reference": "6b0d0e4aca38d57605dcd11e2416994b38774522" + "url": "https://github.com/symfony/http-client.git", + "reference": "2067d3c398d47292f3b413fcc4f56385c1afd0d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/6b0d0e4aca38d57605dcd11e2416994b38774522", - "reference": "6b0d0e4aca38d57605dcd11e2416994b38774522", + "url": "https://api.github.com/repos/symfony/http-client/zipball/2067d3c398d47292f3b413fcc4f56385c1afd0d4", + "reference": "2067d3c398d47292f3b413fcc4f56385c1afd0d4", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", + "psr/log": "^1|^2|^3", + "symfony/http-client-contracts": "^3", + "symfony/service-contracts": "^1.0|^2|^3" + }, + "provide": { + "php-http/async-client-implementation": "*", + "php-http/client-implementation": "*", + "psr/http-client-implementation": "1.0", + "symfony/http-client-implementation": "3.0" + }, + "require-dev": { + "amphp/amp": "^2.5", + "amphp/http-client": "^4.2.1", + "amphp/http-tunnel": "^1.0", + "amphp/socket": "^1.1", + "guzzlehttp/promises": "^1.4", + "nyholm/psr7": "^1.0", + "php-http/httplug": "^1.0|^2.0", + "psr/http-client": "^1.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/http-kernel": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/stopwatch": "^5.4|^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpClient\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "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": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/http-client/tree/v6.0.13" + }, + "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": "2022-09-09T09:33:56+00:00" + }, + { + "name": "symfony/http-client-contracts", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-client-contracts.git", + "reference": "4184b9b63af1edaf35b6a7974c6f1f9f33294129" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/4184b9b63af1edaf35b6a7974c6f1f9f33294129", + "reference": "4184b9b63af1edaf35b6a7974c6f1f9f33294129", + "shasum": "" + }, + "require": { + "php": ">=8.0.2" + }, + "suggest": { + "symfony/http-client-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-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/v3.0.2" + }, + "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": "2022-04-12T16:11:42+00:00" + }, + { + "name": "symfony/http-foundation", + "version": "v6.0.13", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "294208f37a73b7ae64b4297d936e890d5b514902" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/294208f37a73b7ae64b4297d936e890d5b514902", + "reference": "294208f37a73b7ae64b4297d936e890d5b514902", + "shasum": "" + }, + "require": { + "php": ">=8.0.2", "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-mbstring": "~1.1", - "symfony/polyfill-php80": "^1.16" + "symfony/polyfill-mbstring": "~1.1" }, "require-dev": { "predis/predis": "~1.0", - "symfony/cache": "^4.4|^5.0|^6.0", - "symfony/expression-language": "^4.4|^5.0|^6.0", - "symfony/mime": "^4.4|^5.0|^6.0" + "symfony/cache": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/http-kernel": "^5.4.12|^6.0.12|^6.1.4", + "symfony/mime": "^5.4|^6.0", + "symfony/rate-limiter": "^5.2|^6.0" }, "suggest": { "symfony/mime": "To use the file extension guesser" @@ -5470,7 +5656,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v5.4.9" + "source": "https://github.com/symfony/http-foundation/tree/v6.0.13" }, "funding": [ { @@ -5486,67 +5672,64 @@ "type": "tidelift" } ], - "time": "2022-05-17T15:07:29+00:00" + "time": "2022-09-17T07:33:45+00:00" }, { "name": "symfony/http-kernel", - "version": "v5.4.9", + "version": "v6.0.13", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "34b121ad3dc761f35fe1346d2f15618f8cbf77f8" + "reference": "5939a039103580d8d86a4c80e245258ad50c91b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/34b121ad3dc761f35fe1346d2f15618f8cbf77f8", - "reference": "34b121ad3dc761f35fe1346d2f15618f8cbf77f8", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/5939a039103580d8d86a4c80e245258ad50c91b2", + "reference": "5939a039103580d8d86a4c80e245258ad50c91b2", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/log": "^1|^2", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/error-handler": "^4.4|^5.0|^6.0", - "symfony/event-dispatcher": "^5.0|^6.0", - "symfony/http-foundation": "^5.3.7|^6.0", - "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.0.2", + "psr/log": "^1|^2|^3", + "symfony/error-handler": "^5.4|^6.0", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/http-foundation": "^5.4|^6.0", + "symfony/polyfill-ctype": "^1.8" }, "conflict": { "symfony/browser-kit": "<5.4", - "symfony/cache": "<5.0", - "symfony/config": "<5.0", - "symfony/console": "<4.4", - "symfony/dependency-injection": "<5.3", - "symfony/doctrine-bridge": "<5.0", - "symfony/form": "<5.0", - "symfony/http-client": "<5.0", - "symfony/mailer": "<5.0", - "symfony/messenger": "<5.0", - "symfony/translation": "<5.0", - "symfony/twig-bridge": "<5.0", - "symfony/validator": "<5.0", + "symfony/cache": "<5.4", + "symfony/config": "<5.4", + "symfony/console": "<5.4", + "symfony/dependency-injection": "<5.4", + "symfony/doctrine-bridge": "<5.4", + "symfony/form": "<5.4", + "symfony/http-client": "<5.4", + "symfony/mailer": "<5.4", + "symfony/messenger": "<5.4", + "symfony/translation": "<5.4", + "symfony/twig-bridge": "<5.4", + "symfony/validator": "<5.4", "twig/twig": "<2.13" }, "provide": { - "psr/log-implementation": "1.0|2.0" + "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { "psr/cache": "^1.0|^2.0|^3.0", "symfony/browser-kit": "^5.4|^6.0", - "symfony/config": "^5.0|^6.0", - "symfony/console": "^4.4|^5.0|^6.0", - "symfony/css-selector": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^5.3|^6.0", - "symfony/dom-crawler": "^4.4|^5.0|^6.0", - "symfony/expression-language": "^4.4|^5.0|^6.0", - "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/config": "^5.4|^6.0", + "symfony/console": "^5.4|^6.0", + "symfony/css-selector": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/dom-crawler": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/finder": "^5.4|^6.0", "symfony/http-client-contracts": "^1.1|^2|^3", - "symfony/process": "^4.4|^5.0|^6.0", - "symfony/routing": "^4.4|^5.0|^6.0", - "symfony/stopwatch": "^4.4|^5.0|^6.0", - "symfony/translation": "^4.4|^5.0|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/routing": "^5.4|^6.0", + "symfony/stopwatch": "^5.4|^6.0", + "symfony/translation": "^5.4|^6.0", "symfony/translation-contracts": "^1.1|^2|^3", "twig/twig": "^2.13|^3.0.4" }, @@ -5582,7 +5765,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v5.4.9" + "source": "https://github.com/symfony/http-kernel/tree/v6.0.13" }, "funding": [ { @@ -5598,42 +5781,179 @@ "type": "tidelift" } ], - "time": "2022-05-27T07:09:08+00:00" + "time": "2022-09-30T08:03:37+00:00" }, { - "name": "symfony/mime", - "version": "v5.4.9", + "name": "symfony/mailer", + "version": "v6.0.13", "source": { "type": "git", - "url": "https://github.com/symfony/mime.git", - "reference": "2b3802a24e48d0cfccf885173d2aac91e73df92e" + "url": "https://github.com/symfony/mailer.git", + "reference": "6269c872ab4792e8facbf8af27a2fbee8429f217" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/2b3802a24e48d0cfccf885173d2aac91e73df92e", - "reference": "2b3802a24e48d0cfccf885173d2aac91e73df92e", + "url": "https://api.github.com/repos/symfony/mailer/zipball/6269c872ab4792e8facbf8af27a2fbee8429f217", + "reference": "6269c872ab4792e8facbf8af27a2fbee8429f217", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", + "egulias/email-validator": "^2.1.10|^3", + "php": ">=8.0.2", + "psr/event-dispatcher": "^1", + "psr/log": "^1|^2|^3", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/mime": "^5.4|^6.0", + "symfony/service-contracts": "^1.1|^2|^3" + }, + "conflict": { + "symfony/http-kernel": "<5.4" + }, + "require-dev": { + "symfony/http-client-contracts": "^1.1|^2|^3", + "symfony/messenger": "^5.4|^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Mailer\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Helps sending emails", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/mailer/tree/v6.0.13" + }, + "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": "2022-08-29T06:49:22+00:00" + }, + { + "name": "symfony/mailgun-mailer", + "version": "v6.0.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/mailgun-mailer.git", + "reference": "f0d032c26683b26f4bc26864e09b1e08fa55226e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/mailgun-mailer/zipball/f0d032c26683b26f4bc26864e09b1e08fa55226e", + "reference": "f0d032c26683b26f4bc26864e09b1e08fa55226e", + "shasum": "" + }, + "require": { + "php": ">=8.0.2", + "symfony/mailer": "^5.4|^6.0" + }, + "require-dev": { + "symfony/http-client": "^5.4|^6.0" + }, + "type": "symfony-mailer-bridge", + "autoload": { + "psr-4": { + "Symfony\\Component\\Mailer\\Bridge\\Mailgun\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Mailgun Mailer Bridge", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/mailgun-mailer/tree/v6.0.7" + }, + "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": "2022-03-24T17:11:42+00:00" + }, + { + "name": "symfony/mime", + "version": "v6.0.13", + "source": { + "type": "git", + "url": "https://github.com/symfony/mime.git", + "reference": "c1d6eba531d956c23b3127dc6ae6f5ac4a90db6c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/mime/zipball/c1d6eba531d956c23b3127dc6ae6f5ac4a90db6c", + "reference": "c1d6eba531d956c23b3127dc6ae6f5ac4a90db6c", + "shasum": "" + }, + "require": { + "php": ">=8.0.2", "symfony/polyfill-intl-idn": "^1.10", - "symfony/polyfill-mbstring": "^1.0", - "symfony/polyfill-php80": "^1.16" + "symfony/polyfill-mbstring": "^1.0" }, "conflict": { "egulias/email-validator": "~3.0.0", "phpdocumentor/reflection-docblock": "<3.2.2", "phpdocumentor/type-resolver": "<1.4.0", - "symfony/mailer": "<4.4" + "symfony/mailer": "<5.4" }, "require-dev": { "egulias/email-validator": "^2.1.10|^3.1", "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/property-access": "^4.4|^5.1|^6.0", - "symfony/property-info": "^4.4|^5.1|^6.0", - "symfony/serializer": "^5.2|^6.0" + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/property-access": "^5.4|^6.0", + "symfony/property-info": "^5.4|^6.0", + "symfony/serializer": "^5.4|^6.0" }, "type": "library", "autoload": { @@ -5665,7 +5985,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v5.4.9" + "source": "https://github.com/symfony/mime/tree/v6.0.13" }, "funding": [ { @@ -5681,20 +6001,20 @@ "type": "tidelift" } ], - "time": "2022-05-21T10:24:18+00:00" + "time": "2022-09-02T08:05:03+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "30885182c981ab175d4d034db0f6f469898070ab" + "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", - "reference": "30885182c981ab175d4d034db0f6f469898070ab", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", + "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", "shasum": "" }, "require": { @@ -5709,7 +6029,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5747,7 +6067,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0" }, "funding": [ { @@ -5763,103 +6083,20 @@ "type": "tidelift" } ], - "time": "2021-10-20T20:35:02+00:00" - }, - { - "name": "symfony/polyfill-iconv", - "version": "v1.25.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-iconv.git", - "reference": "f1aed619e28cb077fc83fac8c4c0383578356e40" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/f1aed619e28cb077fc83fac8c4c0383578356e40", - "reference": "f1aed619e28cb077fc83fac8c4c0383578356e40", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-iconv": "*" - }, - "suggest": { - "ext-iconv": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Iconv\\": "" - } - }, - "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 polyfill for the Iconv extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "iconv", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-iconv/tree/v1.25.0" - }, - "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": "2022-01-04T09:04:05+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "81b86b50cf841a64252b439e738e97f4a34e2783" + "reference": "433d05519ce6990bf3530fba6957499d327395c2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/81b86b50cf841a64252b439e738e97f4a34e2783", - "reference": "81b86b50cf841a64252b439e738e97f4a34e2783", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/433d05519ce6990bf3530fba6957499d327395c2", + "reference": "433d05519ce6990bf3530fba6957499d327395c2", "shasum": "" }, "require": { @@ -5871,7 +6108,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5911,7 +6148,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.26.0" }, "funding": [ { @@ -5927,20 +6164,20 @@ "type": "tidelift" } ], - "time": "2021-11-23T21:10:46+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "749045c69efb97c70d25d7463abba812e91f3a44" + "reference": "59a8d271f00dd0e4c2e518104cc7963f655a1aa8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/749045c69efb97c70d25d7463abba812e91f3a44", - "reference": "749045c69efb97c70d25d7463abba812e91f3a44", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/59a8d271f00dd0e4c2e518104cc7963f655a1aa8", + "reference": "59a8d271f00dd0e4c2e518104cc7963f655a1aa8", "shasum": "" }, "require": { @@ -5954,7 +6191,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5998,7 +6235,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.26.0" }, "funding": [ { @@ -6014,20 +6251,20 @@ "type": "tidelift" } ], - "time": "2021-09-14T14:02:44+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" + "reference": "219aa369ceff116e673852dce47c3a41794c14bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/219aa369ceff116e673852dce47c3a41794c14bd", + "reference": "219aa369ceff116e673852dce47c3a41794c14bd", "shasum": "" }, "require": { @@ -6039,7 +6276,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -6082,7 +6319,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.26.0" }, "funding": [ { @@ -6098,20 +6335,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" + "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", "shasum": "" }, "require": { @@ -6126,7 +6363,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -6165,7 +6402,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0" }, "funding": [ { @@ -6181,7 +6418,7 @@ "type": "tidelift" } ], - "time": "2021-11-30T18:21:41+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-php56", @@ -6253,16 +6490,16 @@ }, { "name": "symfony/polyfill-php72", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "9a142215a36a3888e30d0a9eeea9766764e96976" + "reference": "bf44a9fd41feaac72b074de600314a93e2ae78e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976", - "reference": "9a142215a36a3888e30d0a9eeea9766764e96976", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/bf44a9fd41feaac72b074de600314a93e2ae78e2", + "reference": "bf44a9fd41feaac72b074de600314a93e2ae78e2", "shasum": "" }, "require": { @@ -6271,7 +6508,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -6309,7 +6546,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.26.0" }, "funding": [ { @@ -6325,99 +6562,20 @@ "type": "tidelift" } ], - "time": "2021-05-27T09:17:38+00:00" - }, - { - "name": "symfony/polyfill-php73", - "version": "v1.25.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5", - "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "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 polyfill backporting some PHP 7.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.25.0" - }, - "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": "2021-06-05T21:20:04+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c" + "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c", - "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace", + "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace", "shasum": "" }, "require": { @@ -6426,7 +6584,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -6471,7 +6629,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0" }, "funding": [ { @@ -6487,20 +6645,20 @@ "type": "tidelift" } ], - "time": "2022-03-04T08:16:47+00:00" + "time": "2022-05-10T07:21:04+00:00" }, { "name": "symfony/polyfill-php81", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f" + "reference": "13f6d1271c663dc5ae9fb843a8f16521db7687a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", - "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/13f6d1271c663dc5ae9fb843a8f16521db7687a1", + "reference": "13f6d1271c663dc5ae9fb843a8f16521db7687a1", "shasum": "" }, "require": { @@ -6509,7 +6667,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -6550,7 +6708,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.26.0" }, "funding": [ { @@ -6566,25 +6724,171 @@ "type": "tidelift" } ], - "time": "2021-09-13T13:58:11+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { - "name": "symfony/process", - "version": "v5.4.8", + "name": "symfony/polyfill-uuid", + "version": "v1.26.0", "source": { "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "597f3fff8e3e91836bb0bd38f5718b56ddbde2f3" + "url": "https://github.com/symfony/polyfill-uuid.git", + "reference": "a41886c1c81dc075a09c71fe6db5b9d68c79de23" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/597f3fff8e3e91836bb0bd38f5718b56ddbde2f3", - "reference": "597f3fff8e3e91836bb0bd38f5718b56ddbde2f3", + "url": "https://api.github.com/repos/symfony/polyfill-uuid/zipball/a41886c1c81dc075a09c71fe6db5b9d68c79de23", + "reference": "a41886c1c81dc075a09c71fe6db5b9d68c79de23", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" + "php": ">=7.1" + }, + "provide": { + "ext-uuid": "*" + }, + "suggest": { + "ext-uuid": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.26-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Uuid\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Grégoire Pineau", + "email": "lyrixx@lyrixx.info" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for uuid functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "uuid" + ], + "support": { + "source": "https://github.com/symfony/polyfill-uuid/tree/v1.26.0" + }, + "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": "2022-05-24T11:49:31+00:00" + }, + { + "name": "symfony/postmark-mailer", + "version": "v6.0.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/postmark-mailer.git", + "reference": "8405569233efb0140e55eb6236c9e55693f058ff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/postmark-mailer/zipball/8405569233efb0140e55eb6236c9e55693f058ff", + "reference": "8405569233efb0140e55eb6236c9e55693f058ff", + "shasum": "" + }, + "require": { + "php": ">=8.0.2", + "symfony/mailer": "^5.4|^6.0" + }, + "require-dev": { + "symfony/http-client": "^5.4|^6.0" + }, + "type": "symfony-mailer-bridge", + "autoload": { + "psr-4": { + "Symfony\\Component\\Mailer\\Bridge\\Postmark\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Postmark Mailer Bridge", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/postmark-mailer/tree/v6.0.7" + }, + "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": "2022-03-24T17:11:42+00:00" + }, + { + "name": "symfony/process", + "version": "v6.0.11", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "44270a08ccb664143dede554ff1c00aaa2247a43" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/44270a08ccb664143dede554ff1c00aaa2247a43", + "reference": "44270a08ccb664143dede554ff1c00aaa2247a43", + "shasum": "" + }, + "require": { + "php": ">=8.0.2" }, "type": "library", "autoload": { @@ -6612,7 +6916,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.8" + "source": "https://github.com/symfony/process/tree/v6.0.11" }, "funding": [ { @@ -6628,41 +6932,39 @@ "type": "tidelift" } ], - "time": "2022-04-08T05:07:18+00:00" + "time": "2022-06-27T17:10:44+00:00" }, { "name": "symfony/routing", - "version": "v5.4.8", + "version": "v6.0.11", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "e07817bb6244ea33ef5ad31abc4a9288bef3f2f7" + "reference": "434b64f7d3a582ec33fcf69baaf085473e67d639" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/e07817bb6244ea33ef5ad31abc4a9288bef3f2f7", - "reference": "e07817bb6244ea33ef5ad31abc4a9288bef3f2f7", + "url": "https://api.github.com/repos/symfony/routing/zipball/434b64f7d3a582ec33fcf69baaf085473e67d639", + "reference": "434b64f7d3a582ec33fcf69baaf085473e67d639", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.0.2" }, "conflict": { "doctrine/annotations": "<1.12", - "symfony/config": "<5.3", - "symfony/dependency-injection": "<4.4", - "symfony/yaml": "<4.4" + "symfony/config": "<5.4", + "symfony/dependency-injection": "<5.4", + "symfony/yaml": "<5.4" }, "require-dev": { "doctrine/annotations": "^1.12", "psr/log": "^1|^2|^3", - "symfony/config": "^5.3|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/expression-language": "^4.4|^5.0|^6.0", - "symfony/http-foundation": "^4.4|^5.0|^6.0", - "symfony/yaml": "^4.4|^5.0|^6.0" + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/http-foundation": "^5.4|^6.0", + "symfony/yaml": "^5.4|^6.0" }, "suggest": { "symfony/config": "For using the all-in-one router or any loader", @@ -6702,7 +7004,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v5.4.8" + "source": "https://github.com/symfony/routing/tree/v6.0.11" }, "funding": [ { @@ -6718,26 +7020,25 @@ "type": "tidelift" } ], - "time": "2022-04-18T21:45:37+00:00" + "time": "2022-07-20T13:45:53+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.5.1", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c" + "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/24d9dc654b83e91aa59f9d167b131bc3b5bea24c", - "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d78d39c1599bd1188b8e26bb341da52c3c6d8a66", + "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.1", - "symfony/deprecation-contracts": "^2.1|^3" + "php": ">=8.0.2", + "psr/container": "^2.0" }, "conflict": { "ext-psr": "<1.1|>=2" @@ -6748,7 +7049,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -6785,7 +7086,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.1" + "source": "https://github.com/symfony/service-contracts/tree/v3.0.2" }, "funding": [ { @@ -6801,38 +7102,37 @@ "type": "tidelift" } ], - "time": "2022-03-13T20:07:29+00:00" + "time": "2022-05-30T19:17:58+00:00" }, { "name": "symfony/string", - "version": "v5.4.9", + "version": "v6.0.13", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "985e6a9703ef5ce32ba617c9c7d97873bb7b2a99" + "reference": "65e99fb179e7241606377e4042cd2161f3dd1c05" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/985e6a9703ef5ce32ba617c9c7d97873bb7b2a99", - "reference": "985e6a9703ef5ce32ba617c9c7d97873bb7b2a99", + "url": "https://api.github.com/repos/symfony/string/zipball/65e99fb179e7241606377e4042cd2161f3dd1c05", + "reference": "65e99fb179e7241606377e4042cd2161f3dd1c05", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "~1.15" + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": ">=3.0" + "symfony/translation-contracts": "<2.0" }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0|^6.0", - "symfony/http-client": "^4.4|^5.0|^6.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0|^6.0" + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/translation-contracts": "^2.0|^3.0", + "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", "autoload": { @@ -6871,7 +7171,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.9" + "source": "https://github.com/symfony/string/tree/v6.0.13" }, "funding": [ { @@ -6887,52 +7187,50 @@ "type": "tidelift" } ], - "time": "2022-04-19T10:40:37+00:00" + "time": "2022-09-02T08:05:03+00:00" }, { "name": "symfony/translation", - "version": "v5.4.9", + "version": "v6.0.12", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "1639abc1177d26bcd4320e535e664cef067ab0ca" + "reference": "5e71973b4991e141271465dacf4bf9e719941424" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/1639abc1177d26bcd4320e535e664cef067ab0ca", - "reference": "1639abc1177d26bcd4320e535e664cef067ab0ca", + "url": "https://api.github.com/repos/symfony/translation/zipball/5e71973b4991e141271465dacf4bf9e719941424", + "reference": "5e71973b4991e141271465dacf4bf9e719941424", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", + "php": ">=8.0.2", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16", - "symfony/translation-contracts": "^2.3" + "symfony/translation-contracts": "^2.3|^3.0" }, "conflict": { - "symfony/config": "<4.4", - "symfony/console": "<5.3", - "symfony/dependency-injection": "<5.0", - "symfony/http-kernel": "<5.0", - "symfony/twig-bundle": "<5.0", - "symfony/yaml": "<4.4" + "symfony/config": "<5.4", + "symfony/console": "<5.4", + "symfony/dependency-injection": "<5.4", + "symfony/http-kernel": "<5.4", + "symfony/twig-bundle": "<5.4", + "symfony/yaml": "<5.4" }, "provide": { - "symfony/translation-implementation": "2.3" + "symfony/translation-implementation": "2.3|3.0" }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^4.4|^5.0|^6.0", + "symfony/config": "^5.4|^6.0", "symfony/console": "^5.4|^6.0", - "symfony/dependency-injection": "^5.0|^6.0", - "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/finder": "^5.4|^6.0", "symfony/http-client-contracts": "^1.1|^2.0|^3.0", - "symfony/http-kernel": "^5.0|^6.0", - "symfony/intl": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^5.4|^6.0", + "symfony/intl": "^5.4|^6.0", "symfony/polyfill-intl-icu": "^1.21", "symfony/service-contracts": "^1.1.2|^2|^3", - "symfony/yaml": "^4.4|^5.0|^6.0" + "symfony/yaml": "^5.4|^6.0" }, "suggest": { "psr/log-implementation": "To use logging capability in translator", @@ -6968,7 +7266,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v5.4.9" + "source": "https://github.com/symfony/translation/tree/v6.0.12" }, "funding": [ { @@ -6984,24 +7282,24 @@ "type": "tidelift" } ], - "time": "2022-05-06T12:33:37+00:00" + "time": "2022-08-02T16:01:06+00:00" }, { "name": "symfony/translation-contracts", - "version": "v2.5.1", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "1211df0afa701e45a04253110e959d4af4ef0f07" + "reference": "acbfbb274e730e5a0236f619b6168d9dedb3e282" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/1211df0afa701e45a04253110e959d4af4ef0f07", - "reference": "1211df0afa701e45a04253110e959d4af4ef0f07", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/acbfbb274e730e5a0236f619b6168d9dedb3e282", + "reference": "acbfbb274e730e5a0236f619b6168d9dedb3e282", "shasum": "" }, "require": { - "php": ">=7.2.5" + "php": ">=8.0.2" }, "suggest": { "symfony/translation-implementation": "" @@ -7009,7 +7307,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -7046,7 +7344,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v2.5.1" + "source": "https://github.com/symfony/translation-contracts/tree/v3.0.2" }, "funding": [ { @@ -7062,36 +7360,109 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2022-06-27T17:10:44+00:00" }, { - "name": "symfony/var-dumper", - "version": "v5.4.9", + "name": "symfony/uid", + "version": "v6.0.13", "source": { "type": "git", - "url": "https://github.com/symfony/var-dumper.git", - "reference": "af52239a330fafd192c773795520dc2dd62b5657" + "url": "https://github.com/symfony/uid.git", + "reference": "db426b27173f5e2d8b960dd10fa8ce19ea9ca5f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/af52239a330fafd192c773795520dc2dd62b5657", - "reference": "af52239a330fafd192c773795520dc2dd62b5657", + "url": "https://api.github.com/repos/symfony/uid/zipball/db426b27173f5e2d8b960dd10fa8ce19ea9ca5f3", + "reference": "db426b27173f5e2d8b960dd10fa8ce19ea9ca5f3", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.0.2", + "symfony/polyfill-uuid": "^1.15" + }, + "require-dev": { + "symfony/console": "^5.4|^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Uid\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Grégoire Pineau", + "email": "lyrixx@lyrixx.info" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to generate and represent UIDs", + "homepage": "https://symfony.com", + "keywords": [ + "UID", + "ulid", + "uuid" + ], + "support": { + "source": "https://github.com/symfony/uid/tree/v6.0.13" + }, + "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": "2022-09-09T09:33:56+00:00" + }, + { + "name": "symfony/var-dumper", + "version": "v6.0.13", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "367522dc769072f2abe554013e073eb079593829" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/367522dc769072f2abe554013e073eb079593829", + "reference": "367522dc769072f2abe554013e073eb079593829", + "shasum": "" + }, + "require": { + "php": ">=8.0.2", + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { "phpunit/phpunit": "<5.4.3", - "symfony/console": "<4.4" + "symfony/console": "<5.4" }, "require-dev": { "ext-iconv": "*", - "symfony/console": "^4.4|^5.0|^6.0", - "symfony/process": "^4.4|^5.0|^6.0", - "symfony/uid": "^5.1|^6.0", + "symfony/console": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/uid": "^5.4|^6.0", "twig/twig": "^2.13|^3.0.4" }, "suggest": { @@ -7135,7 +7506,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v5.4.9" + "source": "https://github.com/symfony/var-dumper/tree/v6.0.13" }, "funding": [ { @@ -7151,35 +7522,39 @@ "type": "tidelift" } ], - "time": "2022-05-21T10:24:18+00:00" + "time": "2022-09-08T09:32:44+00:00" }, { "name": "symfony/yaml", - "version": "v4.4.37", + "version": "v5.4.12", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "d7f637cc0f0cc14beb0984f2bb50da560b271311" + "reference": "7a3aa21ac8ab1a96cc6de5bbcab4bc9fc943b18c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/d7f637cc0f0cc14beb0984f2bb50da560b271311", - "reference": "d7f637cc0f0cc14beb0984f2bb50da560b271311", + "url": "https://api.github.com/repos/symfony/yaml/zipball/7a3aa21ac8ab1a96cc6de5bbcab4bc9fc943b18c", + "reference": "7a3aa21ac8ab1a96cc6de5bbcab4bc9fc943b18c", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/polyfill-ctype": "~1.8" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/console": "<3.4" + "symfony/console": "<5.3" }, "require-dev": { - "symfony/console": "^3.4|^4.0|^5.0" + "symfony/console": "^5.3|^6.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" }, + "bin": [ + "Resources/bin/yaml-lint" + ], "type": "library", "autoload": { "psr-4": { @@ -7206,7 +7581,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v4.4.37" + "source": "https://github.com/symfony/yaml/tree/v5.4.12" }, "funding": [ { @@ -7222,20 +7597,20 @@ "type": "tidelift" } ], - "time": "2022-01-24T20:11:01+00:00" + "time": "2022-08-02T15:52:22+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", - "version": "2.2.4", + "version": "2.2.5", "source": { "type": "git", "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", - "reference": "da444caae6aca7a19c0c140f68c6182e337d5b1c" + "reference": "4348a3a06651827a27d989ad1d13efec6bb49b19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/da444caae6aca7a19c0c140f68c6182e337d5b1c", - "reference": "da444caae6aca7a19c0c140f68c6182e337d5b1c", + "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/4348a3a06651827a27d989ad1d13efec6bb49b19", + "reference": "4348a3a06651827a27d989ad1d13efec6bb49b19", "shasum": "" }, "require": { @@ -7273,9 +7648,9 @@ "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", "support": { "issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues", - "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/2.2.4" + "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/2.2.5" }, - "time": "2021-12-08T09:12:39+00:00" + "time": "2022-09-12T13:28:28+00:00" }, { "name": "vlucas/phpdotenv", @@ -7359,16 +7734,16 @@ }, { "name": "voku/portable-ascii", - "version": "1.6.1", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/voku/portable-ascii.git", - "reference": "87337c91b9dfacee02452244ee14ab3c43bc485a" + "reference": "b56450eed252f6801410d810c8e1727224ae0743" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/voku/portable-ascii/zipball/87337c91b9dfacee02452244ee14ab3c43bc485a", - "reference": "87337c91b9dfacee02452244ee14ab3c43bc485a", + "url": "https://api.github.com/repos/voku/portable-ascii/zipball/b56450eed252f6801410d810c8e1727224ae0743", + "reference": "b56450eed252f6801410d810c8e1727224ae0743", "shasum": "" }, "require": { @@ -7405,7 +7780,7 @@ ], "support": { "issues": "https://github.com/voku/portable-ascii/issues", - "source": "https://github.com/voku/portable-ascii/tree/1.6.1" + "source": "https://github.com/voku/portable-ascii/tree/2.0.1" }, "funding": [ { @@ -7429,25 +7804,25 @@ "type": "tidelift" } ], - "time": "2022-01-24T18:55:24+00:00" + "time": "2022-03-08T17:03:00+00:00" }, { "name": "webmozart/assert", - "version": "1.10.0", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991", + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-ctype": "^1.8" + "ext-ctype": "*", + "php": "^7.2 || ^8.0" }, "conflict": { "phpstan/phpstan": "<0.12.20", @@ -7485,9 +7860,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.10.0" + "source": "https://github.com/webmozarts/assert/tree/1.11.0" }, - "time": "2021-03-09T10:59:23+00:00" + "time": "2022-06-03T18:03:27+00:00" } ], "packages-dev": [ @@ -7857,16 +8232,16 @@ }, { "name": "doctrine/annotations", - "version": "1.13.2", + "version": "1.13.3", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "5b668aef16090008790395c02c893b1ba13f7e08" + "reference": "648b0343343565c4a056bfc8392201385e8d89f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/5b668aef16090008790395c02c893b1ba13f7e08", - "reference": "5b668aef16090008790395c02c893b1ba13f7e08", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/648b0343343565c4a056bfc8392201385e8d89f0", + "reference": "648b0343343565c4a056bfc8392201385e8d89f0", "shasum": "" }, "require": { @@ -7878,9 +8253,10 @@ "require-dev": { "doctrine/cache": "^1.11 || ^2.0", "doctrine/coding-standard": "^6.0 || ^8.1", - "phpstan/phpstan": "^0.12.20", + "phpstan/phpstan": "^1.4.10 || ^1.8.0", "phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5", - "symfony/cache": "^4.4 || ^5.2" + "symfony/cache": "^4.4 || ^5.2", + "vimeo/psalm": "^4.10" }, "type": "library", "autoload": { @@ -7923,9 +8299,9 @@ ], "support": { "issues": "https://github.com/doctrine/annotations/issues", - "source": "https://github.com/doctrine/annotations/tree/1.13.2" + "source": "https://github.com/doctrine/annotations/tree/1.13.3" }, - "time": "2021-08-05T19:00:23+00:00" + "time": "2022-07-02T10:48:51+00:00" }, { "name": "doctrine/instantiator", @@ -7997,214 +8373,18 @@ ], "time": "2022-03-03T08:28:38+00:00" }, - { - "name": "facade/flare-client-php", - "version": "1.9.1", - "source": { - "type": "git", - "url": "https://github.com/facade/flare-client-php.git", - "reference": "b2adf1512755637d0cef4f7d1b54301325ac78ed" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/facade/flare-client-php/zipball/b2adf1512755637d0cef4f7d1b54301325ac78ed", - "reference": "b2adf1512755637d0cef4f7d1b54301325ac78ed", - "shasum": "" - }, - "require": { - "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": { - "files": [ - "src/helpers.php" - ], - "psr-4": { - "Facade\\FlareClient\\": "src" - } - }, - "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.9.1" - }, - "funding": [ - { - "url": "https://github.com/spatie", - "type": "github" - } - ], - "time": "2021-09-13T12:16:46+00:00" - }, - { - "name": "facade/ignition", - "version": "2.17.5", - "source": { - "type": "git", - "url": "https://github.com/facade/ignition.git", - "reference": "1d71996f83c9a5a7807331b8986ac890352b7a0c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/facade/ignition/zipball/1d71996f83c9a5a7807331b8986ac890352b7a0c", - "reference": "1d71996f83c9a5a7807331b8986ac890352b7a0c", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*", - "facade/flare-client-php": "^1.9.1", - "facade/ignition-contracts": "^1.0.2", - "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", - "livewire/livewire": "^2.4", - "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": { - "files": [ - "src/helpers.php" - ], - "psr-4": { - "Facade\\Ignition\\": "src" - } - }, - "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": "2022-02-23T18:31:24+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.19.0", + "version": "v1.20.0", "source": { "type": "git", "url": "https://github.com/FakerPHP/Faker.git", - "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75" + "reference": "37f751c67a5372d4e26353bd9384bc03744ec77b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/d7f08a622b3346766325488aa32ddc93ccdecc75", - "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75", + "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/37f751c67a5372d4e26353bd9384bc03744ec77b", + "reference": "37f751c67a5372d4e26353bd9384bc03744ec77b", "shasum": "" }, "require": { @@ -8231,7 +8411,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "v1.19-dev" + "dev-main": "v1.20-dev" } }, "autoload": { @@ -8256,9 +8436,9 @@ ], "support": { "issues": "https://github.com/FakerPHP/Faker/issues", - "source": "https://github.com/FakerPHP/Faker/tree/v1.19.0" + "source": "https://github.com/FakerPHP/Faker/tree/v1.20.0" }, - "time": "2022-02-02T17:38:57+00:00" + "time": "2022-07-20T13:12:54+00:00" }, { "name": "filp/whoops", @@ -8333,16 +8513,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.8.0", + "version": "v3.11.0", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "cbad1115aac4b5c3c5540e7210d3c9fba2f81fa3" + "reference": "7dcdea3f2f5f473464e835be9be55283ff8cfdc3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/cbad1115aac4b5c3c5540e7210d3c9fba2f81fa3", - "reference": "cbad1115aac4b5c3c5540e7210d3c9fba2f81fa3", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/7dcdea3f2f5f473464e835be9be55283ff8cfdc3", + "reference": "7dcdea3f2f5f473464e835be9be55283ff8cfdc3", "shasum": "" }, "require": { @@ -8352,7 +8532,7 @@ "ext-json": "*", "ext-tokenizer": "*", "php": "^7.4 || ^8.0", - "php-cs-fixer/diff": "^2.0", + "sebastian/diff": "^4.0", "symfony/console": "^5.4 || ^6.0", "symfony/event-dispatcher": "^5.4 || ^6.0", "symfony/filesystem": "^5.4 || ^6.0", @@ -8410,7 +8590,7 @@ "description": "A tool to automatically fix PHP code style", "support": { "issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues", - "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v3.8.0" + "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v3.11.0" }, "funding": [ { @@ -8418,7 +8598,7 @@ "type": "github" } ], - "time": "2022-03-18T17:20:59+00:00" + "time": "2022-09-01T18:24:51+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -8473,16 +8653,16 @@ }, { "name": "itsgoingd/clockwork", - "version": "v5.1.6", + "version": "v5.1.8", "source": { "type": "git", "url": "https://github.com/itsgoingd/clockwork.git", - "reference": "9df41432da1d8cb39c7fda383ddcc02231c83ff3" + "reference": "74ee05a61296aa7298164ef5346f0a568aa6106e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/itsgoingd/clockwork/zipball/9df41432da1d8cb39c7fda383ddcc02231c83ff3", - "reference": "9df41432da1d8cb39c7fda383ddcc02231c83ff3", + "url": "https://api.github.com/repos/itsgoingd/clockwork/zipball/74ee05a61296aa7298164ef5346f0a568aa6106e", + "reference": "74ee05a61296aa7298164ef5346f0a568aa6106e", "shasum": "" }, "require": { @@ -8529,7 +8709,7 @@ ], "support": { "issues": "https://github.com/itsgoingd/clockwork/issues", - "source": "https://github.com/itsgoingd/clockwork/tree/v5.1.6" + "source": "https://github.com/itsgoingd/clockwork/tree/v5.1.8" }, "funding": [ { @@ -8537,20 +8717,20 @@ "type": "github" } ], - "time": "2022-04-12T21:35:47+00:00" + "time": "2022-09-25T20:21:14+00:00" }, { "name": "mockery/mockery", - "version": "1.5.0", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac" + "reference": "e92dcc83d5a51851baf5f5591d32cb2b16e3684e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac", - "reference": "c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac", + "url": "https://api.github.com/repos/mockery/mockery/zipball/e92dcc83d5a51851baf5f5591d32cb2b16e3684e", + "reference": "e92dcc83d5a51851baf5f5591d32cb2b16e3684e", "shasum": "" }, "require": { @@ -8607,9 +8787,9 @@ ], "support": { "issues": "https://github.com/mockery/mockery/issues", - "source": "https://github.com/mockery/mockery/tree/1.5.0" + "source": "https://github.com/mockery/mockery/tree/1.5.1" }, - "time": "2022-01-20T13:18:17+00:00" + "time": "2022-09-07T15:32:08+00:00" }, { "name": "myclabs/deep-copy", @@ -8672,37 +8852,38 @@ }, { "name": "nunomaduro/collision", - "version": "v5.11.0", + "version": "v6.3.1", "source": { "type": "git", "url": "https://github.com/nunomaduro/collision.git", - "reference": "8b610eef8582ccdc05d8f2ab23305e2d37049461" + "reference": "0f6349c3ed5dd28467087b08fb59384bb458a22b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/collision/zipball/8b610eef8582ccdc05d8f2ab23305e2d37049461", - "reference": "8b610eef8582ccdc05d8f2ab23305e2d37049461", + "url": "https://api.github.com/repos/nunomaduro/collision/zipball/0f6349c3ed5dd28467087b08fb59384bb458a22b", + "reference": "0f6349c3ed5dd28467087b08fb59384bb458a22b", "shasum": "" }, "require": { - "facade/ignition-contracts": "^1.0", - "filp/whoops": "^2.14.3", - "php": "^7.3 || ^8.0", - "symfony/console": "^5.0" + "filp/whoops": "^2.14.5", + "php": "^8.0.0", + "symfony/console": "^6.0.2" }, "require-dev": { - "brianium/paratest": "^6.1", - "fideloper/proxy": "^4.4.1", - "fruitcake/laravel-cors": "^2.0.3", - "laravel/framework": "8.x-dev", - "nunomaduro/larastan": "^0.6.2", - "nunomaduro/mock-final-classes": "^1.0", - "orchestra/testbench": "^6.0", - "phpstan/phpstan": "^0.12.64", - "phpunit/phpunit": "^9.5.0" + "brianium/paratest": "^6.4.1", + "laravel/framework": "^9.26.1", + "laravel/pint": "^1.1.1", + "nunomaduro/larastan": "^1.0.3", + "nunomaduro/mock-final-classes": "^1.1.0", + "orchestra/testbench": "^7.7", + "phpunit/phpunit": "^9.5.23", + "spatie/ignition": "^1.4.1" }, "type": "library", "extra": { + "branch-alias": { + "dev-develop": "6.x-dev" + }, "laravel": { "providers": [ "NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider" @@ -8755,7 +8936,7 @@ "type": "patreon" } ], - "time": "2022-01-10T16:22:52+00:00" + "time": "2022-09-29T12:29:49+00:00" }, { "name": "phar-io/manifest", @@ -8868,58 +9049,6 @@ }, "time": "2022-02-21T01:04:05+00:00" }, - { - "name": "php-cs-fixer/diff", - "version": "v2.0.2", - "source": { - "type": "git", - "url": "https://github.com/PHP-CS-Fixer/diff.git", - "reference": "29dc0d507e838c4580d018bd8b5cb412474f7ec3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/29dc0d507e838c4580d018bd8b5cb412474f7ec3", - "reference": "29dc0d507e838c4580d018bd8b5cb412474f7ec3", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0 || ^8.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7.23 || ^6.4.3 || ^7.0", - "symfony/process": "^3.3" - }, - "type": "library", - "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": "sebastian/diff v3 backport support for PHP 5.6+", - "homepage": "https://github.com/PHP-CS-Fixer", - "keywords": [ - "diff" - ], - "support": { - "issues": "https://github.com/PHP-CS-Fixer/diff/issues", - "source": "https://github.com/PHP-CS-Fixer/diff/tree/v2.0.2" - }, - "time": "2020-10-14T08:32:19+00:00" - }, { "name": "php-mock/php-mock", "version": "2.3.1", @@ -9054,16 +9183,16 @@ }, { "name": "php-mock/php-mock-phpunit", - "version": "2.6.0", + "version": "2.6.1", "source": { "type": "git", "url": "https://github.com/php-mock/php-mock-phpunit.git", - "reference": "2877a0e58f12e91b64bf36ccd080a209dcbf6c30" + "reference": "b9ba2db21e7e1c7deba98bc86dcfc6425fb4647d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-mock/php-mock-phpunit/zipball/2877a0e58f12e91b64bf36ccd080a209dcbf6c30", - "reference": "2877a0e58f12e91b64bf36ccd080a209dcbf6c30", + "url": "https://api.github.com/repos/php-mock/php-mock-phpunit/zipball/b9ba2db21e7e1c7deba98bc86dcfc6425fb4647d", + "reference": "b9ba2db21e7e1c7deba98bc86dcfc6425fb4647d", "shasum": "" }, "require": { @@ -9071,6 +9200,9 @@ "php-mock/php-mock-integration": "^2.1", "phpunit/phpunit": "^6 || ^7 || ^8 || ^9" }, + "require-dev": { + "phpspec/prophecy": "^1.10.3" + }, "type": "library", "autoload": { "files": [ @@ -9106,9 +9238,15 @@ ], "support": { "issues": "https://github.com/php-mock/php-mock-phpunit/issues", - "source": "https://github.com/php-mock/php-mock-phpunit/tree/2.6.0" + "source": "https://github.com/php-mock/php-mock-phpunit/tree/2.6.1" }, - "time": "2020-02-08T15:44:47+00:00" + "funding": [ + { + "url": "https://github.com/michalbundyra", + "type": "github" + } + ], + "time": "2022-09-07T20:40:07+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -9163,63 +9301,6 @@ }, "time": "2020-06-27T09:03:43+00:00" }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", - "shasum": "" - }, - "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" - }, - "time": "2021-10-19T17:43:47+00:00" - }, { "name": "phpdocumentor/type-resolver", "version": "1.6.1", @@ -9270,92 +9351,25 @@ }, "time": "2022-03-15T21:29:03+00:00" }, - { - "name": "phpspec/prophecy", - "version": "v1.15.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.2", - "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^6.0 || ^7.0", - "phpunit/phpunit": "^8.0 || ^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "support": { - "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" - }, - "time": "2021-12-08T12:19:24+00:00" - }, { "name": "phpunit/php-code-coverage", - "version": "9.2.15", + "version": "9.2.17", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f" + "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f", - "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa94dc41e8661fe90c7316849907cba3007b10d8", + "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.13.0", + "nikic/php-parser": "^4.14", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -9404,7 +9418,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.17" }, "funding": [ { @@ -9412,7 +9426,7 @@ "type": "github" } ], - "time": "2022-03-07T09:28:20+00:00" + "time": "2022-08-30T12:24:04+00:00" }, { "name": "phpunit/php-file-iterator", @@ -9657,16 +9671,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.20", + "version": "9.5.25", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba" + "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/12bc8879fb65aef2138b26fc633cb1e3620cffba", - "reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d", + "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d", "shasum": "" }, "require": { @@ -9681,7 +9695,6 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", - "phpspec/prophecy": "^1.12.1", "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", @@ -9689,20 +9702,16 @@ "phpunit/php-timer": "^5.0.2", "sebastian/cli-parser": "^1.0.1", "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.5", + "sebastian/comparator": "^4.0.8", "sebastian/diff": "^4.0.3", "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.3", + "sebastian/exporter": "^4.0.5", "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.0", + "sebastian/type": "^3.2", "sebastian/version": "^3.0.2" }, - "require-dev": { - "ext-pdo": "*", - "phpspec/prophecy-phpunit": "^2.0.1" - }, "suggest": { "ext-soap": "*", "ext-xdebug": "*" @@ -9744,7 +9753,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.20" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.25" }, "funding": [ { @@ -9754,9 +9763,13 @@ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" } ], - "time": "2022-04-01T12:37:26+00:00" + "time": "2022-09-25T03:44:45+00:00" }, { "name": "sebastian/cli-parser", @@ -9927,16 +9940,16 @@ }, { "name": "sebastian/comparator", - "version": "4.0.6", + "version": "4.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382" + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", "shasum": "" }, "require": { @@ -9989,7 +10002,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" }, "funding": [ { @@ -9997,7 +10010,7 @@ "type": "github" } ], - "time": "2020-10-26T15:49:45+00:00" + "time": "2022-09-14T12:41:17+00:00" }, { "name": "sebastian/complexity", @@ -10187,16 +10200,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", "shasum": "" }, "require": { @@ -10252,7 +10265,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" }, "funding": [ { @@ -10260,7 +10273,7 @@ "type": "github" } ], - "time": "2021-11-11T14:18:36+00:00" + "time": "2022-09-14T06:03:37+00:00" }, { "name": "sebastian/global-state", @@ -10615,16 +10628,16 @@ }, { "name": "sebastian/type", - "version": "3.0.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad" + "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", + "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", "shasum": "" }, "require": { @@ -10636,7 +10649,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -10659,7 +10672,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.0.0" + "source": "https://github.com/sebastianbergmann/type/tree/3.2.0" }, "funding": [ { @@ -10667,7 +10680,7 @@ "type": "github" } ], - "time": "2022-03-15T09:54:48+00:00" + "time": "2022-09-12T14:47:03+00:00" }, { "name": "sebastian/version", @@ -10723,24 +10736,319 @@ "time": "2020-09-28T06:39:44+00:00" }, { - "name": "symfony/filesystem", - "version": "v5.4.9", + "name": "spatie/backtrace", + "version": "1.2.1", "source": { "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "36a017fa4cce1eff1b8e8129ff53513abcef05ba" + "url": "https://github.com/spatie/backtrace.git", + "reference": "4ee7d41aa5268107906ea8a4d9ceccde136dbd5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/36a017fa4cce1eff1b8e8129ff53513abcef05ba", - "reference": "36a017fa4cce1eff1b8e8129ff53513abcef05ba", + "url": "https://api.github.com/repos/spatie/backtrace/zipball/4ee7d41aa5268107906ea8a4d9ceccde136dbd5b", + "reference": "4ee7d41aa5268107906ea8a4d9ceccde136dbd5b", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": "^7.3|^8.0" + }, + "require-dev": { + "ext-json": "*", + "phpunit/phpunit": "^9.3", + "symfony/var-dumper": "^5.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\Backtrace\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van de Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "A better backtrace", + "homepage": "https://github.com/spatie/backtrace", + "keywords": [ + "Backtrace", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/backtrace/issues", + "source": "https://github.com/spatie/backtrace/tree/1.2.1" + }, + "funding": [ + { + "url": "https://github.com/sponsors/spatie", + "type": "github" + }, + { + "url": "https://spatie.be/open-source/support-us", + "type": "other" + } + ], + "time": "2021-11-09T10:57:15+00:00" + }, + { + "name": "spatie/flare-client-php", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/flare-client-php.git", + "reference": "b1b974348750925b717fa8c8b97a0db0d1aa40ca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/flare-client-php/zipball/b1b974348750925b717fa8c8b97a0db0d1aa40ca", + "reference": "b1b974348750925b717fa8c8b97a0db0d1aa40ca", + "shasum": "" + }, + "require": { + "illuminate/pipeline": "^8.0|^9.0", + "php": "^8.0", + "spatie/backtrace": "^1.2", + "symfony/http-foundation": "^5.0|^6.0", + "symfony/mime": "^5.2|^6.0", + "symfony/process": "^5.2|^6.0", + "symfony/var-dumper": "^5.2|^6.0" + }, + "require-dev": { + "dms/phpunit-arraysubset-asserts": "^0.3.0", + "pestphp/pest": "^1.20", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1.0", + "spatie/phpunit-snapshot-assertions": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.1.x-dev" + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Spatie\\FlareClient\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Send PHP errors to Flare", + "homepage": "https://github.com/spatie/flare-client-php", + "keywords": [ + "exception", + "flare", + "reporting", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/flare-client-php/issues", + "source": "https://github.com/spatie/flare-client-php/tree/1.3.0" + }, + "funding": [ + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2022-08-08T10:10:20+00:00" + }, + { + "name": "spatie/ignition", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/spatie/ignition.git", + "reference": "dd3d456779108d7078baf4e43f8c2b937d9794a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/ignition/zipball/dd3d456779108d7078baf4e43f8c2b937d9794a1", + "reference": "dd3d456779108d7078baf4e43f8c2b937d9794a1", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "monolog/monolog": "^2.0", + "php": "^8.0", + "spatie/flare-client-php": "^1.1", + "symfony/console": "^5.4|^6.0", + "symfony/var-dumper": "^5.4|^6.0" + }, + "require-dev": { + "mockery/mockery": "^1.4", + "pestphp/pest": "^1.20", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1.0", + "symfony/process": "^5.4|^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Spatie\\Ignition\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Spatie", + "email": "info@spatie.be", + "role": "Developer" + } + ], + "description": "A beautiful error page for PHP applications.", + "homepage": "https://flareapp.io/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/spatie/ignition/issues", + "source": "https://github.com/spatie/ignition" + }, + "funding": [ + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2022-08-26T11:51:15+00:00" + }, + { + "name": "spatie/laravel-ignition", + "version": "1.5.1", + "source": { + "type": "git", + "url": "https://github.com/spatie/laravel-ignition.git", + "reference": "75d465ec577abb432af1ca9b33683d5a6e921eb9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/75d465ec577abb432af1ca9b33683d5a6e921eb9", + "reference": "75d465ec577abb432af1ca9b33683d5a6e921eb9", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "illuminate/support": "^8.77|^9.27", + "monolog/monolog": "^2.3", + "php": "^8.0", + "spatie/flare-client-php": "^1.0.1", + "spatie/ignition": "^1.4.1", + "symfony/console": "^5.0|^6.0", + "symfony/var-dumper": "^5.0|^6.0" + }, + "require-dev": { + "filp/whoops": "^2.14", + "livewire/livewire": "^2.8|dev-develop", + "mockery/mockery": "^1.4", + "nunomaduro/larastan": "^1.0", + "orchestra/testbench": "^6.23|^7.0", + "pestphp/pest": "^1.20", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1.0", + "spatie/laravel-ray": "^1.27" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Spatie\\LaravelIgnition\\IgnitionServiceProvider" + ], + "aliases": { + "Flare": "Spatie\\LaravelIgnition\\Facades\\Flare" + } + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Spatie\\LaravelIgnition\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Spatie", + "email": "info@spatie.be", + "role": "Developer" + } + ], + "description": "A beautiful error page for Laravel applications.", + "homepage": "https://flareapp.io/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/spatie/laravel-ignition/issues", + "source": "https://github.com/spatie/laravel-ignition" + }, + "funding": [ + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2022-10-04T10:14:31+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v6.0.13", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "3adca49133bd055ebe6011ed1e012be3c908af79" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/3adca49133bd055ebe6011ed1e012be3c908af79", + "reference": "3adca49133bd055ebe6011ed1e012be3c908af79", + "shasum": "" + }, + "require": { + "php": ">=8.0.2", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.8", - "symfony/polyfill-php80": "^1.16" + "symfony/polyfill-mbstring": "~1.8" }, "type": "library", "autoload": { @@ -10768,7 +11076,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.9" + "source": "https://github.com/symfony/filesystem/tree/v6.0.13" }, "funding": [ { @@ -10784,27 +11092,25 @@ "type": "tidelift" } ], - "time": "2022-05-20T13:55:35+00:00" + "time": "2022-09-21T20:25:27+00:00" }, { "name": "symfony/options-resolver", - "version": "v5.4.3", + "version": "v6.0.3", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "cc1147cb11af1b43f503ac18f31aa3bec213aba8" + "reference": "51f7006670febe4cbcbae177cbffe93ff833250d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/cc1147cb11af1b43f503ac18f31aa3bec213aba8", - "reference": "cc1147cb11af1b43f503ac18f31aa3bec213aba8", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/51f7006670febe4cbcbae177cbffe93ff833250d", + "reference": "51f7006670febe4cbcbae177cbffe93ff833250d", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php73": "~1.0", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.0.2", + "symfony/deprecation-contracts": "^2.1|^3" }, "type": "library", "autoload": { @@ -10837,7 +11143,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v5.4.3" + "source": "https://github.com/symfony/options-resolver/tree/v6.0.3" }, "funding": [ { @@ -10853,24 +11159,24 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2022-01-02T09:55:41+00:00" }, { "name": "symfony/stopwatch", - "version": "v5.4.5", + "version": "v6.0.13", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "4d04b5c24f3c9a1a168a131f6cbe297155bc0d30" + "reference": "7554fde6848af5ef1178f8ccbdbdb8ae1092c70a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/4d04b5c24f3c9a1a168a131f6cbe297155bc0d30", - "reference": "4d04b5c24f3c9a1a168a131f6cbe297155bc0d30", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/7554fde6848af5ef1178f8ccbdbdb8ae1092c70a", + "reference": "7554fde6848af5ef1178f8ccbdbdb8ae1092c70a", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "symfony/service-contracts": "^1|^2|^3" }, "type": "library", @@ -10899,7 +11205,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v5.4.5" + "source": "https://github.com/symfony/stopwatch/tree/v6.0.13" }, "funding": [ { @@ -10915,7 +11221,7 @@ "type": "tidelift" } ], - "time": "2022-02-18T16:06:09+00:00" + "time": "2022-09-28T15:52:47+00:00" }, { "name": "theseer/tokenizer", @@ -10974,7 +11280,7 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "^7.4 || ^8.0 || ^8.1", + "php": "^8.0.2 || ^8.1", "ext-json": "*", "ext-mbstring": "*", "ext-pdo": "*", @@ -10983,7 +11289,7 @@ }, "platform-dev": [], "platform-overrides": { - "php": "7.4.0" + "php": "8.0.2" }, "plugin-api-version": "2.3.0" } diff --git a/config/app.php b/config/app.php index b7513e139..c3764619a 100644 --- a/config/app.php +++ b/config/app.php @@ -1,5 +1,7 @@ env('APP_REPORT_ALL_EXCEPTIONS', false), ], + /* + |-------------------------------------------------------------------------- + | Maintenance Mode Driver + |-------------------------------------------------------------------------- + | + | These configuration options determine the driver used to determine and + | manage Laravel's "maintenance mode" status. The "cache" driver will + | allow maintenance mode to be controlled across multiple machines. + | + | Supported drivers: "file", "cache" + | + */ + + 'maintenance' => [ + 'driver' => 'file', + ], + /* |-------------------------------------------------------------------------- | Autoloaded Service Providers @@ -197,52 +216,19 @@ return [ | | This array of class aliases will be registered when this application | is started. However, feel free to register as many as you wish as - | the aliases are "lazy" loaded so they don't hinder performance. + | the aliases are "lazy" loaded, so they don't hinder performance. | */ - 'aliases' => [ + 'aliases' => Facade::defaultAliases()->merge([ 'Alert' => Prologue\Alerts\Facades\Alert::class, - 'App' => Illuminate\Support\Facades\App::class, - 'Artisan' => Illuminate\Support\Facades\Artisan::class, - 'Auth' => Illuminate\Support\Facades\Auth::class, - 'Blade' => Illuminate\Support\Facades\Blade::class, - 'Bus' => Illuminate\Support\Facades\Bus::class, - 'Cache' => Illuminate\Support\Facades\Cache::class, 'Carbon' => Carbon\Carbon::class, - 'Config' => Illuminate\Support\Facades\Config::class, - 'Cookie' => Illuminate\Support\Facades\Cookie::class, - 'Crypt' => Illuminate\Support\Facades\Crypt::class, - 'DB' => Illuminate\Support\Facades\DB::class, - 'Eloquent' => Illuminate\Database\Eloquent\Model::class, - 'Event' => Illuminate\Support\Facades\Event::class, - 'File' => Illuminate\Support\Facades\File::class, - 'Gate' => Illuminate\Support\Facades\Gate::class, - 'Hash' => Illuminate\Support\Facades\Hash::class, - 'Input' => Illuminate\Support\Facades\Input::class, - 'Javascript' => Laracasts\Utilities\JavaScript\JavaScriptFacade::class, - 'Lang' => Illuminate\Support\Facades\Lang::class, - 'Log' => Illuminate\Support\Facades\Log::class, - 'Mail' => Illuminate\Support\Facades\Mail::class, - 'Notification' => Illuminate\Support\Facades\Notification::class, - 'Password' => Illuminate\Support\Facades\Password::class, - 'Queue' => Illuminate\Support\Facades\Queue::class, - 'Redirect' => Illuminate\Support\Facades\Redirect::class, - 'Redis' => Illuminate\Support\Facades\Redis::class, - 'Request' => Illuminate\Support\Facades\Request::class, - 'Response' => Illuminate\Support\Facades\Response::class, - 'Route' => Illuminate\Support\Facades\Route::class, - 'Schema' => Illuminate\Support\Facades\Schema::class, - 'Session' => Illuminate\Support\Facades\Session::class, - 'Storage' => Illuminate\Support\Facades\Storage::class, + 'JavaScript' => Laracasts\Utilities\JavaScript\JavaScriptFacade::class, 'Theme' => Pterodactyl\Extensions\Facades\Theme::class, - 'URL' => Illuminate\Support\Facades\URL::class, - 'Validator' => Illuminate\Support\Facades\Validator::class, - 'View' => Illuminate\Support\Facades\View::class, // Custom Facades 'Activity' => Pterodactyl\Facades\Activity::class, 'LogBatch' => Pterodactyl\Facades\LogBatch::class, 'LogTarget' => Pterodactyl\Facades\LogTarget::class, - ], + ])->toArray(), ]; diff --git a/config/auth.php b/config/auth.php index 02f4807e4..21e6be7b2 100644 --- a/config/auth.php +++ b/config/auth.php @@ -109,6 +109,20 @@ return [ 'provider' => 'users', 'table' => 'password_resets', 'expire' => 60, + 'throttle' => 60, ], ], + + /* + |-------------------------------------------------------------------------- + | Password Confirmation Timeout + |-------------------------------------------------------------------------- + | + | Here you may define the amount of seconds before a password confirmation + | times out and the user is prompted to re-enter their password via the + | confirmation screen. By default, the timeout lasts for three hours. + | + */ + + 'password_timeout' => 10800, ]; diff --git a/config/broadcasting.php b/config/broadcasting.php index 9c4c792de..81add6d89 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -10,9 +10,10 @@ return [ | framework when an event needs to be broadcast. You may set this to | any of the connections defined in the "connections" array below. | - | Supported: "pusher", "redis", "log", "null" + | Supported: "pusher", "ably", "redis", "log", "null" | */ + 'default' => env('BROADCAST_DRIVER', 'null'), /* @@ -29,9 +30,24 @@ return [ 'connections' => [ 'pusher' => [ 'driver' => 'pusher', - 'key' => env('PUSHER_KEY'), - 'secret' => env('PUSHER_SECRET'), + 'key' => env('PUSHER_APP_KEY'), + 'secret' => env('PUSHER_APP_SECRET'), 'app_id' => env('PUSHER_APP_ID'), + 'options' => [ + 'host' => env('PUSHER_HOST', 'api-' . env('PUSHER_APP_CLUSTER', 'mt1') . '.pusher.com') ?: 'api-' . env('PUSHER_APP_CLUSTER', 'mt1') . '.pusher.com', + 'port' => env('PUSHER_PORT', 443), + 'scheme' => env('PUSHER_SCHEME', 'https'), + 'encrypted' => true, + 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', + ], + 'client_options' => [ + // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html + ], + ], + + 'ably' => [ + 'driver' => 'ably', + 'key' => env('ABLY_KEY'), ], 'redis' => [ diff --git a/config/cache.php b/config/cache.php index 27276c200..14b00b51b 100644 --- a/config/cache.php +++ b/config/cache.php @@ -1,5 +1,7 @@ env('CACHE_DRIVER', 'redis'), @@ -25,6 +25,9 @@ return [ | well as their drivers. You may even define multiple stores for the | same cache driver to group types of items stored in your caches. | + | Supported drivers: "apc", "array", "database", "file", + | "memcached", "redis", "dynamodb", "octane", "null" + | */ 'stores' => [ @@ -90,11 +93,11 @@ return [ | Cache Key Prefix |-------------------------------------------------------------------------- | - | When utilizing a RAM based store such as APC or Memcached, there might - | be other applications utilizing the same cache. So, we'll specify a - | value to get prefixed to all our keys so we can avoid collisions. + | When utilizing the APC, database, memcached, Redis, or DynamoDB cache + | stores there might be other applications using the same cache. For + | that reason, you may prefix every cache key to avoid collisions. | */ - 'prefix' => env('CACHE_PREFIX', str_slug(env('APP_NAME', 'pterodactyl'), '_') . '_cache'), + 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'pterodactyl'), '_') . '_cache_'), ]; diff --git a/config/cors.php b/config/cors.php index a96bb270c..bf72895e0 100644 --- a/config/cors.php +++ b/config/cors.php @@ -3,16 +3,14 @@ return [ /* |-------------------------------------------------------------------------- - | Laravel CORS Options + | Cross-Origin Resource Sharing (CORS) Configuration |-------------------------------------------------------------------------- | - | The allowed_methods and allowed_headers options are case-insensitive. + | Here you may configure your settings for cross-origin resource sharing + | or "CORS". This determines what cross-origin operations may execute + | in web browsers. You are free to adjust these settings as needed. | - | You don't need to provide both allowed_origins and allowed_origins_patterns. - | If one of the strings passed matches, it is considered a valid origin. - | - | If ['*'] is provided to allowed_methods, allowed_origins or allowed_headers - | all methods / origins / headers are allowed. + | To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS | */ diff --git a/config/database.php b/config/database.php index 27bc6deb2..b3a460ba2 100644 --- a/config/database.php +++ b/config/database.php @@ -88,13 +88,14 @@ return [ 'options' => [ 'cluster' => env('REDIS_CLUSTER', 'redis'), - 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'), + 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'pterodactyl'), '_') . '_database_'), ], 'default' => [ 'scheme' => env('REDIS_SCHEME', 'tcp'), 'path' => env('REDIS_PATH', '/run/redis/redis.sock'), 'host' => env('REDIS_HOST', 'localhost'), + 'username' => env('REDIS_USERNAME'), 'password' => env('REDIS_PASSWORD'), 'port' => env('REDIS_PORT', 6379), 'database' => env('REDIS_DATABASE', 0), @@ -113,6 +114,7 @@ return [ 'scheme' => env('REDIS_SCHEME', 'tcp'), 'path' => env('REDIS_PATH', '/run/redis/redis.sock'), 'host' => env('REDIS_HOST', 'localhost'), + 'username' => env('REDIS_USERNAME'), 'password' => env('REDIS_PASSWORD'), 'port' => env('REDIS_PORT', 6379), 'database' => env('REDIS_DATABASE_SESSIONS', 1), diff --git a/config/filesystems.php b/config/filesystems.php index bffcc6514..012bd30b0 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -7,25 +7,12 @@ return [ |-------------------------------------------------------------------------- | | Here you may specify the default filesystem disk that should be used - | by the framework. A "local" driver, as well as a variety of cloud - | based drivers are available for your choosing. Just store away! + | by the framework. The "local" disk, as well as a variety of cloud + | based disks are available to your application. Just store away! | */ - 'default' => env('FILESYSTEM_DRIVER', 'local'), - - /* - |-------------------------------------------------------------------------- - | Default Cloud Filesystem Disk - |-------------------------------------------------------------------------- - | - | Many applications store files both locally and in the cloud. For this - | reason, you may specify a default "cloud" driver here. This driver - | will be bound as the Cloud disk implementation in the container. - | - */ - - 'cloud' => env('FILESYSTEM_CLOUD', 's3'), + 'default' => env('FILESYSTEM_DISK', 'local'), /* |-------------------------------------------------------------------------- @@ -34,15 +21,17 @@ return [ | | Here you may configure as many filesystem "disks" as you wish, and you | may even configure multiple disks of the same driver. Defaults have - | been setup for each driver as an example of the required options. + | been set up for each driver as an example of the required values. | - | Supported Drivers: "local", "ftp", "s3", "rackspace" + | Supported Drivers: "local", "ftp", "sftp", "s3" | */ + 'disks' => [ 'local' => [ 'driver' => 'local', 'root' => storage_path('app'), + 'throw' => false, ], 'public' => [ @@ -50,6 +39,7 @@ return [ 'root' => storage_path('app/public'), 'url' => env('APP_URL') . '/storage', 'visibility' => 'public', + 'throw' => false, ], 's3' => [ @@ -58,8 +48,25 @@ return [ 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION'), 'bucket' => env('AWS_BUCKET'), + 'url' => env('AWS_URL'), 'endpoint' => env('AWS_ENDPOINT'), 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), + 'throw' => false, ], ], + + /* + |-------------------------------------------------------------------------- + | Symbolic Links + |-------------------------------------------------------------------------- + | + | Here you may configure the symbolic links that will be created when the + | `storage:link` Artisan command is executed. The array keys should be + | the locations of the links and the values should be their targets. + | + */ + + 'links' => [ + public_path('storage') => storage_path('app/public'), + ], ]; diff --git a/config/hashing.php b/config/hashing.php index f45a6090b..552f2bbb4 100644 --- a/config/hashing.php +++ b/config/hashing.php @@ -10,7 +10,7 @@ return [ | passwords for your application. By default, the bcrypt algorithm is | used; however, you remain free to modify this option if you wish. | - | Supported: "bcrypt", "argon" + | Supported: "bcrypt", "argon", "argon2id" | */ @@ -43,8 +43,8 @@ return [ */ 'argon' => [ - 'memory' => 1024, - 'threads' => 2, - 'time' => 2, + 'memory' => 65536, + 'threads' => 1, + 'time' => 4, ], ]; diff --git a/config/logging.php b/config/logging.php index bb4470c0f..b2cdb82da 100644 --- a/config/logging.php +++ b/config/logging.php @@ -2,6 +2,7 @@ use Monolog\Handler\NullHandler; use Monolog\Handler\StreamHandler; +use Monolog\Handler\SyslogUdpHandler; return [ /* @@ -17,6 +18,22 @@ return [ 'default' => env('LOG_CHANNEL', 'daily'), + /* + |-------------------------------------------------------------------------- + | Deprecations Log Channel + |-------------------------------------------------------------------------- + | + | This option controls the log channel that should be used to log warnings + | regarding deprecated PHP and library features. This allows you to get + | your application ready for upcoming major versions of dependencies. + | + */ + + 'deprecations' => [ + 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), + 'trace' => false, + ], + /* |-------------------------------------------------------------------------- | Log Channels @@ -36,18 +53,19 @@ return [ 'stack' => [ 'driver' => 'stack', 'channels' => ['single'], + 'ignore_exceptions' => false, ], 'single' => [ 'driver' => 'single', 'path' => storage_path('logs/laravel.log'), - 'level' => 'debug', + 'level' => env('LOG_LEVEL', 'debug'), ], 'daily' => [ 'driver' => 'daily', 'path' => storage_path('logs/laravel.log'), - 'level' => 'debug', + 'level' => env('LOG_LEVEL', 'debug'), 'days' => 7, ], @@ -56,12 +74,25 @@ return [ 'url' => env('LOG_SLACK_WEBHOOK_URL'), 'username' => 'Laravel Log', 'emoji' => ':boom:', - 'level' => 'critical', + 'level' => env('LOG_LEVEL', 'critical'), + ], + + 'papertrail' => [ + 'driver' => 'monolog', + 'level' => env('LOG_LEVEL', 'debug'), + 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), + 'handler_with' => [ + 'host' => env('PAPERTRAIL_URL'), + 'port' => env('PAPERTRAIL_PORT'), + 'connectionString' => 'tls://' . env('PAPERTRAIL_URL') . ':' . env('PAPERTRAIL_PORT'), + ], ], 'stderr' => [ 'driver' => 'monolog', + 'level' => env('LOG_LEVEL', 'debug'), 'handler' => StreamHandler::class, + 'formatter' => env('LOG_STDERR_FORMATTER'), 'with' => [ 'stream' => 'php://stderr', ], @@ -69,17 +100,21 @@ return [ 'syslog' => [ 'driver' => 'syslog', - 'level' => 'debug', + 'level' => env('LOG_LEVEL', 'debug'), ], 'errorlog' => [ 'driver' => 'errorlog', - 'level' => 'debug', + 'level' => env('LOG_LEVEL', 'debug'), ], 'null' => [ 'driver' => 'monolog', 'handler' => NullHandler::class, ], + + 'emergency' => [ + 'path' => storage_path('logs/laravel.log'), + ], ], ]; diff --git a/config/mail.php b/config/mail.php index f47793438..0f9639291 100644 --- a/config/mail.php +++ b/config/mail.php @@ -3,45 +3,81 @@ return [ /* |-------------------------------------------------------------------------- - | Mail Driver + | Default Mailer |-------------------------------------------------------------------------- | - | Laravel supports both SMTP and PHP's "mail" function as drivers for the - | sending of e-mail. You may specify which one you're using throughout - | your application here. By default, Laravel is setup for SMTP mail. - | - | Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses", - | "sparkpost", "log", "array" + | This option controls the default mailer that is used to send any email + | messages sent by your application. Alternative mailers may be setup + | and used as needed; however, this mailer will be used by default. | */ - 'driver' => env('MAIL_DRIVER', 'smtp'), + 'default' => env('MAIL_MAILER', env('MAIL_DRIVER', 'smtp')), /* |-------------------------------------------------------------------------- - | SMTP Host Address + | Mailer Configurations |-------------------------------------------------------------------------- | - | Here you may provide the host address of the SMTP server used by your - | applications. A default option is provided that is compatible with - | the Mailgun mail service which will provide reliable deliveries. + | Here you may configure all of the mailers used by your application plus + | their respective settings. Several examples have been configured for + | you and you are free to add your own as your application requires. + | + | Laravel supports a variety of mail "transport" drivers to be used while + | sending an e-mail. You will specify which one you are using for your + | mailers below. You are free to add additional mailers as required. + | + | Supported: "smtp", "sendmail", "mailgun", "ses", + | "postmark", "log", "array", "failover" | */ - 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), + 'mailers' => [ + 'smtp' => [ + 'transport' => 'smtp', + 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), + 'port' => env('MAIL_PORT', 587), + 'encryption' => env('MAIL_ENCRYPTION', 'tls'), + 'username' => env('MAIL_USERNAME'), + 'password' => env('MAIL_PASSWORD'), + 'timeout' => null, + 'local_domain' => env('MAIL_EHLO_DOMAIN'), + ], - /* - |-------------------------------------------------------------------------- - | SMTP Host Port - |-------------------------------------------------------------------------- - | - | This is the SMTP port used by your application to deliver e-mails to - | users of the application. Like the host we have set this value to - | stay compatible with the Mailgun e-mail application by default. - | - */ + 'ses' => [ + 'transport' => 'ses', + ], - 'port' => env('MAIL_PORT', 587), + 'mailgun' => [ + 'transport' => 'mailgun', + ], + + 'postmark' => [ + 'transport' => 'postmark', + ], + + 'sendmail' => [ + 'transport' => 'sendmail', + 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), + ], + + 'log' => [ + 'transport' => 'log', + 'channel' => env('MAIL_LOG_CHANNEL'), + ], + + 'array' => [ + 'transport' => 'array', + ], + + 'failover' => [ + 'transport' => 'failover', + 'mailers' => [ + 'smtp', + 'log', + ], + ], + ], /* |-------------------------------------------------------------------------- @@ -55,75 +91,10 @@ return [ */ 'from' => [ - 'address' => env('MAIL_FROM'), - 'name' => env('MAIL_FROM_NAME', 'Pterodactyl Panel'), + 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), + 'name' => env('MAIL_FROM_NAME', 'Example'), ], - /* - |-------------------------------------------------------------------------- - | E-Mail Encryption Protocol - |-------------------------------------------------------------------------- - | - | Here you may specify the encryption protocol that should be used when - | the application send e-mail messages. A sensible default using the - | transport layer security protocol should provide great security. - | - */ - - 'encryption' => env('MAIL_ENCRYPTION', 'tls'), - - /* - |-------------------------------------------------------------------------- - | SMTP Server Username - |-------------------------------------------------------------------------- - | - | If your SMTP server requires a username for authentication, you should - | set it here. This will get used to authenticate with your server on - | connection. You may also set the "password" value below this one. - | - */ - - 'username' => env('MAIL_USERNAME'), - - /* - |-------------------------------------------------------------------------- - | SMTP Server Password - |-------------------------------------------------------------------------- - | - | Here you may set the password required by your SMTP server to send out - | messages from your application. This will be given to the server on - | connection so that the application will be able to send messages. - | - */ - - 'password' => env('MAIL_PASSWORD'), - - /* - |-------------------------------------------------------------------------- - | Sendmail System Path - |-------------------------------------------------------------------------- - | - | When using the "sendmail" driver to send e-mails, we will need to know - | the path to where Sendmail lives on this server. A default path has - | been provided here, which will work well on most of your systems. - | - */ - - 'sendmail' => '/usr/sbin/sendmail -bs', - - /* - |-------------------------------------------------------------------------- - | Mail "Pretend" - |-------------------------------------------------------------------------- - | - | When this option is enabled, e-mail will not actually be sent over the - | web and will instead be written to your application's logs files so - | you may inspect the message. This is great for local development. - | - */ - - 'pretend' => false, - /* |-------------------------------------------------------------------------- | Markdown Mail Settings @@ -134,6 +105,7 @@ return [ | of the emails. Or, you may simply stick with the Laravel defaults! | */ + 'markdown' => [ 'theme' => 'default', diff --git a/config/pterodactyl.php b/config/pterodactyl.php index 5bca4a3eb..58c58bc9e 100644 --- a/config/pterodactyl.php +++ b/config/pterodactyl.php @@ -10,6 +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), /* @@ -21,6 +22,7 @@ return [ | author of custom services, and make upgrades easier by identifying | standard Pterodactyl shipped services. */ + 'service' => [ 'author' => env('APP_SERVICE_AUTHOR', 'unknown@unknown.com'), ], @@ -32,6 +34,7 @@ return [ | | Should login success and failure events trigger an email to the user? */ + 'auth' => [ '2fa_required' => env('APP_2FA_REQUIRED', 0), '2fa' => [ @@ -49,6 +52,7 @@ return [ | Certain pagination result counts can be configured here and will take | effect globally. */ + 'paginate' => [ 'frontend' => [ 'servers' => env('APP_PAGINATE_FRONT_SERVERS', 15), @@ -64,18 +68,6 @@ return [ ], ], - /* - |-------------------------------------------------------------------------- - | API Options - |-------------------------------------------------------------------------- - | - | Configuration options for the API. - */ - 'api' => [ - 'include_on_list' => env('API_INCLUDE_ON_LIST', false), - 'key_expire_time' => env('API_KEY_EXPIRE_TIME', 60 * 12), - ], - /* |-------------------------------------------------------------------------- | Guzzle Connections @@ -83,36 +75,12 @@ return [ | | Configure the timeout to be used for Guzzle connections here. */ + 'guzzle' => [ 'timeout' => env('GUZZLE_TIMEOUT', 15), 'connect_timeout' => env('GUZZLE_CONNECT_TIMEOUT', 5), ], - /* - |-------------------------------------------------------------------------- - | Queue Names - |-------------------------------------------------------------------------- - | - | Configure the names of queues to be used in the database. - */ - 'queues' => [ - 'low' => env('QUEUE_LOW', 'low'), - 'standard' => env('QUEUE_STANDARD', 'standard'), - 'high' => env('QUEUE_HIGH', 'high'), - ], - - /* - |-------------------------------------------------------------------------- - | Task Timers - |-------------------------------------------------------------------------- - | - | The amount of time in minutes before performing certain actions on the system. - */ - 'tasks' => [ - 'clear_log' => env('PTERODACTYL_CLEAR_TASKLOG', 720), - 'delete_server' => env('PTERODACTYL_DELETE_MINUTES', 10), - ], - /* |-------------------------------------------------------------------------- | CDN @@ -121,6 +89,7 @@ return [ | Information for the panel to use when contacting the CDN to confirm | if panel is up to date. */ + 'cdn' => [ 'cache_time' => 60, 'url' => 'https://cdn.pterodactyl.io/releases/latest.json', @@ -133,6 +102,7 @@ return [ | | Allow clients to create their own databases. */ + 'client_features' => [ 'databases' => [ 'enabled' => env('PTERODACTYL_CLIENT_DATABASES_ENABLED', true), @@ -158,26 +128,11 @@ return [ | | This array includes the MIME filetypes that can be edited via the web. */ + 'files' => [ 'max_edit_size' => env('PTERODACTYL_FILES_MAX_EDIT_SIZE', 1024 * 1024 * 4), ], - /* - |-------------------------------------------------------------------------- - | JSON Response Routes - |-------------------------------------------------------------------------- - | - | You should not edit this block. These routes are ajax based routes that - | expect content to be returned in JSON format. - */ - 'json_routes' => [ - 'api/*', - 'daemon/*', - 'remote/*', - ], - - 'default_api_version' => 'application/vnd.pterodactyl.v1+json', - /* |-------------------------------------------------------------------------- | Dynamic Environment Variables @@ -191,6 +146,7 @@ return [ | | 'P_SERVER_CREATED_AT' => 'created_at' */ + 'environment_variables' => [ 'P_SERVER_ALLOCATION_LIMIT' => 'allocation_limit', ], @@ -202,6 +158,7 @@ return [ | | This section controls the output format for JS & CSS assets. */ + 'assets' => [ 'use_hash' => env('PTERODACTYL_USE_ASSET_HASH', false), ], @@ -213,6 +170,7 @@ return [ | | This section controls what notifications are sent to users. */ + 'email' => [ // Should an email be sent to a server owner once their server has completed it's first install process? 'send_install_notification' => env('PTERODACTYL_SEND_INSTALL_NOTIFICATION', true), diff --git a/config/queue.php b/config/queue.php index 02588bb3e..35585df0e 100644 --- a/config/queue.php +++ b/config/queue.php @@ -3,14 +3,12 @@ return [ /* |-------------------------------------------------------------------------- - | Default Queue Driver + | Default Queue Connection Name |-------------------------------------------------------------------------- | | Laravel's queue API supports an assortment of back-ends via a single | API, giving you convenient access to each back-end using the same - | syntax for each one. Here you may set the default queue driver. - | - | Supported: "sync", "database", "beanstalkd", "sqs", "redis", "null" + | syntax for every one. Here you may define a default connection. | */ @@ -35,24 +33,29 @@ return [ 'database' => [ 'driver' => 'database', 'table' => 'jobs', - 'queue' => env('QUEUE_STANDARD', 'standard'), + 'queue' => 'default', 'retry_after' => 90, + 'after_commit' => false, ], 'sqs' => [ 'driver' => 'sqs', - 'key' => env('SQS_KEY'), - 'secret' => env('SQS_SECRET'), - 'prefix' => env('SQS_QUEUE_PREFIX'), - 'queue' => env('QUEUE_STANDARD', 'standard'), - 'region' => env('SQS_REGION', 'us-east-1'), + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), + 'queue' => env('SQS_QUEUE', 'default'), + 'suffix' => env('SQS_SUFFIX'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), + 'after_commit' => false, ], 'redis' => [ 'driver' => 'redis', 'connection' => 'default', - 'queue' => env('QUEUE_STANDARD', 'standard'), + 'queue' => env('REDIS_QUEUE', 'default'), 'retry_after' => 90, + 'block_for' => null, + 'after_commit' => false, ], ], @@ -68,7 +71,8 @@ return [ */ 'failed' => [ - 'database' => 'mysql', + 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), + 'database' => env('DB_CONNECTION', 'mysql'), 'table' => 'failed_jobs', ], ]; diff --git a/config/services.php b/config/services.php index acaabc5fa..5cc6e06e2 100644 --- a/config/services.php +++ b/config/services.php @@ -3,33 +3,30 @@ return [ /* |-------------------------------------------------------------------------- - | Third Party Service + | Third Party Services |-------------------------------------------------------------------------- | | This file is for storing the credentials for third party services such - | as Stripe, Mailgun, Mandrill, and others. This file provides a sane - | default location for this type of information, allowing packages - | to have a conventional place to find your various credentials. + | as Mailgun, Postmark, AWS and more. This file provides the de facto + | location for this type of information, allowing packages to have + | a conventional file to locate the various service credentials. | */ 'mailgun' => [ 'domain' => env('MAILGUN_DOMAIN'), 'secret' => env('MAILGUN_SECRET'), - 'endpoint' => env('MAILGUN_ENDPOINT'), + 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), + 'scheme' => 'https', ], - 'mandrill' => [ - 'secret' => env('MANDRILL_SECRET'), + 'postmark' => [ + 'token' => env('POSTMARK_TOKEN'), ], 'ses' => [ - 'key' => env('SES_KEY'), - 'secret' => env('SES_SECRET'), - 'region' => env('SES_REGION', 'us-east-1'), - ], - - 'sparkpost' => [ - 'secret' => env('SPARKPOST_SECRET'), + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], ]; diff --git a/config/session.php b/config/session.php index 058528e5f..d8fb98a09 100644 --- a/config/session.php +++ b/config/session.php @@ -1,5 +1,7 @@ env('SESSION_DRIVER') === 'redis' ? 'sessions' : null, + 'connection' => env('SESSION_CONNECTION'), /* |-------------------------------------------------------------------------- @@ -88,13 +91,15 @@ return [ | Session Cache Store |-------------------------------------------------------------------------- | - | When using the "apc" or "memcached" session drivers, you may specify a - | cache store that should be used for these sessions. This value must - | correspond with one of the application's configured cache stores. + | While using one of the framework's cache driven session backends you may + | list a cache store that should be used for these sessions. This value + | must match with one of the application's configured cache "stores". + | + | Affects: "apc", "dynamodb", "memcached", "redis" | */ - 'store' => null, + 'store' => env('SESSION_STORE'), /* |-------------------------------------------------------------------------- @@ -120,7 +125,10 @@ return [ | */ - 'cookie' => env('SESSION_COOKIE', str_slug(env('APP_NAME', 'pterodactyl'), '_') . '_session'), + 'cookie' => env( + 'SESSION_COOKIE', + Str::slug(env('APP_NAME', 'pterodactyl'), '_') . '_session' + ), /* |-------------------------------------------------------------------------- @@ -155,11 +163,11 @@ return [ | | By setting this option to true, session cookies will only be sent back | to the server if the browser has a HTTPS connection. This will keep - | the cookie from being sent to you if it can not be done securely. + | the cookie from being sent to you when it can't be done securely. | */ - 'secure' => env('SESSION_SECURE_COOKIE', false), + 'secure' => env('SESSION_SECURE_COOKIE'), /* |-------------------------------------------------------------------------- @@ -181,9 +189,9 @@ return [ | | This option determines how your cookies behave when cross-site requests | take place, and can be used to mitigate CSRF attacks. By default, we - | do not enable this as other CSRF protection services are in place. + | will set this value to "lax" since this is a secure default value. | - | Supported: "lax", "strict" + | Supported: "lax", "strict", "none", null | */ diff --git a/config/view.php b/config/view.php index 8796b0abc..24dea7a4a 100644 --- a/config/view.php +++ b/config/view.php @@ -27,5 +27,8 @@ return [ | */ - 'compiled' => realpath(storage_path('framework/views')), + 'compiled' => env( + 'VIEW_COMPILED_PATH', + realpath(storage_path('framework/views')) + ), ]; diff --git a/config/vue-i18n-generator.php b/config/vue-i18n-generator.php deleted file mode 100644 index 92a20fd73..000000000 --- a/config/vue-i18n-generator.php +++ /dev/null @@ -1,50 +0,0 @@ - '/resources/lang', - - /* - |-------------------------------------------------------------------------- - | Laravel translation files - |-------------------------------------------------------------------------- - | - | You can choose which translation files to be generated. - | Note: leave this empty for all the translation files to be generated. - | - */ - - 'langFiles' => [], - - /* - |-------------------------------------------------------------------------- - | Output file - |-------------------------------------------------------------------------- - | - | The javascript path where I will place the generated file. - | Note: the path will be prepended to point to the App directory. - | - */ - 'jsPath' => '/resources/lang/i18n', - 'jsFile' => '/resources/lang/locales.js', - - /* - |-------------------------------------------------------------------------- - | i18n library - |-------------------------------------------------------------------------- - | - | Specify the library you use for localization. - | Options are vue-i18n or vuex-i18n. - | - */ - 'i18nLib' => 'vuex-i18n', -]; diff --git a/database/Factories/AllocationFactory.php b/database/Factories/AllocationFactory.php index c65298ec4..4a5eb70c0 100644 --- a/database/Factories/AllocationFactory.php +++ b/database/Factories/AllocationFactory.php @@ -22,7 +22,7 @@ class AllocationFactory extends Factory { return [ 'ip' => $this->faker->unique()->ipv4, - 'port' => $this->faker->unique()->numberBetween(10000, 20000), + 'port' => $this->faker->unique()->numberBetween(1024, 65535), ]; } diff --git a/database/migrations/2017_03_10_173607_MigrateToNewServiceSystem.php b/database/migrations/2017_03_10_173607_MigrateToNewServiceSystem.php index c786ab468..7cf5707c4 100644 --- a/database/migrations/2017_03_10_173607_MigrateToNewServiceSystem.php +++ b/database/migrations/2017_03_10_173607_MigrateToNewServiceSystem.php @@ -1,11 +1,5 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ + use Illuminate\Database\Migrations\Migration; class MigrateToNewServiceSystem extends Migration diff --git a/database/migrations/2017_11_11_161922_Add2FaLastAuthorizationTimeColumn.php b/database/migrations/2017_11_11_161922_Add2FaLastAuthorizationTimeColumn.php index 53cb6526b..b90b150bd 100644 --- a/database/migrations/2017_11_11_161922_Add2FaLastAuthorizationTimeColumn.php +++ b/database/migrations/2017_11_11_161922_Add2FaLastAuthorizationTimeColumn.php @@ -27,7 +27,7 @@ class Add2FaLastAuthorizationTimeColumn extends Migration DB::table('users')->where('id', $user->id)->update([ 'totp_secret' => Crypt::encrypt($user->totp_secret), - 'updated_at' => Carbon::now()->toIso8601String(), + 'updated_at' => Carbon::now()->toAtomString(), ]); }); }); @@ -46,7 +46,7 @@ class Add2FaLastAuthorizationTimeColumn extends Migration DB::table('users')->where('id', $user->id)->update([ 'totp_secret' => Crypt::decrypt($user->totp_secret), - 'updated_at' => Carbon::now()->toIso8601String(), + 'updated_at' => Carbon::now()->toAtomString(), ]); }); }); diff --git a/phpunit.xml b/phpunit.xml index b3210d5da..d02831cf4 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,9 +1,10 @@ - @@ -19,13 +20,12 @@ - - - - - - - - + + + + + + + diff --git a/public/.gitignore b/public/.gitignore index 31c19f1c1..477f0a162 100644 --- a/public/.gitignore +++ b/public/.gitignore @@ -1,3 +1,4 @@ +assets assets/* !assets/svgs !assets/svgs/*.svg diff --git a/resources/lang/en/admin/nests.php b/resources/lang/en/admin/nests.php index 19e6b5a1e..2a6f37707 100644 --- a/resources/lang/en/admin/nests.php +++ b/resources/lang/en/admin/nests.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ return [ 'notices' => [ diff --git a/resources/lang/en/admin/node.php b/resources/lang/en/admin/node.php index 5d59e41ce..cffd4d737 100644 --- a/resources/lang/en/admin/node.php +++ b/resources/lang/en/admin/node.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ return [ 'validation' => [ diff --git a/resources/lang/en/admin/server.php b/resources/lang/en/admin/server.php index 6e3ce9f94..29cb72d18 100644 --- a/resources/lang/en/admin/server.php +++ b/resources/lang/en/admin/server.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ return [ 'exceptions' => [ diff --git a/resources/lang/en/admin/user.php b/resources/lang/en/admin/user.php index b7f756cb4..65e227806 100644 --- a/resources/lang/en/admin/user.php +++ b/resources/lang/en/admin/user.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ return [ 'exceptions' => [ diff --git a/resources/views/admin/databases/index.blade.php b/resources/views/admin/databases/index.blade.php index df1d13bb7..e4c69c513 100644 --- a/resources/views/admin/databases/index.blade.php +++ b/resources/views/admin/databases/index.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/databases/view.blade.php b/resources/views/admin/databases/view.blade.php index 184d6c72c..e105751a0 100644 --- a/resources/views/admin/databases/view.blade.php +++ b/resources/views/admin/databases/view.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/eggs/new.blade.php b/resources/views/admin/eggs/new.blade.php index e630eab18..9a0a07849 100644 --- a/resources/views/admin/eggs/new.blade.php +++ b/resources/views/admin/eggs/new.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/eggs/scripts.blade.php b/resources/views/admin/eggs/scripts.blade.php index 9b82b6d5d..5bbc9ee3a 100644 --- a/resources/views/admin/eggs/scripts.blade.php +++ b/resources/views/admin/eggs/scripts.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/eggs/variables.blade.php b/resources/views/admin/eggs/variables.blade.php index 2441c725f..fbc14781e 100644 --- a/resources/views/admin/eggs/variables.blade.php +++ b/resources/views/admin/eggs/variables.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/eggs/view.blade.php b/resources/views/admin/eggs/view.blade.php index f64fde659..b999d2a91 100644 --- a/resources/views/admin/eggs/view.blade.php +++ b/resources/views/admin/eggs/view.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/index.blade.php b/resources/views/admin/index.blade.php index 6c1364a71..ed26a92ab 100644 --- a/resources/views/admin/index.blade.php +++ b/resources/views/admin/index.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/locations/index.blade.php b/resources/views/admin/locations/index.blade.php index 3d5128db2..c54ffe0fa 100644 --- a/resources/views/admin/locations/index.blade.php +++ b/resources/views/admin/locations/index.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/locations/view.blade.php b/resources/views/admin/locations/view.blade.php index 2264ee694..f34dcf3f5 100644 --- a/resources/views/admin/locations/view.blade.php +++ b/resources/views/admin/locations/view.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/mounts/index.blade.php b/resources/views/admin/mounts/index.blade.php index 067fe30a5..a3b989243 100644 --- a/resources/views/admin/mounts/index.blade.php +++ b/resources/views/admin/mounts/index.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') diff --git a/resources/views/admin/mounts/view.blade.php b/resources/views/admin/mounts/view.blade.php index f53007f3f..96a156d24 100644 --- a/resources/views/admin/mounts/view.blade.php +++ b/resources/views/admin/mounts/view.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') diff --git a/resources/views/admin/nests/index.blade.php b/resources/views/admin/nests/index.blade.php index b45f1187f..4bb6ae784 100644 --- a/resources/views/admin/nests/index.blade.php +++ b/resources/views/admin/nests/index.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/nests/new.blade.php b/resources/views/admin/nests/new.blade.php index a93911be7..9a1cb0edc 100644 --- a/resources/views/admin/nests/new.blade.php +++ b/resources/views/admin/nests/new.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/nests/view.blade.php b/resources/views/admin/nests/view.blade.php index 0305ec10f..9a6730746 100644 --- a/resources/views/admin/nests/view.blade.php +++ b/resources/views/admin/nests/view.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/nodes/index.blade.php b/resources/views/admin/nodes/index.blade.php index 524d81107..a4747b3fc 100644 --- a/resources/views/admin/nodes/index.blade.php +++ b/resources/views/admin/nodes/index.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/nodes/new.blade.php b/resources/views/admin/nodes/new.blade.php index 1dcdca7c9..3e10be5a1 100644 --- a/resources/views/admin/nodes/new.blade.php +++ b/resources/views/admin/nodes/new.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/nodes/view/allocation.blade.php b/resources/views/admin/nodes/view/allocation.blade.php index 83ac9c6c6..396428b61 100644 --- a/resources/views/admin/nodes/view/allocation.blade.php +++ b/resources/views/admin/nodes/view/allocation.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/nodes/view/configuration.blade.php b/resources/views/admin/nodes/view/configuration.blade.php index 35e3f5f0a..1bbf15f33 100644 --- a/resources/views/admin/nodes/view/configuration.blade.php +++ b/resources/views/admin/nodes/view/configuration.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/nodes/view/index.blade.php b/resources/views/admin/nodes/view/index.blade.php index 3cfe90384..9ef461076 100644 --- a/resources/views/admin/nodes/view/index.blade.php +++ b/resources/views/admin/nodes/view/index.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/nodes/view/settings.blade.php b/resources/views/admin/nodes/view/settings.blade.php index 7c66cdc75..e4848aca3 100644 --- a/resources/views/admin/nodes/view/settings.blade.php +++ b/resources/views/admin/nodes/view/settings.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') @@ -242,4 +237,4 @@ }); $('select[name="location_id"]').select2(); -@endsection \ No newline at end of file +@endsection diff --git a/resources/views/admin/servers/index.blade.php b/resources/views/admin/servers/index.blade.php index e152158ce..4d5ebcdcd 100644 --- a/resources/views/admin/servers/index.blade.php +++ b/resources/views/admin/servers/index.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/servers/new.blade.php b/resources/views/admin/servers/new.blade.php index 51b1b3cca..bbe779ce6 100644 --- a/resources/views/admin/servers/new.blade.php +++ b/resources/views/admin/servers/new.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/servers/view/build.blade.php b/resources/views/admin/servers/view/build.blade.php index 8add287be..f7ba9a2d2 100644 --- a/resources/views/admin/servers/view/build.blade.php +++ b/resources/views/admin/servers/view/build.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/servers/view/database.blade.php b/resources/views/admin/servers/view/database.blade.php index 93916584c..385ce0f3f 100644 --- a/resources/views/admin/servers/view/database.blade.php +++ b/resources/views/admin/servers/view/database.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/servers/view/delete.blade.php b/resources/views/admin/servers/view/delete.blade.php index 2060f2785..c23709632 100644 --- a/resources/views/admin/servers/view/delete.blade.php +++ b/resources/views/admin/servers/view/delete.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') @@ -77,7 +72,7 @@ $('#deleteform').submit() }); }); - + $('#forcedeletebtn').click(function (event) { event.preventDefault(); swal({ diff --git a/resources/views/admin/servers/view/details.blade.php b/resources/views/admin/servers/view/details.blade.php index a3d6be628..9b4464b2c 100644 --- a/resources/views/admin/servers/view/details.blade.php +++ b/resources/views/admin/servers/view/details.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/servers/view/index.blade.php b/resources/views/admin/servers/view/index.blade.php index e246b6cd3..e9b95f985 100644 --- a/resources/views/admin/servers/view/index.blade.php +++ b/resources/views/admin/servers/view/index.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/servers/view/manage.blade.php b/resources/views/admin/servers/view/manage.blade.php index abea741f0..e6177a43b 100644 --- a/resources/views/admin/servers/view/manage.blade.php +++ b/resources/views/admin/servers/view/manage.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/servers/view/startup.blade.php b/resources/views/admin/servers/view/startup.blade.php index 3dccdfda2..05330298e 100644 --- a/resources/views/admin/servers/view/startup.blade.php +++ b/resources/views/admin/servers/view/startup.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/users/index.blade.php b/resources/views/admin/users/index.blade.php index efde3ba4c..0c8e906c3 100644 --- a/resources/views/admin/users/index.blade.php +++ b/resources/views/admin/users/index.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/users/new.blade.php b/resources/views/admin/users/new.blade.php index bf006a82d..2ff50164d 100644 --- a/resources/views/admin/users/new.blade.php +++ b/resources/views/admin/users/new.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/admin/users/view.blade.php b/resources/views/admin/users/view.blade.php index d1e6ba9aa..f042d892d 100644 --- a/resources/views/admin/users/view.blade.php +++ b/resources/views/admin/users/view.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} @extends('layouts.admin') @section('title') diff --git a/resources/views/layouts/admin.blade.php b/resources/views/layouts/admin.blade.php index faadc2c89..1543ddf72 100644 --- a/resources/views/layouts/admin.blade.php +++ b/resources/views/layouts/admin.blade.php @@ -1,8 +1,3 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} diff --git a/server.php b/server.php deleted file mode 100644 index de038652f..000000000 --- a/server.php +++ /dev/null @@ -1,19 +0,0 @@ - - */ -$uri = urldecode( - parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) -); - -// This file allows us to emulate Apache's "mod_rewrite" functionality from the -// built-in PHP web server. This provides a convenient way to test a Laravel -// application without having installed a "real" web server software here. -if ($uri !== '/' && file_exists(__DIR__ . '/public' . $uri)) { - return false; -} - -require_once __DIR__ . '/public/index.php'; diff --git a/tests/Assertions/AssertsActivityLogged.php b/tests/Assertions/AssertsActivityLogged.php index 20571c6b2..7c3232418 100644 --- a/tests/Assertions/AssertsActivityLogged.php +++ b/tests/Assertions/AssertsActivityLogged.php @@ -31,10 +31,8 @@ trait AssertsActivityLogged /** * Asserts that a given activity log event was stored with the subjects being * any of the values provided. - * - * @param \Illuminate\Database\Eloquent\Model|array $subjects */ - public function assertActivitySubjects(string $event, $subjects): void + public function assertActivitySubjects(string $event, Model|array $subjects): void { if (is_array($subjects)) { \Webmozart\Assert\Assert::lessThanEq(count(func_get_args()), 2, 'Invalid call to ' . __METHOD__ . ': cannot provide additional arguments if providing an array.'); diff --git a/tests/Assertions/MiddlewareAttributeAssertionsTrait.php b/tests/Assertions/MiddlewareAttributeAssertionsTrait.php index bd5ec0d1d..a74f541ea 100644 --- a/tests/Assertions/MiddlewareAttributeAssertionsTrait.php +++ b/tests/Assertions/MiddlewareAttributeAssertionsTrait.php @@ -9,7 +9,7 @@ trait MiddlewareAttributeAssertionsTrait /** * Assert a request has an attribute assigned to it. */ - public function assertRequestHasAttribute(string $attribute) + public function assertRequestHasAttribute(string $attribute): void { Assert::assertTrue($this->request->attributes->has($attribute), 'Assert that request mock has ' . $attribute . ' attribute.'); } @@ -17,17 +17,15 @@ trait MiddlewareAttributeAssertionsTrait /** * Assert a request does not have an attribute assigned to it. */ - public function assertRequestMissingAttribute(string $attribute) + public function assertRequestMissingAttribute(string $attribute): void { Assert::assertFalse($this->request->attributes->has($attribute), 'Assert that request mock does not have ' . $attribute . ' attribute.'); } /** * Assert a request attribute matches an expected value. - * - * @param mixed $expected */ - public function assertRequestAttributeEquals($expected, string $attribute) + public function assertRequestAttributeEquals(mixed $expected, string $attribute): void { Assert::assertEquals($expected, $this->request->attributes->get($attribute)); } diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php index b7ff2256c..e9dc91089 100644 --- a/tests/CreatesApplication.php +++ b/tests/CreatesApplication.php @@ -2,16 +2,15 @@ namespace Pterodactyl\Tests; +use Illuminate\Foundation\Application; use Illuminate\Contracts\Console\Kernel; trait CreatesApplication { /** * Creates the application. - * - * @return \Illuminate\Foundation\Application */ - public function createApplication() + public function createApplication(): Application { $app = require __DIR__ . '/../bootstrap/app.php'; diff --git a/tests/Integration/Api/Application/ApplicationApiIntegrationTestCase.php b/tests/Integration/Api/Application/ApplicationApiIntegrationTestCase.php index bc919cdc3..73a4f8f51 100644 --- a/tests/Integration/Api/Application/ApplicationApiIntegrationTestCase.php +++ b/tests/Integration/Api/Application/ApplicationApiIntegrationTestCase.php @@ -20,15 +20,9 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase use DatabaseTransactions; use IntegrationJsonRequestAssertions; - /** - * @var \Pterodactyl\Models\ApiKey - */ - private $key; + private ApiKey $key; - /** - * @var \Pterodactyl\Models\User - */ - private $user; + private User $user; /** * Bootstrap application API tests. Creates a default admin user and associated API key diff --git a/tests/Integration/Api/Application/Location/LocationControllerTest.php b/tests/Integration/Api/Application/Location/LocationControllerTest.php index ef3ff3e63..ed75413ac 100644 --- a/tests/Integration/Api/Application/Location/LocationControllerTest.php +++ b/tests/Integration/Api/Application/Location/LocationControllerTest.php @@ -161,7 +161,7 @@ class LocationControllerTest extends ApplicationApiIntegrationTestCase } /** - * Test that all of the defined relationships for a location can be loaded successfully. + * Test that all the defined relationships for a location can be loaded successfully. */ public function testRelationshipsCanBeLoaded() { diff --git a/tests/Integration/Api/Application/Nests/EggControllerTest.php b/tests/Integration/Api/Application/Nests/EggControllerTest.php index c513535f6..07a527e0f 100644 --- a/tests/Integration/Api/Application/Nests/EggControllerTest.php +++ b/tests/Integration/Api/Application/Nests/EggControllerTest.php @@ -49,7 +49,7 @@ class EggControllerTest extends ApplicationApiIntegrationTestCase $this->assertSame( $expected, $actual, - 'Unable to find JSON fragment: ' . PHP_EOL . PHP_EOL . "[{$expected}]" . PHP_EOL . PHP_EOL . 'within' . PHP_EOL . PHP_EOL . "[{$actual}]." + 'Unable to find JSON fragment: ' . PHP_EOL . PHP_EOL . "[$expected]" . PHP_EOL . PHP_EOL . 'within' . PHP_EOL . PHP_EOL . "[$actual]." ); } } @@ -77,7 +77,7 @@ class EggControllerTest extends ApplicationApiIntegrationTestCase } /** - * Test that a single egg and all of the defined relationships can be returned. + * Test that a single egg and all the defined relationships can be returned. */ public function testReturnSingleEggWithRelationships() { diff --git a/tests/Integration/Api/Application/Nests/NestControllerTest.php b/tests/Integration/Api/Application/Nests/NestControllerTest.php index b3e1def6d..799fc18ac 100644 --- a/tests/Integration/Api/Application/Nests/NestControllerTest.php +++ b/tests/Integration/Api/Application/Nests/NestControllerTest.php @@ -9,10 +9,7 @@ use Pterodactyl\Tests\Integration\Api\Application\ApplicationApiIntegrationTestC class NestControllerTest extends ApplicationApiIntegrationTestCase { - /** - * @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface - */ - private $repository; + private NestRepositoryInterface $repository; /** * Setup tests. @@ -25,7 +22,7 @@ class NestControllerTest extends ApplicationApiIntegrationTestCase } /** - * Test that the expected nests are returned in the request. + * Test that the expected nests are returned by the request. */ public function testNestResponse() { diff --git a/tests/Integration/Api/Application/Users/UserControllerTest.php b/tests/Integration/Api/Application/Users/UserControllerTest.php index 44a739db2..713f6264a 100644 --- a/tests/Integration/Api/Application/Users/UserControllerTest.php +++ b/tests/Integration/Api/Application/Users/UserControllerTest.php @@ -55,7 +55,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase 'first_name' => $this->getApiUser()->name_first, 'last_name' => $this->getApiUser()->name_last, 'language' => $this->getApiUser()->language, - 'root_admin' => (bool) $this->getApiUser()->root_admin, + 'root_admin' => $this->getApiUser()->root_admin, '2fa' => (bool) $this->getApiUser()->totp_enabled, 'created_at' => $this->formatTimestamp($this->getApiUser()->created_at), 'updated_at' => $this->formatTimestamp($this->getApiUser()->updated_at), diff --git a/tests/Integration/Api/Client/AccountControllerTest.php b/tests/Integration/Api/Client/AccountControllerTest.php index 6505f43f1..0fe1813a3 100644 --- a/tests/Integration/Api/Client/AccountControllerTest.php +++ b/tests/Integration/Api/Client/AccountControllerTest.php @@ -52,7 +52,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase } /** - * Tests that an email is not updated if the password provided in the reuqest is not + * Tests that an email is not updated if the password provided in the request is not * valid for the account. */ public function testEmailIsNotUpdatedWhenPasswordIsInvalid() diff --git a/tests/Integration/Api/Client/ApiKeyControllerTest.php b/tests/Integration/Api/Client/ApiKeyControllerTest.php index 78e662cec..9aa515f9b 100644 --- a/tests/Integration/Api/Client/ApiKeyControllerTest.php +++ b/tests/Integration/Api/Client/ApiKeyControllerTest.php @@ -52,7 +52,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase /** @var \Pterodactyl\Models\User $user */ $user = User::factory()->create(); - // Small sub-test to ensure we're always comparing the number of keys to the + // Small subtest 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. ApiKey::factory()->times(10)->create([ @@ -218,7 +218,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase } /** - * Tests that an application API key also belonging to the logged in user cannot be + * Tests that an application API key also belonging to the logged-in user cannot be * deleted through this endpoint if it exists. */ public function testApplicationApiKeyCannotBeDeleted() diff --git a/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php b/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php index b7379f4de..25b5c30cd 100644 --- a/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php +++ b/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php @@ -7,6 +7,7 @@ use Pterodactyl\Models\Node; use Pterodactyl\Models\Task; use Pterodactyl\Models\User; use InvalidArgumentException; +use Pterodactyl\Models\Model; use Pterodactyl\Models\Backup; use Pterodactyl\Models\Server; use Pterodactyl\Models\Database; @@ -17,6 +18,7 @@ use Pterodactyl\Models\Allocation; use Pterodactyl\Models\DatabaseHost; use Pterodactyl\Tests\Integration\TestResponse; use Pterodactyl\Tests\Integration\IntegrationTestCase; +use Illuminate\Database\Eloquent\Model as EloquentModel; use Pterodactyl\Transformers\Api\Client\BaseClientTransformer; abstract class ClientApiIntegrationTestCase extends IntegrationTestCase @@ -53,27 +55,24 @@ abstract class ClientApiIntegrationTestCase extends IntegrationTestCase /** * Returns a link to the specific resource using the client API. - * - * @param mixed $model - * @param string|null $append */ - protected function link($model, $append = null): string + protected function link(mixed $model, string $append = null): string { switch (get_class($model)) { case Server::class: - $link = "/api/client/servers/{$model->uuid}"; + $link = "/api/client/servers/$model->uuid"; break; case Schedule::class: - $link = "/api/client/servers/{$model->server->uuid}/schedules/{$model->id}"; + $link = "/api/client/servers/{$model->server->uuid}/schedules/$model->id"; break; case Task::class: - $link = "/api/client/servers/{$model->schedule->server->uuid}/schedules/{$model->schedule->id}/tasks/{$model->id}"; + $link = "/api/client/servers/{$model->schedule->server->uuid}/schedules/{$model->schedule->id}/tasks/$model->id"; break; case Allocation::class: - $link = "/api/client/servers/{$model->server->uuid}/network/allocations/{$model->id}"; + $link = "/api/client/servers/{$model->server->uuid}/network/allocations/$model->id"; break; case Backup::class: - $link = "/api/client/servers/{$model->server->uuid}/backups/{$model->uuid}"; + $link = "/api/client/servers/{$model->server->uuid}/backups/$model->uuid"; break; default: throw new InvalidArgumentException(sprintf('Cannot create link for Model of type %s', class_basename($model))); @@ -85,10 +84,8 @@ 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 \Pterodactyl\Models\Model|\Illuminate\Database\Eloquent\Model $model */ - protected function assertJsonTransformedWith(array $data, $model) + protected function assertJsonTransformedWith(array $data, Model|EloquentModel $model) { $reflect = new ReflectionClass($model); $transformer = sprintf('\\Pterodactyl\\Transformers\\Api\\Client\\%sTransformer', $reflect->getShortName()); diff --git a/tests/Integration/Api/Client/ClientControllerTest.php b/tests/Integration/Api/Client/ClientControllerTest.php index 3ab6b1912..033b893c3 100644 --- a/tests/Integration/Api/Client/ClientControllerTest.php +++ b/tests/Integration/Api/Client/ClientControllerTest.php @@ -11,7 +11,7 @@ use Pterodactyl\Models\Permission; class ClientControllerTest extends ClientApiIntegrationTestCase { /** - * Test that only the servers a logged in user is assigned to are returned by the + * Test that only the servers a logged-in user is assigned to are returned by the * API endpoint. Obviously there are cases such as being an administrator or being * a subuser, but for this test we just want to test a basic scenario and pretend * subusers do not exist at all. @@ -241,7 +241,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase ]); // Only servers 2 & 3 (0 indexed) should be returned by the API at this point. The user making - // the request is the owner of server 0, and a subuser of server 1 so they should be exluded. + // the request is the owner of server 0, and a subuser of server 1, so they should be excluded. $response = $this->actingAs($users[0])->getJson('/api/client?type=admin'); $response->assertOk(); @@ -286,10 +286,9 @@ class ClientControllerTest extends ClientApiIntegrationTestCase * Test that no servers get returned if the user requests all admin level servers by using * ?type=admin or ?type=admin-all in the request. * - * @param string $type * @dataProvider filterTypeDataProvider */ - public function testNoServersAreReturnedIfAdminFilterIsPassedByRegularUser($type) + public function testNoServersAreReturnedIfAdminFilterIsPassedByRegularUser(string $type) { /** @var \Pterodactyl\Models\User[] $users */ $users = User::factory()->times(3)->create(); @@ -332,10 +331,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase $response->assertJsonPath('data.0.attributes.relationships.allocations.data.0.attributes.notes', null); } - /** - * @return array - */ - public function filterTypeDataProvider() + public function filterTypeDataProvider(): array { return [['admin'], ['admin-all']]; } diff --git a/tests/Integration/Api/Client/Server/Allocation/AllocationAuthorizationTest.php b/tests/Integration/Api/Client/Server/Allocation/AllocationAuthorizationTest.php index b698d8c7e..11ad2fa83 100644 --- a/tests/Integration/Api/Client/Server/Allocation/AllocationAuthorizationTest.php +++ b/tests/Integration/Api/Client/Server/Allocation/AllocationAuthorizationTest.php @@ -46,9 +46,6 @@ class AllocationAuthorizationTest extends ClientApiIntegrationTestCase $this->actingAs($user)->json($method, $this->link($server3, '/network/allocations/' . $allocation3->id . $endpoint))->assertNotFound(); } - /** - * @return \string[][] - */ public function methodDataProvider(): array { return [ diff --git a/tests/Integration/Api/Client/Server/Allocation/CreateNewAllocationTest.php b/tests/Integration/Api/Client/Server/Allocation/CreateNewAllocationTest.php index 6b8da4048..1abb106cd 100644 --- a/tests/Integration/Api/Client/Server/Allocation/CreateNewAllocationTest.php +++ b/tests/Integration/Api/Client/Server/Allocation/CreateNewAllocationTest.php @@ -72,7 +72,7 @@ class CreateNewAllocationTest extends ClientApiIntegrationTestCase } /** - * Test that an allocation cannot be created if the server has reached it's allocation limit. + * Test that an allocation cannot be created if the server has reached its allocation limit. */ public function testAllocationCannotBeCreatedIfServerIsAtLimit() { @@ -86,10 +86,7 @@ class CreateNewAllocationTest extends ClientApiIntegrationTestCase ->assertJsonPath('errors.0.detail', 'Cannot assign additional allocations to this server: limit has been reached.'); } - /** - * @return array - */ - public function permissionDataProvider() + public function permissionDataProvider(): array { return [[[Permission::ACTION_ALLOCATION_CREATE]], [[]]]; } diff --git a/tests/Integration/Api/Client/Server/Backup/BackupAuthorizationTest.php b/tests/Integration/Api/Client/Server/Backup/BackupAuthorizationTest.php index aaaf38a6f..187c522a9 100644 --- a/tests/Integration/Api/Client/Server/Backup/BackupAuthorizationTest.php +++ b/tests/Integration/Api/Client/Server/Backup/BackupAuthorizationTest.php @@ -55,9 +55,6 @@ class BackupAuthorizationTest extends ClientApiIntegrationTestCase $this->actingAs($user)->json($method, $this->link($server3, '/backups/' . $backup3->uuid . $endpoint))->assertNotFound(); } - /** - * @return \string[][] - */ public function methodDataProvider(): array { return [ diff --git a/tests/Integration/Api/Client/Server/Backup/DeleteBackupTest.php b/tests/Integration/Api/Client/Server/Backup/DeleteBackupTest.php index b68b65e88..e5ea95d54 100644 --- a/tests/Integration/Api/Client/Server/Backup/DeleteBackupTest.php +++ b/tests/Integration/Api/Client/Server/Backup/DeleteBackupTest.php @@ -3,6 +3,7 @@ namespace Pterodactyl\Tests\Integration\Api\Client\Server\Backup; use Mockery; +use Mockery\MockInterface; use Illuminate\Http\Response; use Pterodactyl\Models\Backup; use Pterodactyl\Models\Permission; @@ -13,7 +14,7 @@ use Pterodactyl\Tests\Integration\Api\Client\ClientApiIntegrationTestCase; class DeleteBackupTest extends ClientApiIntegrationTestCase { - private $repository; + private MockInterface $repository; public function setUp(): void { diff --git a/tests/Integration/Api/Client/Server/CommandControllerTest.php b/tests/Integration/Api/Client/Server/CommandControllerTest.php index d6010b675..8fa106cfc 100644 --- a/tests/Integration/Api/Client/Server/CommandControllerTest.php +++ b/tests/Integration/Api/Client/Server/CommandControllerTest.php @@ -5,6 +5,7 @@ namespace Pterodactyl\Tests\Integration\Api\Client\Server; use Mockery; use GuzzleHttp\Psr7\Request; use Illuminate\Http\Response; +use Pterodactyl\Models\Server; use Pterodactyl\Models\Permission; use GuzzleHttp\Exception\BadResponseException; use GuzzleHttp\Psr7\Response as GuzzleResponse; @@ -14,20 +15,6 @@ use Pterodactyl\Tests\Integration\Api\Client\ClientApiIntegrationTestCase; class CommandControllerTest extends ClientApiIntegrationTestCase { - /** @var \Mockery\MockInterface */ - private $repository; - - /** - * Setup tests. - */ - public function setUp(): void - { - parent::setUp(); - - $this->repository = Mockery::mock(DaemonCommandRepository::class); - $this->app->instance(DaemonCommandRepository::class, $this->repository); - } - /** * Test that a validation error is returned if there is no command present in the * request. @@ -36,7 +23,7 @@ class CommandControllerTest extends ClientApiIntegrationTestCase { [$user, $server] = $this->generateTestAccount(); - $response = $this->actingAs($user)->postJson("/api/client/servers/{$server->uuid}/command", [ + $response = $this->actingAs($user)->postJson("/api/client/servers/$server->uuid/command", [ 'command' => '', ]); @@ -52,7 +39,7 @@ class CommandControllerTest extends ClientApiIntegrationTestCase { [$user, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]); - $response = $this->actingAs($user)->postJson("/api/client/servers/{$server->uuid}/command", [ + $response = $this->actingAs($user)->postJson("/api/client/servers/$server->uuid/command", [ 'command' => 'say Test', ]); @@ -66,12 +53,14 @@ class CommandControllerTest extends ClientApiIntegrationTestCase { [$user, $server] = $this->generateTestAccount([Permission::ACTION_CONTROL_CONSOLE]); - $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()); + $mock = $this->mock(DaemonCommandRepository::class); + $mock->expects('setServer') + ->with(Mockery::on(fn (Server $value) => $value->is($server))) + ->andReturnSelf(); - $response = $this->actingAs($user)->postJson("/api/client/servers/{$server->uuid}/command", [ + $mock->expects('send')->with('say Test')->andReturn(new GuzzleResponse()); + + $response = $this->actingAs($user)->postJson("/api/client/servers/$server->uuid/command", [ 'command' => 'say Test', ]); @@ -86,13 +75,14 @@ class CommandControllerTest extends ClientApiIntegrationTestCase { [$user, $server] = $this->generateTestAccount(); - $this->repository->expects('setServer->send')->andThrows( + $mock = $this->mock(DaemonCommandRepository::class); + $mock->expects('setServer->send')->andThrows( new DaemonConnectionException( new BadResponseException('', new Request('GET', 'test'), new GuzzleResponse(Response::HTTP_BAD_GATEWAY)) ) ); - $response = $this->actingAs($user)->postJson("/api/client/servers/{$server->uuid}/command", [ + $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 index d7063ea33..ba15c595c 100644 --- a/tests/Integration/Api/Client/Server/Database/DatabaseAuthorizationTest.php +++ b/tests/Integration/Api/Client/Server/Database/DatabaseAuthorizationTest.php @@ -2,7 +2,6 @@ namespace Pterodactyl\Tests\Integration\Api\Client\Server\Database; -use Mockery; use Pterodactyl\Models\Subuser; use Pterodactyl\Models\Database; use Pterodactyl\Models\DatabaseHost; @@ -35,14 +34,10 @@ class DatabaseAuthorizationTest extends ClientApiIntegrationTestCase $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(); - } + $this + ->mock($method === 'POST' ? DatabasePasswordService::class : DatabaseManagementService::class) + ->expects($method === 'POST' ? 'handle' : 'delete') + ->andReturn($method === 'POST' ? 'foo' : null); $hashids = $this->app->make(HashidsInterface::class); // This is the only valid call for this test, accessing the database for the same @@ -63,9 +58,6 @@ class DatabaseAuthorizationTest extends ClientApiIntegrationTestCase $this->actingAs($user)->json($method, $this->link($server3, '/databases/' . $hashids->encode($database3->id) . $endpoint))->assertNotFound(); } - /** - * @return \string[][] - */ public function methodDataProvider(): array { return [ diff --git a/tests/Integration/Api/Client/Server/NetworkAllocationControllerTest.php b/tests/Integration/Api/Client/Server/NetworkAllocationControllerTest.php index 336b4e037..c9523733d 100644 --- a/tests/Integration/Api/Client/Server/NetworkAllocationControllerTest.php +++ b/tests/Integration/Api/Client/Server/NetworkAllocationControllerTest.php @@ -133,7 +133,7 @@ class NetworkAllocationControllerTest extends ClientApiIntegrationTestCase ->assertForbidden(); } - public function updatePermissionsDataProvider() + public function updatePermissionsDataProvider(): array { return [[[]], [[Permission::ACTION_ALLOCATION_UPDATE]]]; } diff --git a/tests/Integration/Api/Client/Server/PowerControllerTest.php b/tests/Integration/Api/Client/Server/PowerControllerTest.php index 6aed481a8..c061add32 100644 --- a/tests/Integration/Api/Client/Server/PowerControllerTest.php +++ b/tests/Integration/Api/Client/Server/PowerControllerTest.php @@ -16,6 +16,7 @@ class PowerControllerTest extends ClientApiIntegrationTestCase * the command to the server. * * @param string[] $permissions + * * @dataProvider invalidPermissionDataProvider */ public function testSubuserWithoutPermissionsReceivesError(string $action, array $permissions) @@ -23,7 +24,7 @@ class PowerControllerTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount($permissions); $this->actingAs($user) - ->postJson("/api/client/servers/{$server->uuid}/power", ['signal' => $action]) + ->postJson("/api/client/servers/$server->uuid/power", ['signal' => $action]) ->assertStatus(Response::HTTP_FORBIDDEN); } @@ -34,7 +35,7 @@ class PowerControllerTest extends ClientApiIntegrationTestCase { [$user, $server] = $this->generateTestAccount(); - $response = $this->actingAs($user)->postJson("/api/client/servers/{$server->uuid}/power", [ + $response = $this->actingAs($user)->postJson("/api/client/servers/$server->uuid/power", [ 'signal' => 'invalid', ]); @@ -65,7 +66,7 @@ class PowerControllerTest extends ClientApiIntegrationTestCase ->with(trim($action)); $this->actingAs($user) - ->postJson("/api/client/servers/{$server->uuid}/power", ['signal' => $action]) + ->postJson("/api/client/servers/$server->uuid/power", ['signal' => $action]) ->assertStatus(Response::HTTP_NO_CONTENT); } diff --git a/tests/Integration/Api/Client/Server/ResourceUtilitizationControllerTest.php b/tests/Integration/Api/Client/Server/ResourceUtilizationControllerTest.php similarity index 92% rename from tests/Integration/Api/Client/Server/ResourceUtilitizationControllerTest.php rename to tests/Integration/Api/Client/Server/ResourceUtilizationControllerTest.php index 7c713dd33..b18de2f5f 100644 --- a/tests/Integration/Api/Client/Server/ResourceUtilitizationControllerTest.php +++ b/tests/Integration/Api/Client/Server/ResourceUtilizationControllerTest.php @@ -7,7 +7,7 @@ use Pterodactyl\Models\Permission; use Pterodactyl\Repositories\Wings\DaemonServerRepository; use Pterodactyl\Tests\Integration\Api\Client\ClientApiIntegrationTestCase; -class ResourceUtilitizationControllerTest extends ClientApiIntegrationTestCase +class ResourceUtilizationControllerTest extends ClientApiIntegrationTestCase { /** * Test that the resource utilization for a server is returned in the expected format. @@ -23,7 +23,7 @@ class ResourceUtilitizationControllerTest extends ClientApiIntegrationTestCase return $server->uuid === $value->uuid; }))->andReturnSelf()->getMock()->expects('getDetails')->andReturns([]); - $response = $this->actingAs($user)->getJson("/api/client/servers/{$server->uuid}/resources"); + $response = $this->actingAs($user)->getJson("/api/client/servers/$server->uuid/resources"); $response->assertOk(); $response->assertJson([ diff --git a/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php b/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php index cde99b090..f87aef292 100644 --- a/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php @@ -12,14 +12,13 @@ class CreateServerScheduleTest extends ClientApiIntegrationTestCase /** * Test that a schedule can be created for the server. * - * @param array $permissions * @dataProvider permissionsDataProvider */ - public function testScheduleCanBeCreatedForServer($permissions) + public function testScheduleCanBeCreatedForServer(array $permissions) { [$user, $server] = $this->generateTestAccount($permissions); - $response = $this->actingAs($user)->postJson("/api/client/servers/{$server->uuid}/schedules", [ + $response = $this->actingAs($user)->postJson("/api/client/servers/$server->uuid/schedules", [ 'name' => 'Test Schedule', 'is_active' => false, 'minute' => '0', @@ -55,17 +54,17 @@ class CreateServerScheduleTest extends ClientApiIntegrationTestCase { [$user, $server] = $this->generateTestAccount(); - $response = $this->actingAs($user)->postJson("/api/client/servers/{$server->uuid}/schedules", []); + $response = $this->actingAs($user)->postJson("/api/client/servers/$server->uuid/schedules", []); $response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY); foreach (['name', 'minute', 'hour', 'day_of_month', 'day_of_week'] as $i => $field) { - $response->assertJsonPath("errors.{$i}.code", 'ValidationException'); - $response->assertJsonPath("errors.{$i}.meta.rule", 'required'); - $response->assertJsonPath("errors.{$i}.meta.source_field", $field); + $response->assertJsonPath("errors.$i.code", 'ValidationException'); + $response->assertJsonPath("errors.$i.meta.rule", 'required'); + $response->assertJsonPath("errors.$i.meta.source_field", $field); } $this->actingAs($user) - ->postJson("/api/client/servers/{$server->uuid}/schedules", [ + ->postJson("/api/client/servers/$server->uuid/schedules", [ 'name' => 'Testing', 'is_active' => 'no', 'minute' => '*', @@ -86,7 +85,7 @@ class CreateServerScheduleTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount([Permission::ACTION_SCHEDULE_UPDATE]); $this->actingAs($user) - ->postJson("/api/client/servers/{$server->uuid}/schedules", []) + ->postJson("/api/client/servers/$server->uuid/schedules", []) ->assertForbidden(); } diff --git a/tests/Integration/Api/Client/Server/Schedule/DeleteServerScheduleTest.php b/tests/Integration/Api/Client/Server/Schedule/DeleteServerScheduleTest.php index f5a2e49dd..4a79584a8 100644 --- a/tests/Integration/Api/Client/Server/Schedule/DeleteServerScheduleTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/DeleteServerScheduleTest.php @@ -13,10 +13,9 @@ class DeleteServerScheduleTest extends ClientApiIntegrationTestCase /** * Test that a schedule can be deleted from the system. * - * @param array $permissions * @dataProvider permissionsDataProvider */ - public function testScheduleCanBeDeleted($permissions) + public function testScheduleCanBeDeleted(array $permissions) { [$user, $server] = $this->generateTestAccount($permissions); @@ -24,7 +23,7 @@ class DeleteServerScheduleTest extends ClientApiIntegrationTestCase $task = Task::factory()->create(['schedule_id' => $schedule->id]); $this->actingAs($user) - ->deleteJson("/api/client/servers/{$server->uuid}/schedules/{$schedule->id}") + ->deleteJson("/api/client/servers/$server->uuid/schedules/$schedule->id") ->assertStatus(Response::HTTP_NO_CONTENT); $this->assertDatabaseMissing('schedules', ['id' => $schedule->id]); @@ -39,7 +38,7 @@ class DeleteServerScheduleTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount(); $this->actingAs($user) - ->deleteJson("/api/client/servers/{$server->uuid}/schedules/123456789") + ->deleteJson("/api/client/servers/$server->uuid/schedules/123456789") ->assertStatus(Response::HTTP_NOT_FOUND); } @@ -55,7 +54,7 @@ class DeleteServerScheduleTest extends ClientApiIntegrationTestCase $schedule = Schedule::factory()->create(['server_id' => $server2->id]); $this->actingAs($user) - ->deleteJson("/api/client/servers/{$server->uuid}/schedules/{$schedule->id}") + ->deleteJson("/api/client/servers/$server->uuid/schedules/$schedule->id") ->assertStatus(Response::HTTP_NOT_FOUND); $this->assertDatabaseHas('schedules', ['id' => $schedule->id]); @@ -72,7 +71,7 @@ class DeleteServerScheduleTest extends ClientApiIntegrationTestCase $schedule = Schedule::factory()->create(['server_id' => $server->id]); $this->actingAs($user) - ->deleteJson("/api/client/servers/{$server->uuid}/schedules/{$schedule->id}") + ->deleteJson("/api/client/servers/$server->uuid/schedules/$schedule->id") ->assertStatus(Response::HTTP_FORBIDDEN); $this->assertDatabaseHas('schedules', ['id' => $schedule->id]); diff --git a/tests/Integration/Api/Client/Server/Schedule/GetServerSchedulesTest.php b/tests/Integration/Api/Client/Server/Schedule/GetServerSchedulesTest.php index 34830a421..d9d2ae3f6 100644 --- a/tests/Integration/Api/Client/Server/Schedule/GetServerSchedulesTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/GetServerSchedulesTest.php @@ -23,11 +23,9 @@ class GetServerSchedulesTest extends ClientApiIntegrationTestCase /** * Test that schedules for a server are returned. * - * @param array $permissions - * @param bool $individual * @dataProvider permissionsDataProvider */ - public function testServerSchedulesAreReturned($permissions, $individual) + public function testServerSchedulesAreReturned(array $permissions, bool $individual) { [$user, $server] = $this->generateTestAccount($permissions); @@ -39,8 +37,8 @@ class GetServerSchedulesTest extends ClientApiIntegrationTestCase $response = $this->actingAs($user) ->getJson( $individual - ? "/api/client/servers/{$server->uuid}/schedules/{$schedule->id}" - : "/api/client/servers/{$server->uuid}/schedules" + ? "/api/client/servers/$server->uuid/schedules/$schedule->id" + : "/api/client/servers/$server->uuid/schedules" ) ->assertOk(); @@ -69,7 +67,7 @@ class GetServerSchedulesTest extends ClientApiIntegrationTestCase $schedule = Schedule::factory()->create(['server_id' => $server2->id]); $this->actingAs($user) - ->getJson("/api/client/servers/{$server->uuid}/schedules/{$schedule->id}") + ->getJson("/api/client/servers/$server->uuid/schedules/$schedule->id") ->assertNotFound(); } @@ -81,13 +79,13 @@ class GetServerSchedulesTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]); $this->actingAs($user) - ->getJson("/api/client/servers/{$server->uuid}/schedules") + ->getJson("/api/client/servers/$server->uuid/schedules") ->assertForbidden(); $schedule = Schedule::factory()->create(['server_id' => $server->id]); $this->actingAs($user) - ->getJson("/api/client/servers/{$server->uuid}/schedules/{$schedule->id}") + ->getJson("/api/client/servers/$server->uuid/schedules/$schedule->id") ->assertForbidden(); } diff --git a/tests/Integration/Api/Client/Server/Schedule/ScheduleAuthorizationTest.php b/tests/Integration/Api/Client/Server/Schedule/ScheduleAuthorizationTest.php index 223e9a673..a8a881194 100644 --- a/tests/Integration/Api/Client/Server/Schedule/ScheduleAuthorizationTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/ScheduleAuthorizationTest.php @@ -54,9 +54,6 @@ class ScheduleAuthorizationTest extends ClientApiIntegrationTestCase $this->actingAs($user)->json($method, $this->link($server3, '/schedules/' . $schedule3->id . $endpoint))->assertNotFound(); } - /** - * @return \string[][] - */ public function methodDataProvider(): array { return [ diff --git a/tests/Integration/Api/Client/Server/Schedule/UpdateServerScheduleTest.php b/tests/Integration/Api/Client/Server/Schedule/UpdateServerScheduleTest.php index f095dd88f..7442a2b5f 100644 --- a/tests/Integration/Api/Client/Server/Schedule/UpdateServerScheduleTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/UpdateServerScheduleTest.php @@ -11,10 +11,8 @@ class UpdateServerScheduleTest extends ClientApiIntegrationTestCase { /** * The data to use when updating a schedule. - * - * @var array */ - private $updateData = [ + private array $updateData = [ 'name' => 'Updated Schedule Name', 'minute' => '5', 'hour' => '*', @@ -27,10 +25,9 @@ class UpdateServerScheduleTest extends ClientApiIntegrationTestCase /** * Test that a schedule can be updated. * - * @param array $permissions * @dataProvider permissionsDataProvider */ - public function testScheduleCanBeUpdated($permissions) + public function testScheduleCanBeUpdated(array $permissions) { [$user, $server] = $this->generateTestAccount($permissions); @@ -48,7 +45,7 @@ class UpdateServerScheduleTest extends ClientApiIntegrationTestCase $this->assertFalse($schedule->is_active); $this->assertJsonTransformedWith($response->json('attributes'), $schedule); - $this->assertSame($expected->toIso8601String(), $schedule->next_run_at->toIso8601String()); + $this->assertSame($expected->toAtomString(), $schedule->next_run_at->toAtomString()); } /** diff --git a/tests/Integration/Api/Client/Server/ScheduleTask/CreateServerScheduleTaskTest.php b/tests/Integration/Api/Client/Server/ScheduleTask/CreateServerScheduleTaskTest.php index 81c65b1d2..a71e0233c 100644 --- a/tests/Integration/Api/Client/Server/ScheduleTask/CreateServerScheduleTaskTest.php +++ b/tests/Integration/Api/Client/Server/ScheduleTask/CreateServerScheduleTaskTest.php @@ -13,10 +13,9 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase /** * Test that a task can be created. * - * @param array $permissions * @dataProvider permissionsDataProvider */ - public function testTaskCanBeCreated($permissions) + public function testTaskCanBeCreated(array $permissions) { [$user, $server] = $this->generateTestAccount($permissions); @@ -56,8 +55,8 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase $response = $this->actingAs($user)->postJson($this->link($schedule, '/tasks'))->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY); foreach (['action', 'payload', 'time_offset'] as $i => $field) { - $response->assertJsonPath("errors.{$i}.meta.rule", $field === 'payload' ? 'required_unless' : 'required'); - $response->assertJsonPath("errors.{$i}.meta.source_field", $field); + $response->assertJsonPath("errors.$i.meta.rule", $field === 'payload' ? 'required_unless' : 'required'); + $response->assertJsonPath("errors.$i.meta.source_field", $field); } $this->actingAs($user)->postJson($this->link($schedule, '/tasks'), [ @@ -151,7 +150,7 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase $schedule = Schedule::factory()->create(['server_id' => $server2->id]); $this->actingAs($user) - ->postJson("/api/client/servers/{$server->uuid}/schedules/{$schedule->id}/tasks") + ->postJson("/api/client/servers/$server->uuid/schedules/$schedule->id/tasks") ->assertNotFound(); } diff --git a/tests/Integration/Api/Client/Server/ScheduleTask/DeleteScheduleTaskTest.php b/tests/Integration/Api/Client/Server/ScheduleTask/DeleteScheduleTaskTest.php index dc9b3fd42..b610dd379 100644 --- a/tests/Integration/Api/Client/Server/ScheduleTask/DeleteScheduleTaskTest.php +++ b/tests/Integration/Api/Client/Server/ScheduleTask/DeleteScheduleTaskTest.php @@ -27,7 +27,7 @@ class DeleteScheduleTaskTest extends ClientApiIntegrationTestCase /** * Test that an error is returned if the task and schedule in the URL do not line up - * with eachother. + * with each other. */ public function testTaskBelongingToDifferentScheduleReturnsError() { @@ -37,7 +37,7 @@ class DeleteScheduleTaskTest extends ClientApiIntegrationTestCase $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(); + $this->actingAs($user)->deleteJson("/api/client/servers/$server->uuid/schedules/$schedule2->id/tasks/$task->id")->assertNotFound(); } /** diff --git a/tests/Integration/Api/Client/Server/SettingsControllerTest.php b/tests/Integration/Api/Client/Server/SettingsControllerTest.php index edd4dc543..c92754cfa 100644 --- a/tests/Integration/Api/Client/Server/SettingsControllerTest.php +++ b/tests/Integration/Api/Client/Server/SettingsControllerTest.php @@ -14,16 +14,15 @@ class SettingsControllerTest extends ClientApiIntegrationTestCase /** * Test that the server's name can be changed. * - * @param array $permissions * @dataProvider renamePermissionsDataProvider */ - public function testServerNameCanBeChanged($permissions) + public function testServerNameCanBeChanged(array $permissions) { /** @var \Pterodactyl\Models\Server $server */ [$user, $server] = $this->generateTestAccount($permissions); $originalName = $server->name; - $response = $this->actingAs($user)->postJson("/api/client/servers/{$server->uuid}/settings/rename", [ + $response = $this->actingAs($user)->postJson("/api/client/servers/$server->uuid/settings/rename", [ 'name' => '', ]); @@ -34,7 +33,7 @@ class SettingsControllerTest extends ClientApiIntegrationTestCase $this->assertSame($originalName, $server->name); $this->actingAs($user) - ->postJson("/api/client/servers/{$server->uuid}/settings/rename", [ + ->postJson("/api/client/servers/$server->uuid/settings/rename", [ 'name' => 'Test Server Name', ]) ->assertStatus(Response::HTTP_NO_CONTENT); @@ -53,7 +52,7 @@ class SettingsControllerTest extends ClientApiIntegrationTestCase $originalName = $server->name; $this->actingAs($user) - ->postJson("/api/client/servers/{$server->uuid}/settings/rename", [ + ->postJson("/api/client/servers/$server->uuid/settings/rename", [ 'name' => 'Test Server Name', ]) ->assertStatus(Response::HTTP_FORBIDDEN); @@ -66,10 +65,9 @@ class SettingsControllerTest extends ClientApiIntegrationTestCase * Test that a server can be reinstalled. Honestly this test doesn't do much of anything other * than make sure the endpoint works since. * - * @param array $permissions * @dataProvider reinstallPermissionsDataProvider */ - public function testServerCanBeReinstalled($permissions) + public function testServerCanBeReinstalled(array $permissions) { /** @var \Pterodactyl\Models\Server $server */ [$user, $server] = $this->generateTestAccount($permissions); @@ -87,7 +85,7 @@ class SettingsControllerTest extends ClientApiIntegrationTestCase ->expects('reinstall') ->andReturnUndefined(); - $this->actingAs($user)->postJson("/api/client/servers/{$server->uuid}/settings/reinstall") + $this->actingAs($user)->postJson("/api/client/servers/$server->uuid/settings/reinstall") ->assertStatus(Response::HTTP_ACCEPTED); $server = $server->refresh(); @@ -103,7 +101,7 @@ class SettingsControllerTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]); $this->actingAs($user) - ->postJson("/api/client/servers/{$server->uuid}/settings/reinstall") + ->postJson("/api/client/servers/$server->uuid/settings/reinstall") ->assertStatus(Response::HTTP_FORBIDDEN); $server = $server->refresh(); diff --git a/tests/Integration/Api/Client/Server/Startup/GetStartupAndVariablesTest.php b/tests/Integration/Api/Client/Server/Startup/GetStartupAndVariablesTest.php index 09a6abd02..a8a5b88e0 100644 --- a/tests/Integration/Api/Client/Server/Startup/GetStartupAndVariablesTest.php +++ b/tests/Integration/Api/Client/Server/Startup/GetStartupAndVariablesTest.php @@ -13,16 +13,15 @@ class GetStartupAndVariablesTest extends ClientApiIntegrationTestCase * Test that the startup command and variables are returned for a server, but only the variables * that can be viewed by a user (e.g. user_viewable=true). * - * @param array $permissions * @dataProvider permissionsDataProvider */ - public function testStartupVariablesAreReturnedForServer($permissions) + public function testStartupVariablesAreReturnedForServer(array $permissions) { /** @var \Pterodactyl\Models\Server $server */ [$user, $server] = $this->generateTestAccount($permissions); $egg = $this->cloneEggAndVariables($server->egg); - // BUNGEE_VERSION should never be returned back to the user in this API call, either in + // BUNGEE_VERSION should never be returned to the user in this API call, either in // the array of variables, or revealed in the startup command. $egg->variables()->first()->update([ 'user_viewable' => false, @@ -59,10 +58,7 @@ class GetStartupAndVariablesTest extends ClientApiIntegrationTestCase $this->actingAs($user2)->getJson($this->link($server) . '/startup')->assertNotFound(); } - /** - * @return array[] - */ - public function permissionsDataProvider() + public function permissionsDataProvider(): array { return [[[]], [[Permission::ACTION_STARTUP_READ]]]; } diff --git a/tests/Integration/Api/Client/Server/Startup/UpdateStartupVariableTest.php b/tests/Integration/Api/Client/Server/Startup/UpdateStartupVariableTest.php index 0e5e421c1..d7ade1eef 100644 --- a/tests/Integration/Api/Client/Server/Startup/UpdateStartupVariableTest.php +++ b/tests/Integration/Api/Client/Server/Startup/UpdateStartupVariableTest.php @@ -13,10 +13,9 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase /** * Test that a startup variable can be edited successfully for a server. * - * @param array $permissions * @dataProvider permissionsDataProvider */ - public function testStartupVariableCanBeUpdated($permissions) + public function testStartupVariableCanBeUpdated(array $permissions) { /** @var \Pterodactyl\Models\Server $server */ [$user, $server] = $this->generateTestAccount($permissions); @@ -150,10 +149,7 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase $this->actingAs($user2)->putJson($this->link($server) . '/startup/variable')->assertNotFound(); } - /** - * @return \array[][] - */ - public function permissionsDataProvider() + public function permissionsDataProvider(): array { return [[[]], [[Permission::ACTION_STARTUP_UPDATE]]]; } diff --git a/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php b/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php index 94c9b17ef..f55ca18a8 100644 --- a/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php +++ b/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php @@ -17,10 +17,9 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase /** * Test that a subuser can be created for a server. * - * @param array $permissions * @dataProvider permissionsDataProvider */ - public function testSubuserCanBeCreated($permissions) + public function testSubuserCanBeCreated(array $permissions) { [$user, $server] = $this->generateTestAccount($permissions); @@ -62,7 +61,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase ]); $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ - 'email' => $email = $this->faker->email, + 'email' => $this->faker->email, 'permissions' => [ Permission::ACTION_USER_CREATE, Permission::ACTION_USER_UPDATE, // This permission is not assigned to the subuser. diff --git a/tests/Integration/Api/Client/Server/Subuser/DeleteSubuserTest.php b/tests/Integration/Api/Client/Server/Subuser/DeleteSubuserTest.php index fbcbbc01c..80fd9845f 100644 --- a/tests/Integration/Api/Client/Server/Subuser/DeleteSubuserTest.php +++ b/tests/Integration/Api/Client/Server/Subuser/DeleteSubuserTest.php @@ -47,7 +47,7 @@ class DeleteSubuserTest extends ClientApiIntegrationTestCase $mock->expects('setServer->revokeUserJTI')->with($subuser->id)->andReturnUndefined(); - $this->actingAs($user)->deleteJson($this->link($server) . "/users/{$subuser->uuid}")->assertNoContent(); + $this->actingAs($user)->deleteJson($this->link($server) . "/users/$subuser->uuid")->assertNoContent(); // Try the same test, but this time with a UUID that if cast to an int (shouldn't) line up with // anything in the database. @@ -63,6 +63,6 @@ class DeleteSubuserTest extends ClientApiIntegrationTestCase $mock->expects('setServer->revokeUserJTI')->with($subuser->id)->andReturnUndefined(); - $this->actingAs($user)->deleteJson($this->link($server) . "/users/{$subuser->uuid}")->assertNoContent(); + $this->actingAs($user)->deleteJson($this->link($server) . "/users/$subuser->uuid")->assertNoContent(); } } diff --git a/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php b/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php index f95e06f72..242130fe9 100644 --- a/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php +++ b/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php @@ -50,9 +50,6 @@ class SubuserAuthorizationTest extends ClientApiIntegrationTestCase $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 d2656015e..66bc27af4 100644 --- a/tests/Integration/Api/Client/Server/WebsocketControllerTest.php +++ b/tests/Integration/Api/Client/Server/WebsocketControllerTest.php @@ -14,14 +14,14 @@ use Pterodactyl\Tests\Integration\Api\Client\ClientApiIntegrationTestCase; class WebsocketControllerTest extends ClientApiIntegrationTestCase { /** - * Test that a subuser attempting to connect to the websocket recieves an error if they + * Test that a subuser attempting to connect to the websocket receives an error if they * do not explicitly have the permission. */ public function testSubuserWithoutWebsocketPermissionReceivesError() { [$user, $server] = $this->generateTestAccount([Permission::ACTION_CONTROL_RESTART]); - $this->actingAs($user)->getJson("/api/client/servers/{$server->uuid}/websocket") + $this->actingAs($user)->getJson("/api/client/servers/$server->uuid/websocket") ->assertStatus(Response::HTTP_FORBIDDEN) ->assertJsonPath('errors.0.code', 'HttpForbiddenException') ->assertJsonPath('errors.0.detail', 'You do not have permission to connect to this server\'s websocket.'); @@ -33,9 +33,9 @@ class WebsocketControllerTest extends ClientApiIntegrationTestCase public function testUserWithoutPermissionForServerReceivesError() { [, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]); - [$user,] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]); + [$user] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]); - $this->actingAs($user)->getJson("/api/client/servers/{$server->uuid}/websocket") + $this->actingAs($user)->getJson("/api/client/servers/$server->uuid/websocket") ->assertStatus(Response::HTTP_NOT_FOUND); } @@ -53,14 +53,14 @@ class WebsocketControllerTest extends ClientApiIntegrationTestCase $server->node->scheme = 'https'; $server->node->save(); - $response = $this->actingAs($user)->getJson("/api/client/servers/{$server->uuid}/websocket"); + $response = $this->actingAs($user)->getJson("/api/client/servers/$server->uuid/websocket"); $response->assertOk(); $response->assertJsonStructure(['data' => ['token', 'socket']]); $connection = $response->json('data.socket'); $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.'); + $this->assertStringEndsWith("/api/servers/$server->uuid/ws", $connection, 'Failed asserting that websocket connection address uses expected Wings endpoint.'); $config = Configuration::forSymmetricSigner(new Sha256(), $key = InMemory::plainText($server->node->getDecryptedKey())); $config->setValidationConstraints(new SignedWith(new Sha256(), $key)); @@ -102,7 +102,7 @@ class WebsocketControllerTest extends ClientApiIntegrationTestCase /** @var \Pterodactyl\Models\Server $server */ [$user, $server] = $this->generateTestAccount($permissions); - $response = $this->actingAs($user)->getJson("/api/client/servers/{$server->uuid}/websocket"); + $response = $this->actingAs($user)->getJson("/api/client/servers/$server->uuid/websocket"); $response->assertOk(); $response->assertJsonStructure(['data' => ['token', 'socket']]); diff --git a/tests/Integration/Api/Client/TwoFactorControllerTest.php b/tests/Integration/Api/Client/TwoFactorControllerTest.php index 905d67d2b..6cc086fc7 100644 --- a/tests/Integration/Api/Client/TwoFactorControllerTest.php +++ b/tests/Integration/Api/Client/TwoFactorControllerTest.php @@ -122,7 +122,7 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase } /** - * Test that two factor authentication can be disabled on an account as long as the password + * Test that two-factor authentication can be disabled on an account as long as the password * provided is valid for the account. */ public function testTwoFactorCanBeDisabledOnAccount() @@ -149,7 +149,7 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase $user = $user->refresh(); $this->assertFalse($user->use_totp); $this->assertNotNull($user->totp_authenticated_at); - $this->assertSame(Carbon::now()->toIso8601String(), $user->totp_authenticated_at->toIso8601String()); + $this->assertSame(Carbon::now()->toAtomString(), $user->totp_authenticated_at->toAtomString()); } /** diff --git a/tests/Integration/Api/Remote/SftpAuthenticationControllerTest.php b/tests/Integration/Api/Remote/SftpAuthenticationControllerTest.php index 4ef485db3..9e7136a80 100644 --- a/tests/Integration/Api/Remote/SftpAuthenticationControllerTest.php +++ b/tests/Integration/Api/Remote/SftpAuthenticationControllerTest.php @@ -97,7 +97,7 @@ class SftpAuthenticationControllerTest extends IntegrationTestCase * * @dataProvider authorizationTypeDataProvider */ - public function testUserIsThrottledIfInvalidCredentialsAreProvided(string $type) + public function testUserIsThrottledIfInvalidCredentialsAreProvided() { for ($i = 0; $i <= 10; ++$i) { $this->postJson('/api/remote/sftp/auth', [ diff --git a/tests/Integration/Http/Controllers/Admin/UserControllerTest.php b/tests/Integration/Http/Controllers/Admin/UserControllerTest.php index d10107833..34cf9f938 100644 --- a/tests/Integration/Http/Controllers/Admin/UserControllerTest.php +++ b/tests/Integration/Http/Controllers/Admin/UserControllerTest.php @@ -21,7 +21,7 @@ class UserControllerTest extends IntegrationTestCase */ public function testIndexReturnsExpectedData() { - $unique = Str::random(16); + $unique = Str::random(); $users = [ User::factory()->create(['username' => $unique . '_1']), User::factory()->create(['username' => $unique . '_2']), @@ -40,7 +40,7 @@ class UserControllerTest extends IntegrationTestCase /** @var \Pterodactyl\Http\Controllers\Admin\UserController $controller */ $controller = $this->app->make(UserController::class); - $request = Request::create('/admin/users?filter[username]=' . $unique, 'GET'); + $request = Request::create('/admin/users?filter[username]=' . $unique); $this->app->instance(Request::class, $request); $data = $controller->index($request)->getData(); diff --git a/tests/Integration/IntegrationTestCase.php b/tests/Integration/IntegrationTestCase.php index 4d504a62a..103c97b9b 100644 --- a/tests/Integration/IntegrationTestCase.php +++ b/tests/Integration/IntegrationTestCase.php @@ -3,6 +3,7 @@ namespace Pterodactyl\Tests\Integration; use Carbon\CarbonImmutable; +use Carbon\CarbonInterface; use Pterodactyl\Tests\TestCase; use Illuminate\Support\Facades\Event; use Pterodactyl\Events\ActivityLogged; @@ -33,8 +34,8 @@ abstract class IntegrationTestCase extends TestCase */ protected function formatTimestamp(string $timestamp): string { - return CarbonImmutable::createFromFormat(CarbonImmutable::DEFAULT_TO_STRING_FORMAT, $timestamp) + return CarbonImmutable::createFromFormat(CarbonInterface::DEFAULT_TO_STRING_FORMAT, $timestamp) ->setTimezone(BaseTransformer::RESPONSE_TIMEZONE) - ->toIso8601String(); + ->toAtomString(); } } diff --git a/tests/Integration/Jobs/Schedule/RunTaskJobTest.php b/tests/Integration/Jobs/Schedule/RunTaskJobTest.php index 9a5dfcea9..b80679bd7 100644 --- a/tests/Integration/Jobs/Schedule/RunTaskJobTest.php +++ b/tests/Integration/Jobs/Schedule/RunTaskJobTest.php @@ -48,7 +48,7 @@ class RunTaskJobTest extends IntegrationTestCase $this->assertFalse($task->is_queued); $this->assertFalse($schedule->is_processing); $this->assertFalse($schedule->is_active); - $this->assertTrue(CarbonImmutable::now()->isSameAs(CarbonImmutable::ISO8601, $schedule->last_run_at)); + $this->assertTrue(CarbonImmutable::now()->isSameAs(DateTimeInterface::ATOM, $schedule->last_run_at)); } public function testJobWithInvalidActionThrowsException() @@ -105,7 +105,7 @@ class RunTaskJobTest extends IntegrationTestCase $this->assertFalse($task->is_queued); $this->assertFalse($schedule->is_processing); - $this->assertTrue(CarbonImmutable::now()->isSameAs(CarbonImmutable::ISO8601, $schedule->last_run_at)); + $this->assertTrue(CarbonImmutable::now()->isSameAs(DateTimeInterface::ATOM, $schedule->last_run_at)); } /** @@ -144,7 +144,7 @@ class RunTaskJobTest extends IntegrationTestCase $this->assertFalse($task->is_queued); $this->assertFalse($schedule->is_processing); - $this->assertTrue(CarbonImmutable::now()->isSameAs(CarbonImmutable::ISO8601, $schedule->last_run_at)); + $this->assertTrue(CarbonImmutable::now()->isSameAs(DateTimeInterface::ATOM, $schedule->last_run_at)); } } @@ -178,10 +178,7 @@ class RunTaskJobTest extends IntegrationTestCase $this->assertTrue(Carbon::now()->isSameAs(DateTimeInterface::ATOM, $schedule->last_run_at)); } - /** - * @return array - */ - public function isManualRunDataProvider() + public function isManualRunDataProvider(): array { return [[true], [false]]; } diff --git a/tests/Integration/Services/Allocations/FindAssignableAllocationServiceTest.php b/tests/Integration/Services/Allocations/FindAssignableAllocationServiceTest.php index c3b88e2cf..3efde3355 100644 --- a/tests/Integration/Services/Allocations/FindAssignableAllocationServiceTest.php +++ b/tests/Integration/Services/Allocations/FindAssignableAllocationServiceTest.php @@ -25,7 +25,7 @@ class FindAssignableAllocationServiceTest extends IntegrationTestCase } /** - * Test that an unassigned allocation is prefered rather than creating an entirely new + * Test that an unassigned allocation is preferred rather than creating an entirely new * allocation for the server. */ public function testExistingAllocationIsPreferred() @@ -141,7 +141,7 @@ class FindAssignableAllocationServiceTest extends IntegrationTestCase try { $this->getService()->handle($server); - $this->assertTrue(false, 'This assertion should not be reached.'); + $this->fail('This assertion should not be reached.'); } catch (Exception $exception) { $this->assertInstanceOf(InvalidArgumentException::class, $exception); $this->assertSame('Expected an integerish value. Got: string', $exception->getMessage()); @@ -152,7 +152,7 @@ class FindAssignableAllocationServiceTest extends IntegrationTestCase try { $this->getService()->handle($server); - $this->assertTrue(false, 'This assertion should not be reached.'); + $this->fail('This assertion should not be reached.'); } catch (Exception $exception) { $this->assertInstanceOf(InvalidArgumentException::class, $exception); $this->assertSame('Expected an integerish value. Got: string', $exception->getMessage()); @@ -169,10 +169,7 @@ class FindAssignableAllocationServiceTest extends IntegrationTestCase $this->getService()->handle($server); } - /** - * @return \Pterodactyl\Services\Allocations\FindAssignableAllocationService - */ - private function getService() + private function getService(): FindAssignableAllocationService { return $this->app->make(FindAssignableAllocationService::class); } diff --git a/tests/Integration/Services/Backups/DeleteBackupServiceTest.php b/tests/Integration/Services/Backups/DeleteBackupServiceTest.php index 34d4028bd..d1fb0faac 100644 --- a/tests/Integration/Services/Backups/DeleteBackupServiceTest.php +++ b/tests/Integration/Services/Backups/DeleteBackupServiceTest.php @@ -2,12 +2,12 @@ namespace Pterodactyl\Tests\Integration\Services\Backups; -use Mockery; use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Response; use Pterodactyl\Models\Backup; use GuzzleHttp\Exception\ClientException; use Pterodactyl\Extensions\Backups\BackupManager; +use Pterodactyl\Extensions\Filesystem\S3Filesystem; use Pterodactyl\Services\Backups\DeleteBackupService; use Pterodactyl\Tests\Integration\IntegrationTestCase; use Pterodactyl\Repositories\Wings\DaemonBackupRepository; @@ -16,17 +16,6 @@ use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; class DeleteBackupServiceTest extends IntegrationTestCase { - private $repository; - - public function setUp(): void - { - parent::setUp(); - - $this->repository = Mockery::mock(DaemonBackupRepository::class); - - $this->app->instance(DaemonBackupRepository::class, $this->repository); - } - public function testLockedBackupCannotBeDeleted() { $server = $this->createServerModel(); @@ -49,9 +38,8 @@ class DeleteBackupServiceTest extends IntegrationTestCase 'is_successful' => false, ]); - $this->repository->expects('setServer->delete')->with($backup)->andReturn( - new Response() - ); + $mock = $this->mock(DaemonBackupRepository::class); + $mock->expects('setServer->delete')->with($backup)->andReturn(new Response()); $this->app->make(DeleteBackupService::class)->handle($backup); @@ -65,7 +53,8 @@ class DeleteBackupServiceTest extends IntegrationTestCase $server = $this->createServerModel(); $backup = Backup::factory()->create(['server_id' => $server->id]); - $this->repository->expects('setServer->delete')->with($backup)->andThrow( + $mock = $this->mock(DaemonBackupRepository::class); + $mock->expects('setServer->delete')->with($backup)->andThrow( new DaemonConnectionException( new ClientException('', new Request('DELETE', '/'), new Response(404)) ) @@ -83,7 +72,8 @@ class DeleteBackupServiceTest extends IntegrationTestCase $server = $this->createServerModel(); $backup = Backup::factory()->create(['server_id' => $server->id]); - $this->repository->expects('setServer->delete')->with($backup)->andThrow( + $mock = $this->mock(DaemonBackupRepository::class); + $mock->expects('setServer->delete')->with($backup)->andThrow( new DaemonConnectionException( new ClientException('', new Request('DELETE', '/'), new Response(500)) ) @@ -107,17 +97,18 @@ class DeleteBackupServiceTest extends IntegrationTestCase ]); $manager = $this->mock(BackupManager::class); - $manager->expects('getBucket')->andReturns('foobar'); - $manager->expects('adapter')->with(Backup::ADAPTER_AWS_S3)->andReturnSelf(); - $manager->expects('getClient->deleteObject')->with([ + $adapter = $this->mock(S3Filesystem::class); + + $manager->expects('adapter')->with(Backup::ADAPTER_AWS_S3)->andReturn($adapter); + + $adapter->expects('getBucket')->andReturn('foobar'); + $adapter->expects('getClient->deleteObject')->with([ 'Bucket' => 'foobar', 'Key' => sprintf('%s/%s.tar.gz', $server->uuid, $backup->uuid), ]); $this->app->make(DeleteBackupService::class)->handle($backup); - $backup->refresh(); - - $this->assertNotNull($backup->deleted_at); + $this->assertSoftDeleted($backup); } } diff --git a/tests/Integration/Services/Databases/DatabaseManagementServiceTest.php b/tests/Integration/Services/Databases/DatabaseManagementServiceTest.php index e354e0299..72c0e804c 100644 --- a/tests/Integration/Services/Databases/DatabaseManagementServiceTest.php +++ b/tests/Integration/Services/Databases/DatabaseManagementServiceTest.php @@ -3,6 +3,7 @@ namespace Pterodactyl\Tests\Integration\Services\Databases; use Mockery; +use Mockery\MockInterface; use BadMethodCallException; use InvalidArgumentException; use Pterodactyl\Models\Database; @@ -16,8 +17,7 @@ use Pterodactyl\Exceptions\Service\Database\DatabaseClientFeatureNotEnabledExcep class DatabaseManagementServiceTest extends IntegrationTestCase { - /** @var \Mockery\MockInterface */ - private $repository; + private MockInterface $repository; /** * Setup tests. @@ -28,8 +28,7 @@ class DatabaseManagementServiceTest extends IntegrationTestCase config()->set('pterodactyl.client_features.databases.enabled', true); - $this->repository = Mockery::mock(DatabaseRepository::class); - $this->swap(DatabaseRepository::class, $this->repository); + $this->repository = $this->mock(DatabaseRepository::class); } /** @@ -74,10 +73,9 @@ class DatabaseManagementServiceTest extends IntegrationTestCase /** * Test that a missing or invalid database name format causes an exception to be thrown. * - * @param array $data * @dataProvider invalidDataDataProvider */ - public function testEmptyDatabaseNameOrInvalidNameTriggersAnException($data) + public function testEmptyDatabaseNameOrInvalidNameTriggersAnException(array $data) { $server = $this->createServerModel(); @@ -166,7 +164,7 @@ class DatabaseManagementServiceTest extends IntegrationTestCase $this->assertInstanceOf(Database::class, $response); $this->assertSame($response->server_id, $server->id); - $this->assertMatchesRegularExpression('/^(u[\d]+_)(\w){10}$/', $username); + $this->assertMatchesRegularExpression('/^(u\d+_)(\w){10}$/', $username); $this->assertSame($username, $secondUsername); $this->assertSame(24, strlen($password)); @@ -174,8 +172,8 @@ class DatabaseManagementServiceTest extends IntegrationTestCase } /** - * Test that an exception encountered while creating the database leads to cleanup code being called - * and any exceptions encountered while cleaning up go unreported. + * Test that an exception encountered while creating the database leads to the cleanup code + * being called and any exceptions encountered while cleaning up go unreported. */ public function testExceptionEncounteredWhileCreatingDatabaseAttemptsToCleanup() { @@ -211,10 +209,7 @@ class DatabaseManagementServiceTest extends IntegrationTestCase ]; } - /** - * @return \Pterodactyl\Services\Databases\DatabaseManagementService - */ - private function getService() + private function getService(): DatabaseManagementService { return $this->app->make(DatabaseManagementService::class); } diff --git a/tests/Integration/Services/Databases/DeployServerDatabaseServiceTest.php b/tests/Integration/Services/Databases/DeployServerDatabaseServiceTest.php index 4d6fa5ec9..0da9245ee 100644 --- a/tests/Integration/Services/Databases/DeployServerDatabaseServiceTest.php +++ b/tests/Integration/Services/Databases/DeployServerDatabaseServiceTest.php @@ -3,6 +3,7 @@ namespace Pterodactyl\Tests\Integration\Services\Databases; use Mockery; +use Mockery\MockInterface; use Pterodactyl\Models\Node; use InvalidArgumentException; use Pterodactyl\Models\Database; @@ -14,8 +15,7 @@ use Pterodactyl\Exceptions\Service\Database\NoSuitableDatabaseHostException; class DeployServerDatabaseServiceTest extends IntegrationTestCase { - /** @var \Mockery\MockInterface */ - private $managementService; + private MockInterface $managementService; /** * Setup tests. @@ -44,10 +44,9 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase /** * Test that an error is thrown if either the database name or the remote host are empty. * - * @param array $data * @dataProvider invalidDataProvider */ - public function testErrorIsThrownIfDatabaseNameIsEmpty($data) + public function testErrorIsThrownIfDatabaseNameIsEmpty(array $data) { $server = $this->createServerModel(); @@ -154,10 +153,7 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase ]; } - /** - * @return \Pterodactyl\Services\Databases\DeployServerDatabaseService - */ - private function getService() + private function getService(): DeployServerDatabaseService { return $this->app->make(DeployServerDatabaseService::class); } diff --git a/tests/Integration/Services/Deployment/FindViableNodesServiceTest.php b/tests/Integration/Services/Deployment/FindViableNodesServiceTest.php index f32810cc8..f77b5b144 100644 --- a/tests/Integration/Services/Deployment/FindViableNodesServiceTest.php +++ b/tests/Integration/Services/Deployment/FindViableNodesServiceTest.php @@ -53,7 +53,7 @@ class FindViableNodesServiceTest extends IntegrationTestCase try { $this->getService()->setLocations(['a']); - $this->assertTrue(false, 'This expectation should not be called.'); + $this->fail('This expectation should not be called.'); } catch (Exception $exception) { $this->assertInstanceOf(InvalidArgumentException::class, $exception); $this->assertSame('An array of location IDs should be provided when calling setLocations.', $exception->getMessage()); @@ -61,7 +61,7 @@ class FindViableNodesServiceTest extends IntegrationTestCase try { $this->getService()->setLocations(['1.2', '1', 2]); - $this->assertTrue(false, 'This expectation should not be called.'); + $this->fail('This expectation should not be called.'); } catch (Exception $exception) { $this->assertInstanceOf(InvalidArgumentException::class, $exception); $this->assertSame('An array of location IDs should be provided when calling setLocations.', $exception->getMessage()); @@ -96,7 +96,7 @@ class FindViableNodesServiceTest extends IntegrationTestCase ]), ]; - // Expect that all of the nodes are returned as we're under all of their limits + // Expect that all the nodes are returned as we're under all of their limits // and there is no location filter being provided. $response = $this->getService()->setDisk(512)->setMemory(512)->handle(); $this->assertInstanceOf(Collection::class, $response); @@ -182,10 +182,7 @@ class FindViableNodesServiceTest extends IntegrationTestCase $this->assertSame($nodes[1]->id, $response[0]->id); } - /** - * @return \Pterodactyl\Services\Deployment\FindViableNodesService - */ - private function getService() + private function getService(): FindViableNodesService { return $this->app->make(FindViableNodesService::class); } diff --git a/tests/Integration/Services/Schedules/ProcessScheduleServiceTest.php b/tests/Integration/Services/Schedules/ProcessScheduleServiceTest.php index e5dd9e234..cd56337ac 100644 --- a/tests/Integration/Services/Schedules/ProcessScheduleServiceTest.php +++ b/tests/Integration/Services/Schedules/ProcessScheduleServiceTest.php @@ -58,10 +58,9 @@ class ProcessScheduleServiceTest extends IntegrationTestCase /** * Test that a job is dispatched as expected using the initial delay. * - * @param bool $now * @dataProvider dispatchNowDataProvider */ - public function testJobCanBeDispatchedWithExpectedInitialDelay($now) + public function testJobCanBeDispatchedWithExpectedInitialDelay(bool $now) { Bus::fake(); @@ -156,10 +155,7 @@ class ProcessScheduleServiceTest extends IntegrationTestCase return [[true], [false]]; } - /** - * @return \Pterodactyl\Services\Schedules\ProcessScheduleService - */ - private function getService() + private function getService(): ProcessScheduleService { return $this->app->make(ProcessScheduleService::class); } diff --git a/tests/Integration/Services/Servers/BuildModificationServiceTest.php b/tests/Integration/Services/Servers/BuildModificationServiceTest.php index cadc9276d..edebb0125 100644 --- a/tests/Integration/Services/Servers/BuildModificationServiceTest.php +++ b/tests/Integration/Services/Servers/BuildModificationServiceTest.php @@ -3,6 +3,7 @@ namespace Pterodactyl\Tests\Integration\Services\Servers; use Mockery; +use Mockery\MockInterface; use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Response; use Pterodactyl\Models\Server; @@ -16,8 +17,7 @@ use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; class BuildModificationServiceTest extends IntegrationTestCase { - /** @var \Mockery\MockInterface */ - private $daemonServerRepository; + private MockInterface $daemonServerRepository; /** * Setup tests. @@ -183,7 +183,7 @@ class BuildModificationServiceTest extends IntegrationTestCase /** * Test that allocations in both the add and remove arrays are only added, and not removed. - * This scenario wouldn't really happen in the UI, but it is possible to perform via the API + * This scenario wouldn't really happen in the UI, but it is possible to perform via the API, * so we want to make sure that the logic being used doesn't break if the allocation exists * in both arrays. * @@ -229,7 +229,7 @@ class BuildModificationServiceTest extends IntegrationTestCase /** * Test that any changes we made to the server or allocations are rolled back if there is an - * exception while performing any action. This is different than the connection exception + * exception while performing any action. This is different from the connection exception * test which should properly ignore connection issues. We want any other type of exception * to properly be thrown back to the caller. */ @@ -248,10 +248,7 @@ class BuildModificationServiceTest extends IntegrationTestCase $this->assertDatabaseHas('allocations', ['id' => $allocation->id, 'server_id' => null]); } - /** - * @return \Pterodactyl\Services\Servers\BuildModificationService - */ - private function getService() + private function getService(): BuildModificationService { return $this->app->make(BuildModificationService::class); } diff --git a/tests/Integration/Services/Servers/ServerCreationServiceTest.php b/tests/Integration/Services/Servers/ServerCreationServiceTest.php index c194c21a5..92a873a18 100644 --- a/tests/Integration/Services/Servers/ServerCreationServiceTest.php +++ b/tests/Integration/Services/Servers/ServerCreationServiceTest.php @@ -3,6 +3,7 @@ namespace Pterodactyl\Tests\Integration\Services\Servers; use Mockery; +use Mockery\MockInterface; use Pterodactyl\Models\Egg; use GuzzleHttp\Psr7\Request; use Pterodactyl\Models\Node; @@ -24,8 +25,7 @@ class ServerCreationServiceTest extends IntegrationTestCase { use WithFaker; - /** @var \Mockery\MockInterface */ - protected $daemonServerRepository; + protected MockInterface $daemonServerRepository; protected Egg $bungeecord; @@ -208,10 +208,7 @@ class ServerCreationServiceTest extends IntegrationTestCase $this->assertDatabaseMissing('servers', ['owner_id' => $user->id]); } - /** - * @return \Pterodactyl\Services\Servers\ServerCreationService - */ - private function getService() + private function getService(): ServerCreationService { return $this->app->make(ServerCreationService::class); } diff --git a/tests/Integration/Services/Servers/ServerDeletionServiceTest.php b/tests/Integration/Services/Servers/ServerDeletionServiceTest.php index 197e6b38f..3bad99932 100644 --- a/tests/Integration/Services/Servers/ServerDeletionServiceTest.php +++ b/tests/Integration/Services/Servers/ServerDeletionServiceTest.php @@ -4,9 +4,9 @@ namespace Pterodactyl\Tests\Integration\Services\Servers; use Mockery; use Exception; +use Mockery\MockInterface; use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Response; -use Pterodactyl\Models\Server; use Pterodactyl\Models\Database; use Pterodactyl\Models\DatabaseHost; use GuzzleHttp\Exception\BadResponseException; @@ -18,13 +18,11 @@ use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; class ServerDeletionServiceTest extends IntegrationTestCase { - /** @var \Mockery\MockInterface */ - private $daemonServerRepository; + private MockInterface $daemonServerRepository; - /** @var \Mockery\MockInterface */ - private $databaseManagementService; + private MockInterface $databaseManagementService; - private static $defaultLogger; + private static ?string $defaultLogger; /** * Stub out services that we don't want to test in here. @@ -102,7 +100,7 @@ class ServerDeletionServiceTest extends IntegrationTestCase new DaemonConnectionException(new BadResponseException('Bad request', new Request('GET', '/test'), new Response(500))) ); - $this->getService()->withForce(true)->handle($server); + $this->getService()->withForce()->handle($server); $this->assertDatabaseMissing('servers', ['id' => $server->id]); } @@ -157,10 +155,7 @@ class ServerDeletionServiceTest extends IntegrationTestCase $this->assertDatabaseMissing('databases', ['id' => $db->id]); } - /** - * @return \Pterodactyl\Services\Servers\ServerDeletionService - */ - private function getService() + private function getService(): ServerDeletionService { return $this->app->make(ServerDeletionService::class); } diff --git a/tests/Integration/Services/Servers/StartupModificationServiceTest.php b/tests/Integration/Services/Servers/StartupModificationServiceTest.php index 31a1b85a2..47f4595f0 100644 --- a/tests/Integration/Services/Servers/StartupModificationServiceTest.php +++ b/tests/Integration/Services/Servers/StartupModificationServiceTest.php @@ -33,7 +33,7 @@ class StartupModificationServiceTest extends IntegrationTestCase ], ]); - $this->assertTrue(false, 'This assertion should not be called.'); + $this->fail('This assertion should not be called.'); } catch (Exception $exception) { $this->assertInstanceOf(ValidationException::class, $exception); @@ -161,10 +161,7 @@ class StartupModificationServiceTest extends IntegrationTestCase ->handle($server, ['egg_id' => 123456789]); } - /** - * @return \Pterodactyl\Services\Servers\StartupModificationService - */ - private function getService() + private function getService(): StartupModificationService { return $this->app->make(StartupModificationService::class); } diff --git a/tests/Integration/Services/Servers/SuspensionServiceTest.php b/tests/Integration/Services/Servers/SuspensionServiceTest.php index 258a8ca2e..bb7297d14 100644 --- a/tests/Integration/Services/Servers/SuspensionServiceTest.php +++ b/tests/Integration/Services/Servers/SuspensionServiceTest.php @@ -3,6 +3,7 @@ namespace Pterodactyl\Tests\Integration\Services\Servers; use Mockery; +use Mockery\MockInterface; use InvalidArgumentException; use Pterodactyl\Models\Server; use Pterodactyl\Services\Servers\SuspensionService; @@ -11,8 +12,7 @@ use Pterodactyl\Repositories\Wings\DaemonServerRepository; class SuspensionServiceTest extends IntegrationTestCase { - /** @var \Mockery\MockInterface */ - private $repository; + private MockInterface $repository; /** * Setup test instance. @@ -31,7 +31,7 @@ class SuspensionServiceTest extends IntegrationTestCase $this->repository->expects('setServer->sync')->twice()->andReturnSelf(); - $this->getService()->toggle($server, SuspensionService::ACTION_SUSPEND); + $this->getService()->toggle($server); $this->assertTrue($server->refresh()->isSuspended()); @@ -50,7 +50,7 @@ class SuspensionServiceTest extends IntegrationTestCase $this->assertFalse($server->isSuspended()); $server->update(['status' => Server::STATUS_SUSPENDED]); - $this->getService()->toggle($server, SuspensionService::ACTION_SUSPEND); + $this->getService()->toggle($server); $server->refresh(); $this->assertTrue($server->isSuspended()); @@ -66,10 +66,7 @@ class SuspensionServiceTest extends IntegrationTestCase $this->getService()->toggle($server, 'foo'); } - /** - * @return \Pterodactyl\Services\Servers\SuspensionService - */ - private function getService() + private function getService(): SuspensionService { return $this->app->make(SuspensionService::class); } diff --git a/tests/Integration/Services/Servers/VariableValidatorServiceTest.php b/tests/Integration/Services/Servers/VariableValidatorServiceTest.php index 86a725746..7f0e157fa 100644 --- a/tests/Integration/Services/Servers/VariableValidatorServiceTest.php +++ b/tests/Integration/Services/Servers/VariableValidatorServiceTest.php @@ -25,7 +25,7 @@ class VariableValidatorServiceTest extends IntegrationTestCase } /** - * Test that enviornment variables for a server are validated as expected. + * Test that environment variables for a server are validated as expected. */ public function testEnvironmentVariablesCanBeValidated() { @@ -36,7 +36,7 @@ class VariableValidatorServiceTest extends IntegrationTestCase 'BUNGEE_VERSION' => '1.2.3', ]); - $this->assertTrue(false, 'This statement should not be reached.'); + $this->fail('This statement should not be reached.'); } catch (ValidationException $exception) { $errors = $exception->errors(); @@ -96,7 +96,7 @@ class VariableValidatorServiceTest extends IntegrationTestCase 'SERVER_JARFILE' => 'server.jar', ]); - $this->assertTrue(false, 'This statement should not be reached.'); + $this->fail('This statement should not be reached.'); } catch (ValidationException $exception) { $this->assertCount(1, $exception->errors()); $this->assertArrayHasKey('environment.BUNGEE_VERSION', $exception->errors()); @@ -135,10 +135,7 @@ class VariableValidatorServiceTest extends IntegrationTestCase $this->assertSame('', $response->get(0)->value); } - /** - * @return \Pterodactyl\Services\Servers\VariableValidatorService - */ - private function getService() + private function getService(): VariableValidatorService { return $this->app->make(VariableValidatorService::class); } diff --git a/tests/Integration/TestResponse.php b/tests/Integration/TestResponse.php index e715071e9..a5a8609c8 100644 --- a/tests/Integration/TestResponse.php +++ b/tests/Integration/TestResponse.php @@ -12,14 +12,10 @@ class TestResponse extends IlluminateTestResponse { /** * Overrides the default assert status logic to dump out the error to the - * test output if it is caused by a 500 level error and we were not specifically + * test output if it is caused by a 500 level error, and we were not specifically * look for that status response. - * - * @param int $status - * - * @return \Pterodactyl\Tests\Integration\TestResponse */ - public function assertStatus($status) + public function assertStatus($status): TestResponse { $actual = $this->getStatusCode(); @@ -41,10 +37,7 @@ class TestResponse extends IlluminateTestResponse return $this; } - /** - * @return $this - */ - public function assertForbidden() + public function assertForbidden(): self { return self::assertStatus(Response::HTTP_FORBIDDEN); } diff --git a/tests/Traits/Http/IntegrationJsonRequestAssertions.php b/tests/Traits/Http/IntegrationJsonRequestAssertions.php index 2658520ee..4583d5312 100644 --- a/tests/Traits/Http/IntegrationJsonRequestAssertions.php +++ b/tests/Traits/Http/IntegrationJsonRequestAssertions.php @@ -10,7 +10,7 @@ trait IntegrationJsonRequestAssertions /** * Make assertions about a 404 response on the API. */ - public function assertNotFoundJson(TestResponse $response) + public function assertNotFoundJson(TestResponse $response): void { $response->assertStatus(Response::HTTP_NOT_FOUND); $response->assertJsonStructure(['errors' => [['code', 'status', 'detail']]]); @@ -29,7 +29,7 @@ trait IntegrationJsonRequestAssertions /** * Make assertions about a 403 error returned by the API. */ - public function assertAccessDeniedJson(TestResponse $response) + public function assertAccessDeniedJson(TestResponse $response): void { $response->assertStatus(Response::HTTP_FORBIDDEN); $response->assertJsonStructure(['errors' => [['code', 'status', 'detail']]]); diff --git a/tests/Traits/Http/RequestMockHelpers.php b/tests/Traits/Http/RequestMockHelpers.php index 668d809e6..23e88663c 100644 --- a/tests/Traits/Http/RequestMockHelpers.php +++ b/tests/Traits/Http/RequestMockHelpers.php @@ -3,6 +3,7 @@ namespace Pterodactyl\Tests\Traits\Http; use Mockery as m; +use Mockery\Mock; use Illuminate\Http\Request; use Pterodactyl\Models\User; use InvalidArgumentException; @@ -10,20 +11,14 @@ use Symfony\Component\HttpFoundation\ParameterBag; trait RequestMockHelpers { - /** - * @var string - */ - private $requestMockClass = Request::class; + private string $requestMockClass = Request::class; - /** - * @var \Illuminate\Http\Request|\Mockery\Mock - */ - protected $request; + protected Request|Mock $request; /** * Set the class to mock for requests. */ - public function setRequestMockClass(string $class) + public function setRequestMockClass(string $class): void { $this->requestMockClass = $class; @@ -33,7 +28,7 @@ trait RequestMockHelpers /** * Configure the user model that the request mock should return with. */ - public function setRequestUserModel(User $user = null) + public function setRequestUserModel(User $user = null): void { $this->request->shouldReceive('user')->andReturn($user); } @@ -43,6 +38,7 @@ trait RequestMockHelpers */ public function generateRequestUserModel(array $args = []): User { + /** @var \Pterodactyl\Models\User $user */ $user = User::factory()->make($args); $this->setRequestUserModel($user); @@ -51,10 +47,8 @@ trait RequestMockHelpers /** * Set a request attribute on the mock object. - * - * @param mixed $value */ - public function setRequestAttribute(string $attribute, $value) + public function setRequestAttribute(string $attribute, mixed $value): void { $this->request->attributes->set($attribute, $value); } @@ -62,7 +56,7 @@ trait RequestMockHelpers /** * Set the request route name. */ - public function setRequestRouteName(string $name) + public function setRequestRouteName(string $name): void { $this->request->shouldReceive('route->getName')->andReturn($name); } @@ -70,7 +64,7 @@ trait RequestMockHelpers /** * Set the active request object to be an instance of a mocked request. */ - protected function buildRequestMock() + protected function buildRequestMock(): void { $this->request = m::mock($this->requestMockClass); if (!$this->request instanceof Request) { diff --git a/tests/Traits/Integration/CreatesTestModels.php b/tests/Traits/Integration/CreatesTestModels.php index ce64376ce..62245d72b 100644 --- a/tests/Traits/Integration/CreatesTestModels.php +++ b/tests/Traits/Integration/CreatesTestModels.php @@ -18,11 +18,9 @@ trait CreatesTestModels * is passed in that normally requires this function to create a model no model will be * created and that attribute's value will be used. * - * The returned server model will have all of the relationships loaded onto it. - * - * @return \Pterodactyl\Models\Server + * The returned server model will have all the relationships loaded onto it. */ - public function createServerModel(array $attributes = []) + public function createServerModel(array $attributes = []): Server { if (isset($attributes['user_id'])) { $attributes['owner_id'] = $attributes['user_id']; @@ -126,11 +124,14 @@ trait CreatesTestModels } /** - * Most every test just assumes it is using Bungeecord — this is the critical + * Almost every test just assumes it is using BungeeCord — this is the critical * egg model for all tests unless specified otherwise. */ - private function getBungeecordEgg() + private function getBungeecordEgg(): Egg { - return Egg::query()->where('author', 'support@pterodactyl.io')->where('name', 'Bungeecord')->firstOrFail(); + /** @var \Pterodactyl\Models\Egg $egg */ + $egg = Egg::query()->where('author', 'support@pterodactyl.io')->where('name', 'Bungeecord')->firstOrFail(); + + return $egg; } } diff --git a/tests/Traits/MocksPdoConnection.php b/tests/Traits/MocksPdoConnection.php index c7fe8cdd0..a93896463 100644 --- a/tests/Traits/MocksPdoConnection.php +++ b/tests/Traits/MocksPdoConnection.php @@ -7,21 +7,17 @@ use Mockery; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\MySqlConnection; use Illuminate\Database\ConnectionResolver; +use Illuminate\Database\ConnectionResolverInterface; trait MocksPdoConnection { - /** - * @var \Illuminate\Database\ConnectionResolverInterface|null - */ - private static $initialResolver; + private static ?ConnectionResolverInterface $initialResolver; /** * Generates a mock PDO connection and injects it into the models so that any actual * DB call can be properly intercepted. - * - * @return \Mockery\MockInterface */ - protected function mockPdoConnection() + protected function mockPdoConnection(): Mockery\MockInterface { self::$initialResolver = Model::getConnectionResolver(); @@ -39,7 +35,7 @@ trait MocksPdoConnection /** * Resets the mock state. */ - protected function tearDownPdoMock() + protected function tearDownPdoMock(): void { if (!self::$initialResolver) { return; diff --git a/tests/Traits/MocksRequestException.php b/tests/Traits/MocksRequestException.php index 69c04913a..fc011d152 100644 --- a/tests/Traits/MocksRequestException.php +++ b/tests/Traits/MocksRequestException.php @@ -3,28 +3,21 @@ namespace Pterodactyl\Tests\Traits; use Mockery; +use Mockery\Mock; use Mockery\MockInterface; use GuzzleHttp\Exception\RequestException; trait MocksRequestException { - /** - * @var \GuzzleHttp\Exception\RequestException|\Mockery\Mock - */ - private $exception; + private RequestException|Mock $exception; - /** - * @var mixed - */ - private $exceptionResponse; + private mixed $exceptionResponse; /** * Configure the exception mock to work with the Panel's default exception * handler actions. - * - * @param null $response */ - protected function configureExceptionMock(string $abstract = RequestException::class, $response = null) + protected function configureExceptionMock(string $abstract = RequestException::class, $response = null): void { $this->getExceptionMock($abstract)->shouldReceive('getResponse')->andReturn(value($response)); } diff --git a/tests/Traits/MocksUuids.php b/tests/Traits/MocksUuids.php index 0a84fce12..fb5b7c971 100644 --- a/tests/Traits/MocksUuids.php +++ b/tests/Traits/MocksUuids.php @@ -1,11 +1,4 @@ . - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ namespace Pterodactyl\Tests\Traits; @@ -17,15 +10,13 @@ trait MocksUuids { /** * The known UUID string. - * - * @var string */ - protected $knownUuid = 'ffb5c3a6-ab17-43ab-97f0-8ff37ccd7f5f'; + protected string $knownUuid = 'ffb5c3a6-ab17-43ab-97f0-8ff37ccd7f5f'; /** * Setup a factory mock to produce the same UUID whenever called. */ - public function setKnownUuidFactory() + public function setKnownUuidFactory(): void { $uuid = Uuid::fromString($this->getKnownUuid()); $factoryMock = m::mock(UuidFactory::class . '[uuid4]', [ diff --git a/tests/Unit/Helpers/IsDigitTest.php b/tests/Unit/Helpers/IsDigitTest.php index eae5fbac5..4ba08042f 100644 --- a/tests/Unit/Helpers/IsDigitTest.php +++ b/tests/Unit/Helpers/IsDigitTest.php @@ -18,10 +18,8 @@ class IsDigitTest extends TestCase /** * Provide data to test against the helper function. - * - * @return array */ - public function helperDataProvider() + public function helperDataProvider(): array { return [ [true, false], diff --git a/tests/Unit/Http/Middleware/Api/Application/AuthenticateUserTest.php b/tests/Unit/Http/Middleware/Api/Application/AuthenticateUserTest.php index 8ba4c75fc..429d63084 100644 --- a/tests/Unit/Http/Middleware/Api/Application/AuthenticateUserTest.php +++ b/tests/Unit/Http/Middleware/Api/Application/AuthenticateUserTest.php @@ -21,7 +21,7 @@ class AuthenticateUserTest extends MiddlewareTestCase } /** - * Test that a non-admin user results an an exception. + * Test that a non-admin user results in an exception. */ public function testNonAdminUser() { diff --git a/tests/Unit/Http/Middleware/Api/Daemon/DaemonAuthenticateTest.php b/tests/Unit/Http/Middleware/Api/Daemon/DaemonAuthenticateTest.php index 945e08701..8c8c76920 100644 --- a/tests/Unit/Http/Middleware/Api/Daemon/DaemonAuthenticateTest.php +++ b/tests/Unit/Http/Middleware/Api/Daemon/DaemonAuthenticateTest.php @@ -3,6 +3,7 @@ namespace Pterodactyl\Tests\Unit\Http\Middleware\Api\Daemon; use Mockery as m; +use Mockery\MockInterface; use Pterodactyl\Models\Node; use Illuminate\Contracts\Encryption\Encrypter; use Pterodactyl\Repositories\Eloquent\NodeRepository; @@ -15,15 +16,9 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; class DaemonAuthenticateTest extends MiddlewareTestCase { - /** - * @var \Mockery\MockInterface - */ - private $repository; + private MockInterface $encrypter; - /** - * @var \Mockery\MockInterface - */ - private $encrypter; + private MockInterface $repository; /** * Setup tests. diff --git a/tests/Unit/Http/Middleware/LanguageMiddlewareTest.php b/tests/Unit/Http/Middleware/LanguageMiddlewareTest.php index 569ef417a..c870d8e5b 100644 --- a/tests/Unit/Http/Middleware/LanguageMiddlewareTest.php +++ b/tests/Unit/Http/Middleware/LanguageMiddlewareTest.php @@ -3,16 +3,14 @@ namespace Pterodactyl\Tests\Unit\Http\Middleware; use Mockery as m; +use Mockery\MockInterface; use Pterodactyl\Models\User; use Illuminate\Foundation\Application; use Pterodactyl\Http\Middleware\LanguageMiddleware; class LanguageMiddlewareTest extends MiddlewareTestCase { - /** - * @var \Illuminate\Foundation\Application|\Mockery\Mock - */ - private $appMock; + private MockInterface $appMock; /** * Setup tests. diff --git a/tests/Unit/Http/Middleware/MaintenanceMiddlewareTest.php b/tests/Unit/Http/Middleware/MaintenanceMiddlewareTest.php index a007dd34a..573c78814 100644 --- a/tests/Unit/Http/Middleware/MaintenanceMiddlewareTest.php +++ b/tests/Unit/Http/Middleware/MaintenanceMiddlewareTest.php @@ -3,6 +3,7 @@ namespace Pterodactyl\Tests\Unit\Http\Middleware; use Mockery as m; +use Mockery\MockInterface; use Pterodactyl\Models\Node; use Illuminate\Http\Response; use Pterodactyl\Models\Server; @@ -11,10 +12,7 @@ use Pterodactyl\Http\Middleware\MaintenanceMiddleware; class MaintenanceMiddlewareTest extends MiddlewareTestCase { - /** - * @var \Illuminate\Contracts\Routing\ResponseFactory|\Mockery\Mock - */ - private $response; + private MockInterface $response; /** * Setup tests. diff --git a/tests/Unit/Http/Middleware/RedirectIfAuthenticatedTest.php b/tests/Unit/Http/Middleware/RedirectIfAuthenticatedTest.php index ea4bc8014..68f238aaf 100644 --- a/tests/Unit/Http/Middleware/RedirectIfAuthenticatedTest.php +++ b/tests/Unit/Http/Middleware/RedirectIfAuthenticatedTest.php @@ -3,16 +3,14 @@ namespace Pterodactyl\Tests\Unit\Http\Middleware; use Mockery as m; +use Mockery\MockInterface; use Illuminate\Auth\AuthManager; use Illuminate\Http\RedirectResponse; use Pterodactyl\Http\Middleware\RedirectIfAuthenticated; class RedirectIfAuthenticatedTest extends MiddlewareTestCase { - /** - * @var \Illuminate\Auth\AuthManager|\Mockery\Mock - */ - private $authManager; + private MockInterface $authManager; /** * Setup tests.