From 1e3fddbffd0e7676315366f0b298966407c272a0 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 23 Jan 2021 12:05:09 -0800 Subject: [PATCH] Reformat for csfixer --- .../Commands/Overrides/SeedCommand.php | 2 +- app/Console/Commands/Overrides/UpCommand.php | 2 +- .../Schedule/ProcessRunnableCommand.php | 2 +- .../Server/BulkPowerActionCommand.php | 4 ++-- .../Commands/User/DeleteUserCommand.php | 8 +++---- app/Console/RequiresDatabaseMigrations.php | 6 ++--- .../AllocationRepositoryInterface.php | 2 -- .../Repository/NodeRepositoryInterface.php | 3 --- .../Connection/DaemonConnectionException.php | 2 +- .../Http/TwoFactorAuthRequiredException.php | 2 +- app/Extensions/Backups/BackupManager.php | 2 +- .../Controllers/Admin/MountController.php | 4 ---- .../Controllers/Admin/Nests/EggController.php | 4 ++-- .../Admin/Servers/CreateServerController.php | 2 +- .../Servers/ServerTransferController.php | 3 ++- .../Controllers/Admin/ServersController.php | 5 +---- .../Api/Client/ClientController.php | 2 +- .../Api/Client/Servers/BackupController.php | 1 + .../Api/Client/Servers/FileController.php | 2 +- .../Servers/NetworkAllocationController.php | 2 +- .../Api/Client/Servers/ScheduleController.php | 3 +-- .../Api/Client/Servers/SettingsController.php | 3 +-- .../Api/Client/Servers/StartupController.php | 6 ++--- .../Remote/Backups/BackupStatusController.php | 2 +- .../Servers/ServerDetailsController.php | 2 +- .../Servers/ServerTransferController.php | 2 +- .../Auth/LoginCheckpointController.php | 1 - app/Http/Controllers/Auth/LoginController.php | 2 +- .../Server/AuthenticateServerAccess.php | 2 +- .../Client/Server/ResourceBelongsToServer.php | 4 ++-- .../Client/SubstituteClientApiBindings.php | 2 +- .../RequireTwoFactorAuthentication.php | 4 ++-- .../Requests/Admin/Egg/EggFormRequest.php | 2 +- .../Wings/ServerConfigurationCollection.php | 2 +- app/Jobs/Schedule/RunTaskJob.php | 1 - app/Models/Filters/MultiFieldServerFilter.php | 4 ++-- app/Models/Model.php | 2 +- app/Models/Mount.php | 4 ++-- app/Models/Node.php | 2 +- .../Eloquent/DatabaseRepository.php | 1 - .../Eloquent/EloquentRepository.php | 1 - app/Repositories/Eloquent/NodeRepository.php | 2 -- .../Eloquent/ServerRepository.php | 4 ++-- .../Wings/DaemonBackupRepository.php | 1 - .../Wings/DaemonFileRepository.php | 2 +- .../Wings/DaemonServerRepository.php | 2 +- .../Databases/DatabaseManagementService.php | 1 - .../Deployment/FindViableNodesService.php | 2 +- app/Services/Eggs/EggConfigurationService.php | 2 +- .../Eggs/Sharing/EggImporterService.php | 2 +- app/Services/Nodes/NodeUpdateService.php | 4 +--- .../Servers/BuildModificationService.php | 2 +- .../Servers/ReinstallServerService.php | 1 - .../ServerConfigurationStructureService.php | 20 ++++++++--------- .../Servers/ServerDeletionService.php | 2 +- .../Servers/StartupCommandService.php | 2 +- .../Servers/StartupModificationService.php | 2 +- app/Services/Servers/SuspensionService.php | 1 - .../Servers/VariableValidatorService.php | 2 +- .../Api/Application/SubuserTransformer.php | 1 - .../Api/Client/EggVariableTransformer.php | 3 +-- composer.json | 4 ++-- config/database.php | 4 ++-- config/pterodactyl.php | 2 +- .../AllocationFactory.php | 0 .../ApiKeyFactory.php | 0 .../BackupFactory.php | 0 .../DatabaseFactory.php | 0 .../DatabaseHostFactory.php | 0 .../{factories => Factories}/EggFactory.php | 0 .../EggVariableFactory.php | 2 +- .../LocationFactory.php | 0 .../{factories => Factories}/NestFactory.php | 0 .../{factories => Factories}/NodeFactory.php | 0 .../ScheduleFactory.php | 0 .../ServerFactory.php | 0 .../SubuserFactory.php | 2 +- .../{factories => Factories}/TaskFactory.php | 0 .../{factories => Factories}/UserFactory.php | 0 database/{seeders => Seeders}/.gitkeep | 0 .../{seeders => Seeders}/DatabaseSeeder.php | 0 database/{seeders => Seeders}/EggSeeder.php | 0 database/{seeders => Seeders}/NestSeeder.php | 0 .../eggs/minecraft/egg-bungeecord.json | 0 .../eggs/minecraft/egg-forge-minecraft.json | 0 .../eggs/minecraft/egg-paper.json | 0 .../minecraft/egg-sponge--sponge-vanilla.json | 0 .../eggs/minecraft/egg-vanilla-minecraft.json | 0 .../eggs/rust/egg-rust.json | 0 .../egg-ark--survival-evolved.json | 0 ...egg-counter--strike--global-offensive.json | 0 .../egg-custom-source-engine-game.json | 0 .../eggs/source-engine/egg-garrys-mod.json | 0 .../eggs/source-engine/egg-insurgency.json | 0 .../source-engine/egg-team-fortress2.json | 0 .../eggs/voice-servers/egg-mumble-server.json | 0 .../voice-servers/egg-teamspeak3-server.json | 0 ...03_10_173607_MigrateToNewServiceSystem.php | 2 +- ..._merge_permissions_table_into_subusers.php | 2 +- ...2020_04_03_230614_create_backups_table.php | 4 ++-- ..._26_111208_add_backup_limit_to_servers.php | 2 +- ...3612_create_user_recovery_tokens_table.php | 4 ++-- ...01845_add_notes_column_for_allocations.php | 4 ++-- ...533_add_backup_state_column_to_backups.php | 4 ++-- ...132500_update_bytes_to_unsigned_bigint.php | 4 ++-- ...31_modify_checksums_column_for_backups.php | 4 ++-- ...0_09_13_110007_drop_packs_from_servers.php | 4 ++-- ...21_drop_packs_from_api_key_permissions.php | 4 ++-- .../2020_09_13_110047_drop_packs_table.php | 4 ++-- ...020_09_13_113503_drop_daemon_key_table.php | 4 ++-- ...ue_database_name_to_account_for_server.php | 5 ++--- ...move_nullable_from_schedule_name_field.php | 4 ++-- ..._02_201014_add_features_column_to_eggs.php | 4 ++-- ...ort_multiple_docker_images_and_updates.php | 4 ++-- ..._24_092449_make_allocation_fields_json.php | 4 ++-- ...53937_add_file_denylist_to_egg_configs.php | 4 ++-- .../2021_01_13_013420_add_cron_month.php | 4 ++-- routes/api-client.php | 2 -- tests/Browser/BrowserTestCase.php | 2 +- .../ApplicationApiIntegrationTestCase.php | 4 ++-- .../Client/ClientApiIntegrationTestCase.php | 6 ++--- .../Api/Client/ClientControllerTest.php | 2 +- .../AllocationAuthorizationTest.php | 18 +++++++-------- .../Allocation/CreateNewAllocationTest.php | 10 ++++----- .../Allocation/DeleteAllocationTest.php | 2 +- .../Server/Backup/BackupAuthorizationTest.php | 18 +++++++-------- .../Database/DatabaseAuthorizationTest.php | 16 +++++++------- .../Server/Schedule/ExecuteScheduleTest.php | 2 +- .../Schedule/ScheduleAuthorizationTest.php | 22 +++++++++---------- .../Startup/GetStartupAndVariablesTest.php | 6 ++--- .../Startup/UpdateStartupVariableTest.php | 4 ++-- .../Subuser/CreateServerSubuserTest.php | 14 ++++++------ .../Server/Subuser/DeleteSubuserTest.php | 2 +- .../Subuser/SubuserAuthorizationTest.php | 8 +++---- .../Client/Server/WebsocketControllerTest.php | 1 - .../Controllers/Admin/UserControllerTest.php | 10 ++++----- tests/Integration/IntegrationTestCase.php | 2 +- .../DeployServerDatabaseServiceTest.php | 3 +-- .../Deployment/FindViableNodesServiceTest.php | 4 ++-- .../Schedules/ProcessScheduleServiceTest.php | 2 +- .../Servers/ServerCreationServiceTest.php | 4 ++-- .../StartupModificationServiceTest.php | 3 +-- .../Servers/VariableValidatorServiceTest.php | 1 - .../Api/AuthenticateIPAccessTest.php | 2 +- .../Middleware/Api/AuthenticateKeyTest.php | 2 +- .../Api/Daemon/DaemonAuthenticateTest.php | 2 +- .../Middleware/Api/SetSessionDriverTest.php | 2 +- .../Server/AccessingValidServerTest.php | 2 +- tests/Unit/Rules/UsernameTest.php | 2 +- tests/Unit/Services/Acl/Api/AdminAclTest.php | 2 +- .../Services/Api/KeyCreationServiceTest.php | 2 +- 151 files changed, 203 insertions(+), 240 deletions(-) rename database/{factories => Factories}/AllocationFactory.php (100%) rename database/{factories => Factories}/ApiKeyFactory.php (100%) rename database/{factories => Factories}/BackupFactory.php (100%) rename database/{factories => Factories}/DatabaseFactory.php (100%) rename database/{factories => Factories}/DatabaseHostFactory.php (100%) rename database/{factories => Factories}/EggFactory.php (100%) rename database/{factories => Factories}/EggVariableFactory.php (97%) rename database/{factories => Factories}/LocationFactory.php (100%) rename database/{factories => Factories}/NestFactory.php (100%) rename database/{factories => Factories}/NodeFactory.php (100%) rename database/{factories => Factories}/ScheduleFactory.php (100%) rename database/{factories => Factories}/ServerFactory.php (100%) rename database/{factories => Factories}/SubuserFactory.php (91%) rename database/{factories => Factories}/TaskFactory.php (100%) rename database/{factories => Factories}/UserFactory.php (100%) rename database/{seeders => Seeders}/.gitkeep (100%) rename database/{seeders => Seeders}/DatabaseSeeder.php (100%) rename database/{seeders => Seeders}/EggSeeder.php (100%) rename database/{seeders => Seeders}/NestSeeder.php (100%) rename database/{seeders => Seeders}/eggs/minecraft/egg-bungeecord.json (100%) rename database/{seeders => Seeders}/eggs/minecraft/egg-forge-minecraft.json (100%) rename database/{seeders => Seeders}/eggs/minecraft/egg-paper.json (100%) rename database/{seeders => Seeders}/eggs/minecraft/egg-sponge--sponge-vanilla.json (100%) rename database/{seeders => Seeders}/eggs/minecraft/egg-vanilla-minecraft.json (100%) rename database/{seeders => Seeders}/eggs/rust/egg-rust.json (100%) rename database/{seeders => Seeders}/eggs/source-engine/egg-ark--survival-evolved.json (100%) rename database/{seeders => Seeders}/eggs/source-engine/egg-counter--strike--global-offensive.json (100%) rename database/{seeders => Seeders}/eggs/source-engine/egg-custom-source-engine-game.json (100%) rename database/{seeders => Seeders}/eggs/source-engine/egg-garrys-mod.json (100%) rename database/{seeders => Seeders}/eggs/source-engine/egg-insurgency.json (100%) rename database/{seeders => Seeders}/eggs/source-engine/egg-team-fortress2.json (100%) rename database/{seeders => Seeders}/eggs/voice-servers/egg-mumble-server.json (100%) rename database/{seeders => Seeders}/eggs/voice-servers/egg-teamspeak3-server.json (100%) diff --git a/app/Console/Commands/Overrides/SeedCommand.php b/app/Console/Commands/Overrides/SeedCommand.php index 91b555d4..d8bc9c2a 100644 --- a/app/Console/Commands/Overrides/SeedCommand.php +++ b/app/Console/Commands/Overrides/SeedCommand.php @@ -17,7 +17,7 @@ class SeedCommand extends BaseSeedCommand */ public function handle() { - if (!$this->hasCompletedMigrations()) { + if (! $this->hasCompletedMigrations()) { return $this->showMigrationWarning(); } diff --git a/app/Console/Commands/Overrides/UpCommand.php b/app/Console/Commands/Overrides/UpCommand.php index 3a5f3461..4d28b1bd 100644 --- a/app/Console/Commands/Overrides/UpCommand.php +++ b/app/Console/Commands/Overrides/UpCommand.php @@ -14,7 +14,7 @@ class UpCommand extends BaseUpCommand */ public function handle() { - if (!$this->hasCompletedMigrations()) { + if (! $this->hasCompletedMigrations()) { return $this->showMigrationWarning(); } diff --git a/app/Console/Commands/Schedule/ProcessRunnableCommand.php b/app/Console/Commands/Schedule/ProcessRunnableCommand.php index 310b2f3b..8a4134ac 100644 --- a/app/Console/Commands/Schedule/ProcessRunnableCommand.php +++ b/app/Console/Commands/Schedule/ProcessRunnableCommand.php @@ -2,8 +2,8 @@ namespace Pterodactyl\Console\Commands\Schedule; -use Throwable; use Exception; +use Throwable; use Illuminate\Console\Command; use Pterodactyl\Models\Schedule; use Illuminate\Support\Facades\Log; diff --git a/app/Console/Commands/Server/BulkPowerActionCommand.php b/app/Console/Commands/Server/BulkPowerActionCommand.php index 32d9868b..0e5934bf 100644 --- a/app/Console/Commands/Server/BulkPowerActionCommand.php +++ b/app/Console/Commands/Server/BulkPowerActionCommand.php @@ -99,9 +99,9 @@ class BulkPowerActionCommand extends Command if (! empty($nodes) && ! empty($servers)) { $instance->whereIn('id', $servers)->orWhereIn('node_id', $nodes); - } else if (empty($nodes) && ! empty($servers)) { + } elseif (empty($nodes) && ! empty($servers)) { $instance->whereIn('id', $servers); - } else if (! empty($nodes) && empty($servers)) { + } elseif (! empty($nodes) && empty($servers)) { $instance->whereIn('node_id', $nodes); } diff --git a/app/Console/Commands/User/DeleteUserCommand.php b/app/Console/Commands/User/DeleteUserCommand.php index 64885dca..30460464 100644 --- a/app/Console/Commands/User/DeleteUserCommand.php +++ b/app/Console/Commands/User/DeleteUserCommand.php @@ -9,11 +9,10 @@ namespace Pterodactyl\Console\Commands\User; -use Webmozart\Assert\Assert; use Pterodactyl\Models\User; +use Webmozart\Assert\Assert; use Illuminate\Console\Command; use Pterodactyl\Services\Users\UserDeletionService; -use Pterodactyl\Contracts\Repository\UserRepositoryInterface; class DeleteUserCommand extends Command { @@ -42,7 +41,8 @@ class DeleteUserCommand extends Command * * @param \Pterodactyl\Services\Users\UserDeletionService $deletionService */ - public function __construct(UserDeletionService $deletionService) { + public function __construct(UserDeletionService $deletionService) + { parent::__construct(); $this->deletionService = $deletionService; @@ -96,7 +96,5 @@ class DeleteUserCommand extends Command $this->deletionService->handle($deleteUser); $this->info(trans('command/messages.user.deleted')); } - - return; } } diff --git a/app/Console/RequiresDatabaseMigrations.php b/app/Console/RequiresDatabaseMigrations.php index f288ca1f..7b881d00 100644 --- a/app/Console/RequiresDatabaseMigrations.php +++ b/app/Console/RequiresDatabaseMigrations.php @@ -39,7 +39,7 @@ trait RequiresDatabaseMigrations */ protected function showMigrationWarning(): int { - $this->getOutput()->writeln(" + $this->getOutput()->writeln(' | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | | | | Your database has not been properly migrated! | @@ -52,9 +52,9 @@ You must run the following command to finish migrating your database: You will not be able to use Pterodactyl Panel as expected without fixing your database state by running the command above. -"); +'); - $this->getOutput()->error("You must correct the error above before continuing."); + $this->getOutput()->error('You must correct the error above before continuing.'); return 1; } diff --git a/app/Contracts/Repository/AllocationRepositoryInterface.php b/app/Contracts/Repository/AllocationRepositoryInterface.php index 40027973..143834a4 100644 --- a/app/Contracts/Repository/AllocationRepositoryInterface.php +++ b/app/Contracts/Repository/AllocationRepositoryInterface.php @@ -2,8 +2,6 @@ namespace Pterodactyl\Contracts\Repository; -use Illuminate\Support\Collection; - interface AllocationRepositoryInterface extends RepositoryInterface { /** diff --git a/app/Contracts/Repository/NodeRepositoryInterface.php b/app/Contracts/Repository/NodeRepositoryInterface.php index 76ed7da9..fc6f1d89 100644 --- a/app/Contracts/Repository/NodeRepositoryInterface.php +++ b/app/Contracts/Repository/NodeRepositoryInterface.php @@ -4,9 +4,6 @@ namespace Pterodactyl\Contracts\Repository; use Pterodactyl\Models\Node; use Illuminate\Support\Collection; -use Illuminate\Support\LazyCollection; -use Illuminate\Contracts\Pagination\LengthAwarePaginator; -use Pterodactyl\Contracts\Repository\Attributes\SearchableInterface; interface NodeRepositoryInterface extends RepositoryInterface { diff --git a/app/Exceptions/Http/Connection/DaemonConnectionException.php b/app/Exceptions/Http/Connection/DaemonConnectionException.php index e6765b8a..b8b35ac1 100644 --- a/app/Exceptions/Http/Connection/DaemonConnectionException.php +++ b/app/Exceptions/Http/Connection/DaemonConnectionException.php @@ -42,7 +42,7 @@ class DaemonConnectionException extends DisplayException $body = $response->getBody(); if (is_string($body) || (is_object($body) && method_exists($body, '__toString'))) { $body = json_decode(is_string($body) ? $body : $body->__toString(), true); - $message = "[Wings Error]: " . Arr::get($body, 'error', $message); + $message = '[Wings Error]: ' . Arr::get($body, 'error', $message); } } diff --git a/app/Exceptions/Http/TwoFactorAuthRequiredException.php b/app/Exceptions/Http/TwoFactorAuthRequiredException.php index c3850357..23a581f7 100644 --- a/app/Exceptions/Http/TwoFactorAuthRequiredException.php +++ b/app/Exceptions/Http/TwoFactorAuthRequiredException.php @@ -16,6 +16,6 @@ class TwoFactorAuthRequiredException extends HttpException implements HttpExcept */ public function __construct(Throwable $previous = null) { - parent::__construct(Response::HTTP_BAD_REQUEST, "Two-factor authentication is required on this account in order to access this endpoint.", $previous); + parent::__construct(Response::HTTP_BAD_REQUEST, 'Two-factor authentication is required on this account in order to access this endpoint.', $previous); } } diff --git a/app/Extensions/Backups/BackupManager.php b/app/Extensions/Backups/BackupManager.php index fb0e0a26..e812e0d6 100644 --- a/app/Extensions/Backups/BackupManager.php +++ b/app/Extensions/Backups/BackupManager.php @@ -8,8 +8,8 @@ use Illuminate\Support\Arr; use Illuminate\Support\Str; use Webmozart\Assert\Assert; use InvalidArgumentException; -use League\Flysystem\AdapterInterface; use Illuminate\Foundation\Application; +use League\Flysystem\AdapterInterface; use League\Flysystem\AwsS3v3\AwsS3Adapter; use League\Flysystem\Memory\MemoryAdapter; use Illuminate\Contracts\Config\Repository; diff --git a/app/Http/Controllers/Admin/MountController.php b/app/Http/Controllers/Admin/MountController.php index 79c72997..506c2b0d 100644 --- a/app/Http/Controllers/Admin/MountController.php +++ b/app/Http/Controllers/Admin/MountController.php @@ -3,17 +3,13 @@ namespace Pterodactyl\Http\Controllers\Admin; use Ramsey\Uuid\Uuid; -use Illuminate\Support\Str; use Illuminate\Http\Request; use Pterodactyl\Models\Nest; use Pterodactyl\Models\Mount; use Pterodactyl\Models\Location; use Prologue\Alerts\AlertsMessageBag; use Pterodactyl\Http\Controllers\Controller; -use Pterodactyl\Services\Mounts\MountUpdateService; use Pterodactyl\Http\Requests\Admin\MountFormRequest; -use Pterodactyl\Services\Mounts\MountCreationService; -use Pterodactyl\Services\Mounts\MountDeletionService; use Pterodactyl\Repositories\Eloquent\MountRepository; use Pterodactyl\Contracts\Repository\NestRepositoryInterface; use Pterodactyl\Contracts\Repository\LocationRepositoryInterface; diff --git a/app/Http/Controllers/Admin/Nests/EggController.php b/app/Http/Controllers/Admin/Nests/EggController.php index 4e3dd5e9..dc9cae5a 100644 --- a/app/Http/Controllers/Admin/Nests/EggController.php +++ b/app/Http/Controllers/Admin/Nests/EggController.php @@ -79,7 +79,7 @@ class EggController extends Controller public function store(EggFormRequest $request): RedirectResponse { $data = $request->normalize(); - if (!empty($data['docker_images']) && !is_array($data['docker_images'])) { + if (! empty($data['docker_images']) && ! is_array($data['docker_images'])) { $data['docker_images'] = array_map(function ($value) { return trim($value); }, explode("\n", $data['docker_images'])); @@ -116,7 +116,7 @@ class EggController extends Controller public function update(EggFormRequest $request, Egg $egg): RedirectResponse { $data = $request->normalize(); - if (!empty($data['docker_images']) && !is_array($data['docker_images'])) { + if (! empty($data['docker_images']) && ! is_array($data['docker_images'])) { $data['docker_images'] = array_map(function ($value) { return trim($value); }, explode("\n", $data['docker_images'])); diff --git a/app/Http/Controllers/Admin/Servers/CreateServerController.php b/app/Http/Controllers/Admin/Servers/CreateServerController.php index 1cea7651..b36fe4da 100644 --- a/app/Http/Controllers/Admin/Servers/CreateServerController.php +++ b/app/Http/Controllers/Admin/Servers/CreateServerController.php @@ -118,7 +118,7 @@ class CreateServerController extends Controller public function store(ServerFormRequest $request) { $data = $request->except(['_token']); - if (!empty($data['custom_image'])) { + if (! empty($data['custom_image'])) { $data['image'] = $data['custom_image']; unset($data['custom_image']); } diff --git a/app/Http/Controllers/Admin/Servers/ServerTransferController.php b/app/Http/Controllers/Admin/Servers/ServerTransferController.php index 5207ef9d..c85f28e3 100644 --- a/app/Http/Controllers/Admin/Servers/ServerTransferController.php +++ b/app/Http/Controllers/Admin/Servers/ServerTransferController.php @@ -89,7 +89,8 @@ class ServerTransferController extends Controller * * @throws \Throwable */ - public function transfer(Request $request, Server $server) { + public function transfer(Request $request, Server $server) + { $validatedData = $request->validate([ 'node_id' => 'required|exists:nodes,id', 'allocation_id' => 'required|bail|unique:servers|exists:allocations,id', diff --git a/app/Http/Controllers/Admin/ServersController.php b/app/Http/Controllers/Admin/ServersController.php index bec5ac4a..0f77ce5f 100644 --- a/app/Http/Controllers/Admin/ServersController.php +++ b/app/Http/Controllers/Admin/ServersController.php @@ -9,14 +9,12 @@ namespace Pterodactyl\Http\Controllers\Admin; -use Illuminate\Support\Arr; use Illuminate\Http\Request; use Pterodactyl\Models\User; use Pterodactyl\Models\Mount; use Pterodactyl\Models\Server; use Pterodactyl\Models\MountServer; use Prologue\Alerts\AlertsMessageBag; -use GuzzleHttp\Exception\RequestException; use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Http\Controllers\Controller; use Illuminate\Validation\ValidationException; @@ -37,7 +35,6 @@ use Illuminate\Contracts\Config\Repository as ConfigRepository; use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface; use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface; -use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; use Pterodactyl\Services\Servers\ServerConfigurationStructureService; use Pterodactyl\Http\Requests\Admin\Servers\Databases\StoreServerDatabaseRequest; @@ -338,7 +335,7 @@ class ServersController extends Controller public function saveStartup(Request $request, Server $server) { $data = $request->except('_token'); - if (!empty($data['custom_docker_image'])) { + if (! empty($data['custom_docker_image'])) { $data['docker_image'] = $data['custom_docker_image']; unset($data['custom_docker_image']); } diff --git a/app/Http/Controllers/Api/Client/ClientController.php b/app/Http/Controllers/Api/Client/ClientController.php index 243868b5..7c66b742 100644 --- a/app/Http/Controllers/Api/Client/ClientController.php +++ b/app/Http/Controllers/Api/Client/ClientController.php @@ -67,7 +67,7 @@ class ClientController extends ClientApiController ? $builder : $builder->whereNotIn('servers.id', $user->accessibleServers()->pluck('id')->all()); } - } else if ($type === 'owner') { + } elseif ($type === 'owner') { $builder = $builder->where('servers.owner_id', $user->id); } else { $builder = $builder->whereIn('servers.id', $user->accessibleServers()->pluck('id')->all()); diff --git a/app/Http/Controllers/Api/Client/Servers/BackupController.php b/app/Http/Controllers/Api/Client/Servers/BackupController.php index 23daf1bc..84f7496b 100644 --- a/app/Http/Controllers/Api/Client/Servers/BackupController.php +++ b/app/Http/Controllers/Api/Client/Servers/BackupController.php @@ -61,6 +61,7 @@ class BackupController extends ClientApiController public function index(GetBackupsRequest $request, Server $server) { $limit = min($request->query('per_page') ?? 20, 50); + return $this->fractal->collection($server->backups()->paginate($limit)) ->transformWith($this->getTransformer(BackupTransformer::class)) ->toArray(); diff --git a/app/Http/Controllers/Api/Client/Servers/FileController.php b/app/Http/Controllers/Api/Client/Servers/FileController.php index 7597c0b0..0b764e5d 100644 --- a/app/Http/Controllers/Api/Client/Servers/FileController.php +++ b/app/Http/Controllers/Api/Client/Servers/FileController.php @@ -14,9 +14,9 @@ use Pterodactyl\Http\Controllers\Api\Client\ClientApiController; use Pterodactyl\Http\Requests\Api\Client\Servers\Files\CopyFileRequest; use Pterodactyl\Http\Requests\Api\Client\Servers\Files\PullFileRequest; use Pterodactyl\Http\Requests\Api\Client\Servers\Files\ListFilesRequest; +use Pterodactyl\Http\Requests\Api\Client\Servers\Files\ChmodFilesRequest; use Pterodactyl\Http\Requests\Api\Client\Servers\Files\DeleteFileRequest; use Pterodactyl\Http\Requests\Api\Client\Servers\Files\RenameFileRequest; -use Pterodactyl\Http\Requests\Api\Client\Servers\Files\ChmodFilesRequest; use Pterodactyl\Http\Requests\Api\Client\Servers\Files\CreateFolderRequest; use Pterodactyl\Http\Requests\Api\Client\Servers\Files\CompressFilesRequest; use Pterodactyl\Http\Requests\Api\Client\Servers\Files\DecompressFilesRequest; diff --git a/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php b/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php index 43140f62..5af97ab5 100644 --- a/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php +++ b/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php @@ -112,7 +112,7 @@ class NetworkAllocationController extends ClientApiController /** * Set the notes for the allocation for a server. - *s + *s. * * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Network\NewAllocationRequest $request * @param \Pterodactyl\Models\Server $server diff --git a/app/Http/Controllers/Api/Client/Servers/ScheduleController.php b/app/Http/Controllers/Api/Client/Servers/ScheduleController.php index 0d7241a6..5d86c759 100644 --- a/app/Http/Controllers/Api/Client/Servers/ScheduleController.php +++ b/app/Http/Controllers/Api/Client/Servers/ScheduleController.php @@ -10,7 +10,6 @@ use Pterodactyl\Models\Server; use Pterodactyl\Models\Schedule; use Illuminate\Http\JsonResponse; use Pterodactyl\Helpers\Utilities; -use Pterodactyl\Jobs\Schedule\RunTaskJob; use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Repositories\Eloquent\ScheduleRepository; use Pterodactyl\Services\Schedules\ProcessScheduleService; @@ -173,7 +172,7 @@ class ScheduleController extends ClientApiController */ public function execute(TriggerScheduleRequest $request, Server $server, Schedule $schedule) { - if (!$schedule->is_active) { + if (! $schedule->is_active) { throw new BadRequestHttpException( 'Cannot trigger schedule exection for a schedule that is not currently active.' ); diff --git a/app/Http/Controllers/Api/Client/Servers/SettingsController.php b/app/Http/Controllers/Api/Client/Servers/SettingsController.php index 80fc0e18..1e0b4aad 100644 --- a/app/Http/Controllers/Api/Client/Servers/SettingsController.php +++ b/app/Http/Controllers/Api/Client/Servers/SettingsController.php @@ -2,7 +2,6 @@ namespace Pterodactyl\Http\Controllers\Api\Client\Servers; -use Illuminate\Http\Request; use Illuminate\Http\Response; use Pterodactyl\Models\Server; use Illuminate\Http\JsonResponse; @@ -88,7 +87,7 @@ class SettingsController extends ClientApiController */ public function dockerImage(SetDockerImageRequest $request, Server $server) { - if (!in_array($server->image, $server->egg->docker_images)) { + if (! in_array($server->image, $server->egg->docker_images)) { throw new BadRequestHttpException( 'This server\'s Docker image has been manually set by an administrator and cannot be updated.' ); diff --git a/app/Http/Controllers/Api/Client/Servers/StartupController.php b/app/Http/Controllers/Api/Client/Servers/StartupController.php index 7e06abf8..76f59546 100644 --- a/app/Http/Controllers/Api/Client/Servers/StartupController.php +++ b/app/Http/Controllers/Api/Client/Servers/StartupController.php @@ -86,11 +86,11 @@ class StartupController extends ClientApiController if (is_null($variable) || ! $variable->user_viewable) { throw new BadRequestHttpException( - "The environment variable you are trying to edit does not exist." + 'The environment variable you are trying to edit does not exist.' ); - } else if (! $variable->user_editable) { + } elseif (! $variable->user_editable) { throw new BadRequestHttpException( - "The environment variable you are trying to edit is read-only." + 'The environment variable you are trying to edit is read-only.' ); } diff --git a/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php b/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php index b11c07ad..92d911f9 100644 --- a/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php +++ b/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php @@ -6,8 +6,8 @@ use Carbon\CarbonImmutable; use Pterodactyl\Models\Backup; use Illuminate\Http\JsonResponse; use League\Flysystem\AwsS3v3\AwsS3Adapter; -use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Exceptions\DisplayException; +use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Extensions\Backups\BackupManager; use Pterodactyl\Repositories\Eloquent\BackupRepository; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; diff --git a/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php b/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php index 99ba7136..5bbd2d55 100644 --- a/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php +++ b/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php @@ -85,7 +85,7 @@ class ServerDetailsController extends Controller ->where('node_id', $node->id) // If you don't cast this to a string you'll end up with a stringified per_page returned in // the metadata, and then Wings will panic crash as a result. - ->paginate((int)$request->input('per_page', 50)); + ->paginate((int) $request->input('per_page', 50)); return new ServerConfigurationCollection($servers); } diff --git a/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php b/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php index 8b0cf9d5..221ddbeb 100644 --- a/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php +++ b/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php @@ -2,8 +2,8 @@ namespace Pterodactyl\Http\Controllers\Api\Remote\Servers; -use Illuminate\Support\Arr; use Carbon\CarbonImmutable; +use Illuminate\Support\Arr; use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\Http\JsonResponse; diff --git a/app/Http/Controllers/Auth/LoginCheckpointController.php b/app/Http/Controllers/Auth/LoginCheckpointController.php index 70d83a32..4a5d6e87 100644 --- a/app/Http/Controllers/Auth/LoginCheckpointController.php +++ b/app/Http/Controllers/Auth/LoginCheckpointController.php @@ -12,7 +12,6 @@ use Illuminate\Database\Eloquent\ModelNotFoundException; use Pterodactyl\Http\Requests\Auth\LoginCheckpointRequest; use Illuminate\Contracts\Cache\Repository as CacheRepository; use Pterodactyl\Contracts\Repository\UserRepositoryInterface; -use Pterodactyl\Exceptions\Repository\RecordNotFoundException; use Pterodactyl\Repositories\Eloquent\RecoveryTokenRepository; class LoginCheckpointController extends AbstractLoginController diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 8eaed6c3..178be84f 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -2,8 +2,8 @@ namespace Pterodactyl\Http\Controllers\Auth; -use Illuminate\Support\Str; use Carbon\CarbonImmutable; +use Illuminate\Support\Str; use Illuminate\Http\Request; use Illuminate\Auth\AuthManager; use Illuminate\Http\JsonResponse; diff --git a/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php b/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php index e9eaa143..01462317 100644 --- a/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php +++ b/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php @@ -8,8 +8,8 @@ use Pterodactyl\Models\Server; use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; use Symfony\Component\HttpKernel\Exception\ConflictHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Pterodactyl\Exceptions\Http\Server\ServerTransferringException; +use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; class AuthenticateServerAccess { diff --git a/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php b/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php index b57fee2e..81254f17 100644 --- a/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php +++ b/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php @@ -7,11 +7,11 @@ use Illuminate\Http\Request; use Pterodactyl\Models\Task; use Pterodactyl\Models\User; use InvalidArgumentException; -use Pterodactyl\Models\Server; use Pterodactyl\Models\Backup; +use Pterodactyl\Models\Server; use Pterodactyl\Models\Subuser; -use Pterodactyl\Models\Schedule; use Pterodactyl\Models\Database; +use Pterodactyl\Models\Schedule; use Pterodactyl\Models\Allocation; use Illuminate\Database\Eloquent\Model; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; diff --git a/app/Http/Middleware/Api/Client/SubstituteClientApiBindings.php b/app/Http/Middleware/Api/Client/SubstituteClientApiBindings.php index 7ab597b6..c5a20f29 100644 --- a/app/Http/Middleware/Api/Client/SubstituteClientApiBindings.php +++ b/app/Http/Middleware/Api/Client/SubstituteClientApiBindings.php @@ -43,7 +43,7 @@ class SubstituteClientApiBindings extends ApiSubstituteBindings } }); - $this->router->bind('database', function ($value) use ($request) { + $this->router->bind('database', function ($value) { $id = Container::getInstance()->make(HashidsInterface::class)->decodeFirst($value); return Database::query()->where('id', $id)->firstOrFail(); diff --git a/app/Http/Middleware/RequireTwoFactorAuthentication.php b/app/Http/Middleware/RequireTwoFactorAuthentication.php index d837df24..d3c8ec6f 100644 --- a/app/Http/Middleware/RequireTwoFactorAuthentication.php +++ b/app/Http/Middleware/RequireTwoFactorAuthentication.php @@ -59,14 +59,14 @@ class RequireTwoFactorAuthentication return $next($request); } - $level = (int)config('pterodactyl.auth.2fa_required'); + $level = (int) config('pterodactyl.auth.2fa_required'); // If this setting is not configured, or the user is already using 2FA then we can just // send them right through, nothing else needs to be checked. // // If the level is set as admin and the user is not an admin, pass them through as well. if ($level === self::LEVEL_NONE || $user->use_totp) { return $next($request); - } else if ($level === self::LEVEL_ADMIN && ! $user->root_admin) { + } elseif ($level === self::LEVEL_ADMIN && ! $user->root_admin) { return $next($request); } diff --git a/app/Http/Requests/Admin/Egg/EggFormRequest.php b/app/Http/Requests/Admin/Egg/EggFormRequest.php index 92e4a654..4cc44f63 100644 --- a/app/Http/Requests/Admin/Egg/EggFormRequest.php +++ b/app/Http/Requests/Admin/Egg/EggFormRequest.php @@ -44,7 +44,7 @@ class EggFormRequest extends AdminFormRequest public function withValidator($validator) { $validator->sometimes('config_from', 'exists:eggs,id', function () { - return (int)$this->input('config_from') !== 0; + return (int) $this->input('config_from') !== 0; }); } } diff --git a/app/Http/Resources/Wings/ServerConfigurationCollection.php b/app/Http/Resources/Wings/ServerConfigurationCollection.php index 5ee877a9..8cf6ec7f 100644 --- a/app/Http/Resources/Wings/ServerConfigurationCollection.php +++ b/app/Http/Resources/Wings/ServerConfigurationCollection.php @@ -24,7 +24,7 @@ class ServerConfigurationCollection extends ResourceCollection $egg = Container::getInstance()->make(EggConfigurationService::class); $configuration = Container::getInstance()->make(ServerConfigurationStructureService::class); - return $this->collection->map(function (Server $server) use ($configuration, $egg) { + return $this->collection->map(function (Server $server) use ($configuration, $egg) { return [ 'uuid' => $server->uuid, 'settings' => $configuration->handle($server), diff --git a/app/Jobs/Schedule/RunTaskJob.php b/app/Jobs/Schedule/RunTaskJob.php index ee3c3e16..9b0497bb 100644 --- a/app/Jobs/Schedule/RunTaskJob.php +++ b/app/Jobs/Schedule/RunTaskJob.php @@ -8,7 +8,6 @@ use Carbon\CarbonImmutable; use Pterodactyl\Models\Task; use InvalidArgumentException; use Pterodactyl\Models\Schedule; -use Illuminate\Support\Facades\Log; use Illuminate\Queue\SerializesModels; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldQueue; diff --git a/app/Models/Filters/MultiFieldServerFilter.php b/app/Models/Filters/MultiFieldServerFilter.php index 21c45b77..2d6cd2c0 100644 --- a/app/Models/Filters/MultiFieldServerFilter.php +++ b/app/Models/Filters/MultiFieldServerFilter.php @@ -42,12 +42,12 @@ class MultiFieldServerFilter implements Filter $parts = explode(':', $value); $builder->when( - !Str::startsWith($value, ':'), + ! Str::startsWith($value, ':'), // When the string does not start with a ":" it means we're looking for an IP or IP:Port // combo, so use a query to handle that. function (Builder $builder) use ($parts) { $builder->orWhere('allocations.ip', $parts[0]); - if (!is_null($parts[1] ?? null)) { + if (! is_null($parts[1] ?? null)) { $builder->where('allocations.port', 'LIKE', "{$parts[1]}%"); } }, diff --git a/app/Models/Model.php b/app/Models/Model.php index 86a8cfcb..90207474 100644 --- a/app/Models/Model.php +++ b/app/Models/Model.php @@ -7,8 +7,8 @@ use Illuminate\Validation\Rule; use Illuminate\Container\Container; use Illuminate\Contracts\Validation\Factory; use Illuminate\Database\Eloquent\Factories\HasFactory; -use Illuminate\Database\Eloquent\Model as IlluminateModel; use Pterodactyl\Exceptions\Model\DataValidationException; +use Illuminate\Database\Eloquent\Model as IlluminateModel; abstract class Model extends IlluminateModel { diff --git a/app/Models/Mount.php b/app/Models/Mount.php index ee9879b1..99dd6234 100644 --- a/app/Models/Mount.php +++ b/app/Models/Mount.php @@ -87,7 +87,7 @@ class Mount extends Model public $timestamps = false; /** - * Blacklisted source paths + * Blacklisted source paths. * * @var string[] */ @@ -98,7 +98,7 @@ class Mount extends Model ]; /** - * Blacklisted target paths + * Blacklisted target paths. * * @var string[] */ diff --git a/app/Models/Node.php b/app/Models/Node.php index 8258ae86..8a711ad7 100644 --- a/app/Models/Node.php +++ b/app/Models/Node.php @@ -202,7 +202,7 @@ class Node extends Model */ public function getDecryptedKey(): string { - return (string)Container::getInstance()->make(Encrypter::class)->decrypt( + return (string) Container::getInstance()->make(Encrypter::class)->decrypt( $this->daemon_token ); } diff --git a/app/Repositories/Eloquent/DatabaseRepository.php b/app/Repositories/Eloquent/DatabaseRepository.php index 46b3916d..0ae6758d 100644 --- a/app/Repositories/Eloquent/DatabaseRepository.php +++ b/app/Repositories/Eloquent/DatabaseRepository.php @@ -8,7 +8,6 @@ use Illuminate\Foundation\Application; use Illuminate\Database\DatabaseManager; use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface; -use Pterodactyl\Exceptions\Repository\DuplicateDatabaseNameException; class DatabaseRepository extends EloquentRepository implements DatabaseRepositoryInterface { diff --git a/app/Repositories/Eloquent/EloquentRepository.php b/app/Repositories/Eloquent/EloquentRepository.php index bd813302..8e25a5e2 100644 --- a/app/Repositories/Eloquent/EloquentRepository.php +++ b/app/Repositories/Eloquent/EloquentRepository.php @@ -13,7 +13,6 @@ use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Pterodactyl\Contracts\Repository\RepositoryInterface; use Pterodactyl\Exceptions\Model\DataValidationException; use Pterodactyl\Exceptions\Repository\RecordNotFoundException; -use Pterodactyl\Contracts\Repository\Attributes\SearchableInterface; abstract class EloquentRepository extends Repository implements RepositoryInterface { diff --git a/app/Repositories/Eloquent/NodeRepository.php b/app/Repositories/Eloquent/NodeRepository.php index 9c852fb5..57b98bb7 100644 --- a/app/Repositories/Eloquent/NodeRepository.php +++ b/app/Repositories/Eloquent/NodeRepository.php @@ -4,8 +4,6 @@ namespace Pterodactyl\Repositories\Eloquent; use Pterodactyl\Models\Node; use Illuminate\Support\Collection; -use Illuminate\Support\LazyCollection; -use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Pterodactyl\Contracts\Repository\NodeRepositoryInterface; class NodeRepository extends EloquentRepository implements NodeRepositoryInterface diff --git a/app/Repositories/Eloquent/ServerRepository.php b/app/Repositories/Eloquent/ServerRepository.php index 5c16664b..a96c4b65 100644 --- a/app/Repositories/Eloquent/ServerRepository.php +++ b/app/Repositories/Eloquent/ServerRepository.php @@ -51,7 +51,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt if (! is_null($server) && is_null($node)) { $instance = $instance->where('id', '=', $server); - } else if (is_null($server) && ! is_null($node)) { + } elseif (is_null($server) && ! is_null($node)) { $instance = $instance->where('node_id', '=', $node); } @@ -71,7 +71,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt if (! is_null($server) && is_null($node)) { $instance = $instance->where('id', '=', $server); - } else if (is_null($server) && ! is_null($node)) { + } elseif (is_null($server) && ! is_null($node)) { $instance = $instance->where('node_id', '=', $node); } diff --git a/app/Repositories/Wings/DaemonBackupRepository.php b/app/Repositories/Wings/DaemonBackupRepository.php index 37156f21..20be7642 100644 --- a/app/Repositories/Wings/DaemonBackupRepository.php +++ b/app/Repositories/Wings/DaemonBackupRepository.php @@ -2,7 +2,6 @@ namespace Pterodactyl\Repositories\Wings; -use Illuminate\Support\Arr; use Webmozart\Assert\Assert; use Pterodactyl\Models\Backup; use Pterodactyl\Models\Server; diff --git a/app/Repositories/Wings/DaemonFileRepository.php b/app/Repositories/Wings/DaemonFileRepository.php index da6cb7ae..9c403861 100644 --- a/app/Repositories/Wings/DaemonFileRepository.php +++ b/app/Repositories/Wings/DaemonFileRepository.php @@ -37,7 +37,7 @@ class DaemonFileRepository extends DaemonRepository throw new DaemonConnectionException($exception); } - $length = (int)$response->getHeader('Content-Length')[0] ?? 0; + $length = (int) $response->getHeader('Content-Length')[0] ?? 0; if ($notLargerThan && $length > $notLargerThan) { throw new FileSizeTooLargeException; diff --git a/app/Repositories/Wings/DaemonServerRepository.php b/app/Repositories/Wings/DaemonServerRepository.php index db039476..702b46a5 100644 --- a/app/Repositories/Wings/DaemonServerRepository.php +++ b/app/Repositories/Wings/DaemonServerRepository.php @@ -156,7 +156,7 @@ class DaemonServerRepository extends DaemonRepository { Assert::isInstanceOf($this->server, Server::class); - $this->revokeJTIs([ md5($id . $this->server->uuid) ]); + $this->revokeJTIs([md5($id . $this->server->uuid)]); } /** diff --git a/app/Services/Databases/DatabaseManagementService.php b/app/Services/Databases/DatabaseManagementService.php index 832e4bdf..8d7b2bfd 100644 --- a/app/Services/Databases/DatabaseManagementService.php +++ b/app/Services/Databases/DatabaseManagementService.php @@ -8,7 +8,6 @@ use Pterodactyl\Models\Server; use Pterodactyl\Models\Database; use Pterodactyl\Helpers\Utilities; use Illuminate\Database\ConnectionInterface; -use Symfony\Component\VarDumper\Cloner\Data; use Illuminate\Contracts\Encryption\Encrypter; use Pterodactyl\Extensions\DynamicDatabaseConnection; use Pterodactyl\Repositories\Eloquent\DatabaseRepository; diff --git a/app/Services/Deployment/FindViableNodesService.php b/app/Services/Deployment/FindViableNodesService.php index 0963d88e..7ebce9e8 100644 --- a/app/Services/Deployment/FindViableNodesService.php +++ b/app/Services/Deployment/FindViableNodesService.php @@ -2,8 +2,8 @@ namespace Pterodactyl\Services\Deployment; -use Webmozart\Assert\Assert; use Pterodactyl\Models\Node; +use Webmozart\Assert\Assert; use Pterodactyl\Exceptions\Service\Deployment\NoViableNodeException; class FindViableNodesService diff --git a/app/Services/Eggs/EggConfigurationService.php b/app/Services/Eggs/EggConfigurationService.php index 4d1db4e2..b863b5e0 100644 --- a/app/Services/Eggs/EggConfigurationService.php +++ b/app/Services/Eggs/EggConfigurationService.php @@ -108,7 +108,7 @@ class EggConfigurationService // Normalize the output of the configuration for the new Wings Daemon to more // easily ingest, as well as make things more flexible down the road. foreach ($configs as $file => $data) { - $append = array_merge((array)$data, ['file' => $file, 'replace' => []]); + $append = array_merge((array) $data, ['file' => $file, 'replace' => []]); foreach ($this->iterate($data->find, $structure) as $find => $replace) { if (is_object($replace)) { diff --git a/app/Services/Eggs/Sharing/EggImporterService.php b/app/Services/Eggs/Sharing/EggImporterService.php index 19d1c7d2..1200e5ac 100644 --- a/app/Services/Eggs/Sharing/EggImporterService.php +++ b/app/Services/Eggs/Sharing/EggImporterService.php @@ -119,7 +119,7 @@ class EggImporterService ], true, true); collect($parsed->variables)->each(function ($variable) use ($egg) { - $this->eggVariableRepository->create(array_merge((array)$variable, [ + $this->eggVariableRepository->create(array_merge((array) $variable, [ 'egg_id' => $egg->id, ])); }); diff --git a/app/Services/Nodes/NodeUpdateService.php b/app/Services/Nodes/NodeUpdateService.php index f684d106..2a71924f 100644 --- a/app/Services/Nodes/NodeUpdateService.php +++ b/app/Services/Nodes/NodeUpdateService.php @@ -5,11 +5,9 @@ namespace Pterodactyl\Services\Nodes; use Illuminate\Support\Str; use Pterodactyl\Models\Node; use Illuminate\Support\Facades\Log; -use GuzzleHttp\Exception\ConnectException; use Illuminate\Database\ConnectionInterface; use Illuminate\Contracts\Encryption\Encrypter; use Pterodactyl\Repositories\Eloquent\NodeRepository; -use Pterodactyl\Repositories\Daemon\ConfigurationRepository; use Pterodactyl\Repositories\Wings\DaemonConfigurationRepository; use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; use Pterodactyl\Exceptions\Service\Node\ConfigurationNotPersistedException; @@ -101,7 +99,7 @@ class NodeUpdateService // inject their own response pages, causing this logic to get fucked up. // // @see https://github.com/pterodactyl/panel/issues/2712 - return [ $updated, true ]; + return [$updated, true]; } return [$updated, false]; diff --git a/app/Services/Servers/BuildModificationService.php b/app/Services/Servers/BuildModificationService.php index 328e0e53..69bcef26 100644 --- a/app/Services/Servers/BuildModificationService.php +++ b/app/Services/Servers/BuildModificationService.php @@ -82,7 +82,7 @@ class BuildModificationService $updateData = $this->structureService->handle($server); - if (!empty($updateData['build'])) { + if (! empty($updateData['build'])) { $this->daemonServerRepository->setServer($server)->update([ 'build' => $updateData['build'], ]); diff --git a/app/Services/Servers/ReinstallServerService.php b/app/Services/Servers/ReinstallServerService.php index 6f5b5608..8a648ac8 100644 --- a/app/Services/Servers/ReinstallServerService.php +++ b/app/Services/Servers/ReinstallServerService.php @@ -4,7 +4,6 @@ namespace Pterodactyl\Services\Servers; use Pterodactyl\Models\Server; use Illuminate\Database\ConnectionInterface; -use Pterodactyl\Repositories\Eloquent\ServerRepository; use Pterodactyl\Repositories\Wings\DaemonServerRepository; class ReinstallServerService diff --git a/app/Services/Servers/ServerConfigurationStructureService.php b/app/Services/Servers/ServerConfigurationStructureService.php index b942a270..c726796e 100644 --- a/app/Services/Servers/ServerConfigurationStructureService.php +++ b/app/Services/Servers/ServerConfigurationStructureService.php @@ -38,7 +38,7 @@ class ServerConfigurationStructureService $clone = $server; // If any overrides have been set on this call make sure to update them on the // cloned instance so that the configuration generated uses them. - if (!empty($override)) { + if (! empty($override)) { $clone = $server->fresh(); foreach ($override as $key => $value) { $clone->setAttribute($key, $value); @@ -95,10 +95,10 @@ class ServerConfigurationStructureService 'id' => $server->egg->uuid, 'file_denylist' => [ 'config.yml', - '**/*.json' - ] + '**/*.json', + ], // 'file_denylist' => explode(PHP_EOL, $server->egg->inherit_file_denylist), - ] + ], ]; } @@ -124,12 +124,12 @@ class ServerConfigurationStructureService })->toArray(), 'env' => $this->environment->handle($server), 'oom_disabled' => $server->oom_disabled, - 'memory' => (int)$server->memory, - 'swap' => (int)$server->swap, - 'io' => (int)$server->io, - 'cpu' => (int)$server->cpu, + 'memory' => (int) $server->memory, + 'swap' => (int) $server->swap, + 'io' => (int) $server->io, + 'cpu' => (int) $server->cpu, 'threads' => $server->threads, - 'disk' => (int)$server->disk, + 'disk' => (int) $server->disk, 'image' => $server->image, ], 'service' => [ @@ -137,7 +137,7 @@ class ServerConfigurationStructureService 'skip_scripts' => $server->skip_scripts, ], 'rebuild' => false, - 'suspended' => (int)$server->suspended, + 'suspended' => (int) $server->suspended, ]; } } diff --git a/app/Services/Servers/ServerDeletionService.php b/app/Services/Servers/ServerDeletionService.php index 95585873..a4841652 100644 --- a/app/Services/Servers/ServerDeletionService.php +++ b/app/Services/Servers/ServerDeletionService.php @@ -92,7 +92,7 @@ class ServerDeletionService try { $this->databaseManagementService->delete($database); } catch (Exception $exception) { - if (!$this->force) { + if (! $this->force) { throw $exception; } diff --git a/app/Services/Servers/StartupCommandService.php b/app/Services/Servers/StartupCommandService.php index bf31763c..1cb4e229 100644 --- a/app/Services/Servers/StartupCommandService.php +++ b/app/Services/Servers/StartupCommandService.php @@ -20,7 +20,7 @@ class StartupCommandService foreach ($server->variables as $variable) { $find[] = '{{' . $variable->env_variable . '}}'; - $replace[] = ($variable->user_viewable && !$hideAllValues) ? ($variable->server_value ?? $variable->default_value) : '[hidden]'; + $replace[] = ($variable->user_viewable && ! $hideAllValues) ? ($variable->server_value ?? $variable->default_value) : '[hidden]'; } return str_replace($find, $replace, $server->startup); diff --git a/app/Services/Servers/StartupModificationService.php b/app/Services/Servers/StartupModificationService.php index f154c54b..aaad5c45 100644 --- a/app/Services/Servers/StartupModificationService.php +++ b/app/Services/Servers/StartupModificationService.php @@ -91,7 +91,7 @@ class StartupModificationService { $eggId = Arr::get($data, 'egg_id'); - if (is_digit($eggId) && $server->egg_id !== (int)$eggId) { + if (is_digit($eggId) && $server->egg_id !== (int) $eggId) { /** @var \Pterodactyl\Models\Egg $egg */ $egg = Egg::query()->findOrFail($data['egg_id']); diff --git a/app/Services/Servers/SuspensionService.php b/app/Services/Servers/SuspensionService.php index 87fd0a33..7abd978a 100644 --- a/app/Services/Servers/SuspensionService.php +++ b/app/Services/Servers/SuspensionService.php @@ -6,7 +6,6 @@ use Webmozart\Assert\Assert; use Pterodactyl\Models\Server; use Illuminate\Database\ConnectionInterface; use Pterodactyl\Repositories\Wings\DaemonServerRepository; -use Symfony\Component\HttpKernel\Exception\ConflictHttpException; use Pterodactyl\Exceptions\Http\Server\ServerTransferringException; class SuspensionService diff --git a/app/Services/Servers/VariableValidatorService.php b/app/Services/Servers/VariableValidatorService.php index 7cb1aa42..95dee555 100644 --- a/app/Services/Servers/VariableValidatorService.php +++ b/app/Services/Servers/VariableValidatorService.php @@ -68,7 +68,7 @@ class VariableValidatorService } return Collection::make($variables)->map(function ($item) use ($fields) { - return (object)[ + return (object) [ 'id' => $item->id, 'key' => $item->env_variable, 'value' => $fields[$item->env_variable] ?? null, diff --git a/app/Transformers/Api/Application/SubuserTransformer.php b/app/Transformers/Api/Application/SubuserTransformer.php index 265e2f9d..9be61716 100644 --- a/app/Transformers/Api/Application/SubuserTransformer.php +++ b/app/Transformers/Api/Application/SubuserTransformer.php @@ -3,7 +3,6 @@ namespace Pterodactyl\Transformers\Api\Application; use Pterodactyl\Models\Subuser; -use Pterodactyl\Models\Permission; use Pterodactyl\Services\Acl\Api\AdminAcl; class SubuserTransformer extends BaseTransformer diff --git a/app/Transformers/Api/Client/EggVariableTransformer.php b/app/Transformers/Api/Client/EggVariableTransformer.php index 4f7e3965..b6a5784d 100644 --- a/app/Transformers/Api/Client/EggVariableTransformer.php +++ b/app/Transformers/Api/Client/EggVariableTransformer.php @@ -3,7 +3,6 @@ namespace Pterodactyl\Transformers\Api\Client; use BadMethodCallException; -use InvalidArgumentException; use Pterodactyl\Models\EggVariable; class EggVariableTransformer extends BaseClientTransformer @@ -25,7 +24,7 @@ class EggVariableTransformer extends BaseClientTransformer // 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 // pathway since you should never be exposing these types of variables to a client. - if (!$variable->user_viewable) { + if (! $variable->user_viewable) { throw new BadMethodCallException( 'Cannot transform a hidden egg variable in a client transformer.' ); diff --git a/composer.json b/composer.json index 343f50ed..987d7d05 100644 --- a/composer.json +++ b/composer.json @@ -58,8 +58,8 @@ ], "psr-4": { "Pterodactyl\\": "app/", - "Database\\Factories\\": "database/factories/", - "Database\\Seeders\\": "database/seeders/" + "Database\\Factories\\": "database/Factories/", + "Database\\Seeders\\": "database/Seeders/" } }, "autoload-dev": { diff --git a/config/database.php b/config/database.php index e69e19ed..d404a37f 100644 --- a/config/database.php +++ b/config/database.php @@ -45,7 +45,7 @@ return [ 'collation' => 'utf8mb4_unicode_ci', 'prefix' => env('DB_PREFIX', ''), 'strict' => env('DB_STRICT_MODE', false), - 'timezone' => env('DB_TIMEZONE', Time::getMySQLTimezoneOffset(env('APP_TIMEZONE', 'UTC'))) + 'timezone' => env('DB_TIMEZONE', Time::getMySQLTimezoneOffset(env('APP_TIMEZONE', 'UTC'))), ], /* @@ -68,7 +68,7 @@ return [ 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'strict' => false, - 'timezone' => env('DB_TIMEZONE', Time::getMySQLTimezoneOffset(env('APP_TIMEZONE', 'UTC'))) + 'timezone' => env('DB_TIMEZONE', Time::getMySQLTimezoneOffset(env('APP_TIMEZONE', 'UTC'))), ], ], diff --git a/config/pterodactyl.php b/config/pterodactyl.php index 404f7aa3..db08688d 100644 --- a/config/pterodactyl.php +++ b/config/pterodactyl.php @@ -10,7 +10,7 @@ return [ | setup on the panel. When set to true, configurations stored in the | database will not be applied. */ - 'load_environment_only' => (bool)env('APP_ENVIRONMENT_ONLY', false), + 'load_environment_only' => (bool) env('APP_ENVIRONMENT_ONLY', false), /* |-------------------------------------------------------------------------- diff --git a/database/factories/AllocationFactory.php b/database/Factories/AllocationFactory.php similarity index 100% rename from database/factories/AllocationFactory.php rename to database/Factories/AllocationFactory.php diff --git a/database/factories/ApiKeyFactory.php b/database/Factories/ApiKeyFactory.php similarity index 100% rename from database/factories/ApiKeyFactory.php rename to database/Factories/ApiKeyFactory.php diff --git a/database/factories/BackupFactory.php b/database/Factories/BackupFactory.php similarity index 100% rename from database/factories/BackupFactory.php rename to database/Factories/BackupFactory.php diff --git a/database/factories/DatabaseFactory.php b/database/Factories/DatabaseFactory.php similarity index 100% rename from database/factories/DatabaseFactory.php rename to database/Factories/DatabaseFactory.php diff --git a/database/factories/DatabaseHostFactory.php b/database/Factories/DatabaseHostFactory.php similarity index 100% rename from database/factories/DatabaseHostFactory.php rename to database/Factories/DatabaseHostFactory.php diff --git a/database/factories/EggFactory.php b/database/Factories/EggFactory.php similarity index 100% rename from database/factories/EggFactory.php rename to database/Factories/EggFactory.php diff --git a/database/factories/EggVariableFactory.php b/database/Factories/EggVariableFactory.php similarity index 97% rename from database/factories/EggVariableFactory.php rename to database/Factories/EggVariableFactory.php index d5b6596a..39d8754a 100644 --- a/database/factories/EggVariableFactory.php +++ b/database/Factories/EggVariableFactory.php @@ -25,7 +25,7 @@ class EggVariableFactory extends Factory return [ 'name' => $this->faker->firstName, 'description' => $this->faker->sentence(), - 'env_variable' => Str::upper(Str::replaceArray(' ', [ '_' ], $this->faker->words(2, true))), + 'env_variable' => Str::upper(Str::replaceArray(' ', ['_'], $this->faker->words(2, true))), 'default_value' => $this->faker->colorName, 'user_viewable' => 0, 'user_editable' => 0, diff --git a/database/factories/LocationFactory.php b/database/Factories/LocationFactory.php similarity index 100% rename from database/factories/LocationFactory.php rename to database/Factories/LocationFactory.php diff --git a/database/factories/NestFactory.php b/database/Factories/NestFactory.php similarity index 100% rename from database/factories/NestFactory.php rename to database/Factories/NestFactory.php diff --git a/database/factories/NodeFactory.php b/database/Factories/NodeFactory.php similarity index 100% rename from database/factories/NodeFactory.php rename to database/Factories/NodeFactory.php diff --git a/database/factories/ScheduleFactory.php b/database/Factories/ScheduleFactory.php similarity index 100% rename from database/factories/ScheduleFactory.php rename to database/Factories/ScheduleFactory.php diff --git a/database/factories/ServerFactory.php b/database/Factories/ServerFactory.php similarity index 100% rename from database/factories/ServerFactory.php rename to database/Factories/ServerFactory.php diff --git a/database/factories/SubuserFactory.php b/database/Factories/SubuserFactory.php similarity index 91% rename from database/factories/SubuserFactory.php rename to database/Factories/SubuserFactory.php index d570e733..b0ce9dc3 100644 --- a/database/factories/SubuserFactory.php +++ b/database/Factories/SubuserFactory.php @@ -24,7 +24,7 @@ class SubuserFactory extends Factory { return [ 'permissions' => [ - Permission::ACTION_WEBSOCKET_CONNECT + Permission::ACTION_WEBSOCKET_CONNECT, ], ]; } diff --git a/database/factories/TaskFactory.php b/database/Factories/TaskFactory.php similarity index 100% rename from database/factories/TaskFactory.php rename to database/Factories/TaskFactory.php diff --git a/database/factories/UserFactory.php b/database/Factories/UserFactory.php similarity index 100% rename from database/factories/UserFactory.php rename to database/Factories/UserFactory.php diff --git a/database/seeders/.gitkeep b/database/Seeders/.gitkeep similarity index 100% rename from database/seeders/.gitkeep rename to database/Seeders/.gitkeep diff --git a/database/seeders/DatabaseSeeder.php b/database/Seeders/DatabaseSeeder.php similarity index 100% rename from database/seeders/DatabaseSeeder.php rename to database/Seeders/DatabaseSeeder.php diff --git a/database/seeders/EggSeeder.php b/database/Seeders/EggSeeder.php similarity index 100% rename from database/seeders/EggSeeder.php rename to database/Seeders/EggSeeder.php diff --git a/database/seeders/NestSeeder.php b/database/Seeders/NestSeeder.php similarity index 100% rename from database/seeders/NestSeeder.php rename to database/Seeders/NestSeeder.php diff --git a/database/seeders/eggs/minecraft/egg-bungeecord.json b/database/Seeders/eggs/minecraft/egg-bungeecord.json similarity index 100% rename from database/seeders/eggs/minecraft/egg-bungeecord.json rename to database/Seeders/eggs/minecraft/egg-bungeecord.json diff --git a/database/seeders/eggs/minecraft/egg-forge-minecraft.json b/database/Seeders/eggs/minecraft/egg-forge-minecraft.json similarity index 100% rename from database/seeders/eggs/minecraft/egg-forge-minecraft.json rename to database/Seeders/eggs/minecraft/egg-forge-minecraft.json diff --git a/database/seeders/eggs/minecraft/egg-paper.json b/database/Seeders/eggs/minecraft/egg-paper.json similarity index 100% rename from database/seeders/eggs/minecraft/egg-paper.json rename to database/Seeders/eggs/minecraft/egg-paper.json diff --git a/database/seeders/eggs/minecraft/egg-sponge--sponge-vanilla.json b/database/Seeders/eggs/minecraft/egg-sponge--sponge-vanilla.json similarity index 100% rename from database/seeders/eggs/minecraft/egg-sponge--sponge-vanilla.json rename to database/Seeders/eggs/minecraft/egg-sponge--sponge-vanilla.json diff --git a/database/seeders/eggs/minecraft/egg-vanilla-minecraft.json b/database/Seeders/eggs/minecraft/egg-vanilla-minecraft.json similarity index 100% rename from database/seeders/eggs/minecraft/egg-vanilla-minecraft.json rename to database/Seeders/eggs/minecraft/egg-vanilla-minecraft.json diff --git a/database/seeders/eggs/rust/egg-rust.json b/database/Seeders/eggs/rust/egg-rust.json similarity index 100% rename from database/seeders/eggs/rust/egg-rust.json rename to database/Seeders/eggs/rust/egg-rust.json diff --git a/database/seeders/eggs/source-engine/egg-ark--survival-evolved.json b/database/Seeders/eggs/source-engine/egg-ark--survival-evolved.json similarity index 100% rename from database/seeders/eggs/source-engine/egg-ark--survival-evolved.json rename to database/Seeders/eggs/source-engine/egg-ark--survival-evolved.json diff --git a/database/seeders/eggs/source-engine/egg-counter--strike--global-offensive.json b/database/Seeders/eggs/source-engine/egg-counter--strike--global-offensive.json similarity index 100% rename from database/seeders/eggs/source-engine/egg-counter--strike--global-offensive.json rename to database/Seeders/eggs/source-engine/egg-counter--strike--global-offensive.json diff --git a/database/seeders/eggs/source-engine/egg-custom-source-engine-game.json b/database/Seeders/eggs/source-engine/egg-custom-source-engine-game.json similarity index 100% rename from database/seeders/eggs/source-engine/egg-custom-source-engine-game.json rename to database/Seeders/eggs/source-engine/egg-custom-source-engine-game.json diff --git a/database/seeders/eggs/source-engine/egg-garrys-mod.json b/database/Seeders/eggs/source-engine/egg-garrys-mod.json similarity index 100% rename from database/seeders/eggs/source-engine/egg-garrys-mod.json rename to database/Seeders/eggs/source-engine/egg-garrys-mod.json diff --git a/database/seeders/eggs/source-engine/egg-insurgency.json b/database/Seeders/eggs/source-engine/egg-insurgency.json similarity index 100% rename from database/seeders/eggs/source-engine/egg-insurgency.json rename to database/Seeders/eggs/source-engine/egg-insurgency.json diff --git a/database/seeders/eggs/source-engine/egg-team-fortress2.json b/database/Seeders/eggs/source-engine/egg-team-fortress2.json similarity index 100% rename from database/seeders/eggs/source-engine/egg-team-fortress2.json rename to database/Seeders/eggs/source-engine/egg-team-fortress2.json diff --git a/database/seeders/eggs/voice-servers/egg-mumble-server.json b/database/Seeders/eggs/voice-servers/egg-mumble-server.json similarity index 100% rename from database/seeders/eggs/voice-servers/egg-mumble-server.json rename to database/Seeders/eggs/voice-servers/egg-mumble-server.json diff --git a/database/seeders/eggs/voice-servers/egg-teamspeak3-server.json b/database/Seeders/eggs/voice-servers/egg-teamspeak3-server.json similarity index 100% rename from database/seeders/eggs/voice-servers/egg-teamspeak3-server.json rename to database/Seeders/eggs/voice-servers/egg-teamspeak3-server.json diff --git a/database/migrations/2017_03_10_173607_MigrateToNewServiceSystem.php b/database/migrations/2017_03_10_173607_MigrateToNewServiceSystem.php index 03997635..5dddb875 100644 --- a/database/migrations/2017_03_10_173607_MigrateToNewServiceSystem.php +++ b/database/migrations/2017_03_10_173607_MigrateToNewServiceSystem.php @@ -22,7 +22,7 @@ class MigrateToNewServiceSystem extends Migration } $options = DB::table('service_options')->where('service_id', $service->id)->get(); - $options->each(function ($item) use ($options) { + $options->each(function ($item) { if ($item->tag === 'srcds' && $item->name === 'Insurgency') { $item->tag = 'insurgency'; } elseif ($item->tag === 'srcds' && $item->name === 'Team Fortress 2') { diff --git a/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php b/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php index b40f4f55..b204d172 100644 --- a/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php +++ b/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php @@ -1,7 +1,7 @@ TABLE_NAME, $result->TABLE_NAME. '_plugin_bak'); + Schema::rename($result->TABLE_NAME, $result->TABLE_NAME . '_plugin_bak'); } Schema::create('backups', function (Blueprint $table) { diff --git a/database/migrations/2020_04_26_111208_add_backup_limit_to_servers.php b/database/migrations/2020_04_26_111208_add_backup_limit_to_servers.php index 92121b7d..b0f859c9 100644 --- a/database/migrations/2020_04_26_111208_add_backup_limit_to_servers.php +++ b/database/migrations/2020_04_26_111208_add_backup_limit_to_servers.php @@ -19,7 +19,7 @@ class AddBackupLimitToServers extends Migration // here. If we find a result we'll actually keep the column around since we can maintain that backup // limit, but we need to correct the column definition a bit. $results = DB::select('SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = ? AND TABLE_NAME = \'servers\' AND COLUMN_NAME = \'backup_limit\'', [ - config("database.connections.{$db}.database") + config("database.connections.{$db}.database"), ]); if (count($results) === 1) { diff --git a/database/migrations/2020_07_02_213612_create_user_recovery_tokens_table.php b/database/migrations/2020_07_02_213612_create_user_recovery_tokens_table.php index df0f3491..9b0743af 100644 --- a/database/migrations/2020_07_02_213612_create_user_recovery_tokens_table.php +++ b/database/migrations/2020_07_02_213612_create_user_recovery_tokens_table.php @@ -1,8 +1,8 @@ unique(['database_host_id', 'database']); }); - } } diff --git a/database/migrations/2020_10_26_194904_remove_nullable_from_schedule_name_field.php b/database/migrations/2020_10_26_194904_remove_nullable_from_schedule_name_field.php index fc1f01ba..69593e65 100644 --- a/database/migrations/2020_10_26_194904_remove_nullable_from_schedule_name_field.php +++ b/database/migrations/2020_10_26_194904_remove_nullable_from_schedule_name_field.php @@ -1,9 +1,9 @@ actingAs($user)->json($method, $this->link($server1, "/network/allocations/" . $allocation1->id . $endpoint)); + $response = $this->actingAs($user)->json($method, $this->link($server1, '/network/allocations/' . $allocation1->id . $endpoint)); $this->assertTrue($response->status() <= 204 || $response->status() === 400 || $response->status() === 422); // This request fails because the allocation is valid for that server but the user // making the request is not authorized to perform that action. - $this->actingAs($user)->json($method, $this->link($server2, "/network/allocations/" . $allocation2->id . $endpoint))->assertForbidden(); + $this->actingAs($user)->json($method, $this->link($server2, '/network/allocations/' . $allocation2->id . $endpoint))->assertForbidden(); // Both of these should report a 404 error due to the allocations being linked to // servers that are not the same as the server in the request, or are assigned // to a server for which the user making the request has no access to. - $this->actingAs($user)->json($method, $this->link($server1, "/network/allocations/" . $allocation2->id . $endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server1, "/network/allocations/" . $allocation3->id . $endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server2, "/network/allocations/" . $allocation3->id . $endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server3, "/network/allocations/" . $allocation3->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server1, '/network/allocations/' . $allocation2->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server1, '/network/allocations/' . $allocation3->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server2, '/network/allocations/' . $allocation3->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server3, '/network/allocations/' . $allocation3->id . $endpoint))->assertNotFound(); } /** @@ -54,9 +54,9 @@ class AllocationAuthorizationTest extends ClientApiIntegrationTestCase public function methodDataProvider(): array { return [ - ["POST", ""], - ["DELETE", ""], - ["POST", "/primary"], + ['POST', ''], + ['DELETE', ''], + ['POST', '/primary'], ]; } } diff --git a/tests/Integration/Api/Client/Server/Allocation/CreateNewAllocationTest.php b/tests/Integration/Api/Client/Server/Allocation/CreateNewAllocationTest.php index ab33ba81..8793d421 100644 --- a/tests/Integration/Api/Client/Server/Allocation/CreateNewAllocationTest.php +++ b/tests/Integration/Api/Client/Server/Allocation/CreateNewAllocationTest.php @@ -3,8 +3,8 @@ namespace Pterodactyl\Tests\Integration\Api\Client\Server\Allocation; use Illuminate\Http\Response; -use Pterodactyl\Models\Permission; use Pterodactyl\Models\Allocation; +use Pterodactyl\Models\Permission; use Pterodactyl\Tests\Integration\Api\Client\ClientApiIntegrationTestCase; class CreateNewAllocationTest extends ClientApiIntegrationTestCase @@ -33,7 +33,7 @@ class CreateNewAllocationTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount($permission); $server->update(['allocation_limit' => 2]); - $response = $this->actingAs($user)->postJson($this->link($server, "/network/allocations")); + $response = $this->actingAs($user)->postJson($this->link($server, '/network/allocations')); $response->assertJsonPath('object', Allocation::RESOURCE_NAME); $matched = Allocation::query()->findOrFail($response->json('attributes.id')); @@ -52,7 +52,7 @@ class CreateNewAllocationTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount([Permission::ACTION_ALLOCATION_UPDATE]); $server->update(['allocation_limit' => 2]); - $this->actingAs($user)->postJson($this->link($server, "/network/allocations"))->assertForbidden(); + $this->actingAs($user)->postJson($this->link($server, '/network/allocations'))->assertForbidden(); } /** @@ -66,7 +66,7 @@ class CreateNewAllocationTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount(); $server->update(['allocation_limit' => 2]); - $this->actingAs($user)->postJson($this->link($server, "/network/allocations")) + $this->actingAs($user)->postJson($this->link($server, '/network/allocations')) ->assertStatus(Response::HTTP_BAD_REQUEST) ->assertJsonPath('errors.0.code', 'AutoAllocationNotEnabledException') ->assertJsonPath('errors.0.detail', 'Server auto-allocation is not enabled for this instance.'); @@ -81,7 +81,7 @@ class CreateNewAllocationTest extends ClientApiIntegrationTestCase [$user, $server] = $this->generateTestAccount(); $server->update(['allocation_limit' => 1]); - $this->actingAs($user)->postJson($this->link($server, "/network/allocations")) + $this->actingAs($user)->postJson($this->link($server, '/network/allocations')) ->assertStatus(Response::HTTP_BAD_REQUEST) ->assertJsonPath('errors.0.code', 'DisplayException') ->assertJsonPath('errors.0.detail', 'Cannot assign additional allocations to this server: limit has been reached.'); diff --git a/tests/Integration/Api/Client/Server/Allocation/DeleteAllocationTest.php b/tests/Integration/Api/Client/Server/Allocation/DeleteAllocationTest.php index d249f550..36575503 100644 --- a/tests/Integration/Api/Client/Server/Allocation/DeleteAllocationTest.php +++ b/tests/Integration/Api/Client/Server/Allocation/DeleteAllocationTest.php @@ -3,8 +3,8 @@ namespace Pterodactyl\Tests\Integration\Api\Client\Server\Allocation; use Illuminate\Http\Response; -use Pterodactyl\Models\Permission; use Pterodactyl\Models\Allocation; +use Pterodactyl\Models\Permission; use Pterodactyl\Tests\Integration\Api\Client\ClientApiIntegrationTestCase; class DeleteAllocationTest extends ClientApiIntegrationTestCase diff --git a/tests/Integration/Api/Client/Server/Backup/BackupAuthorizationTest.php b/tests/Integration/Api/Client/Server/Backup/BackupAuthorizationTest.php index 6267eae8..f44209b2 100644 --- a/tests/Integration/Api/Client/Server/Backup/BackupAuthorizationTest.php +++ b/tests/Integration/Api/Client/Server/Backup/BackupAuthorizationTest.php @@ -41,20 +41,20 @@ class BackupAuthorizationTest extends ClientApiIntegrationTestCase // This is the only valid call for this test, accessing the backup for the same // server that the API user is the owner of. - $this->actingAs($user)->json($method, $this->link($server1, "/backups/" . $backup1->uuid . $endpoint)) + $this->actingAs($user)->json($method, $this->link($server1, '/backups/' . $backup1->uuid . $endpoint)) ->assertStatus($method === 'DELETE' ? 204 : 200); // This request fails because the backup is valid for that server but the user // making the request is not authorized to perform that action. - $this->actingAs($user)->json($method, $this->link($server2, "/backups/" . $backup2->uuid . $endpoint))->assertForbidden(); + $this->actingAs($user)->json($method, $this->link($server2, '/backups/' . $backup2->uuid . $endpoint))->assertForbidden(); // Both of these should report a 404 error due to the backup being linked to // servers that are not the same as the server in the request, or are assigned // to a server for which the user making the request has no access to. - $this->actingAs($user)->json($method, $this->link($server1, "/backups/" . $backup2->uuid . $endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server1, "/backups/" . $backup3->uuid . $endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server2, "/backups/" . $backup3->uuid . $endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server3, "/backups/" . $backup3->uuid . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server1, '/backups/' . $backup2->uuid . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server1, '/backups/' . $backup3->uuid . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server2, '/backups/' . $backup3->uuid . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server3, '/backups/' . $backup3->uuid . $endpoint))->assertNotFound(); } /** @@ -63,9 +63,9 @@ class BackupAuthorizationTest extends ClientApiIntegrationTestCase public function methodDataProvider(): array { return [ - ["GET", ""], - ["GET", "/download"], - ["DELETE", ""], + ['GET', ''], + ['GET', '/download'], + ['DELETE', ''], ]; } } diff --git a/tests/Integration/Api/Client/Server/Database/DatabaseAuthorizationTest.php b/tests/Integration/Api/Client/Server/Database/DatabaseAuthorizationTest.php index 2aaea10b..dbc78522 100644 --- a/tests/Integration/Api/Client/Server/Database/DatabaseAuthorizationTest.php +++ b/tests/Integration/Api/Client/Server/Database/DatabaseAuthorizationTest.php @@ -49,20 +49,20 @@ class DatabaseAuthorizationTest extends ClientApiIntegrationTestCase $hashids = $this->app->make(HashidsInterface::class); // This is the only valid call for this test, accessing the database for the same // server that the API user is the owner of. - $this->actingAs($user)->json($method, $this->link($server1, "/databases/" . $hashids->encode($database1->id) . $endpoint)) + $this->actingAs($user)->json($method, $this->link($server1, '/databases/' . $hashids->encode($database1->id) . $endpoint)) ->assertStatus($method === 'DELETE' ? 204 : 200); // This request fails because the database is valid for that server but the user // making the request is not authorized to perform that action. - $this->actingAs($user)->json($method, $this->link($server2, "/databases/" . $hashids->encode($database2->id) . $endpoint))->assertForbidden(); + $this->actingAs($user)->json($method, $this->link($server2, '/databases/' . $hashids->encode($database2->id) . $endpoint))->assertForbidden(); // Both of these should report a 404 error due to the database being linked to // servers that are not the same as the server in the request, or are assigned // to a server for which the user making the request has no access to. - $this->actingAs($user)->json($method, $this->link($server1, "/databases/" . $hashids->encode($database2->id) . $endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server1, "/databases/" . $hashids->encode($database3->id) . $endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server2, "/databases/" . $hashids->encode($database3->id) . $endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server3, "/databases/" . $hashids->encode($database3->id) . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server1, '/databases/' . $hashids->encode($database2->id) . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server1, '/databases/' . $hashids->encode($database3->id) . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server2, '/databases/' . $hashids->encode($database3->id) . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server3, '/databases/' . $hashids->encode($database3->id) . $endpoint))->assertNotFound(); } /** @@ -71,8 +71,8 @@ class DatabaseAuthorizationTest extends ClientApiIntegrationTestCase public function methodDataProvider(): array { return [ - ["POST", "/rotate-password"], - ["DELETE", ""], + ['POST', '/rotate-password'], + ['DELETE', ''], ]; } } diff --git a/tests/Integration/Api/Client/Server/Schedule/ExecuteScheduleTest.php b/tests/Integration/Api/Client/Server/Schedule/ExecuteScheduleTest.php index c40966c2..fc9c7c73 100644 --- a/tests/Integration/Api/Client/Server/Schedule/ExecuteScheduleTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/ExecuteScheduleTest.php @@ -65,7 +65,7 @@ class ExecuteScheduleTest extends ClientApiIntegrationTestCase 'is_active' => false, ]); - $response = $this->actingAs($user)->postJson($this->link($schedule, "/execute")); + $response = $this->actingAs($user)->postJson($this->link($schedule, '/execute')); $response->assertStatus(Response::HTTP_BAD_REQUEST); $response->assertJsonPath('errors.0.code', 'BadRequestHttpException'); diff --git a/tests/Integration/Api/Client/Server/Schedule/ScheduleAuthorizationTest.php b/tests/Integration/Api/Client/Server/Schedule/ScheduleAuthorizationTest.php index 0d3ded84..49f0e991 100644 --- a/tests/Integration/Api/Client/Server/Schedule/ScheduleAuthorizationTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/ScheduleAuthorizationTest.php @@ -40,20 +40,20 @@ class ScheduleAuthorizationTest extends ClientApiIntegrationTestCase // This is the only valid call for this test, accessing the schedule for the same // server that the API user is the owner of. - $response = $this->actingAs($user)->json($method, $this->link($server1, "/schedules/" . $schedule1->id . $endpoint)); + $response = $this->actingAs($user)->json($method, $this->link($server1, '/schedules/' . $schedule1->id . $endpoint)); $this->assertTrue($response->status() <= 204 || $response->status() === 400 || $response->status() === 422); // This request fails because the schedule is valid for that server but the user // making the request is not authorized to perform that action. - $this->actingAs($user)->json($method, $this->link($server2, "/schedules/" . $schedule2->id . $endpoint))->assertForbidden(); + $this->actingAs($user)->json($method, $this->link($server2, '/schedules/' . $schedule2->id . $endpoint))->assertForbidden(); // Both of these should report a 404 error due to the schedules being linked to // servers that are not the same as the server in the request, or are assigned // to a server for which the user making the request has no access to. - $this->actingAs($user)->json($method, $this->link($server1, "/schedules/" . $schedule2->id . $endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server1, "/schedules/" . $schedule3->id . $endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server2, "/schedules/" . $schedule3->id . $endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server3, "/schedules/" . $schedule3->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server1, '/schedules/' . $schedule2->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server1, '/schedules/' . $schedule3->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server2, '/schedules/' . $schedule3->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server3, '/schedules/' . $schedule3->id . $endpoint))->assertNotFound(); } /** @@ -62,11 +62,11 @@ class ScheduleAuthorizationTest extends ClientApiIntegrationTestCase public function methodDataProvider(): array { return [ - ["GET", ""], - ["POST", ""], - ["DELETE", ""], - ["POST", "/execute"], - ["POST", "/tasks"], + ['GET', ''], + ['POST', ''], + ['DELETE', ''], + ['POST', '/execute'], + ['POST', '/tasks'], ]; } } diff --git a/tests/Integration/Api/Client/Server/Startup/GetStartupAndVariablesTest.php b/tests/Integration/Api/Client/Server/Startup/GetStartupAndVariablesTest.php index 8ea74ffc..09a6abd0 100644 --- a/tests/Integration/Api/Client/Server/Startup/GetStartupAndVariablesTest.php +++ b/tests/Integration/Api/Client/Server/Startup/GetStartupAndVariablesTest.php @@ -34,7 +34,7 @@ class GetStartupAndVariablesTest extends ClientApiIntegrationTestCase ])->save(); $server = $server->refresh(); - $response = $this->actingAs($user)->getJson($this->link($server) . "/startup"); + $response = $this->actingAs($user)->getJson($this->link($server) . '/startup'); $response->assertOk(); $response->assertJsonPath('meta.startup_command', 'java bungeecord.jar --version [hidden]'); @@ -53,10 +53,10 @@ class GetStartupAndVariablesTest extends ClientApiIntegrationTestCase public function testStartupDataIsNotReturnedWithoutPermission() { [$user, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]); - $this->actingAs($user)->getJson($this->link($server) . "/startup")->assertForbidden(); + $this->actingAs($user)->getJson($this->link($server) . '/startup')->assertForbidden(); $user2 = User::factory()->create(); - $this->actingAs($user2)->getJson($this->link($server) . "/startup")->assertNotFound(); + $this->actingAs($user2)->getJson($this->link($server) . '/startup')->assertNotFound(); } /** diff --git a/tests/Integration/Api/Client/Server/Startup/UpdateStartupVariableTest.php b/tests/Integration/Api/Client/Server/Startup/UpdateStartupVariableTest.php index d439a926..7f40fb5b 100644 --- a/tests/Integration/Api/Client/Server/Startup/UpdateStartupVariableTest.php +++ b/tests/Integration/Api/Client/Server/Startup/UpdateStartupVariableTest.php @@ -145,10 +145,10 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase public function testStartupVariableCannotBeUpdatedIfNotUserViewable() { [$user, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]); - $this->actingAs($user)->putJson($this->link($server) . "/startup/variable")->assertForbidden(); + $this->actingAs($user)->putJson($this->link($server) . '/startup/variable')->assertForbidden(); $user2 = User::factory()->create(); - $this->actingAs($user2)->putJson($this->link($server) . "/startup/variable")->assertNotFound(); + $this->actingAs($user2)->putJson($this->link($server) . '/startup/variable')->assertNotFound(); } /** diff --git a/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php b/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php index c9bfc4d4..d01bbd05 100644 --- a/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php +++ b/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php @@ -24,7 +24,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase { [$user, $server] = $this->generateTestAccount($permissions); - $response = $this->actingAs($user)->postJson($this->link($server) . "/users", [ + $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ 'email' => $email = $this->faker->email, 'permissions' => [ Permission::ACTION_USER_CREATE, @@ -61,7 +61,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase Permission::ACTION_CONTROL_CONSOLE, ]); - $response = $this->actingAs($user)->postJson($this->link($server) . "/users", [ + $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ 'email' => $email = $this->faker->email, 'permissions' => [ Permission::ACTION_USER_CREATE, @@ -83,7 +83,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase $email = str_repeat(Str::random(20), 9) . '1@gmail.com'; // 191 is the hard limit for the column in MySQL. - $response = $this->actingAs($user)->postJson($this->link($server) . "/users", [ + $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ 'email' => $email, 'permissions' => [ Permission::ACTION_USER_CREATE, @@ -92,7 +92,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase $response->assertOk(); - $response = $this->actingAs($user)->postJson($this->link($server) . "/users", [ + $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ 'email' => $email . '.au', 'permissions' => [ Permission::ACTION_USER_CREATE, @@ -115,7 +115,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase /** @var \Pterodactyl\Models\User $existing */ $existing = User::factory()->create(['email' => $this->faker->email]); - $response = $this->actingAs($user)->postJson($this->link($server) . "/users", [ + $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ 'email' => $existing->email, 'permissions' => [ Permission::ACTION_USER_CREATE, @@ -135,7 +135,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase { [$user, $server] = $this->generateTestAccount(); - $response = $this->actingAs($user)->postJson($this->link($server) . "/users", [ + $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ 'email' => $email = $this->faker->email, 'permissions' => [ Permission::ACTION_USER_CREATE, @@ -144,7 +144,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase $response->assertOk(); - $response = $this->actingAs($user)->postJson($this->link($server) . "/users", [ + $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ 'email' => $email, 'permissions' => [ Permission::ACTION_USER_CREATE, diff --git a/tests/Integration/Api/Client/Server/Subuser/DeleteSubuserTest.php b/tests/Integration/Api/Client/Server/Subuser/DeleteSubuserTest.php index ad394de2..eeb24851 100644 --- a/tests/Integration/Api/Client/Server/Subuser/DeleteSubuserTest.php +++ b/tests/Integration/Api/Client/Server/Subuser/DeleteSubuserTest.php @@ -33,7 +33,7 @@ class DeleteSubuserTest extends ClientApiIntegrationTestCase $differentUser = User::factory()->create(); // Generate a UUID that lines up with a user in the database if it were to be cast to an int. - $uuid = $differentUser->id . str_repeat('a', strlen((string)$differentUser->id)) . substr(Uuid::uuid4()->toString(), 8); + $uuid = $differentUser->id . str_repeat('a', strlen((string) $differentUser->id)) . substr(Uuid::uuid4()->toString(), 8); /** @var \Pterodactyl\Models\User $subuser */ $subuser = User::factory()->create(['uuid' => $uuid]); diff --git a/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php b/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php index e063054d..0e55cc80 100644 --- a/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php +++ b/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php @@ -43,12 +43,12 @@ class SubuserAuthorizationTest extends ClientApiIntegrationTestCase } // This route is acceptable since they're accessing a subuser on their own server. - $this->actingAs($user)->json($method, $this->link($server1, "/users/" . $internal->uuid))->assertStatus($method === 'POST' ? 422 : ($method === 'DELETE' ? 204 : 200)); + $this->actingAs($user)->json($method, $this->link($server1, '/users/' . $internal->uuid))->assertStatus($method === 'POST' ? 422 : ($method === 'DELETE' ? 204 : 200)); // This route can be revealed since the subuser belongs to the correct server, but // errors out with a 403 since $user does not have the right permissions for this. - $this->actingAs($user)->json($method, $this->link($server2, "/users/" . $internal->uuid))->assertForbidden(); - $this->actingAs($user)->json($method, $this->link($server3, "/users/" . $internal->uuid))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server2, '/users/' . $internal->uuid))->assertForbidden(); + $this->actingAs($user)->json($method, $this->link($server3, '/users/' . $internal->uuid))->assertNotFound(); } /** @@ -56,6 +56,6 @@ class SubuserAuthorizationTest extends ClientApiIntegrationTestCase */ public function methodDataProvider(): array { - return [["GET"], ["POST"], ["DELETE"]]; + return [['GET'], ['POST'], ['DELETE']]; } } diff --git a/tests/Integration/Api/Client/Server/WebsocketControllerTest.php b/tests/Integration/Api/Client/Server/WebsocketControllerTest.php index cfe794d0..aa01ae6d 100644 --- a/tests/Integration/Api/Client/Server/WebsocketControllerTest.php +++ b/tests/Integration/Api/Client/Server/WebsocketControllerTest.php @@ -105,7 +105,6 @@ class WebsocketControllerTest extends ClientApiIntegrationTestCase 'Failed to validate that the JWT data returned was signed using the Node\'s secret key.' ); - // Check that the claims are generated correctly. $this->assertSame($permissions, $token->claims()->get('permissions')); } diff --git a/tests/Integration/Http/Controllers/Admin/UserControllerTest.php b/tests/Integration/Http/Controllers/Admin/UserControllerTest.php index 5e271a8c..d1010783 100644 --- a/tests/Integration/Http/Controllers/Admin/UserControllerTest.php +++ b/tests/Integration/Http/Controllers/Admin/UserControllerTest.php @@ -7,8 +7,8 @@ use Illuminate\Http\Request; use Pterodactyl\Models\User; use Pterodactyl\Models\Subuser; use Illuminate\Pagination\LengthAwarePaginator; -use Pterodactyl\Tests\Integration\IntegrationTestCase; use Pterodactyl\Http\Controllers\Admin\UserController; +use Pterodactyl\Tests\Integration\IntegrationTestCase; class UserControllerTest extends IntegrationTestCase { @@ -51,9 +51,9 @@ class UserControllerTest extends IntegrationTestCase $response = $data['users']->items(); $this->assertCount(2, $response); $this->assertInstanceOf(User::class, $response[0]); - $this->assertSame(3, (int)$response[0]->servers_count); - $this->assertSame(0, (int)$response[0]->subuser_of_count); - $this->assertSame(1, (int)$response[1]->servers_count); - $this->assertSame(2, (int)$response[1]->subuser_of_count); + $this->assertSame(3, (int) $response[0]->servers_count); + $this->assertSame(0, (int) $response[0]->subuser_of_count); + $this->assertSame(1, (int) $response[1]->servers_count); + $this->assertSame(2, (int) $response[1]->subuser_of_count); } } diff --git a/tests/Integration/IntegrationTestCase.php b/tests/Integration/IntegrationTestCase.php index 5fc2d9f4..cf3f33a9 100644 --- a/tests/Integration/IntegrationTestCase.php +++ b/tests/Integration/IntegrationTestCase.php @@ -2,8 +2,8 @@ namespace Pterodactyl\Tests\Integration; -use Pterodactyl\Tests\TestCase; use Carbon\CarbonImmutable; +use Pterodactyl\Tests\TestCase; use Illuminate\Database\Eloquent\Model; use Pterodactyl\Tests\Traits\Integration\CreatesTestModels; use Pterodactyl\Transformers\Api\Application\BaseTransformer; diff --git a/tests/Integration/Services/Databases/DeployServerDatabaseServiceTest.php b/tests/Integration/Services/Databases/DeployServerDatabaseServiceTest.php index 1628dcfc..cc2aa662 100644 --- a/tests/Integration/Services/Databases/DeployServerDatabaseServiceTest.php +++ b/tests/Integration/Services/Databases/DeployServerDatabaseServiceTest.php @@ -7,7 +7,6 @@ use Pterodactyl\Models\Node; use InvalidArgumentException; use Pterodactyl\Models\Database; use Pterodactyl\Models\DatabaseHost; -use Symfony\Component\VarDumper\Cloner\Data; use Pterodactyl\Tests\Integration\IntegrationTestCase; use Pterodactyl\Services\Databases\DatabaseManagementService; use Pterodactyl\Services\Databases\DeployServerDatabaseService; @@ -53,7 +52,7 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase $server = $this->createServerModel(); $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessageMatches('/^Expected a non-empty value\. Got: /',); + $this->expectExceptionMessageMatches('/^Expected a non-empty value\. Got: /', ); $this->getService()->handle($server, $data); } diff --git a/tests/Integration/Services/Deployment/FindViableNodesServiceTest.php b/tests/Integration/Services/Deployment/FindViableNodesServiceTest.php index d5fcb448..f32810cc 100644 --- a/tests/Integration/Services/Deployment/FindViableNodesServiceTest.php +++ b/tests/Integration/Services/Deployment/FindViableNodesServiceTest.php @@ -6,8 +6,8 @@ use Exception; use Pterodactyl\Models\Node; use InvalidArgumentException; use Pterodactyl\Models\Server; -use Pterodactyl\Models\Location; use Pterodactyl\Models\Database; +use Pterodactyl\Models\Location; use Illuminate\Support\Collection; use Pterodactyl\Tests\Integration\IntegrationTestCase; use Pterodactyl\Services\Deployment\FindViableNodesService; @@ -112,7 +112,7 @@ class FindViableNodesServiceTest extends IntegrationTestCase // Helper, I am lazy. $base = function () use ($locations) { - return $this->getService()->setLocations([ $locations[1]->id ])->setDisk(512); + return $this->getService()->setLocations([$locations[1]->id])->setDisk(512); }; // Expect that we can create this server on either node since the disk and memory diff --git a/tests/Integration/Services/Schedules/ProcessScheduleServiceTest.php b/tests/Integration/Services/Schedules/ProcessScheduleServiceTest.php index b36332ee..d8cd6d1a 100644 --- a/tests/Integration/Services/Schedules/ProcessScheduleServiceTest.php +++ b/tests/Integration/Services/Schedules/ProcessScheduleServiceTest.php @@ -109,7 +109,7 @@ class ProcessScheduleServiceTest extends IntegrationTestCase $this->getService()->handle($schedule); - Bus::assertDispatched(RunTaskJob::class, function (RunTaskJob $job) use ($task) { + Bus::assertDispatched(RunTaskJob::class, function (RunTaskJob $job) use ($task) { return $task->id === $job->task->id; }); diff --git a/tests/Integration/Services/Servers/ServerCreationServiceTest.php b/tests/Integration/Services/Servers/ServerCreationServiceTest.php index f19ca888..c33844c2 100644 --- a/tests/Integration/Services/Servers/ServerCreationServiceTest.php +++ b/tests/Integration/Services/Servers/ServerCreationServiceTest.php @@ -4,16 +4,16 @@ namespace Pterodactyl\Tests\Integration\Services\Servers; use Mockery; use Pterodactyl\Models\Egg; +use GuzzleHttp\Psr7\Request; use Pterodactyl\Models\Node; use Pterodactyl\Models\User; -use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Response; use Pterodactyl\Models\Server; use Pterodactyl\Models\Location; use Pterodactyl\Models\Allocation; use Illuminate\Foundation\Testing\WithFaker; -use Illuminate\Validation\ValidationException; use GuzzleHttp\Exception\BadResponseException; +use Illuminate\Validation\ValidationException; use Pterodactyl\Models\Objects\DeploymentObject; use Pterodactyl\Tests\Integration\IntegrationTestCase; use Pterodactyl\Services\Servers\ServerCreationService; diff --git a/tests/Integration/Services/Servers/StartupModificationServiceTest.php b/tests/Integration/Services/Servers/StartupModificationServiceTest.php index 84fee3be..36a0348f 100644 --- a/tests/Integration/Services/Servers/StartupModificationServiceTest.php +++ b/tests/Integration/Services/Servers/StartupModificationServiceTest.php @@ -3,10 +3,9 @@ namespace Pterodactyl\Tests\Integration\Services\Servers; use Exception; -use Ramsey\Uuid\Uuid; use Pterodactyl\Models\Egg; -use Pterodactyl\Models\User; use Pterodactyl\Models\Nest; +use Pterodactyl\Models\User; use Pterodactyl\Models\Server; use Pterodactyl\Models\ServerVariable; use Illuminate\Validation\ValidationException; diff --git a/tests/Integration/Services/Servers/VariableValidatorServiceTest.php b/tests/Integration/Services/Servers/VariableValidatorServiceTest.php index 79a97ff7..01f6f7f0 100644 --- a/tests/Integration/Services/Servers/VariableValidatorServiceTest.php +++ b/tests/Integration/Services/Servers/VariableValidatorServiceTest.php @@ -92,7 +92,6 @@ class VariableValidatorServiceTest extends IntegrationTestCase $this->assertArrayHasKey('environment.BUNGEE_VERSION', $exception->errors()); } - $response = $this->getService()->setUserLevel(User::USER_LEVEL_ADMIN)->handle($egg->id, [ 'BUNGEE_VERSION' => '123', 'SERVER_JARFILE' => 'server.jar', diff --git a/tests/Unit/Http/Middleware/Api/AuthenticateIPAccessTest.php b/tests/Unit/Http/Middleware/Api/AuthenticateIPAccessTest.php index 5f7d67e5..287c50f8 100644 --- a/tests/Unit/Http/Middleware/Api/AuthenticateIPAccessTest.php +++ b/tests/Unit/Http/Middleware/Api/AuthenticateIPAccessTest.php @@ -3,8 +3,8 @@ namespace Pterodactyl\Tests\Unit\Http\Middleware\Api; use Pterodactyl\Models\ApiKey; -use Pterodactyl\Tests\Unit\Http\Middleware\MiddlewareTestCase; use Pterodactyl\Http\Middleware\Api\AuthenticateIPAccess; +use Pterodactyl\Tests\Unit\Http\Middleware\MiddlewareTestCase; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; class AuthenticateIPAccessTest extends MiddlewareTestCase diff --git a/tests/Unit/Http/Middleware/Api/AuthenticateKeyTest.php b/tests/Unit/Http/Middleware/Api/AuthenticateKeyTest.php index 9928dba0..521bb7ea 100644 --- a/tests/Unit/Http/Middleware/Api/AuthenticateKeyTest.php +++ b/tests/Unit/Http/Middleware/Api/AuthenticateKeyTest.php @@ -8,10 +8,10 @@ use Pterodactyl\Models\User; use Pterodactyl\Models\ApiKey; use Illuminate\Auth\AuthManager; use Illuminate\Contracts\Encryption\Encrypter; -use Pterodactyl\Tests\Unit\Http\Middleware\MiddlewareTestCase; use Pterodactyl\Http\Middleware\Api\AuthenticateKey; use Symfony\Component\HttpKernel\Exception\HttpException; use Pterodactyl\Exceptions\Repository\RecordNotFoundException; +use Pterodactyl\Tests\Unit\Http\Middleware\MiddlewareTestCase; use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; diff --git a/tests/Unit/Http/Middleware/Api/Daemon/DaemonAuthenticateTest.php b/tests/Unit/Http/Middleware/Api/Daemon/DaemonAuthenticateTest.php index d00c019a..d7364080 100644 --- a/tests/Unit/Http/Middleware/Api/Daemon/DaemonAuthenticateTest.php +++ b/tests/Unit/Http/Middleware/Api/Daemon/DaemonAuthenticateTest.php @@ -5,11 +5,11 @@ namespace Pterodactyl\Tests\Unit\Http\Middleware\Api\Daemon; use Mockery as m; use Pterodactyl\Models\Node; use Illuminate\Contracts\Encryption\Encrypter; -use Pterodactyl\Tests\Unit\Http\Middleware\MiddlewareTestCase; use Pterodactyl\Repositories\Eloquent\NodeRepository; use Symfony\Component\HttpKernel\Exception\HttpException; use Pterodactyl\Exceptions\Repository\RecordNotFoundException; use Pterodactyl\Http\Middleware\Api\Daemon\DaemonAuthenticate; +use Pterodactyl\Tests\Unit\Http\Middleware\MiddlewareTestCase; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; diff --git a/tests/Unit/Http/Middleware/Api/SetSessionDriverTest.php b/tests/Unit/Http/Middleware/Api/SetSessionDriverTest.php index 0cca3b85..6cbf810d 100644 --- a/tests/Unit/Http/Middleware/Api/SetSessionDriverTest.php +++ b/tests/Unit/Http/Middleware/Api/SetSessionDriverTest.php @@ -4,8 +4,8 @@ namespace Pterodactyl\Tests\Unit\Http\Middleware\Api; use Mockery as m; use Illuminate\Contracts\Config\Repository; -use Pterodactyl\Tests\Unit\Http\Middleware\MiddlewareTestCase; use Pterodactyl\Http\Middleware\Api\SetSessionDriver; +use Pterodactyl\Tests\Unit\Http\Middleware\MiddlewareTestCase; class SetSessionDriverTest extends MiddlewareTestCase { diff --git a/tests/Unit/Http/Middleware/Server/AccessingValidServerTest.php b/tests/Unit/Http/Middleware/Server/AccessingValidServerTest.php index b410c4de..de0259ff 100644 --- a/tests/Unit/Http/Middleware/Server/AccessingValidServerTest.php +++ b/tests/Unit/Http/Middleware/Server/AccessingValidServerTest.php @@ -6,8 +6,8 @@ use Mockery as m; use Pterodactyl\Models\Server; use Illuminate\Contracts\Config\Repository; use Illuminate\Contracts\Routing\ResponseFactory; -use Pterodactyl\Tests\Unit\Http\Middleware\MiddlewareTestCase; use Pterodactyl\Http\Middleware\Server\AccessingValidServer; +use Pterodactyl\Tests\Unit\Http\Middleware\MiddlewareTestCase; use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; use Symfony\Component\HttpKernel\Exception\ConflictHttpException; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; diff --git a/tests/Unit/Rules/UsernameTest.php b/tests/Unit/Rules/UsernameTest.php index cbf29767..5684e6a5 100644 --- a/tests/Unit/Rules/UsernameTest.php +++ b/tests/Unit/Rules/UsernameTest.php @@ -2,8 +2,8 @@ namespace Pterodactyl\Tests\Unit\Rules; -use Pterodactyl\Tests\TestCase; use Pterodactyl\Rules\Username; +use Pterodactyl\Tests\TestCase; class UsernameTest extends TestCase { diff --git a/tests/Unit/Services/Acl/Api/AdminAclTest.php b/tests/Unit/Services/Acl/Api/AdminAclTest.php index 7a694b19..a1941b93 100644 --- a/tests/Unit/Services/Acl/Api/AdminAclTest.php +++ b/tests/Unit/Services/Acl/Api/AdminAclTest.php @@ -2,8 +2,8 @@ namespace Pterodactyl\Tests\Unit\Services\Acl\Api; -use Pterodactyl\Tests\TestCase; use Pterodactyl\Models\ApiKey; +use Pterodactyl\Tests\TestCase; use Pterodactyl\Services\Acl\Api\AdminAcl; class AdminAclTest extends TestCase diff --git a/tests/Unit/Services/Api/KeyCreationServiceTest.php b/tests/Unit/Services/Api/KeyCreationServiceTest.php index 760439e2..e46033d8 100644 --- a/tests/Unit/Services/Api/KeyCreationServiceTest.php +++ b/tests/Unit/Services/Api/KeyCreationServiceTest.php @@ -3,9 +3,9 @@ namespace Pterodactyl\Tests\Unit\Services\Api; use Mockery as m; -use Pterodactyl\Tests\TestCase; use phpmock\phpunit\PHPMock; use Pterodactyl\Models\ApiKey; +use Pterodactyl\Tests\TestCase; use Illuminate\Contracts\Encryption\Encrypter; use Pterodactyl\Services\Api\KeyCreationService; use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface;