From c449ca5155b135329237fe2e03cf94af24b6683b Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 23 Jan 2021 12:33:34 -0800 Subject: [PATCH] Use more standardized phpcs --- .php_cs | 49 ++++------ .../Environment/AppSettingsCommand.php | 69 ++++++------- .../Environment/DatabaseSettingsCommand.php | 26 ++--- .../Environment/EmailSettingsCommand.php | 63 +++++++----- app/Console/Commands/InfoCommand.php | 6 +- .../Location/DeleteLocationCommand.php | 8 +- .../Commands/Location/MakeLocationCommand.php | 2 - .../CleanServiceBackupFilesCommand.php | 4 +- .../PruneOrphanedBackupsCommand.php | 7 +- .../Migration/CleanOrphanedApiKeysCommand.php | 7 +- .../Commands/Overrides/KeyGenerateCommand.php | 6 +- .../Commands/Overrides/SeedCommand.php | 2 +- app/Console/Commands/Overrides/UpCommand.php | 2 +- .../Schedule/ProcessRunnableCommand.php | 1 - .../Server/BulkPowerActionCommand.php | 12 +-- .../Server/BulkReinstallActionCommand.php | 6 +- .../Commands/User/DeleteUserCommand.php | 7 +- .../Commands/User/DisableTwoFactorCommand.php | 2 - app/Console/Commands/User/MakeUserCommand.php | 4 +- app/Console/Kernel.php | 2 - app/Console/RequiresDatabaseMigrations.php | 6 +- app/Contracts/Core/ReceivesEvents.php | 2 - app/Contracts/Criteria/CriteriaInterface.php | 2 +- app/Contracts/Extensions/HashidsInterface.php | 3 +- .../Http/ClientPermissionsRequest.php | 2 - .../AllocationRepositoryInterface.php | 6 -- .../Repository/ApiKeyRepositoryInterface.php | 14 --- .../DatabaseHostRepositoryInterface.php | 2 - .../DatabaseRepositoryInterface.php | 31 +----- .../Repository/EggRepositoryInterface.php | 14 --- .../EggVariableRepositoryInterface.php | 3 - .../LocationRepositoryInterface.php | 6 -- .../Repository/NestRepositoryInterface.php | 5 +- .../Repository/NodeRepositoryInterface.php | 20 +--- .../Repository/RepositoryInterface.php | 45 +-------- .../ScheduleRepositoryInterface.php | 6 -- .../Repository/ServerRepositoryInterface.php | 45 --------- .../Repository/SessionRepositoryInterface.php | 5 - .../SettingsRepositoryInterface.php | 7 +- .../Repository/SubuserRepositoryInterface.php | 12 --- .../Repository/TaskRepositoryInterface.php | 5 - app/Events/Server/Created.php | 2 - app/Events/Server/Creating.php | 2 - app/Events/Server/Deleted.php | 2 - app/Events/Server/Deleting.php | 2 - app/Events/Server/Saved.php | 2 - app/Events/Server/Saving.php | 2 - app/Events/Server/Updated.php | 2 - app/Events/Server/Updating.php | 2 - app/Events/Subuser/Created.php | 2 - app/Events/Subuser/Creating.php | 2 - app/Events/Subuser/Deleted.php | 2 - app/Events/Subuser/Deleting.php | 2 - app/Events/User/Created.php | 2 - app/Events/User/Creating.php | 2 - app/Events/User/Deleted.php | 2 - app/Events/User/Deleting.php | 2 - app/Exceptions/DisplayException.php | 14 +-- app/Exceptions/Handler.php | 17 +--- .../Connection/DaemonConnectionException.php | 5 +- .../Http/HttpForbiddenException.php | 3 - .../Http/TwoFactorAuthRequiredException.php | 2 - .../Model/DataValidationException.php | 2 - .../Backup/TooManyBackupsException.php | 2 - .../Service/ServiceLimitExceededException.php | 3 - app/Extensions/Backups/BackupManager.php | 22 +---- app/Extensions/DynamicDatabaseConnection.php | 16 ++- app/Extensions/Hashids.php | 2 +- .../Lcobucci/JWT/Encoding/TimestampDates.php | 5 +- .../Serializers/PterodactylSerializer.php | 5 +- .../Spatie/Fractalistic/Fractal.php | 2 +- app/Helpers/Time.php | 3 - app/Helpers/Utilities.php | 12 +-- app/Http/Controllers/Admin/ApiController.php | 15 --- app/Http/Controllers/Admin/BaseController.php | 4 - .../Controllers/Admin/DatabaseController.php | 23 ----- .../Controllers/Admin/LocationController.php | 11 +-- .../Controllers/Admin/MountController.php | 18 +--- .../Controllers/Admin/Nests/EggController.php | 19 +--- .../Admin/Nests/EggScriptController.php | 11 --- .../Admin/Nests/EggShareController.php | 15 --- .../Admin/Nests/EggVariableController.php | 22 ----- .../Admin/Nests/NestController.php | 23 ----- .../Admin/NodeAutoDeployController.php | 8 +- .../Admin/Nodes/NodeController.php | 4 - .../Admin/Nodes/NodeViewController.php | 17 ---- .../Nodes/SystemInformationController.php | 4 - .../Controllers/Admin/NodesController.php | 30 +----- .../Admin/Servers/CreateServerController.php | 11 +-- .../Admin/Servers/ServerController.php | 6 +- .../Servers/ServerTransferController.php | 21 +--- .../Admin/Servers/ServerViewController.php | 29 +----- .../Controllers/Admin/ServersController.php | 46 +-------- .../Admin/Settings/AdvancedController.php | 9 -- .../Admin/Settings/IndexController.php | 12 +-- .../Admin/Settings/MailController.php | 16 +-- .../Admin/StatisticsController.php | 2 +- app/Http/Controllers/Admin/UserController.php | 15 --- .../Application/ApplicationApiController.php | 6 -- .../Locations/LocationController.php | 20 ---- .../Api/Application/Nests/EggController.php | 8 -- .../Api/Application/Nests/NestController.php | 8 -- .../Nodes/AllocationController.php | 16 --- .../Nodes/NodeConfigurationController.php | 2 - .../Api/Application/Nodes/NodeController.php | 27 +---- .../Nodes/NodeDeploymentController.php | 5 - .../Servers/DatabaseController.php | 25 ----- .../Servers/ExternalServerController.php | 3 - .../Application/Servers/ServerController.php | 18 ---- .../Servers/ServerDetailsController.php | 13 +-- .../Servers/ServerManagementController.php | 15 --- .../Application/Servers/StartupController.php | 5 - .../Users/ExternalUserController.php | 3 - .../Api/Application/Users/UserController.php | 23 ----- .../Api/Client/AccountController.php | 13 --- .../Api/Client/ApiKeyController.php | 16 +-- .../Api/Client/ClientApiController.php | 5 +- .../Api/Client/ClientController.php | 9 +- .../Api/Client/Servers/BackupController.php | 14 --- .../Api/Client/Servers/CommandController.php | 10 +- .../Api/Client/Servers/DatabaseController.php | 21 ---- .../Servers/DownloadBackupController.php | 15 +-- .../Api/Client/Servers/FileController.php | 60 ++---------- .../Client/Servers/FileUploadController.php | 7 -- .../Servers/NetworkAllocationController.php | 33 +------ .../Api/Client/Servers/PowerController.php | 6 -- .../Servers/ResourceUtilizationController.php | 6 -- .../Api/Client/Servers/ScheduleController.php | 33 +------ .../Client/Servers/ScheduleTaskController.php | 23 +---- .../Api/Client/Servers/ServerController.php | 7 -- .../Api/Client/Servers/SettingsController.php | 15 +-- .../Api/Client/Servers/StartupController.php | 20 +--- .../Api/Client/Servers/SubuserController.php | 22 +---- .../Client/Servers/WebsocketController.php | 9 +- .../Api/Client/TwoFactorController.php | 13 +-- .../Backups/BackupRemoteUploadController.php | 17 ++-- .../Remote/Backups/BackupStatusController.php | 19 +--- .../Api/Remote/EggInstallController.php | 9 +- .../Servers/ServerDetailsController.php | 8 +- .../Servers/ServerInstallController.php | 6 -- .../Servers/ServerTransferController.php | 18 +--- .../Remote/SftpAuthenticationController.php | 38 ++----- .../Auth/AbstractLoginController.php | 19 +--- .../Auth/ForgotPasswordController.php | 3 - .../Auth/LoginCheckpointController.php | 19 +--- app/Http/Controllers/Auth/LoginController.php | 11 +-- .../Auth/ResetPasswordController.php | 16 +-- app/Http/Controllers/Base/IndexController.php | 2 - .../Controllers/Base/LocaleController.php | 5 - app/Http/Controllers/Controller.php | 4 +- .../Admin/Servers/ServerInstalled.php | 12 +-- app/Http/Middleware/AdminAuthenticate.php | 6 +- .../Middleware/Api/ApiSubstituteBindings.php | 4 +- .../AuthenticateApplicationUser.php | 4 +- .../Middleware/Api/AuthenticateIPAccess.php | 2 - app/Http/Middleware/Api/AuthenticateKey.php | 17 +--- .../Server/AuthenticateServerAccess.php | 28 +++--- .../Client/Server/ResourceBelongsToServer.php | 6 +- .../Client/SubstituteClientApiBindings.php | 2 +- .../Api/Daemon/DaemonAuthenticate.php | 17 +--- app/Http/Middleware/Api/IsValidJson.php | 12 +-- app/Http/Middleware/Api/SetSessionDriver.php | 4 - app/Http/Middleware/Authenticate.php | 6 +- app/Http/Middleware/LanguageMiddleware.php | 4 - app/Http/Middleware/MaintenanceMiddleware.php | 4 +- .../Middleware/RedirectIfAuthenticated.php | 5 - .../RequireTwoFactorAuthentication.php | 16 ++- .../Server/AccessingValidServer.php | 10 +- app/Http/Middleware/VerifyReCaptcha.php | 22 ++--- app/Http/Requests/Admin/AdminFormRequest.php | 1 - .../Api/StoreApplicationApiKeyRequest.php | 1 + .../Admin/DatabaseHostFormRequest.php | 2 +- .../Requests/Admin/Node/NodeFormRequest.php | 2 +- app/Http/Requests/Admin/ServerFormRequest.php | 6 +- .../Databases/StoreServerDatabaseRequest.php | 2 - .../Settings/MailSettingsFormRequest.php | 1 + .../Allocations/DeleteAllocationRequest.php | 2 - .../Allocations/GetAllocationsRequest.php | 2 - .../Allocations/StoreAllocationRequest.php | 3 - .../Api/Application/ApplicationApiRequest.php | 18 +--- .../Locations/DeleteLocationRequest.php | 2 - .../Locations/GetLocationRequest.php | 2 - .../Locations/StoreLocationRequest.php | 2 - .../Locations/UpdateLocationRequest.php | 4 - .../Application/Nests/Eggs/GetEggRequest.php | 2 - .../Application/Nodes/DeleteNodeRequest.php | 2 - .../Api/Application/Nodes/GetNodeRequest.php | 2 - .../Application/Nodes/StoreNodeRequest.php | 5 +- .../Application/Nodes/UpdateNodeRequest.php | 3 - .../Databases/GetServerDatabaseRequest.php | 2 - .../Databases/StoreServerDatabaseRequest.php | 4 - .../Servers/GetExternalServerRequest.php | 4 - .../Application/Servers/GetServersRequest.php | 3 - .../Servers/StoreServerRequest.php | 8 +- .../UpdateServerBuildConfigurationRequest.php | 9 +- .../Servers/UpdateServerDetailsRequest.php | 6 -- .../Servers/UpdateServerStartupRequest.php | 2 - .../Application/Users/DeleteUserRequest.php | 2 - .../Users/GetExternalUserRequest.php | 4 - .../Application/Users/StoreUserRequest.php | 3 - .../Application/Users/UpdateUserRequest.php | 3 - .../Api/Client/Account/StoreApiKeyRequest.php | 3 - .../Api/Client/Account/UpdateEmailRequest.php | 9 +- .../Client/Account/UpdatePasswordRequest.php | 9 +- .../Requests/Api/Client/ClientApiRequest.php | 2 - .../Requests/Api/Client/GetServersRequest.php | 3 - .../Servers/Backups/DownloadBackupRequest.php | 2 - .../Servers/Backups/StoreBackupRequest.php | 3 - .../Databases/DeleteDatabaseRequest.php | 6 -- .../Servers/Databases/GetDatabasesRequest.php | 3 - .../Databases/RotatePasswordRequest.php | 2 - .../Databases/StoreDatabaseRequest.php | 6 -- .../Servers/Files/ChmodFilesRequest.php | 6 -- .../Servers/Files/CompressFilesRequest.php | 5 - .../Client/Servers/Files/CopyFileRequest.php | 6 -- .../Servers/Files/CreateFolderRequest.php | 5 - .../Servers/Files/DecompressFilesRequest.php | 5 - .../Servers/Files/DeleteFileRequest.php | 6 -- .../Servers/Files/DownloadFileRequest.php | 2 - .../Servers/Files/GetFileContentsRequest.php | 5 - .../Client/Servers/Files/ListFilesRequest.php | 5 - .../Client/Servers/Files/PullFileRequest.php | 3 - .../Servers/Files/RenameFileRequest.php | 5 - .../Servers/Files/WriteFileContentRequest.php | 4 - .../Api/Client/Servers/GetServerRequest.php | 2 - .../Network/DeleteAllocationRequest.php | 3 - .../Servers/Network/GetNetworkRequest.php | 2 - .../Servers/Network/NewAllocationRequest.php | 3 - .../Network/SetPrimaryAllocationRequest.php | 3 - .../Network/UpdateAllocationRequest.php | 6 -- .../Schedules/DeleteScheduleRequest.php | 3 - .../Schedules/StoreScheduleRequest.php | 6 -- .../Servers/Schedules/StoreTaskRequest.php | 5 - .../Schedules/TriggerScheduleRequest.php | 6 -- .../Schedules/UpdateScheduleRequest.php | 3 - .../Servers/Schedules/ViewScheduleRequest.php | 11 +-- .../Api/Client/Servers/SendCommandRequest.php | 4 - .../Api/Client/Servers/SendPowerRequest.php | 4 - .../Servers/Settings/RenameServerRequest.php | 4 - .../Settings/SetDockerImageRequest.php | 3 - .../Servers/Subusers/GetSubuserRequest.php | 2 - .../Servers/Subusers/StoreSubuserRequest.php | 3 - .../Servers/Subusers/SubuserRequest.php | 10 +- .../Servers/Subusers/UpdateSubuserRequest.php | 3 - .../Requests/Auth/LoginCheckpointRequest.php | 4 - app/Http/Requests/Auth/LoginRequest.php | 6 -- .../Requests/Auth/ResetPasswordRequest.php | 6 -- app/Http/Requests/FrontendUserFormRequest.php | 2 +- .../Wings/ServerConfigurationCollection.php | 1 + app/Http/ViewComposers/AssetComposer.php | 4 - app/Jobs/Schedule/RunTaskJob.php | 14 +-- app/Models/Allocation.php | 32 +++--- app/Models/ApiKey.php | 34 +++---- app/Models/Backup.php | 33 +++---- app/Models/Database.php | 25 +++-- app/Models/DatabaseHost.php | 18 ++-- app/Models/Egg.php | 98 +++++++++---------- app/Models/EggVariable.php | 31 +++--- app/Models/Filters/AdminServerFilter.php | 6 +- app/Models/Filters/MultiFieldServerFilter.php | 10 +- app/Models/Location.php | 15 ++- app/Models/Model.php | 17 ++-- app/Models/Mount.php | 23 +++-- app/Models/Nest.php | 19 ++-- app/Models/Node.php | 68 ++++++------- app/Models/Objects/DeploymentObject.php | 12 --- app/Models/Permission.php | 81 +++++++-------- app/Models/RecoveryToken.php | 11 +-- app/Models/Schedule.php | 36 ++++--- app/Models/Server.php | 96 +++++++++--------- app/Models/ServerTransfer.php | 31 +++--- app/Models/ServerVariable.php | 2 +- app/Models/Subuser.php | 17 ++-- app/Models/Task.php | 27 +++-- app/Models/User.php | 55 +++++------ app/Notifications/AccountCreated.php | 9 +- app/Notifications/AddedToServer.php | 6 +- app/Notifications/MailTested.php | 2 +- app/Notifications/RemovedFromServer.php | 6 +- app/Notifications/SendPasswordReset.php | 4 +- app/Notifications/ServerInstalled.php | 2 +- app/Observers/ServerObserver.php | 16 --- app/Observers/SubuserObserver.php | 8 -- app/Observers/UserObserver.php | 8 -- app/Policies/ServerPolicy.php | 10 +- app/Providers/AppServiceProvider.php | 4 +- app/Providers/SettingsServiceProvider.php | 8 -- .../Eloquent/AllocationRepository.php | 22 ++--- .../Eloquent/ApiKeyRepository.php | 14 --- .../Eloquent/BackupRepository.php | 2 - .../Eloquent/DatabaseHostRepository.php | 2 - .../Eloquent/DatabaseRepository.php | 37 +------ app/Repositories/Eloquent/EggRepository.php | 20 +--- .../Eloquent/EggVariableRepository.php | 3 - .../Eloquent/EloquentRepository.php | 67 +++---------- .../Eloquent/LocationRepository.php | 10 +- app/Repositories/Eloquent/MountRepository.php | 8 +- app/Repositories/Eloquent/NestRepository.php | 21 ++-- app/Repositories/Eloquent/NodeRepository.php | 24 +---- .../Eloquent/PermissionRepository.php | 1 + .../Eloquent/ScheduleRepository.php | 8 +- .../Eloquent/ServerRepository.php | 69 +++---------- .../Eloquent/SessionRepository.php | 5 - .../Eloquent/SettingsRepository.php | 9 +- .../Eloquent/SubuserRepository.php | 22 +---- app/Repositories/Eloquent/TaskRepository.php | 7 +- app/Repositories/Repository.php | 5 +- .../Wings/DaemonBackupRepository.php | 6 -- .../Wings/DaemonCommandRepository.php | 1 - .../Wings/DaemonConfigurationRepository.php | 6 +- .../Wings/DaemonFileRepository.php | 42 +------- .../Wings/DaemonPowerRepository.php | 3 - app/Repositories/Wings/DaemonRepository.php | 7 -- .../Wings/DaemonServerRepository.php | 19 ++-- .../Wings/DaemonTransferRepository.php | 5 - app/Rules/Username.php | 5 +- app/Services/Acl/Api/AdminAcl.php | 32 +++--- .../Allocations/AllocationDeletionService.php | 5 +- .../Allocations/AssignmentService.php | 30 +++--- .../FindAssignableAllocationService.php | 14 +-- app/Services/Api/KeyCreationService.php | 8 -- app/Services/Backups/DeleteBackupService.php | 9 +- .../Backups/InitiateBackupService.php | 20 +--- .../Databases/DatabaseManagementService.php | 41 +++----- .../Databases/DatabasePasswordService.php | 6 -- .../Databases/DeployServerDatabaseService.php | 10 +- .../Databases/Hosts/HostCreationService.php | 9 -- .../Databases/Hosts/HostDeletionService.php | 6 -- .../Databases/Hosts/HostUpdateService.php | 12 +-- .../Deployment/AllocationSelectionService.php | 7 -- .../Deployment/FindViableNodesService.php | 8 +- app/Services/Eggs/EggConfigurationService.php | 34 +++---- app/Services/Eggs/EggCreationService.php | 8 +- app/Services/Eggs/EggDeletionService.php | 6 -- app/Services/Eggs/EggUpdateService.php | 7 +- .../Eggs/Scripts/InstallScriptService.php | 7 +- .../Eggs/Sharing/EggExporterService.php | 5 - .../Eggs/Sharing/EggImporterService.php | 26 +---- .../Eggs/Sharing/EggUpdateImporterService.php | 26 +---- .../Variables/VariableCreationService.php | 16 +-- .../Eggs/Variables/VariableUpdateService.php | 19 +--- app/Services/Helpers/AssetHashService.php | 20 +--- .../Helpers/SoftwareVersionService.php | 8 +- .../Locations/LocationCreationService.php | 3 - .../Locations/LocationDeletionService.php | 4 +- .../Locations/LocationUpdateService.php | 4 +- app/Services/Nests/NestCreationService.php | 6 -- app/Services/Nests/NestDeletionService.php | 6 -- app/Services/Nests/NestUpdateService.php | 6 +- app/Services/Nodes/NodeCreationService.php | 4 - app/Services/Nodes/NodeDeletionService.php | 5 +- app/Services/Nodes/NodeJWTService.php | 12 +-- app/Services/Nodes/NodeUpdateService.php | 10 +- .../Schedules/ProcessScheduleService.php | 12 +-- .../Servers/BuildModificationService.php | 17 +--- .../Servers/DetailsModificationService.php | 7 -- app/Services/Servers/EnvironmentService.php | 13 +-- .../Servers/GetUserPermissionsService.php | 2 - .../Servers/ReinstallServerService.php | 4 - .../ServerConfigurationStructureService.php | 8 +- .../Servers/ServerCreationService.php | 34 +------ .../Servers/ServerDeletionService.php | 11 +-- .../Servers/StartupCommandService.php | 6 +- .../Servers/StartupModificationService.php | 10 +- app/Services/Servers/SuspensionService.php | 12 +-- app/Services/Servers/TransferService.php | 3 - .../Servers/VariableValidatorService.php | 7 +- .../Subusers/SubuserCreationService.php | 10 -- app/Services/Users/ToggleTwoFactorService.php | 17 +--- app/Services/Users/TwoFactorSetupService.php | 11 +-- app/Services/Users/UserCreationService.php | 10 +- app/Services/Users/UserDeletionService.php | 5 +- app/Services/Users/UserUpdateService.php | 7 +- .../Commands/EnvironmentWriterTrait.php | 6 +- .../Controllers/JavascriptInjection.php | 2 +- app/Traits/Helpers/AvailableLanguages.php | 5 - app/Traits/Services/HasUserLevels.php | 6 -- app/Traits/Services/ReturnsUpdatedModels.php | 2 - .../Services/ValidatesValidationRules.php | 7 +- .../Api/Application/AllocationTransformer.php | 21 ++-- .../Api/Application/BaseTransformer.php | 17 +--- .../Application/DatabaseHostTransformer.php | 7 +- .../Api/Application/EggTransformer.php | 17 ++-- .../Application/EggVariableTransformer.php | 2 - .../Api/Application/LocationTransformer.php | 11 +-- .../Api/Application/NestTransformer.php | 9 +- .../Api/Application/NodeTransformer.php | 29 +++--- .../Application/ServerDatabaseTransformer.php | 12 +-- .../Api/Application/ServerTransformer.php | 34 ++----- .../Application/ServerVariableTransformer.php | 7 +- .../Api/Application/SubuserTransformer.php | 11 +-- .../Api/Application/UserTransformer.php | 8 +- .../Api/Client/AccountTransformer.php | 3 - .../Api/Client/AllocationTransformer.php | 3 - .../Api/Client/ApiKeyTransformer.php | 1 - .../Api/Client/BackupTransformer.php | 4 - .../Api/Client/BaseClientTransformer.php | 10 +- .../Api/Client/DatabaseTransformer.php | 13 +-- .../Api/Client/EggTransformer.php | 3 - .../Api/Client/EggVariableTransformer.php | 10 +- .../Api/Client/ScheduleTransformer.php | 6 +- .../Api/Client/ServerTransformer.php | 21 ++-- .../Api/Client/StatsTransformer.php | 4 - .../Api/Client/SubuserTransformer.php | 4 +- .../Api/Client/TaskTransformer.php | 1 - .../Api/Client/UserTransformer.php | 3 - .../Daemon/FileObjectTransformer.php | 4 - app/helpers.php | 10 +- bootstrap/tests.php | 6 +- database/Factories/AllocationFactory.php | 2 - database/Factories/ApiKeyFactory.php | 2 - database/Factories/BackupFactory.php | 2 - database/Factories/DatabaseFactory.php | 2 - database/Factories/DatabaseHostFactory.php | 2 - database/Factories/EggFactory.php | 2 - database/Factories/EggVariableFactory.php | 6 -- database/Factories/LocationFactory.php | 2 - database/Factories/NestFactory.php | 2 - database/Factories/NodeFactory.php | 2 - database/Factories/ScheduleFactory.php | 2 - database/Factories/SubuserFactory.php | 2 - database/Factories/TaskFactory.php | 2 - database/Factories/UserFactory.php | 4 - database/Seeders/EggSeeder.php | 13 --- database/Seeders/NestSeeder.php | 11 --- ...04_000949_add_ark_service_option_fixed.php | 2 +- ...03_10_173607_MigrateToNewServiceSystem.php | 2 +- ...dPermissionsToPointToNewScheduleSystem.php | 4 +- ...1_13_142012_SetupTableForKeyEncryption.php | 2 + ..._merge_permissions_table_into_subusers.php | 6 +- ...4_store_node_tokens_as_encrypted_value.php | 1 + .../MiddlewareAttributeAssertionsTrait.php | 7 +- tests/Browser/BrowserTestCase.php | 12 +-- tests/Browser/Pages/LoginPage.php | 3 - .../ForgotPasswordProcessTest.php | 4 +- .../Authentication/LoginProcessTest.php | 4 +- .../Dashboard/AccountEmailProcessTest.php | 6 +- .../Dashboard/AccountPasswordProcessTest.php | 4 +- .../TwoFactorAuthenticationProcessTest.php | 8 +- tests/Browser/PterodactylBrowser.php | 4 +- .../ApplicationApiIntegrationTestCase.php | 25 +---- .../Application/Nests/EggControllerTest.php | 4 +- .../Application/Users/UserControllerTest.php | 5 - .../Client/ClientApiIntegrationTestCase.php | 10 +- .../AllocationAuthorizationTest.php | 2 - .../Allocation/CreateNewAllocationTest.php | 1 - .../Allocation/DeleteAllocationTest.php | 1 - .../Server/Backup/BackupAuthorizationTest.php | 2 - .../Client/Server/CommandControllerTest.php | 2 +- .../Database/DatabaseAuthorizationTest.php | 2 - .../NetworkAllocationControllerTest.php | 2 - .../Api/Client/Server/PowerControllerTest.php | 8 -- .../Schedule/CreateServerScheduleTest.php | 3 - .../Schedule/DeleteServerScheduleTest.php | 3 - .../Server/Schedule/ExecuteScheduleTest.php | 4 - .../Schedule/GetServerSchedulesTest.php | 7 +- .../Schedule/ScheduleAuthorizationTest.php | 2 - .../Schedule/UpdateServerScheduleTest.php | 3 - .../CreateServerScheduleTaskTest.php | 3 - .../Client/Server/SettingsControllerTest.php | 6 -- .../Startup/UpdateStartupVariableTest.php | 1 - .../Subuser/CreateServerSubuserTest.php | 3 - .../Subuser/SubuserAuthorizationTest.php | 1 - .../Client/Server/WebsocketControllerTest.php | 8 +- .../Api/Client/TwoFactorControllerTest.php | 4 +- tests/Integration/IntegrationTestCase.php | 3 - .../FindAssignableAllocationServiceTest.php | 2 +- .../DatabaseManagementServiceTest.php | 7 +- .../DeployServerDatabaseServiceTest.php | 7 +- .../Schedules/ProcessScheduleServiceTest.php | 3 - .../Servers/ServerDeletionServiceTest.php | 6 +- tests/Integration/TestResponse.php | 3 +- .../Http/IntegrationJsonRequestAssertions.php | 4 - tests/Traits/Http/RequestMockHelpers.php | 16 +-- .../Traits/Integration/CreatesTestModels.php | 19 ++-- tests/Traits/MocksPdoConnection.php | 2 +- tests/Traits/MocksRequestException.php | 6 +- tests/Traits/MocksUuids.php | 2 - .../Http/Middleware/AdminAuthenticateTest.php | 2 - .../Api/Application/AuthenticateUserTest.php | 4 +- .../Api/AuthenticateIPAccessTest.php | 2 - .../Middleware/Api/AuthenticateKeyTest.php | 4 +- .../Api/Daemon/DaemonAuthenticateTest.php | 3 - .../Middleware/Api/SetSessionDriverTest.php | 2 - .../Unit/Http/Middleware/AuthenticateTest.php | 2 - .../Middleware/LanguageMiddlewareTest.php | 2 - .../Middleware/MaintenanceMiddlewareTest.php | 5 +- .../Http/Middleware/MiddlewareTestCase.php | 4 +- .../RedirectIfAuthenticatedTest.php | 2 - .../Server/AccessingValidServerTest.php | 4 - tests/Unit/Rules/UsernameTest.php | 9 +- tests/Unit/Services/Acl/Api/AdminAclTest.php | 2 - .../Services/Api/KeyCreationServiceTest.php | 4 - 493 files changed, 1116 insertions(+), 3903 deletions(-) diff --git a/.php_cs b/.php_cs index e72e8e70..2da2c8ee 100644 --- a/.php_cs +++ b/.php_cs @@ -1,58 +1,43 @@ in([ - 'app', - 'bootstrap', - 'config', - 'database', - 'resources/lang', - 'routes', - 'tests', - ]); +use PhpCsFixer\Config; +use PhpCsFixer\Finder; -return PhpCsFixer\Config::create() +$finder = (new Finder)->in([ + 'app', + 'bootstrap', + 'config', + 'database', + 'resources/lang', + 'routes', + 'tests', +]); + +return (new Config) + ->setRiskyAllowed(true) + ->setFinder($finder) ->setRules([ '@Symfony' => true, '@PSR1' => true, '@PSR2' => true, + '@PSR12' => true, 'align_multiline_comment' => ['comment_type' => 'phpdocs_like'], - 'array_syntax' => ['syntax' => 'short'], - 'blank_line_before_return' => true, - 'blank_line_before_statement' => false, 'combine_consecutive_unsets' => true, 'concat_space' => ['spacing' => 'one'], - 'declare_equal_normalize' => ['space' => 'single'], 'heredoc_to_nowdoc' => true, - 'increment_style' => ['style' => 'post'], - 'linebreak_after_opening_tag' => true, - 'method_argument_space' => [ - 'ensure_fully_multiline' => false, - 'keep_multiple_spaces_after_comma' => false, - ], - 'new_with_braces' => false, 'no_alias_functions' => true, - 'no_multiline_whitespace_before_semicolons' => true, - 'no_superfluous_phpdoc_tags' => false, 'no_unreachable_default_argument_value' => true, 'no_useless_return' => true, - 'not_operator_with_successor_space' => true, 'ordered_imports' => [ 'sortAlgorithm' => 'length', ], - 'phpdoc_align' => false, - 'phpdoc_separation' => false, - 'protected_to_private' => false, 'psr0' => ['dir' => 'app'], 'psr4' => true, 'random_api_migration' => true, - 'single_line_throw' => false, - 'single_trait_insert_per_statement' => false, - 'standardize_not_equals' => true, 'ternary_to_null_coalescing' => true, 'yoda_style' => [ 'equal' => false, 'identical' => false, 'less_and_greater' => false, ], - ])->setRiskyAllowed(true)->setFinder($finder); + ]); diff --git a/app/Console/Commands/Environment/AppSettingsCommand.php b/app/Console/Commands/Environment/AppSettingsCommand.php index 01518d61..cfe1d798 100644 --- a/app/Console/Commands/Environment/AppSettingsCommand.php +++ b/app/Console/Commands/Environment/AppSettingsCommand.php @@ -19,13 +19,13 @@ class AppSettingsCommand extends Command { use EnvironmentWriterTrait; - const ALLOWED_CACHE_DRIVERS = [ + public const ALLOWED_CACHE_DRIVERS = [ 'redis' => 'Redis (recommended)', 'memcached' => 'Memcached', 'file' => 'Filesystem', ]; - const ALLOWED_SESSION_DRIVERS = [ + public const ALLOWED_SESSION_DRIVERS = [ 'redis' => 'Redis (recommended)', 'memcached' => 'Memcached', 'database' => 'MySQL Database', @@ -33,7 +33,7 @@ class AppSettingsCommand extends Command 'cookie' => 'Cookie', ]; - const ALLOWED_QUEUE_DRIVERS = [ + public const ALLOWED_QUEUE_DRIVERS = [ 'redis' => 'Redis (recommended)', 'database' => 'MySQL Database', 'sync' => 'Sync', @@ -77,9 +77,6 @@ class AppSettingsCommand extends Command /** * AppSettingsCommand constructor. - * - * @param \Illuminate\Contracts\Config\Repository $config - * @param \Illuminate\Contracts\Console\Kernel $command */ public function __construct(ConfigRepository $config, Kernel $command) { @@ -102,43 +99,45 @@ class AppSettingsCommand extends Command $this->output->comment(trans('command/messages.environment.app.author_help')); $this->variables['APP_SERVICE_AUTHOR'] = $this->option('author') ?? $this->ask( - trans('command/messages.environment.app.author'), $this->config->get('pterodactyl.service.author', 'unknown@unknown.com') - ); + trans('command/messages.environment.app.author'), + $this->config->get('pterodactyl.service.author', 'unknown@unknown.com') + ); $this->output->comment(trans('command/messages.environment.app.app_url_help')); $this->variables['APP_URL'] = $this->option('url') ?? $this->ask( - trans('command/messages.environment.app.app_url'), $this->config->get('app.url', 'http://example.org') - ); + trans('command/messages.environment.app.app_url'), + $this->config->get('app.url', 'http://example.org') + ); $this->output->comment(trans('command/messages.environment.app.timezone_help')); $this->variables['APP_TIMEZONE'] = $this->option('timezone') ?? $this->anticipate( - trans('command/messages.environment.app.timezone'), - DateTimeZone::listIdentifiers(DateTimeZone::ALL), - $this->config->get('app.timezone') - ); + trans('command/messages.environment.app.timezone'), + DateTimeZone::listIdentifiers(DateTimeZone::ALL), + $this->config->get('app.timezone') + ); $selected = $this->config->get('cache.default', 'redis'); $this->variables['CACHE_DRIVER'] = $this->option('cache') ?? $this->choice( - trans('command/messages.environment.app.cache_driver'), - self::ALLOWED_CACHE_DRIVERS, - array_key_exists($selected, self::ALLOWED_CACHE_DRIVERS) ? $selected : null - ); + trans('command/messages.environment.app.cache_driver'), + self::ALLOWED_CACHE_DRIVERS, + array_key_exists($selected, self::ALLOWED_CACHE_DRIVERS) ? $selected : null + ); $selected = $this->config->get('session.driver', 'redis'); $this->variables['SESSION_DRIVER'] = $this->option('session') ?? $this->choice( - trans('command/messages.environment.app.session_driver'), - self::ALLOWED_SESSION_DRIVERS, - array_key_exists($selected, self::ALLOWED_SESSION_DRIVERS) ? $selected : null - ); + trans('command/messages.environment.app.session_driver'), + self::ALLOWED_SESSION_DRIVERS, + array_key_exists($selected, self::ALLOWED_SESSION_DRIVERS) ? $selected : null + ); $selected = $this->config->get('queue.default', 'redis'); $this->variables['QUEUE_CONNECTION'] = $this->option('queue') ?? $this->choice( - trans('command/messages.environment.app.queue_driver'), - self::ALLOWED_QUEUE_DRIVERS, - array_key_exists($selected, self::ALLOWED_QUEUE_DRIVERS) ? $selected : null - ); + trans('command/messages.environment.app.queue_driver'), + self::ALLOWED_QUEUE_DRIVERS, + array_key_exists($selected, self::ALLOWED_QUEUE_DRIVERS) ? $selected : null + ); - if (! is_null($this->option('settings-ui'))) { + if (!is_null($this->option('settings-ui'))) { $this->variables['APP_ENVIRONMENT_ONLY'] = $this->option('settings-ui') == 'true' ? 'false' : 'true'; } else { $this->variables['APP_ENVIRONMENT_ONLY'] = $this->confirm(trans('command/messages.environment.app.settings'), true) ? 'false' : 'true'; @@ -171,11 +170,12 @@ class AppSettingsCommand extends Command $this->output->note(trans('command/messages.environment.app.using_redis')); $this->variables['REDIS_HOST'] = $this->option('redis-host') ?? $this->ask( - trans('command/messages.environment.app.redis_host'), $this->config->get('database.redis.default.host') - ); + trans('command/messages.environment.app.redis_host'), + $this->config->get('database.redis.default.host') + ); $askForRedisPassword = true; - if (! empty($this->config->get('database.redis.default.password'))) { + if (!empty($this->config->get('database.redis.default.password'))) { $this->variables['REDIS_PASSWORD'] = $this->config->get('database.redis.default.password'); $askForRedisPassword = $this->confirm(trans('command/messages.environment.app.redis_pass_defined')); } @@ -183,8 +183,8 @@ class AppSettingsCommand extends Command if ($askForRedisPassword) { $this->output->comment(trans('command/messages.environment.app.redis_pass_help')); $this->variables['REDIS_PASSWORD'] = $this->option('redis-pass') ?? $this->output->askHidden( - trans('command/messages.environment.app.redis_password') - ); + trans('command/messages.environment.app.redis_password') + ); } if (empty($this->variables['REDIS_PASSWORD'])) { @@ -192,7 +192,8 @@ class AppSettingsCommand extends Command } $this->variables['REDIS_PORT'] = $this->option('redis-port') ?? $this->ask( - trans('command/messages.environment.app.redis_port'), $this->config->get('database.redis.default.port') - ); + trans('command/messages.environment.app.redis_port'), + $this->config->get('database.redis.default.port') + ); } } diff --git a/app/Console/Commands/Environment/DatabaseSettingsCommand.php b/app/Console/Commands/Environment/DatabaseSettingsCommand.php index 0a0e56b2..b983fcc9 100644 --- a/app/Console/Commands/Environment/DatabaseSettingsCommand.php +++ b/app/Console/Commands/Environment/DatabaseSettingsCommand.php @@ -57,10 +57,6 @@ class DatabaseSettingsCommand extends Command /** * DatabaseSettingsCommand constructor. - * - * @param \Illuminate\Contracts\Config\Repository $config - * @param \Illuminate\Database\DatabaseManager $database - * @param \Illuminate\Contracts\Console\Kernel $console */ public function __construct(ConfigRepository $config, DatabaseManager $database, Kernel $console) { @@ -82,24 +78,28 @@ class DatabaseSettingsCommand extends Command { $this->output->note(trans('command/messages.environment.database.host_warning')); $this->variables['DB_HOST'] = $this->option('host') ?? $this->ask( - trans('command/messages.environment.database.host'), $this->config->get('database.connections.mysql.host', '127.0.0.1') - ); + trans('command/messages.environment.database.host'), + $this->config->get('database.connections.mysql.host', '127.0.0.1') + ); $this->variables['DB_PORT'] = $this->option('port') ?? $this->ask( - trans('command/messages.environment.database.port'), $this->config->get('database.connections.mysql.port', 3306) - ); + trans('command/messages.environment.database.port'), + $this->config->get('database.connections.mysql.port', 3306) + ); $this->variables['DB_DATABASE'] = $this->option('database') ?? $this->ask( - trans('command/messages.environment.database.database'), $this->config->get('database.connections.mysql.database', 'panel') - ); + trans('command/messages.environment.database.database'), + $this->config->get('database.connections.mysql.database', 'panel') + ); $this->output->note(trans('command/messages.environment.database.username_warning')); $this->variables['DB_USERNAME'] = $this->option('username') ?? $this->ask( - trans('command/messages.environment.database.username'), $this->config->get('database.connections.mysql.username', 'pterodactyl') - ); + trans('command/messages.environment.database.username'), + $this->config->get('database.connections.mysql.username', 'pterodactyl') + ); $askForMySQLPassword = true; - if (! empty($this->config->get('database.connections.mysql.password')) && $this->input->isInteractive()) { + if (!empty($this->config->get('database.connections.mysql.password')) && $this->input->isInteractive()) { $this->variables['DB_PASSWORD'] = $this->config->get('database.connections.mysql.password'); $askForMySQLPassword = $this->confirm(trans('command/messages.environment.database.password_defined')); } diff --git a/app/Console/Commands/Environment/EmailSettingsCommand.php b/app/Console/Commands/Environment/EmailSettingsCommand.php index add1296e..6d98b63c 100644 --- a/app/Console/Commands/Environment/EmailSettingsCommand.php +++ b/app/Console/Commands/Environment/EmailSettingsCommand.php @@ -47,8 +47,6 @@ class EmailSettingsCommand extends Command /** * EmailSettingsCommand constructor. - * - * @param \Illuminate\Contracts\Config\Repository $config */ public function __construct(ConfigRepository $config) { @@ -65,13 +63,15 @@ class EmailSettingsCommand extends Command public function handle() { $this->variables['MAIL_DRIVER'] = $this->option('driver') ?? $this->choice( - trans('command/messages.environment.mail.ask_driver'), [ + trans('command/messages.environment.mail.ask_driver'), + [ 'smtp' => 'SMTP Server', 'mail' => 'PHP\'s Internal Mail Function', 'mailgun' => 'Mailgun Transactional Email', 'mandrill' => 'Mandrill Transactional Email', 'postmark' => 'Postmarkapp Transactional Email', - ], $this->config->get('mail.driver', 'smtp') + ], + $this->config->get('mail.driver', 'smtp') ); $method = 'setup' . studly_case($this->variables['MAIL_DRIVER']) . 'DriverVariables'; @@ -80,16 +80,20 @@ class EmailSettingsCommand extends Command } $this->variables['MAIL_FROM'] = $this->option('email') ?? $this->ask( - trans('command/messages.environment.mail.ask_mail_from'), $this->config->get('mail.from.address') - ); + trans('command/messages.environment.mail.ask_mail_from'), + $this->config->get('mail.from.address') + ); $this->variables['MAIL_FROM_NAME'] = $this->option('from') ?? $this->ask( - trans('command/messages.environment.mail.ask_mail_name'), $this->config->get('mail.from.name') - ); + trans('command/messages.environment.mail.ask_mail_name'), + $this->config->get('mail.from.name') + ); $this->variables['MAIL_ENCRYPTION'] = $this->option('encryption') ?? $this->choice( - trans('command/messages.environment.mail.ask_encryption'), ['tls' => 'TLS', 'ssl' => 'SSL', '' => 'None'], $this->config->get('mail.encryption', 'tls') - ); + trans('command/messages.environment.mail.ask_encryption'), + ['tls' => 'TLS', 'ssl' => 'SSL', '' => 'None'], + $this->config->get('mail.encryption', 'tls') + ); $this->writeToEnvironment($this->variables); @@ -103,20 +107,23 @@ class EmailSettingsCommand extends Command private function setupSmtpDriverVariables() { $this->variables['MAIL_HOST'] = $this->option('host') ?? $this->ask( - trans('command/messages.environment.mail.ask_smtp_host'), $this->config->get('mail.host') - ); + trans('command/messages.environment.mail.ask_smtp_host'), + $this->config->get('mail.host') + ); $this->variables['MAIL_PORT'] = $this->option('port') ?? $this->ask( - trans('command/messages.environment.mail.ask_smtp_port'), $this->config->get('mail.port') - ); + trans('command/messages.environment.mail.ask_smtp_port'), + $this->config->get('mail.port') + ); $this->variables['MAIL_USERNAME'] = $this->option('username') ?? $this->ask( - trans('command/messages.environment.mail.ask_smtp_username'), $this->config->get('mail.username') - ); + trans('command/messages.environment.mail.ask_smtp_username'), + $this->config->get('mail.username') + ); $this->variables['MAIL_PASSWORD'] = $this->option('password') ?? $this->secret( - trans('command/messages.environment.mail.ask_smtp_password') - ); + trans('command/messages.environment.mail.ask_smtp_password') + ); } /** @@ -125,12 +132,14 @@ class EmailSettingsCommand extends Command private function setupMailgunDriverVariables() { $this->variables['MAILGUN_DOMAIN'] = $this->option('host') ?? $this->ask( - trans('command/messages.environment.mail.ask_mailgun_domain'), $this->config->get('services.mailgun.domain') - ); + trans('command/messages.environment.mail.ask_mailgun_domain'), + $this->config->get('services.mailgun.domain') + ); $this->variables['MAILGUN_SECRET'] = $this->option('password') ?? $this->ask( - trans('command/messages.environment.mail.ask_mailgun_secret'), $this->config->get('services.mailgun.secret') - ); + trans('command/messages.environment.mail.ask_mailgun_secret'), + $this->config->get('services.mailgun.secret') + ); } /** @@ -139,8 +148,9 @@ class EmailSettingsCommand extends Command private function setupMandrillDriverVariables() { $this->variables['MANDRILL_SECRET'] = $this->option('password') ?? $this->ask( - trans('command/messages.environment.mail.ask_mandrill_secret'), $this->config->get('services.mandrill.secret') - ); + trans('command/messages.environment.mail.ask_mandrill_secret'), + $this->config->get('services.mandrill.secret') + ); } /** @@ -152,7 +162,8 @@ class EmailSettingsCommand extends Command $this->variables['MAIL_HOST'] = 'smtp.postmarkapp.com'; $this->variables['MAIL_PORT'] = 587; $this->variables['MAIL_USERNAME'] = $this->variables['MAIL_PASSWORD'] = $this->option('username') ?? $this->ask( - trans('command/messages.environment.mail.ask_postmark_username'), $this->config->get('mail.username') - ); + trans('command/messages.environment.mail.ask_postmark_username'), + $this->config->get('mail.username') + ); } } diff --git a/app/Console/Commands/InfoCommand.php b/app/Console/Commands/InfoCommand.php index 7ee140a1..4db0be70 100644 --- a/app/Console/Commands/InfoCommand.php +++ b/app/Console/Commands/InfoCommand.php @@ -37,9 +37,6 @@ class InfoCommand extends Command /** * VersionCommand constructor. - * - * @param \Illuminate\Contracts\Config\Repository $config - * @param \Pterodactyl\Services\Helpers\SoftwareVersionService $versionService */ public function __construct(ConfigRepository $config, SoftwareVersionService $versionService) { @@ -65,7 +62,7 @@ class InfoCommand extends Command $this->output->title('Application Configuration'); $this->table([], [ ['Environment', $this->formatText($this->config->get('app.env'), $this->config->get('app.env') === 'production' ?: 'bg=red')], - ['Debug Mode', $this->formatText($this->config->get('app.debug') ? 'Yes' : 'No', ! $this->config->get('app.debug') ?: 'bg=red')], + ['Debug Mode', $this->formatText($this->config->get('app.debug') ? 'Yes' : 'No', !$this->config->get('app.debug') ?: 'bg=red')], ['Installation URL', $this->config->get('app.url')], ['Installation Directory', base_path()], ['Timezone', $this->config->get('app.timezone')], @@ -104,6 +101,7 @@ class InfoCommand extends Command * * @param string $value * @param string $opts + * * @return string */ private function formatText($value, $opts = '') diff --git a/app/Console/Commands/Location/DeleteLocationCommand.php b/app/Console/Commands/Location/DeleteLocationCommand.php index b6782207..898dbb92 100644 --- a/app/Console/Commands/Location/DeleteLocationCommand.php +++ b/app/Console/Commands/Location/DeleteLocationCommand.php @@ -42,9 +42,6 @@ class DeleteLocationCommand extends Command /** * DeleteLocationCommand constructor. - * - * @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $repository - * @param \Pterodactyl\Services\Locations\LocationDeletionService $deletionService */ public function __construct( LocationDeletionService $deletionService, @@ -66,8 +63,9 @@ class DeleteLocationCommand extends Command { $this->locations = $this->locations ?? $this->repository->all(); $short = $this->option('short') ?? $this->anticipate( - trans('command/messages.location.ask_short'), $this->locations->pluck('short')->toArray() - ); + trans('command/messages.location.ask_short'), + $this->locations->pluck('short')->toArray() + ); $location = $this->locations->where('short', $short)->first(); if (is_null($location)) { diff --git a/app/Console/Commands/Location/MakeLocationCommand.php b/app/Console/Commands/Location/MakeLocationCommand.php index 79112972..db4d4e2e 100644 --- a/app/Console/Commands/Location/MakeLocationCommand.php +++ b/app/Console/Commands/Location/MakeLocationCommand.php @@ -33,8 +33,6 @@ class MakeLocationCommand extends Command /** * Create a new command instance. - * - * @param \Pterodactyl\Services\Locations\LocationCreationService $creationService */ public function __construct(LocationCreationService $creationService) { diff --git a/app/Console/Commands/Maintenance/CleanServiceBackupFilesCommand.php b/app/Console/Commands/Maintenance/CleanServiceBackupFilesCommand.php index 1b5ded4d..69a3b118 100644 --- a/app/Console/Commands/Maintenance/CleanServiceBackupFilesCommand.php +++ b/app/Console/Commands/Maintenance/CleanServiceBackupFilesCommand.php @@ -9,7 +9,7 @@ use Illuminate\Contracts\Filesystem\Factory as FilesystemFactory; class CleanServiceBackupFilesCommand extends Command { - const BACKUP_THRESHOLD_MINUTES = 5; + public const BACKUP_THRESHOLD_MINUTES = 5; /** * @var string @@ -28,8 +28,6 @@ class CleanServiceBackupFilesCommand extends Command /** * CleanServiceBackupFilesCommand constructor. - * - * @param \Illuminate\Contracts\Filesystem\Factory $filesystem */ public function __construct(FilesystemFactory $filesystem) { diff --git a/app/Console/Commands/Maintenance/PruneOrphanedBackupsCommand.php b/app/Console/Commands/Maintenance/PruneOrphanedBackupsCommand.php index af4590d4..77ad86ad 100644 --- a/app/Console/Commands/Maintenance/PruneOrphanedBackupsCommand.php +++ b/app/Console/Commands/Maintenance/PruneOrphanedBackupsCommand.php @@ -19,13 +19,10 @@ class PruneOrphanedBackupsCommand extends Command */ protected $description = 'Marks all backups that have not completed in the last "n" minutes as being failed.'; - /** - * @param \Pterodactyl\Repositories\Eloquent\BackupRepository $repository - */ public function handle(BackupRepository $repository) { $since = $this->option('since-minutes'); - if (! is_digit($since)) { + if (!is_digit($since)) { throw new InvalidArgumentException('The --since-minutes option must be a valid numeric digit.'); } @@ -34,7 +31,7 @@ class PruneOrphanedBackupsCommand extends Command ->whereDate('created_at', '<=', CarbonImmutable::now()->subMinutes($since)); $count = $query->count(); - if (! $count) { + if (!$count) { $this->info('There are no orphaned backups to be marked as failed.'); return; diff --git a/app/Console/Commands/Migration/CleanOrphanedApiKeysCommand.php b/app/Console/Commands/Migration/CleanOrphanedApiKeysCommand.php index e7d86399..7a7ff33a 100644 --- a/app/Console/Commands/Migration/CleanOrphanedApiKeysCommand.php +++ b/app/Console/Commands/Migration/CleanOrphanedApiKeysCommand.php @@ -25,8 +25,6 @@ class CleanOrphanedApiKeysCommand extends Command /** * CleanOrphanedApiKeysCommand constructor. - * - * @param \Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface $repository */ public function __construct(ApiKeyRepositoryInterface $repository) { @@ -44,10 +42,11 @@ class CleanOrphanedApiKeysCommand extends Command { $count = $this->repository->findCountWhere([['key_type', '=', ApiKey::TYPE_NONE]]); $continue = $this->confirm( - 'This action will remove ' . $count . ' keys from the database. Are you sure you wish to continue?', false + 'This action will remove ' . $count . ' keys from the database. Are you sure you wish to continue?', + false ); - if (! $continue) { + if (!$continue) { return null; } diff --git a/app/Console/Commands/Overrides/KeyGenerateCommand.php b/app/Console/Commands/Overrides/KeyGenerateCommand.php index aa929499..8aa30a9e 100644 --- a/app/Console/Commands/Overrides/KeyGenerateCommand.php +++ b/app/Console/Commands/Overrides/KeyGenerateCommand.php @@ -12,13 +12,13 @@ class KeyGenerateCommand extends BaseKeyGenerateCommand */ public function handle() { - if (! empty(config('app.key')) && $this->input->isInteractive()) { + if (!empty(config('app.key')) && $this->input->isInteractive()) { $this->output->warning(trans('command/messages.key.warning')); - if (! $this->confirm(trans('command/messages.key.confirm'))) { + if (!$this->confirm(trans('command/messages.key.confirm'))) { return; } - if (! $this->confirm(trans('command/messages.key.final_confirm'))) { + if (!$this->confirm(trans('command/messages.key.final_confirm'))) { return; } } diff --git a/app/Console/Commands/Overrides/SeedCommand.php b/app/Console/Commands/Overrides/SeedCommand.php index d8bc9c2a..91b555d4 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 4d28b1bd..3a5f3461 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 8a4134ac..9e51feae 100644 --- a/app/Console/Commands/Schedule/ProcessRunnableCommand.php +++ b/app/Console/Commands/Schedule/ProcessRunnableCommand.php @@ -54,7 +54,6 @@ class ProcessRunnableCommand extends Command * never throw an exception out, otherwise you'll end up killing the entire run group causing * any other schedules to not process correctly. * - * @param \Pterodactyl\Models\Schedule $schedule * @see https://github.com/pterodactyl/panel/issues/2609 */ protected function processSchedule(Schedule $schedule) diff --git a/app/Console/Commands/Server/BulkPowerActionCommand.php b/app/Console/Commands/Server/BulkPowerActionCommand.php index 0e5934bf..460df719 100644 --- a/app/Console/Commands/Server/BulkPowerActionCommand.php +++ b/app/Console/Commands/Server/BulkPowerActionCommand.php @@ -27,8 +27,6 @@ class BulkPowerActionCommand extends Command /** * Handle the bulk power request. * - * @param \Pterodactyl\Repositories\Wings\DaemonPowerRepository $powerRepository - * @param \Illuminate\Validation\Factory $validator * @throws \Illuminate\Validation\ValidationException */ public function handle(DaemonPowerRepository $powerRepository, ValidatorFactory $validator) @@ -58,7 +56,7 @@ class BulkPowerActionCommand extends Command } $count = $this->getQueryBuilder($servers, $nodes)->count(); - if (! $this->confirm(trans('command/messages.server.power.confirm', ['action' => $action, 'count' => $count])) && $this->input->isInteractive()) { + if (!$this->confirm(trans('command/messages.server.power.confirm', ['action' => $action, 'count' => $count])) && $this->input->isInteractive()) { return; } @@ -87,8 +85,6 @@ class BulkPowerActionCommand extends Command /** * Returns the query builder instance that will return the servers that should be affected. * - * @param array $servers - * @param array $nodes * @return \Illuminate\Database\Eloquent\Builder */ protected function getQueryBuilder(array $servers, array $nodes) @@ -97,11 +93,11 @@ class BulkPowerActionCommand extends Command ->where('suspended', false) ->where('installed', Server::STATUS_INSTALLED); - if (! empty($nodes) && ! empty($servers)) { + if (!empty($nodes) && !empty($servers)) { $instance->whereIn('id', $servers)->orWhereIn('node_id', $nodes); - } elseif (empty($nodes) && ! empty($servers)) { + } elseif (empty($nodes) && !empty($servers)) { $instance->whereIn('id', $servers); - } elseif (! empty($nodes) && empty($servers)) { + } elseif (!empty($nodes) && empty($servers)) { $instance->whereIn('node_id', $nodes); } diff --git a/app/Console/Commands/Server/BulkReinstallActionCommand.php b/app/Console/Commands/Server/BulkReinstallActionCommand.php index a56cefc7..e6250cc3 100644 --- a/app/Console/Commands/Server/BulkReinstallActionCommand.php +++ b/app/Console/Commands/Server/BulkReinstallActionCommand.php @@ -47,10 +47,6 @@ class BulkReinstallActionCommand extends Command /** * BulkReinstallActionCommand constructor. - * - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonRepository - * @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $configurationStructureService - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository */ public function __construct( DaemonServerRepository $daemonRepository, @@ -71,7 +67,7 @@ class BulkReinstallActionCommand extends Command { $servers = $this->getServersToProcess(); - if (! $this->confirm(trans('command/messages.server.reinstall.confirm')) && $this->input->isInteractive()) { + if (!$this->confirm(trans('command/messages.server.reinstall.confirm')) && $this->input->isInteractive()) { return; } diff --git a/app/Console/Commands/User/DeleteUserCommand.php b/app/Console/Commands/User/DeleteUserCommand.php index 30460464..4c847257 100644 --- a/app/Console/Commands/User/DeleteUserCommand.php +++ b/app/Console/Commands/User/DeleteUserCommand.php @@ -38,8 +38,6 @@ class DeleteUserCommand extends Command /** * DeleteUserCommand constructor. - * - * @param \Pterodactyl\Services\Users\UserDeletionService $deletionService */ public function __construct(UserDeletionService $deletionService) { @@ -50,6 +48,7 @@ class DeleteUserCommand extends Command /** * @return bool + * * @throws \Pterodactyl\Exceptions\DisplayException */ public function handle() @@ -79,7 +78,7 @@ class DeleteUserCommand extends Command } $this->table(['User ID', 'Email', 'Name'], $tableValues); - if (! $deleteUser = $this->ask(trans('command/messages.user.select_search_user'))) { + if (!$deleteUser = $this->ask(trans('command/messages.user.select_search_user'))) { return $this->handle(); } } else { @@ -92,7 +91,7 @@ class DeleteUserCommand extends Command $deleteUser = $results->first(); } - if ($this->confirm(trans('command/messages.user.confirm_delete')) || ! $this->input->isInteractive()) { + if ($this->confirm(trans('command/messages.user.confirm_delete')) || !$this->input->isInteractive()) { $this->deletionService->handle($deleteUser); $this->info(trans('command/messages.user.deleted')); } diff --git a/app/Console/Commands/User/DisableTwoFactorCommand.php b/app/Console/Commands/User/DisableTwoFactorCommand.php index f2cab910..05e98c04 100644 --- a/app/Console/Commands/User/DisableTwoFactorCommand.php +++ b/app/Console/Commands/User/DisableTwoFactorCommand.php @@ -31,8 +31,6 @@ class DisableTwoFactorCommand extends Command /** * DisableTwoFactorCommand constructor. - * - * @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository */ public function __construct(UserRepositoryInterface $repository) { diff --git a/app/Console/Commands/User/MakeUserCommand.php b/app/Console/Commands/User/MakeUserCommand.php index 35060b53..f981a2f2 100644 --- a/app/Console/Commands/User/MakeUserCommand.php +++ b/app/Console/Commands/User/MakeUserCommand.php @@ -31,8 +31,6 @@ class MakeUserCommand extends Command /** * MakeUserCommand constructor. - * - * @param \Pterodactyl\Services\Users\UserCreationService $creationService */ public function __construct(UserCreationService $creationService) { @@ -55,7 +53,7 @@ class MakeUserCommand extends Command $name_first = $this->option('name-first') ?? $this->ask(trans('command/messages.user.ask_name_first')); $name_last = $this->option('name-last') ?? $this->ask(trans('command/messages.user.ask_name_last')); - if (is_null($password = $this->option('password')) && ! $this->option('no-password')) { + if (is_null($password = $this->option('password')) && !$this->option('no-password')) { $this->warn(trans('command/messages.user.ask_password_help')); $this->line(trans('command/messages.user.ask_password_tip')); $password = $this->secret(trans('command/messages.user.ask_password')); diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 4fa0845e..b5f8067e 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -17,8 +17,6 @@ class Kernel extends ConsoleKernel /** * Define the application's command schedule. - * - * @param \Illuminate\Console\Scheduling\Schedule $schedule */ protected function schedule(Schedule $schedule) { diff --git a/app/Console/RequiresDatabaseMigrations.php b/app/Console/RequiresDatabaseMigrations.php index 7b881d00..479722b6 100644 --- a/app/Console/RequiresDatabaseMigrations.php +++ b/app/Console/RequiresDatabaseMigrations.php @@ -9,8 +9,6 @@ trait RequiresDatabaseMigrations { /** * Checks if the migrations have finished running by comparing the last migration file. - * - * @return bool */ protected function hasCompletedMigrations(): bool { @@ -19,7 +17,7 @@ trait RequiresDatabaseMigrations $files = $migrator->getMigrationFiles(database_path('migrations')); - if (! $migrator->repositoryExists()) { + if (!$migrator->repositoryExists()) { return false; } @@ -34,8 +32,6 @@ trait RequiresDatabaseMigrations * Throw a massive error into the console to hopefully catch the users attention and get * them to properly run the migrations rather than ignoring all of the other previous * errors... - * - * @return int */ protected function showMigrationWarning(): int { diff --git a/app/Contracts/Core/ReceivesEvents.php b/app/Contracts/Core/ReceivesEvents.php index a6c1aa10..dbbad445 100644 --- a/app/Contracts/Core/ReceivesEvents.php +++ b/app/Contracts/Core/ReceivesEvents.php @@ -8,8 +8,6 @@ interface ReceivesEvents { /** * Handles receiving an event from the application. - * - * @param \Pterodactyl\Events\Event $notification */ public function handle(Event $notification): void; } diff --git a/app/Contracts/Criteria/CriteriaInterface.php b/app/Contracts/Criteria/CriteriaInterface.php index 1b832819..cb9f56d7 100644 --- a/app/Contracts/Criteria/CriteriaInterface.php +++ b/app/Contracts/Criteria/CriteriaInterface.php @@ -17,7 +17,7 @@ interface CriteriaInterface * Apply selected criteria to a repository call. * * @param \Illuminate\Database\Eloquent\Model $model - * @param \Pterodactyl\Repositories\Repository $repository + * * @return mixed */ public function apply($model, Repository $repository); diff --git a/app/Contracts/Extensions/HashidsInterface.php b/app/Contracts/Extensions/HashidsInterface.php index 8e1e6990..e8d525f3 100644 --- a/app/Contracts/Extensions/HashidsInterface.php +++ b/app/Contracts/Extensions/HashidsInterface.php @@ -17,7 +17,8 @@ interface HashidsInterface extends VendorHashidsInterface * Decode an encoded hashid and return the first result. * * @param string $encoded - * @param null $default + * @param null $default + * * @return mixed * * @throws \InvalidArgumentException diff --git a/app/Contracts/Http/ClientPermissionsRequest.php b/app/Contracts/Http/ClientPermissionsRequest.php index 6b863fce..85eae225 100644 --- a/app/Contracts/Http/ClientPermissionsRequest.php +++ b/app/Contracts/Http/ClientPermissionsRequest.php @@ -8,8 +8,6 @@ interface ClientPermissionsRequest * Returns the permissions string indicating which permission should be used to * validate that the authenticated user has permission to perform this action aganist * the given resource (server). - * - * @return string */ public function permission(): string; } diff --git a/app/Contracts/Repository/AllocationRepositoryInterface.php b/app/Contracts/Repository/AllocationRepositoryInterface.php index 143834a4..24507f9a 100644 --- a/app/Contracts/Repository/AllocationRepositoryInterface.php +++ b/app/Contracts/Repository/AllocationRepositoryInterface.php @@ -7,18 +7,12 @@ interface AllocationRepositoryInterface extends RepositoryInterface /** * Return all of the allocations that exist for a node that are not currently * allocated. - * - * @param int $node - * @return array */ public function getUnassignedAllocationIds(int $node): array; /** * Return a single allocation from those meeting the requirements. * - * @param array $nodes - * @param array $ports - * @param bool $dedicated * @return \Pterodactyl\Models\Allocation|null */ public function getRandomAllocation(array $nodes, array $ports, bool $dedicated = false); diff --git a/app/Contracts/Repository/ApiKeyRepositoryInterface.php b/app/Contracts/Repository/ApiKeyRepositoryInterface.php index 89a722b2..91e0a382 100644 --- a/app/Contracts/Repository/ApiKeyRepositoryInterface.php +++ b/app/Contracts/Repository/ApiKeyRepositoryInterface.php @@ -9,35 +9,21 @@ interface ApiKeyRepositoryInterface extends RepositoryInterface { /** * Get all of the account API keys that exist for a specific user. - * - * @param \Pterodactyl\Models\User $user - * @return \Illuminate\Support\Collection */ public function getAccountKeys(User $user): Collection; /** * Get all of the application API keys that exist for a specific user. - * - * @param \Pterodactyl\Models\User $user - * @return \Illuminate\Support\Collection */ public function getApplicationKeys(User $user): Collection; /** * Delete an account API key from the panel for a specific user. - * - * @param \Pterodactyl\Models\User $user - * @param string $identifier - * @return int */ public function deleteAccountKey(User $user, string $identifier): int; /** * Delete an application API key from the panel for a specific user. - * - * @param \Pterodactyl\Models\User $user - * @param string $identifier - * @return int */ public function deleteApplicationKey(User $user, string $identifier): int; } diff --git a/app/Contracts/Repository/DatabaseHostRepositoryInterface.php b/app/Contracts/Repository/DatabaseHostRepositoryInterface.php index a924d85a..01f1ca4b 100644 --- a/app/Contracts/Repository/DatabaseHostRepositoryInterface.php +++ b/app/Contracts/Repository/DatabaseHostRepositoryInterface.php @@ -9,8 +9,6 @@ interface DatabaseHostRepositoryInterface extends RepositoryInterface /** * Return database hosts with a count of databases and the node * information for which it is attached. - * - * @return \Illuminate\Support\Collection */ public function getWithViewDetails(): Collection; } diff --git a/app/Contracts/Repository/DatabaseRepositoryInterface.php b/app/Contracts/Repository/DatabaseRepositoryInterface.php index 5926adb7..62207220 100644 --- a/app/Contracts/Repository/DatabaseRepositoryInterface.php +++ b/app/Contracts/Repository/DatabaseRepositoryInterface.php @@ -8,89 +8,60 @@ use Illuminate\Contracts\Pagination\LengthAwarePaginator; interface DatabaseRepositoryInterface extends RepositoryInterface { - const DEFAULT_CONNECTION_NAME = 'dynamic'; + public const DEFAULT_CONNECTION_NAME = 'dynamic'; /** * Set the connection name to execute statements against. * - * @param string $connection * @return $this */ public function setConnection(string $connection); /** * Return the connection to execute statements against. - * - * @return string */ public function getConnection(): string; /** * Return all of the databases belonging to a server. - * - * @param int $server - * @return \Illuminate\Support\Collection */ public function getDatabasesForServer(int $server): Collection; /** * Return all of the databases for a given host with the server relationship loaded. - * - * @param int $host - * @param int $count - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator */ public function getDatabasesForHost(int $host, int $count = 25): LengthAwarePaginator; /** * Create a new database on a given connection. - * - * @param string $database - * @return bool */ public function createDatabase(string $database): bool; /** * Create a new database user on a given connection. * - * @param string $username - * @param string $remote - * @param string $password * @param $max_connections - * @return bool */ public function createUser(string $username, string $remote, string $password, string $max_connections): bool; /** * Give a specific user access to a given database. - * - * @param string $database - * @param string $username - * @param string $remote - * @return bool */ public function assignUserToDatabase(string $database, string $username, string $remote): bool; /** * Flush the privileges for a given connection. - * - * @return bool */ public function flush(): bool; /** * Drop a given database on a specific connection. - * - * @param string $database - * @return bool */ public function dropDatabase(string $database): bool; /** * Drop a given user on a specific connection. * - * @param string $username - * @param string $remote * @return mixed */ public function dropUser(string $username, string $remote): bool; diff --git a/app/Contracts/Repository/EggRepositoryInterface.php b/app/Contracts/Repository/EggRepositoryInterface.php index 0f6a88aa..733e70cf 100644 --- a/app/Contracts/Repository/EggRepositoryInterface.php +++ b/app/Contracts/Repository/EggRepositoryInterface.php @@ -17,17 +17,12 @@ interface EggRepositoryInterface extends RepositoryInterface /** * Return an egg with the variables relation attached. * - * @param int $id - * @return \Pterodactyl\Models\Egg - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function getWithVariables(int $id): Egg; /** * Return all eggs and their relations to be used in the daemon API. - * - * @return \Illuminate\Database\Eloquent\Collection */ public function getAllWithCopyAttributes(): Collection; @@ -35,27 +30,18 @@ interface EggRepositoryInterface extends RepositoryInterface * Return an egg with the scriptFrom and configFrom relations loaded onto the model. * * @param int|string $value - * @param string $column - * @return \Pterodactyl\Models\Egg */ public function getWithCopyAttributes($value, string $column = 'id'): Egg; /** * Return all of the data needed to export a service. * - * @param int $id - * @return \Pterodactyl\Models\Egg - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function getWithExportAttributes(int $id): Egg; /** * Confirm a copy script belongs to the same nest as the item trying to use it. - * - * @param int $copyFromId - * @param int $service - * @return bool */ public function isCopyableScript(int $copyFromId, int $service): bool; } diff --git a/app/Contracts/Repository/EggVariableRepositoryInterface.php b/app/Contracts/Repository/EggVariableRepositoryInterface.php index 77b46f96..6a00955d 100644 --- a/app/Contracts/Repository/EggVariableRepositoryInterface.php +++ b/app/Contracts/Repository/EggVariableRepositoryInterface.php @@ -16,9 +16,6 @@ interface EggVariableRepositoryInterface extends RepositoryInterface /** * Return editable variables for a given egg. Editable variables must be set to * user viewable in order to be picked up by this function. - * - * @param int $egg - * @return \Illuminate\Support\Collection */ public function getEditableVariables(int $egg): Collection; } diff --git a/app/Contracts/Repository/LocationRepositoryInterface.php b/app/Contracts/Repository/LocationRepositoryInterface.php index 76a952e4..d24cee5b 100644 --- a/app/Contracts/Repository/LocationRepositoryInterface.php +++ b/app/Contracts/Repository/LocationRepositoryInterface.php @@ -9,22 +9,17 @@ interface LocationRepositoryInterface extends RepositoryInterface { /** * Return locations with a count of nodes and servers attached to it. - * - * @return \Illuminate\Support\Collection */ public function getAllWithDetails(): Collection; /** * Return all of the available locations with the nodes as a relationship. - * - * @return \Illuminate\Support\Collection */ public function getAllWithNodes(): Collection; /** * Return all of the nodes and their respective count of servers for a location. * - * @param int $id * @return mixed * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -34,7 +29,6 @@ interface LocationRepositoryInterface extends RepositoryInterface /** * Return a location and the count of nodes in that location. * - * @param int $id * @return mixed * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException diff --git a/app/Contracts/Repository/NestRepositoryInterface.php b/app/Contracts/Repository/NestRepositoryInterface.php index e457262f..1f430dbf 100644 --- a/app/Contracts/Repository/NestRepositoryInterface.php +++ b/app/Contracts/Repository/NestRepositoryInterface.php @@ -17,6 +17,7 @@ interface NestRepositoryInterface extends RepositoryInterface * Return a nest or all nests with their associated eggs and variables. * * @param int $id + * * @return \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Nest * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -26,7 +27,6 @@ interface NestRepositoryInterface extends RepositoryInterface /** * Return a nest or all nests and the count of eggs and servers for that nest. * - * @param int|null $id * @return \Pterodactyl\Models\Nest|\Illuminate\Database\Eloquent\Collection * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -36,9 +36,6 @@ interface NestRepositoryInterface extends RepositoryInterface /** * Return a nest along with its associated eggs and the servers relation on those eggs. * - * @param int $id - * @return \Pterodactyl\Models\Nest - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function getWithEggServers(int $id): Nest; diff --git a/app/Contracts/Repository/NodeRepositoryInterface.php b/app/Contracts/Repository/NodeRepositoryInterface.php index fc6f1d89..87d5b4de 100644 --- a/app/Contracts/Repository/NodeRepositoryInterface.php +++ b/app/Contracts/Repository/NodeRepositoryInterface.php @@ -7,48 +7,32 @@ use Illuminate\Support\Collection; interface NodeRepositoryInterface extends RepositoryInterface { - const THRESHOLD_PERCENTAGE_LOW = 75; - const THRESHOLD_PERCENTAGE_MEDIUM = 90; + public const THRESHOLD_PERCENTAGE_LOW = 75; + public const THRESHOLD_PERCENTAGE_MEDIUM = 90; /** * Return the usage stats for a single node. - * - * @param \Pterodactyl\Models\Node $node - * @return array */ public function getUsageStats(Node $node): array; /** * Return the usage stats for a single node. - * - * @param \Pterodactyl\Models\Node $node - * @return array */ public function getUsageStatsRaw(Node $node): array; /** * Return a single node with location and server information. - * - * @param \Pterodactyl\Models\Node $node - * @param bool $refresh - * @return \Pterodactyl\Models\Node */ public function loadLocationAndServerCount(Node $node, bool $refresh = false): Node; /** * Attach a paginated set of allocations to a node mode including * any servers that are also attached to those allocations. - * - * @param \Pterodactyl\Models\Node $node - * @param bool $refresh - * @return \Pterodactyl\Models\Node */ public function loadNodeAllocations(Node $node, bool $refresh = false): Node; /** * Return a collection of nodes for all locations to use in server creation UI. - * - * @return \Illuminate\Support\Collection */ public function getNodesForServerCreation(): Collection; } diff --git a/app/Contracts/Repository/RepositoryInterface.php b/app/Contracts/Repository/RepositoryInterface.php index 5caaac90..e9350d5f 100644 --- a/app/Contracts/Repository/RepositoryInterface.php +++ b/app/Contracts/Repository/RepositoryInterface.php @@ -39,6 +39,7 @@ interface RepositoryInterface * An array of columns to filter the response by. * * @param array|string $columns + * * @return $this */ public function setColumns($columns = ['*']); @@ -62,7 +63,6 @@ interface RepositoryInterface * Set whether or not the repository should return a fresh model * when changes are committed. * - * @param bool $fresh * @return $this */ public function setFreshModel(bool $fresh = true); @@ -70,9 +70,6 @@ interface RepositoryInterface /** * Create a new model instance and persist it to the database. * - * @param array $fields - * @param bool $validate - * @param bool $force * @return mixed * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -82,7 +79,6 @@ interface RepositoryInterface /** * Find a model that has the specific ID passed. * - * @param int $id * @return mixed * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -91,16 +87,12 @@ interface RepositoryInterface /** * Find a model matching an array of where clauses. - * - * @param array $fields - * @return \Illuminate\Support\Collection */ public function findWhere(array $fields): Collection; /** * Find and return the first matching instance for the given fields. * - * @param array $fields * @return mixed * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -109,25 +101,16 @@ interface RepositoryInterface /** * Return a count of records matching the passed arguments. - * - * @param array $fields - * @return int */ public function findCountWhere(array $fields): int; /** * Delete a given record from the database. - * - * @param int $id - * @return int */ public function delete(int $id): int; /** * Delete records matching the given attributes. - * - * @param array $attributes - * @return int */ public function deleteWhere(array $attributes): int; @@ -135,9 +118,7 @@ interface RepositoryInterface * Update a given ID with the passed array of fields. * * @param int $id - * @param array $fields - * @param bool $validate - * @param bool $force + * * @return mixed * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -148,21 +129,12 @@ interface RepositoryInterface /** * Perform a mass update where matching records are updated using whereIn. * This does not perform any model data validation. - * - * @param string $column - * @param array $values - * @param array $fields - * @return int */ public function updateWhereIn(string $column, array $values, array $fields): int; /** * Update a record if it exists in the database, otherwise create it. * - * @param array $where - * @param array $fields - * @param bool $validate - * @param bool $force * @return mixed * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -171,40 +143,27 @@ interface RepositoryInterface /** * Return all records associated with the given model. - * - * @return Collection */ public function all(): Collection; /** * Return a paginated result set using a search term if set on the repository. - * - * @param int $perPage - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator */ public function paginated(int $perPage): LengthAwarePaginator; /** * Insert a single or multiple records into the database at once skipping * validation and mass assignment checking. - * - * @param array $data - * @return bool */ public function insert(array $data): bool; /** * Insert multiple records into the database and ignore duplicates. - * - * @param array $values - * @return bool */ public function insertIgnore(array $values): bool; /** * Get the amount of entries in the database. - * - * @return int */ public function count(): int; } diff --git a/app/Contracts/Repository/ScheduleRepositoryInterface.php b/app/Contracts/Repository/ScheduleRepositoryInterface.php index b6e73a2d..c7bb0ee2 100644 --- a/app/Contracts/Repository/ScheduleRepositoryInterface.php +++ b/app/Contracts/Repository/ScheduleRepositoryInterface.php @@ -9,18 +9,12 @@ interface ScheduleRepositoryInterface extends RepositoryInterface { /** * Return all of the schedules for a given server. - * - * @param int $server - * @return \Illuminate\Support\Collection */ public function findServerSchedules(int $server): Collection; /** * Return a schedule model with all of the associated tasks as a relationship. * - * @param int $schedule - * @return \Pterodactyl\Models\Schedule - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function getScheduleWithTasks(int $schedule): Schedule; diff --git a/app/Contracts/Repository/ServerRepositoryInterface.php b/app/Contracts/Repository/ServerRepositoryInterface.php index 55cf79a3..323e1cd3 100644 --- a/app/Contracts/Repository/ServerRepositoryInterface.php +++ b/app/Contracts/Repository/ServerRepositoryInterface.php @@ -10,37 +10,22 @@ interface ServerRepositoryInterface extends RepositoryInterface { /** * Load the egg relations onto the server model. - * - * @param \Pterodactyl\Models\Server $server - * @param bool $refresh - * @return \Pterodactyl\Models\Server */ public function loadEggRelations(Server $server, bool $refresh = false): Server; /** * Return a collection of servers with their associated data for rebuild operations. - * - * @param int|null $server - * @param int|null $node - * @return \Illuminate\Support\Collection */ public function getDataForRebuild(int $server = null, int $node = null): Collection; /** * Return a collection of servers with their associated data for reinstall operations. - * - * @param int|null $server - * @param int|null $node - * @return \Illuminate\Support\Collection */ public function getDataForReinstall(int $server = null, int $node = null): Collection; /** * Return a server model and all variables associated with the server. * - * @param int $id - * @return \Pterodactyl\Models\Server - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function findWithVariables(int $id): Server; @@ -49,28 +34,16 @@ interface ServerRepositoryInterface extends RepositoryInterface * Get the primary allocation for a given server. If a model is passed into * the function, load the allocation relationship onto it. Otherwise, find and * return the server from the database. - * - * @param \Pterodactyl\Models\Server $server - * @param bool $refresh - * @return \Pterodactyl\Models\Server */ public function getPrimaryAllocation(Server $server, bool $refresh = false): Server; /** * Return enough data to be used for the creation of a server via the daemon. - * - * @param \Pterodactyl\Models\Server $server - * @param bool $refresh - * @return \Pterodactyl\Models\Server */ public function getDataForCreation(Server $server, bool $refresh = false): Server; /** * Load associated databases onto the server model. - * - * @param \Pterodactyl\Models\Server $server - * @param bool $refresh - * @return \Pterodactyl\Models\Server */ public function loadDatabaseRelations(Server $server, bool $refresh = false): Server; @@ -78,46 +51,28 @@ interface ServerRepositoryInterface extends RepositoryInterface * Get data for use when updating a server on the Daemon. Returns an array of * the egg which is used for build and rebuild. Only loads relations * if they are missing, or refresh is set to true. - * - * @param \Pterodactyl\Models\Server $server - * @param bool $refresh - * @return array */ public function getDaemonServiceData(Server $server, bool $refresh = false): array; /** * Return a server by UUID. * - * @param string $uuid - * @return \Pterodactyl\Models\Server - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function getByUuid(string $uuid): Server; /** * Check if a given UUID and UUID-Short string are unique to a server. - * - * @param string $uuid - * @param string $short - * @return bool */ public function isUniqueUuidCombo(string $uuid, string $short): bool; /** * Get the amount of servers that are suspended. - * - * @return int */ public function getSuspendedServersCount(): int; /** * Returns all of the servers that exist for a given node in a paginated response. - * - * @param int $node - * @param int $limit - * - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator */ public function loadAllServersForNode(int $node, int $limit): LengthAwarePaginator; } diff --git a/app/Contracts/Repository/SessionRepositoryInterface.php b/app/Contracts/Repository/SessionRepositoryInterface.php index e1dafed1..305752fb 100644 --- a/app/Contracts/Repository/SessionRepositoryInterface.php +++ b/app/Contracts/Repository/SessionRepositoryInterface.php @@ -8,17 +8,12 @@ interface SessionRepositoryInterface extends RepositoryInterface { /** * Return all of the active sessions for a user. - * - * @param int $user - * @return \Illuminate\Support\Collection */ public function getUserSessions(int $user): Collection; /** * Delete a session for a given user. * - * @param int $user - * @param string $session * @return int|null */ public function deleteUserSession(int $user, string $session); diff --git a/app/Contracts/Repository/SettingsRepositoryInterface.php b/app/Contracts/Repository/SettingsRepositoryInterface.php index 6c4db9dc..e5b2bb77 100644 --- a/app/Contracts/Repository/SettingsRepositoryInterface.php +++ b/app/Contracts/Repository/SettingsRepositoryInterface.php @@ -7,9 +7,6 @@ interface SettingsRepositoryInterface extends RepositoryInterface /** * Store a new persistent setting in the database. * - * @param string $key - * @param string|null $value - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -18,16 +15,14 @@ interface SettingsRepositoryInterface extends RepositoryInterface /** * Retrieve a persistent setting from the database. * - * @param string $key * @param mixed $default + * * @return mixed */ public function get(string $key, $default); /** * Remove a key from the database cache. - * - * @param string $key */ public function forget(string $key); } diff --git a/app/Contracts/Repository/SubuserRepositoryInterface.php b/app/Contracts/Repository/SubuserRepositoryInterface.php index 6babbfcc..1379e120 100644 --- a/app/Contracts/Repository/SubuserRepositoryInterface.php +++ b/app/Contracts/Repository/SubuserRepositoryInterface.php @@ -8,29 +8,17 @@ interface SubuserRepositoryInterface extends RepositoryInterface { /** * Return a subuser with the associated server relationship. - * - * @param \Pterodactyl\Models\Subuser $subuser - * @param bool $refresh - * @return \Pterodactyl\Models\Subuser */ public function loadServerAndUserRelations(Subuser $subuser, bool $refresh = false): Subuser; /** * Return a subuser with the associated permissions relationship. - * - * @param \Pterodactyl\Models\Subuser $subuser - * @param bool $refresh - * @return \Pterodactyl\Models\Subuser */ public function getWithPermissions(Subuser $subuser, bool $refresh = false): Subuser; /** * Return a subuser and associated permissions given a user_id and server_id. * - * @param int $user - * @param int $server - * @return \Pterodactyl\Models\Subuser - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function getWithPermissionsUsingUserAndServer(int $user, int $server): Subuser; diff --git a/app/Contracts/Repository/TaskRepositoryInterface.php b/app/Contracts/Repository/TaskRepositoryInterface.php index ea948625..18811ba5 100644 --- a/app/Contracts/Repository/TaskRepositoryInterface.php +++ b/app/Contracts/Repository/TaskRepositoryInterface.php @@ -9,9 +9,6 @@ interface TaskRepositoryInterface extends RepositoryInterface /** * Get a task and the server relationship for that task. * - * @param int $id - * @return \Pterodactyl\Models\Task - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function getTaskForJobProcess(int $id): Task; @@ -19,8 +16,6 @@ interface TaskRepositoryInterface extends RepositoryInterface /** * Returns the next task in a schedule. * - * @param int $schedule - * @param int $index * @return \Pterodactyl\Models\Task|null */ public function getNextTask(int $schedule, int $index); diff --git a/app/Events/Server/Created.php b/app/Events/Server/Created.php index 8ca54700..8963b3cb 100644 --- a/app/Events/Server/Created.php +++ b/app/Events/Server/Created.php @@ -25,8 +25,6 @@ class Created /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Server $server */ public function __construct(Server $server) { diff --git a/app/Events/Server/Creating.php b/app/Events/Server/Creating.php index 318156b6..457f586e 100644 --- a/app/Events/Server/Creating.php +++ b/app/Events/Server/Creating.php @@ -25,8 +25,6 @@ class Creating /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Server $server */ public function __construct(Server $server) { diff --git a/app/Events/Server/Deleted.php b/app/Events/Server/Deleted.php index 258ac75b..c9f69cab 100644 --- a/app/Events/Server/Deleted.php +++ b/app/Events/Server/Deleted.php @@ -25,8 +25,6 @@ class Deleted /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Server $server */ public function __construct(Server $server) { diff --git a/app/Events/Server/Deleting.php b/app/Events/Server/Deleting.php index 49219afc..e411e2a7 100644 --- a/app/Events/Server/Deleting.php +++ b/app/Events/Server/Deleting.php @@ -25,8 +25,6 @@ class Deleting /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Server $server */ public function __construct(Server $server) { diff --git a/app/Events/Server/Saved.php b/app/Events/Server/Saved.php index 4b8ae216..c6dc024c 100644 --- a/app/Events/Server/Saved.php +++ b/app/Events/Server/Saved.php @@ -25,8 +25,6 @@ class Saved /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Server $server */ public function __construct(Server $server) { diff --git a/app/Events/Server/Saving.php b/app/Events/Server/Saving.php index 9bb8153f..9e80d626 100644 --- a/app/Events/Server/Saving.php +++ b/app/Events/Server/Saving.php @@ -25,8 +25,6 @@ class Saving /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Server $server */ public function __construct(Server $server) { diff --git a/app/Events/Server/Updated.php b/app/Events/Server/Updated.php index 7157d4b3..b813b099 100644 --- a/app/Events/Server/Updated.php +++ b/app/Events/Server/Updated.php @@ -25,8 +25,6 @@ class Updated /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Server $server */ public function __construct(Server $server) { diff --git a/app/Events/Server/Updating.php b/app/Events/Server/Updating.php index c91c8a12..4c8ead09 100644 --- a/app/Events/Server/Updating.php +++ b/app/Events/Server/Updating.php @@ -25,8 +25,6 @@ class Updating /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Server $server */ public function __construct(Server $server) { diff --git a/app/Events/Subuser/Created.php b/app/Events/Subuser/Created.php index 63941b2a..2467fe99 100644 --- a/app/Events/Subuser/Created.php +++ b/app/Events/Subuser/Created.php @@ -25,8 +25,6 @@ class Created /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Subuser $subuser */ public function __construct(Subuser $subuser) { diff --git a/app/Events/Subuser/Creating.php b/app/Events/Subuser/Creating.php index 5d6f6d80..03aa5f7f 100644 --- a/app/Events/Subuser/Creating.php +++ b/app/Events/Subuser/Creating.php @@ -25,8 +25,6 @@ class Creating /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Subuser $subuser */ public function __construct(Subuser $subuser) { diff --git a/app/Events/Subuser/Deleted.php b/app/Events/Subuser/Deleted.php index ee53388b..0e9744c3 100644 --- a/app/Events/Subuser/Deleted.php +++ b/app/Events/Subuser/Deleted.php @@ -25,8 +25,6 @@ class Deleted /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Subuser $subuser */ public function __construct(Subuser $subuser) { diff --git a/app/Events/Subuser/Deleting.php b/app/Events/Subuser/Deleting.php index 6d25a3eb..9d1e12c2 100644 --- a/app/Events/Subuser/Deleting.php +++ b/app/Events/Subuser/Deleting.php @@ -25,8 +25,6 @@ class Deleting /** * Create a new event instance. - * - * @param \Pterodactyl\Models\Subuser $subuser */ public function __construct(Subuser $subuser) { diff --git a/app/Events/User/Created.php b/app/Events/User/Created.php index b66d531d..72eba811 100644 --- a/app/Events/User/Created.php +++ b/app/Events/User/Created.php @@ -25,8 +25,6 @@ class Created /** * Create a new event instance. - * - * @param \Pterodactyl\Models\User $user */ public function __construct(User $user) { diff --git a/app/Events/User/Creating.php b/app/Events/User/Creating.php index d6297440..7948d706 100644 --- a/app/Events/User/Creating.php +++ b/app/Events/User/Creating.php @@ -25,8 +25,6 @@ class Creating /** * Create a new event instance. - * - * @param \Pterodactyl\Models\User $user */ public function __construct(User $user) { diff --git a/app/Events/User/Deleted.php b/app/Events/User/Deleted.php index 1b1682ef..48b52487 100644 --- a/app/Events/User/Deleted.php +++ b/app/Events/User/Deleted.php @@ -25,8 +25,6 @@ class Deleted /** * Create a new event instance. - * - * @param \Pterodactyl\Models\User $user */ public function __construct(User $user) { diff --git a/app/Events/User/Deleting.php b/app/Events/User/Deleting.php index 05e3ba25..a386bd95 100644 --- a/app/Events/User/Deleting.php +++ b/app/Events/User/Deleting.php @@ -25,8 +25,6 @@ class Deleting /** * Create a new event instance. - * - * @param \Pterodactyl\Models\User $user */ public function __construct(User $user) { diff --git a/app/Exceptions/DisplayException.php b/app/Exceptions/DisplayException.php index 94a92005..f3120471 100644 --- a/app/Exceptions/DisplayException.php +++ b/app/Exceptions/DisplayException.php @@ -11,10 +11,10 @@ use Prologue\Alerts\AlertsMessageBag; class DisplayException extends PterodactylException { - const LEVEL_DEBUG = 'debug'; - const LEVEL_INFO = 'info'; - const LEVEL_WARNING = 'warning'; - const LEVEL_ERROR = 'error'; + public const LEVEL_DEBUG = 'debug'; + public const LEVEL_INFO = 'info'; + public const LEVEL_WARNING = 'warning'; + public const LEVEL_ERROR = 'error'; /** * @var string @@ -25,9 +25,8 @@ class DisplayException extends PterodactylException * Exception constructor. * * @param string $message - * @param Throwable|null $previous * @param string $level - * @param int $code + * @param int $code */ public function __construct($message, Throwable $previous = null, $level = self::LEVEL_ERROR, $code = 0) { @@ -58,6 +57,7 @@ class DisplayException extends PterodactylException * request originated from an API hit, return the error in JSONAPI spec format. * * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse */ public function render($request) @@ -83,7 +83,7 @@ class DisplayException extends PterodactylException */ public function report() { - if (! $this->getPrevious() instanceof Exception || ! Handler::isReportable($this->getPrevious())) { + if (!$this->getPrevious() instanceof Exception || !Handler::isReportable($this->getPrevious())) { return null; } diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index f80b9b26..a94ad8aa 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -112,7 +112,7 @@ class Handler extends ExceptionHandler * Render an exception into an HTTP response. * * @param \Illuminate\Http\Request $request - * @param \Throwable $exception + * * @return \Symfony\Component\HttpFoundation\Response * * @throws \Throwable @@ -142,7 +142,7 @@ class Handler extends ExceptionHandler * calls to the API. * * @param \Illuminate\Http\Request $request - * @param \Illuminate\Validation\ValidationException $exception + * * @return \Illuminate\Http\JsonResponse */ public function invalidJson($request, ValidationException $exception) @@ -162,7 +162,8 @@ class Handler extends ExceptionHandler $meta = [ 'source_field' => $field, 'rule' => str_replace(self::PTERODACTYL_RULE_STRING, 'p_', Arr::get( - $codes, str_replace('.', '_', $field) . '.' . $key + $codes, + str_replace('.', '_', $field) . '.' . $key )), ]; @@ -183,10 +184,6 @@ class Handler extends ExceptionHandler /** * Return the exception as a JSONAPI representation for use on API requests. - * - * @param \Throwable $exception - * @param array $override - * @return array */ public static function convertToArray(Throwable $exception, array $override = []): array { @@ -225,9 +222,6 @@ class Handler extends ExceptionHandler /** * Return an array of exceptions that should not be reported. - * - * @param \Exception $exception - * @return bool */ public static function isReportable(Exception $exception): bool { @@ -238,7 +232,7 @@ class Handler extends ExceptionHandler * Convert an authentication exception into an unauthenticated response. * * @param \Illuminate\Http\Request $request - * @param \Illuminate\Auth\AuthenticationException $exception + * * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse */ protected function unauthenticated($request, AuthenticationException $exception) @@ -254,7 +248,6 @@ class Handler extends ExceptionHandler * Converts an exception into an array to render in the response. Overrides * Laravel's built-in converter to output as a JSONAPI spec compliant object. * - * @param \Throwable $exception * @return array */ protected function convertExceptionToArray(Throwable $exception) diff --git a/app/Exceptions/Http/Connection/DaemonConnectionException.php b/app/Exceptions/Http/Connection/DaemonConnectionException.php index b8b35ac1..94778c03 100644 --- a/app/Exceptions/Http/Connection/DaemonConnectionException.php +++ b/app/Exceptions/Http/Connection/DaemonConnectionException.php @@ -19,9 +19,6 @@ class DaemonConnectionException extends DisplayException /** * Throw a displayable exception caused by a daemon connection error. - * - * @param \GuzzleHttp\Exception\GuzzleException $previous - * @param bool $useStatusCode */ public function __construct(GuzzleException $previous, bool $useStatusCode = true) { @@ -38,7 +35,7 @@ class DaemonConnectionException extends DisplayException // Attempt to pull the actual error message off the response and return that if it is not // a 500 level error. - if ($this->statusCode < 500 && ! is_null($response)) { + if ($this->statusCode < 500 && !is_null($response)) { $body = $response->getBody(); if (is_string($body) || (is_object($body) && method_exists($body, '__toString'))) { $body = json_decode(is_string($body) ? $body : $body->__toString(), true); diff --git a/app/Exceptions/Http/HttpForbiddenException.php b/app/Exceptions/Http/HttpForbiddenException.php index fa2aae9b..1488265a 100644 --- a/app/Exceptions/Http/HttpForbiddenException.php +++ b/app/Exceptions/Http/HttpForbiddenException.php @@ -9,9 +9,6 @@ class HttpForbiddenException extends HttpException { /** * HttpForbiddenException constructor. - * - * @param string|null $message - * @param \Throwable|null $previous */ public function __construct(string $message = null, \Throwable $previous = null) { diff --git a/app/Exceptions/Http/TwoFactorAuthRequiredException.php b/app/Exceptions/Http/TwoFactorAuthRequiredException.php index 23a581f7..cecb6462 100644 --- a/app/Exceptions/Http/TwoFactorAuthRequiredException.php +++ b/app/Exceptions/Http/TwoFactorAuthRequiredException.php @@ -11,8 +11,6 @@ class TwoFactorAuthRequiredException extends HttpException implements HttpExcept { /** * TwoFactorAuthRequiredException constructor. - * - * @param \Throwable|null $previous */ public function __construct(Throwable $previous = null) { diff --git a/app/Exceptions/Model/DataValidationException.php b/app/Exceptions/Model/DataValidationException.php index 5840e6d9..1118081e 100644 --- a/app/Exceptions/Model/DataValidationException.php +++ b/app/Exceptions/Model/DataValidationException.php @@ -18,8 +18,6 @@ class DataValidationException extends PterodactylException implements HttpExcept /** * DataValidationException constructor. - * - * @param \Illuminate\Contracts\Validation\Validator $validator */ public function __construct(Validator $validator) { diff --git a/app/Exceptions/Service/Backup/TooManyBackupsException.php b/app/Exceptions/Service/Backup/TooManyBackupsException.php index a96baed5..8ccbaf76 100644 --- a/app/Exceptions/Service/Backup/TooManyBackupsException.php +++ b/app/Exceptions/Service/Backup/TooManyBackupsException.php @@ -8,8 +8,6 @@ class TooManyBackupsException extends DisplayException { /** * TooManyBackupsException constructor. - * - * @param int $backupLimit */ public function __construct(int $backupLimit) { diff --git a/app/Exceptions/Service/ServiceLimitExceededException.php b/app/Exceptions/Service/ServiceLimitExceededException.php index 55ee6c94..7236034f 100644 --- a/app/Exceptions/Service/ServiceLimitExceededException.php +++ b/app/Exceptions/Service/ServiceLimitExceededException.php @@ -10,9 +10,6 @@ class ServiceLimitExceededException extends DisplayException /** * Exception thrown when something goes over a defined limit, such as allocated * ports, tasks, databases, etc. - * - * @param string $message - * @param \Throwable|null $previous */ public function __construct(string $message, Throwable $previous = null) { diff --git a/app/Extensions/Backups/BackupManager.php b/app/Extensions/Backups/BackupManager.php index e812e0d6..80515848 100644 --- a/app/Extensions/Backups/BackupManager.php +++ b/app/Extensions/Backups/BackupManager.php @@ -42,8 +42,6 @@ class BackupManager /** * BackupManager constructor. - * - * @param \Illuminate\Foundation\Application $app */ public function __construct(Application $app) { @@ -54,7 +52,6 @@ class BackupManager /** * Returns a backup adapter instance. * - * @param string|null $name * @return \League\Flysystem\AdapterInterface */ public function adapter(string $name = null) @@ -65,8 +62,8 @@ class BackupManager /** * Set the given backup adapter instance. * - * @param string $name * @param \League\Flysystem\AdapterInterface $disk + * * @return $this */ public function set(string $name, $disk) @@ -79,7 +76,6 @@ class BackupManager /** * Gets a backup adapter. * - * @param string $name * @return \League\Flysystem\AdapterInterface */ protected function get(string $name) @@ -90,7 +86,6 @@ class BackupManager /** * Resolve the given backup disk. * - * @param string $name * @return \League\Flysystem\AdapterInterface */ protected function resolve(string $name) @@ -98,9 +93,7 @@ class BackupManager $config = $this->getConfig($name); if (empty($config['adapter'])) { - throw new InvalidArgumentException( - "Backup disk [{$name}] does not have a configured adapter." - ); + throw new InvalidArgumentException("Backup disk [{$name}] does not have a configured adapter."); } $adapter = $config['adapter']; @@ -124,7 +117,6 @@ class BackupManager /** * Calls a custom creator for a given adapter type. * - * @param array $config * @return \League\Flysystem\AdapterInterface */ protected function callCustomCreator(array $config) @@ -139,7 +131,6 @@ class BackupManager /** * Creates a new wings adapter. * - * @param array $config * @return \League\Flysystem\AdapterInterface */ public function createWingsAdapter(array $config) @@ -150,14 +141,13 @@ class BackupManager /** * Creates a new S3 adapter. * - * @param array $config * @return \League\Flysystem\AdapterInterface */ public function createS3Adapter(array $config) { $config['version'] = 'latest'; - if (! empty($config['key']) && ! empty($config['secret'])) { + if (!empty($config['key']) && !empty($config['secret'])) { $config['credentials'] = Arr::only($config, ['key', 'secret', 'token']); } @@ -169,7 +159,6 @@ class BackupManager /** * Returns the configuration associated with a given backup type. * - * @param string $name * @return array */ protected function getConfig(string $name) @@ -189,8 +178,6 @@ class BackupManager /** * Set the default session driver name. - * - * @param string $name */ public function setDefaultAdapter(string $name) { @@ -201,6 +188,7 @@ class BackupManager * Unset the given adapter instances. * * @param string|string[] $adapter + * * @return $this */ public function forget($adapter) @@ -215,8 +203,6 @@ class BackupManager /** * Register a custom adapter creator closure. * - * @param string $adapter - * @param \Closure $callback * @return $this */ public function extend(string $adapter, Closure $callback) diff --git a/app/Extensions/DynamicDatabaseConnection.php b/app/Extensions/DynamicDatabaseConnection.php index f31a92b1..e45243e5 100644 --- a/app/Extensions/DynamicDatabaseConnection.php +++ b/app/Extensions/DynamicDatabaseConnection.php @@ -16,9 +16,9 @@ use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface; class DynamicDatabaseConnection { - const DB_CHARSET = 'utf8'; - const DB_COLLATION = 'utf8_unicode_ci'; - const DB_DRIVER = 'mysql'; + public const DB_CHARSET = 'utf8'; + public const DB_COLLATION = 'utf8_unicode_ci'; + public const DB_DRIVER = 'mysql'; /** * @var \Illuminate\Config\Repository @@ -37,10 +37,6 @@ class DynamicDatabaseConnection /** * DynamicDatabaseConnection constructor. - * - * @param \Illuminate\Config\Repository $config - * @param \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface $repository - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter */ public function __construct( ConfigRepository $config, @@ -55,15 +51,15 @@ class DynamicDatabaseConnection /** * Adds a dynamic database connection entry to the runtime config. * - * @param string $connection + * @param string $connection * @param \Pterodactyl\Models\DatabaseHost|int $host - * @param string $database + * @param string $database * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function set($connection, $host, $database = 'mysql') { - if (! $host instanceof DatabaseHost) { + if (!$host instanceof DatabaseHost) { $host = $this->repository->find($host); } diff --git a/app/Extensions/Hashids.php b/app/Extensions/Hashids.php index 60e5d956..ab07fc86 100644 --- a/app/Extensions/Hashids.php +++ b/app/Extensions/Hashids.php @@ -20,7 +20,7 @@ class Hashids extends VendorHashids implements HashidsInterface public function decodeFirst($encoded, $default = null) { $result = $this->decode($encoded); - if (! is_array($result)) { + if (!is_array($result)) { return $default; } diff --git a/app/Extensions/Lcobucci/JWT/Encoding/TimestampDates.php b/app/Extensions/Lcobucci/JWT/Encoding/TimestampDates.php index 69c18dd5..e13133c3 100644 --- a/app/Extensions/Lcobucci/JWT/Encoding/TimestampDates.php +++ b/app/Extensions/Lcobucci/JWT/Encoding/TimestampDates.php @@ -13,14 +13,11 @@ final class TimestampDates implements ClaimsFormatter * by Wings and will cause a flood of errors and panic conditions because the times * cannot be parsed correctly. The default is time with microseconds, we just need * to use the normal unix timestamp here. - * - * @param array $claims - * @return array */ public function formatClaims(array $claims): array { foreach (RegisteredClaims::DATE_CLAIMS as $claim) { - if (! array_key_exists($claim, $claims)) { + if (!array_key_exists($claim, $claims)) { continue; } diff --git a/app/Extensions/League/Fractal/Serializers/PterodactylSerializer.php b/app/Extensions/League/Fractal/Serializers/PterodactylSerializer.php index 4a76d8ff..2481cf96 100644 --- a/app/Extensions/League/Fractal/Serializers/PterodactylSerializer.php +++ b/app/Extensions/League/Fractal/Serializers/PterodactylSerializer.php @@ -10,7 +10,7 @@ class PterodactylSerializer extends ArraySerializer * Serialize an item. * * @param string $resourceKey - * @param array $data + * * @return array */ public function item($resourceKey, array $data) @@ -25,7 +25,7 @@ class PterodactylSerializer extends ArraySerializer * Serialize a collection. * * @param string $resourceKey - * @param array $data + * * @return array */ public function collection($resourceKey, array $data) @@ -59,6 +59,7 @@ class PterodactylSerializer extends ArraySerializer * * @param array $transformedData * @param array $includedData + * * @return array */ public function mergeIncludes($transformedData, $includedData) diff --git a/app/Extensions/Spatie/Fractalistic/Fractal.php b/app/Extensions/Spatie/Fractalistic/Fractal.php index 5bb0dd52..b9c651d3 100644 --- a/app/Extensions/Spatie/Fractalistic/Fractal.php +++ b/app/Extensions/Spatie/Fractalistic/Fractal.php @@ -22,7 +22,7 @@ class Fractal extends SpatieFractal { // Set the serializer by default. if (is_null($this->serializer)) { - $this->serializer = new PterodactylSerializer; + $this->serializer = new PterodactylSerializer(); } // Automatically set the paginator on the response object if the diff --git a/app/Helpers/Time.php b/app/Helpers/Time.php index 248ff55f..fd9a265a 100644 --- a/app/Helpers/Time.php +++ b/app/Helpers/Time.php @@ -12,9 +12,6 @@ final class Time * for named timezones in MySQL. * * Returns the timezone as a string like +08:00 or -05:00 depending on the app timezone. - * - * @param string $timezone - * @return string */ public static function getMySQLTimezoneOffset(string $timezone): string { diff --git a/app/Helpers/Utilities.php b/app/Helpers/Utilities.php index 6e8e9223..b48e9f09 100644 --- a/app/Helpers/Utilities.php +++ b/app/Helpers/Utilities.php @@ -13,9 +13,6 @@ class Utilities /** * Generates a random string and injects special characters into it, in addition to * the randomness of the alpha-numeric default response. - * - * @param int $length - * @return string */ public static function randomStringWithSpecialCharacters(int $length = 16): string { @@ -23,7 +20,7 @@ class Utilities // Given a random string of characters, randomly loop through the characters and replace some // with special characters to avoid issues with MySQL password requirements on some servers. try { - for ($i = 0; $i < random_int(2, 6); $i++) { + for ($i = 0; $i < random_int(2, 6); ++$i) { $character = ['!', '@', '=', '.', '+', '^'][random_int(0, 5)]; $string = substr_replace($string, $character, random_int(0, $length - 1), 1); @@ -39,11 +36,6 @@ class Utilities /** * Converts schedule cron data into a carbon object. * - * @param string $minute - * @param string $hour - * @param string $dayOfMonth - * @param string $month - * @param string $dayOfWeek * @return \Carbon\Carbon */ public static function getScheduleNextRunDate(string $minute, string $hour, string $dayOfMonth, string $month, string $dayOfWeek) @@ -54,8 +46,8 @@ class Utilities } /** - * @param string $name * @param mixed $default + * * @return string */ public static function checked(string $name, $default) diff --git a/app/Http/Controllers/Admin/ApiController.php b/app/Http/Controllers/Admin/ApiController.php index 6067b423..ef9c8635 100644 --- a/app/Http/Controllers/Admin/ApiController.php +++ b/app/Http/Controllers/Admin/ApiController.php @@ -33,10 +33,6 @@ class ApiController extends Controller /** * ApplicationApiController constructor. - * - * @param \Prologue\Alerts\AlertsMessageBag $alert - * @param \Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface $repository - * @param \Pterodactyl\Services\Api\KeyCreationService $keyCreationService */ public function __construct( AlertsMessageBag $alert, @@ -50,9 +46,6 @@ class ApiController extends Controller /** * Render view showing all of a user's application API keys. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\View\View */ public function index(Request $request): View { @@ -64,7 +57,6 @@ class ApiController extends Controller /** * Render view allowing an admin to create a new application API key. * - * @return \Illuminate\View\View * @throws \ReflectionException */ public function create(): View @@ -85,9 +77,6 @@ class ApiController extends Controller /** * Store the new key and redirect the user back to the application key listing. * - * @param \Pterodactyl\Http\Requests\Admin\Api\StoreApplicationApiKeyRequest $request - * @return \Illuminate\Http\RedirectResponse - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ public function store(StoreApplicationApiKeyRequest $request): RedirectResponse @@ -104,10 +93,6 @@ class ApiController extends Controller /** * Delete an application API key from the database. - * - * @param \Illuminate\Http\Request $request - * @param string $identifier - * @return \Illuminate\Http\Response */ public function delete(Request $request, string $identifier): Response { diff --git a/app/Http/Controllers/Admin/BaseController.php b/app/Http/Controllers/Admin/BaseController.php index b80676f2..68e923ad 100644 --- a/app/Http/Controllers/Admin/BaseController.php +++ b/app/Http/Controllers/Admin/BaseController.php @@ -15,8 +15,6 @@ class BaseController extends Controller /** * BaseController constructor. - * - * @param \Pterodactyl\Services\Helpers\SoftwareVersionService $version */ public function __construct(SoftwareVersionService $version) { @@ -25,8 +23,6 @@ class BaseController extends Controller /** * Return the admin index view. - * - * @return \Illuminate\View\View */ public function index(): View { diff --git a/app/Http/Controllers/Admin/DatabaseController.php b/app/Http/Controllers/Admin/DatabaseController.php index 0aee8680..9e6cc000 100644 --- a/app/Http/Controllers/Admin/DatabaseController.php +++ b/app/Http/Controllers/Admin/DatabaseController.php @@ -56,14 +56,6 @@ class DatabaseController extends Controller /** * DatabaseController constructor. - * - * @param \Prologue\Alerts\AlertsMessageBag $alert - * @param \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface $repository - * @param \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface $databaseRepository - * @param \Pterodactyl\Services\Databases\Hosts\HostCreationService $creationService - * @param \Pterodactyl\Services\Databases\Hosts\HostDeletionService $deletionService - * @param \Pterodactyl\Services\Databases\Hosts\HostUpdateService $updateService - * @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $locationRepository */ public function __construct( AlertsMessageBag $alert, @@ -85,8 +77,6 @@ class DatabaseController extends Controller /** * Display database host index. - * - * @return \Illuminate\View\View */ public function index(): View { @@ -99,9 +89,6 @@ class DatabaseController extends Controller /** * Display database host to user. * - * @param int $host - * @return \Illuminate\View\View - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function view(int $host): View @@ -116,9 +103,6 @@ class DatabaseController extends Controller /** * Handle request to create a new database host. * - * @param \Pterodactyl\Http\Requests\Admin\DatabaseHostFormRequest $request - * @return \Illuminate\Http\RedirectResponse - * * @throws \Throwable */ public function create(DatabaseHostFormRequest $request): RedirectResponse @@ -145,10 +129,6 @@ class DatabaseController extends Controller /** * Handle updating database host. * - * @param \Pterodactyl\Http\Requests\Admin\DatabaseHostFormRequest $request - * @param \Pterodactyl\Models\DatabaseHost $host - * @return \Illuminate\Http\RedirectResponse - * * @throws \Throwable */ public function update(DatabaseHostFormRequest $request, DatabaseHost $host): RedirectResponse @@ -178,9 +158,6 @@ class DatabaseController extends Controller /** * Handle request to delete a database host. * - * @param int $host - * @return \Illuminate\Http\RedirectResponse - * * @throws \Pterodactyl\Exceptions\Service\HasActiveServersException */ public function delete(int $host): RedirectResponse diff --git a/app/Http/Controllers/Admin/LocationController.php b/app/Http/Controllers/Admin/LocationController.php index 286d15cf..195977f2 100644 --- a/app/Http/Controllers/Admin/LocationController.php +++ b/app/Http/Controllers/Admin/LocationController.php @@ -48,12 +48,6 @@ class LocationController extends Controller /** * LocationController constructor. - * - * @param \Prologue\Alerts\AlertsMessageBag $alert - * @param \Pterodactyl\Services\Locations\LocationCreationService $creationService - * @param \Pterodactyl\Services\Locations\LocationDeletionService $deletionService - * @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $repository - * @param \Pterodactyl\Services\Locations\LocationUpdateService $updateService */ public function __construct( AlertsMessageBag $alert, @@ -85,6 +79,7 @@ class LocationController extends Controller * Return the location view page. * * @param int $id + * * @return \Illuminate\View\View * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -99,7 +94,6 @@ class LocationController extends Controller /** * Handle request to create new location. * - * @param \Pterodactyl\Http\Requests\Admin\LocationFormRequest $request * @return \Illuminate\Http\RedirectResponse * * @throws \Throwable @@ -115,8 +109,6 @@ class LocationController extends Controller /** * Handle request to update or delete location. * - * @param \Pterodactyl\Http\Requests\Admin\LocationFormRequest $request - * @param \Pterodactyl\Models\Location $location * @return \Illuminate\Http\RedirectResponse * * @throws \Throwable @@ -136,7 +128,6 @@ class LocationController extends Controller /** * Delete a location from the system. * - * @param \Pterodactyl\Models\Location $location * @return \Illuminate\Http\RedirectResponse * * @throws \Exception diff --git a/app/Http/Controllers/Admin/MountController.php b/app/Http/Controllers/Admin/MountController.php index 506c2b0d..811abfba 100644 --- a/app/Http/Controllers/Admin/MountController.php +++ b/app/Http/Controllers/Admin/MountController.php @@ -38,11 +38,6 @@ class MountController extends Controller /** * MountController constructor. - * - * @param \Prologue\Alerts\AlertsMessageBag $alert - * @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $nestRepository - * @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $locationRepository - * @param \Pterodactyl\Repositories\Eloquent\MountRepository $repository */ public function __construct( AlertsMessageBag $alert, @@ -72,6 +67,7 @@ class MountController extends Controller * Return the mount view page. * * @param string $id + * * @return \Illuminate\View\View * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -91,7 +87,6 @@ class MountController extends Controller /** * Handle request to create new mount. * - * @param \Pterodactyl\Http\Requests\Admin\MountFormRequest $request * @return \Illuminate\Http\RedirectResponse * * @throws \Throwable @@ -112,8 +107,6 @@ class MountController extends Controller /** * Handle request to update or delete location. * - * @param \Pterodactyl\Http\Requests\Admin\MountFormRequest $request - * @param \Pterodactyl\Models\Mount $mount * @return \Illuminate\Http\RedirectResponse * * @throws \Throwable @@ -134,7 +127,6 @@ class MountController extends Controller /** * Delete a location from the system. * - * @param \Pterodactyl\Models\Mount $mount * @return \Illuminate\Http\RedirectResponse * * @throws \Exception @@ -149,8 +141,6 @@ class MountController extends Controller /** * Adds eggs to the mount's many to many relation. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Mount $mount * @return \Illuminate\Http\RedirectResponse */ public function addEggs(Request $request, Mount $mount) @@ -172,8 +162,6 @@ class MountController extends Controller /** * Adds nodes to the mount's many to many relation. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Mount $mount * @return \Illuminate\Http\RedirectResponse */ public function addNodes(Request $request, Mount $mount) @@ -193,8 +181,6 @@ class MountController extends Controller /** * Deletes an egg from the mount's many to many relation. * - * @param \Pterodactyl\Models\Mount $mount - * @param int $egg_id * @return \Illuminate\Http\Response */ public function deleteEgg(Mount $mount, int $egg_id) @@ -207,8 +193,6 @@ class MountController extends Controller /** * Deletes an node from the mount's many to many relation. * - * @param \Pterodactyl\Models\Mount $mount - * @param int $node_id * @return \Illuminate\Http\Response */ public function deleteNode(Mount $mount, int $node_id) diff --git a/app/Http/Controllers/Admin/Nests/EggController.php b/app/Http/Controllers/Admin/Nests/EggController.php index dc9cae5a..f8d36551 100644 --- a/app/Http/Controllers/Admin/Nests/EggController.php +++ b/app/Http/Controllers/Admin/Nests/EggController.php @@ -55,8 +55,6 @@ class EggController extends Controller /** * Handle a request to display the Egg creation page. * - * @return \Illuminate\View\View - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function create(): View @@ -70,16 +68,13 @@ class EggController extends Controller /** * Handle request to store a new Egg. * - * @param \Pterodactyl\Http\Requests\Admin\Egg\EggFormRequest $request - * @return \Illuminate\Http\RedirectResponse - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Service\Egg\NoParentConfigurationFoundException */ public function store(EggFormRequest $request): RedirectResponse { $data = $request->normalize(); - if (! empty($data['docker_images']) && ! is_array($data['docker_images'])) { + if (!empty($data['docker_images']) && !is_array($data['docker_images'])) { $data['docker_images'] = array_map(function ($value) { return trim($value); }, explode("\n", $data['docker_images'])); @@ -93,9 +88,6 @@ class EggController extends Controller /** * Handle request to view a single Egg. - * - * @param \Pterodactyl\Models\Egg $egg - * @return \Illuminate\View\View */ public function view(Egg $egg): View { @@ -105,10 +97,6 @@ class EggController extends Controller /** * Handle request to update an Egg. * - * @param \Pterodactyl\Http\Requests\Admin\Egg\EggFormRequest $request - * @param \Pterodactyl\Models\Egg $egg - * @return \Illuminate\Http\RedirectResponse - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Service\Egg\NoParentConfigurationFoundException @@ -116,7 +104,7 @@ class EggController extends Controller public function update(EggFormRequest $request, Egg $egg): RedirectResponse { $data = $request->normalize(); - if (! empty($data['docker_images']) && ! is_array($data['docker_images'])) { + if (!empty($data['docker_images']) && !is_array($data['docker_images'])) { $data['docker_images'] = array_map(function ($value) { return trim($value); }, explode("\n", $data['docker_images'])); @@ -131,9 +119,6 @@ class EggController extends Controller /** * Handle request to destroy an egg. * - * @param \Pterodactyl\Models\Egg $egg - * @return \Illuminate\Http\RedirectResponse - * * @throws \Pterodactyl\Exceptions\Service\Egg\HasChildrenException * @throws \Pterodactyl\Exceptions\Service\HasActiveServersException */ diff --git a/app/Http/Controllers/Admin/Nests/EggScriptController.php b/app/Http/Controllers/Admin/Nests/EggScriptController.php index ea8d4dfa..4ae8f410 100644 --- a/app/Http/Controllers/Admin/Nests/EggScriptController.php +++ b/app/Http/Controllers/Admin/Nests/EggScriptController.php @@ -30,10 +30,6 @@ class EggScriptController extends Controller /** * EggScriptController constructor. - * - * @param \Prologue\Alerts\AlertsMessageBag $alert - * @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository - * @param \Pterodactyl\Services\Eggs\Scripts\InstallScriptService $installScriptService */ public function __construct( AlertsMessageBag $alert, @@ -47,9 +43,6 @@ class EggScriptController extends Controller /** * Handle requests to render installation script for an Egg. - * - * @param int $egg - * @return \Illuminate\View\View */ public function index(int $egg): View { @@ -74,10 +67,6 @@ class EggScriptController extends Controller /** * Handle a request to update the installation script for an Egg. * - * @param \Pterodactyl\Http\Requests\Admin\Egg\EggScriptFormRequest $request - * @param \Pterodactyl\Models\Egg $egg - * @return \Illuminate\Http\RedirectResponse - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Service\Egg\InvalidCopyFromException diff --git a/app/Http/Controllers/Admin/Nests/EggShareController.php b/app/Http/Controllers/Admin/Nests/EggShareController.php index 7845680e..32882ba5 100644 --- a/app/Http/Controllers/Admin/Nests/EggShareController.php +++ b/app/Http/Controllers/Admin/Nests/EggShareController.php @@ -43,11 +43,6 @@ class EggShareController extends Controller /** * OptionShareController constructor. - * - * @param \Prologue\Alerts\AlertsMessageBag $alert - * @param \Pterodactyl\Services\Eggs\Sharing\EggExporterService $exporterService - * @param \Pterodactyl\Services\Eggs\Sharing\EggImporterService $importerService - * @param \Pterodactyl\Services\Eggs\Sharing\EggUpdateImporterService $updateImporterService */ public function __construct( AlertsMessageBag $alert, @@ -62,9 +57,6 @@ class EggShareController extends Controller } /** - * @param \Pterodactyl\Models\Egg $egg - * @return \Symfony\Component\HttpFoundation\Response - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function export(Egg $egg): Response @@ -82,9 +74,6 @@ class EggShareController extends Controller /** * Import a new service option using an XML file. * - * @param \Pterodactyl\Http\Requests\Admin\Egg\EggImportFormRequest $request - * @return \Illuminate\Http\RedirectResponse - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Service\Egg\BadJsonFormatException @@ -101,10 +90,6 @@ class EggShareController extends Controller /** * Update an existing Egg using a new imported file. * - * @param \Pterodactyl\Http\Requests\Admin\Egg\EggImportFormRequest $request - * @param \Pterodactyl\Models\Egg $egg - * @return \Illuminate\Http\RedirectResponse - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Service\Egg\BadJsonFormatException diff --git a/app/Http/Controllers/Admin/Nests/EggVariableController.php b/app/Http/Controllers/Admin/Nests/EggVariableController.php index c0677abb..193f3b9b 100644 --- a/app/Http/Controllers/Admin/Nests/EggVariableController.php +++ b/app/Http/Controllers/Admin/Nests/EggVariableController.php @@ -50,12 +50,6 @@ class EggVariableController extends Controller /** * EggVariableController constructor. - * - * @param \Prologue\Alerts\AlertsMessageBag $alert - * @param \Pterodactyl\Services\Eggs\Variables\VariableCreationService $creationService - * @param \Pterodactyl\Services\Eggs\Variables\VariableUpdateService $updateService - * @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository - * @param \Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface $variableRepository */ public function __construct( AlertsMessageBag $alert, @@ -74,9 +68,6 @@ class EggVariableController extends Controller /** * Handle request to view the variables attached to an Egg. * - * @param int $egg - * @return \Illuminate\View\View - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function view(int $egg): View @@ -89,10 +80,6 @@ class EggVariableController extends Controller /** * Handle a request to create a new Egg variable. * - * @param \Pterodactyl\Http\Requests\Admin\Egg\EggVariableFormRequest $request - * @param \Pterodactyl\Models\Egg $egg - * - * @return \Illuminate\Http\RedirectResponse * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Service\Egg\Variable\BadValidationRuleException * @throws \Pterodactyl\Exceptions\Service\Egg\Variable\ReservedVariableNameException @@ -108,11 +95,6 @@ class EggVariableController extends Controller /** * Handle a request to update an existing Egg variable. * - * @param \Pterodactyl\Http\Requests\Admin\Egg\EggVariableFormRequest $request - * @param \Pterodactyl\Models\Egg $egg - * @param \Pterodactyl\Models\EggVariable $variable - * @return \Illuminate\Http\RedirectResponse - * * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -130,10 +112,6 @@ class EggVariableController extends Controller /** * Handle a request to delete an existing Egg variable from the Panel. - * - * @param int $egg - * @param \Pterodactyl\Models\EggVariable $variable - * @return \Illuminate\Http\RedirectResponse */ public function destroy(int $egg, EggVariable $variable): RedirectResponse { diff --git a/app/Http/Controllers/Admin/Nests/NestController.php b/app/Http/Controllers/Admin/Nests/NestController.php index 155df2a5..89e1efd7 100644 --- a/app/Http/Controllers/Admin/Nests/NestController.php +++ b/app/Http/Controllers/Admin/Nests/NestController.php @@ -48,12 +48,6 @@ class NestController extends Controller /** * NestController constructor. - * - * @param \Prologue\Alerts\AlertsMessageBag $alert - * @param \Pterodactyl\Services\Nests\NestCreationService $nestCreationService - * @param \Pterodactyl\Services\Nests\NestDeletionService $nestDeletionService - * @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $repository - * @param \Pterodactyl\Services\Nests\NestUpdateService $nestUpdateService */ public function __construct( AlertsMessageBag $alert, @@ -72,8 +66,6 @@ class NestController extends Controller /** * Render nest listing page. * - * @return \Illuminate\View\View - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function index(): View @@ -85,8 +77,6 @@ class NestController extends Controller /** * Render nest creation page. - * - * @return \Illuminate\View\View */ public function create(): View { @@ -96,9 +86,6 @@ class NestController extends Controller /** * Handle the storage of a new nest. * - * @param \Pterodactyl\Http\Requests\Admin\Nest\StoreNestFormRequest $request - * @return \Illuminate\Http\RedirectResponse - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ public function store(StoreNestFormRequest $request): RedirectResponse @@ -112,9 +99,6 @@ class NestController extends Controller /** * Return details about a nest including all of the eggs and servers per egg. * - * @param int $nest - * @return \Illuminate\View\View - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function view(int $nest): View @@ -127,10 +111,6 @@ class NestController extends Controller /** * Handle request to update a nest. * - * @param \Pterodactyl\Http\Requests\Admin\Nest\StoreNestFormRequest $request - * @param int $nest - * - * @return \Illuminate\Http\RedirectResponse * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -145,9 +125,6 @@ class NestController extends Controller /** * Handle request to delete a nest. * - * @param int $nest - * @return \Illuminate\Http\RedirectResponse - * * @throws \Pterodactyl\Exceptions\Service\HasActiveServersException */ public function destroy(int $nest): RedirectResponse diff --git a/app/Http/Controllers/Admin/NodeAutoDeployController.php b/app/Http/Controllers/Admin/NodeAutoDeployController.php index be6301c3..a638a3f1 100644 --- a/app/Http/Controllers/Admin/NodeAutoDeployController.php +++ b/app/Http/Controllers/Admin/NodeAutoDeployController.php @@ -30,10 +30,6 @@ class NodeAutoDeployController extends Controller /** * NodeAutoDeployController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\ApiKeyRepository $repository - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter - * @param \Pterodactyl\Services\Api\KeyCreationService $keyCreationService */ public function __construct( ApiKeyRepository $repository, @@ -49,8 +45,6 @@ class NodeAutoDeployController extends Controller * Generates a new API key for the logged in user with only permission to read * nodes, and returns that as the deployment key for a node. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Node $node * @return \Illuminate\Http\JsonResponse * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -72,7 +66,7 @@ class NodeAutoDeployController extends Controller // We couldn't find a key that exists for this user with only permission for // reading nodes. Go ahead and create it now. - if (! $key) { + if (!$key) { $key = $this->keyCreationService->setKeyType(ApiKey::TYPE_APPLICATION)->handle([ 'user_id' => $request->user()->id, 'memo' => 'Automatically generated node deployment key.', diff --git a/app/Http/Controllers/Admin/Nodes/NodeController.php b/app/Http/Controllers/Admin/Nodes/NodeController.php index 5a7bc1e3..d3d53fc8 100644 --- a/app/Http/Controllers/Admin/Nodes/NodeController.php +++ b/app/Http/Controllers/Admin/Nodes/NodeController.php @@ -23,9 +23,6 @@ class NodeController extends Controller /** * NodeController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\NodeRepository $repository - * @param \Illuminate\Contracts\View\Factory $view */ public function __construct(NodeRepository $repository, Factory $view) { @@ -36,7 +33,6 @@ class NodeController extends Controller /** * Returns a listing of nodes on the system. * - * @param \Illuminate\Http\Request $request * @return \Illuminate\Contracts\View\View */ public function index(Request $request) diff --git a/app/Http/Controllers/Admin/Nodes/NodeViewController.php b/app/Http/Controllers/Admin/Nodes/NodeViewController.php index 2121985c..b45b23a0 100644 --- a/app/Http/Controllers/Admin/Nodes/NodeViewController.php +++ b/app/Http/Controllers/Admin/Nodes/NodeViewController.php @@ -51,13 +51,6 @@ class NodeViewController extends Controller /** * NodeViewController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\AllocationRepository $allocationRepository - * @param \Pterodactyl\Repositories\Eloquent\LocationRepository $locationRepository - * @param \Pterodactyl\Repositories\Eloquent\NodeRepository $repository - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $serverRepository - * @param \Pterodactyl\Services\Helpers\SoftwareVersionService $versionService - * @param \Illuminate\Contracts\View\Factory $view */ public function __construct( AllocationRepository $allocationRepository, @@ -78,8 +71,6 @@ class NodeViewController extends Controller /** * Returns index view for a specific node on the system. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Node $node * @return \Illuminate\Contracts\View\View */ public function index(Request $request, Node $node) @@ -96,8 +87,6 @@ class NodeViewController extends Controller /** * Returns the settings page for a specific node. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Node $node * @return \Illuminate\Contracts\View\View */ public function settings(Request $request, Node $node) @@ -111,8 +100,6 @@ class NodeViewController extends Controller /** * Return the node configuration page for a specific node. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Node $node * @return \Illuminate\Contracts\View\View */ public function configuration(Request $request, Node $node) @@ -123,8 +110,6 @@ class NodeViewController extends Controller /** * Return the node allocation management page. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Node $node * @return \Illuminate\Contracts\View\View */ public function allocations(Request $request, Node $node) @@ -145,8 +130,6 @@ class NodeViewController extends Controller /** * Return a listing of servers that exist for this specific node. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Node $node * @return \Illuminate\Contracts\View\View */ public function servers(Request $request, Node $node) diff --git a/app/Http/Controllers/Admin/Nodes/SystemInformationController.php b/app/Http/Controllers/Admin/Nodes/SystemInformationController.php index 4e1a3fe8..476cea49 100644 --- a/app/Http/Controllers/Admin/Nodes/SystemInformationController.php +++ b/app/Http/Controllers/Admin/Nodes/SystemInformationController.php @@ -18,8 +18,6 @@ class SystemInformationController extends Controller /** * SystemInformationController constructor. - * - * @param \Pterodactyl\Repositories\Wings\DaemonConfigurationRepository $repository */ public function __construct(DaemonConfigurationRepository $repository) { @@ -29,8 +27,6 @@ class SystemInformationController extends Controller /** * Returns system information from the Daemon. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Node $node * @return \Illuminate\Http\JsonResponse * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException diff --git a/app/Http/Controllers/Admin/NodesController.php b/app/Http/Controllers/Admin/NodesController.php index d482c47a..193326de 100644 --- a/app/Http/Controllers/Admin/NodesController.php +++ b/app/Http/Controllers/Admin/NodesController.php @@ -94,19 +94,6 @@ class NodesController extends Controller /** * NodesController constructor. - * - * @param \Prologue\Alerts\AlertsMessageBag $alert - * @param \Pterodactyl\Services\Allocations\AllocationDeletionService $allocationDeletionService - * @param \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface $allocationRepository - * @param \Pterodactyl\Services\Allocations\AssignmentService $assignmentService - * @param \Illuminate\Cache\Repository $cache - * @param \Pterodactyl\Services\Nodes\NodeCreationService $creationService - * @param \Pterodactyl\Services\Nodes\NodeDeletionService $deletionService - * @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $locationRepository - * @param \Pterodactyl\Contracts\Repository\NodeRepositoryInterface $repository - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $serverRepository - * @param \Pterodactyl\Services\Nodes\NodeUpdateService $updateService - * @param \Pterodactyl\Services\Helpers\SoftwareVersionService $versionService */ public function __construct( AlertsMessageBag $alert, @@ -156,7 +143,6 @@ class NodesController extends Controller /** * Post controller to create a new node on the system. * - * @param \Pterodactyl\Http\Requests\Admin\Node\NodeFormRequest $request * @return \Illuminate\Http\RedirectResponse * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -172,8 +158,6 @@ class NodesController extends Controller /** * Updates settings for a node. * - * @param \Pterodactyl\Http\Requests\Admin\Node\NodeFormRequest $request - * @param \Pterodactyl\Models\Node $node * @return \Illuminate\Http\RedirectResponse * * @throws \Pterodactyl\Exceptions\DisplayException @@ -191,10 +175,6 @@ class NodesController extends Controller /** * Removes a single allocation from a node. * - * @param int $node - * @param \Pterodactyl\Models\Allocation $allocation - * @return \Illuminate\Http\Response - * * @throws \Pterodactyl\Exceptions\Service\Allocation\ServerUsingAllocationException */ public function allocationRemoveSingle(int $node, Allocation $allocation): Response @@ -207,10 +187,6 @@ class NodesController extends Controller /** * Removes multiple individual allocations from a node. * - * @param \Illuminate\Http\Request $request - * @param int $node - * @return \Illuminate\Http\Response - * * @throws \Pterodactyl\Exceptions\Service\Allocation\ServerUsingAllocationException */ public function allocationRemoveMultiple(Request $request, int $node): Response @@ -228,8 +204,8 @@ class NodesController extends Controller /** * Remove all allocations for a specific IP at once on a node. * - * @param \Illuminate\Http\Request $request * @param int $node + * * @return \Illuminate\Http\RedirectResponse */ public function allocationRemoveBlock(Request $request, $node) @@ -249,7 +225,6 @@ class NodesController extends Controller /** * Sets an alias for a specific allocation on a node. * - * @param \Pterodactyl\Http\Requests\Admin\Node\AllocationAliasFormRequest $request * @return \Symfony\Component\HttpFoundation\Response * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -267,8 +242,8 @@ class NodesController extends Controller /** * Creates new allocations on a node. * - * @param \Pterodactyl\Http\Requests\Admin\Node\AllocationFormRequest $request * @param int|\Pterodactyl\Models\Node $node + * * @return \Illuminate\Http\RedirectResponse * * @throws \Pterodactyl\Exceptions\Service\Allocation\CidrOutOfRangeException @@ -288,6 +263,7 @@ class NodesController extends Controller * Deletes a node from the system. * * @param $node + * * @return \Illuminate\Http\RedirectResponse * * @throws \Pterodactyl\Exceptions\DisplayException diff --git a/app/Http/Controllers/Admin/Servers/CreateServerController.php b/app/Http/Controllers/Admin/Servers/CreateServerController.php index b36fe4da..b8f5a320 100644 --- a/app/Http/Controllers/Admin/Servers/CreateServerController.php +++ b/app/Http/Controllers/Admin/Servers/CreateServerController.php @@ -47,13 +47,6 @@ class CreateServerController extends Controller /** * CreateServerController constructor. - * - * @param \Prologue\Alerts\AlertsMessageBag $alert - * @param \Pterodactyl\Repositories\Eloquent\NestRepository $nestRepository - * @param \Pterodactyl\Repositories\Eloquent\LocationRepository $locationRepository - * @param \Pterodactyl\Repositories\Eloquent\NodeRepository $nodeRepository - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository - * @param \Pterodactyl\Services\Servers\ServerCreationService $creationService */ public function __construct( AlertsMessageBag $alert, @@ -75,6 +68,7 @@ class CreateServerController extends Controller * Displays the create server page. * * @return \Illuminate\Contracts\View\Factory + * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function index() @@ -106,7 +100,6 @@ class CreateServerController extends Controller /** * Create a new server on the remote system. * - * @param \Pterodactyl\Http\Requests\Admin\ServerFormRequest $request * @return \Illuminate\Http\RedirectResponse * * @throws \Illuminate\Validation\ValidationException @@ -118,7 +111,7 @@ class CreateServerController extends Controller public function store(ServerFormRequest $request) { $data = $request->except(['_token']); - if (! empty($data['custom_image'])) { + if (!empty($data['custom_image'])) { $data['image'] = $data['custom_image']; unset($data['custom_image']); } diff --git a/app/Http/Controllers/Admin/Servers/ServerController.php b/app/Http/Controllers/Admin/Servers/ServerController.php index c8e54b1c..f369b7ad 100644 --- a/app/Http/Controllers/Admin/Servers/ServerController.php +++ b/app/Http/Controllers/Admin/Servers/ServerController.php @@ -25,9 +25,6 @@ class ServerController extends Controller /** * ServerController constructor. - * - * @param \Illuminate\Contracts\View\Factory $view - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository */ public function __construct( Factory $view, @@ -41,7 +38,6 @@ class ServerController extends Controller * Returns all of the servers that exist on the system using a paginated result set. If * a query is passed along in the request it is also passed to the repository function. * - * @param \Illuminate\Http\Request $request * @return \Illuminate\Contracts\View\View */ public function index(Request $request) @@ -49,7 +45,7 @@ class ServerController extends Controller $servers = QueryBuilder::for(Server::query()->with('node', 'user', 'allocation')) ->allowedFilters([ AllowedFilter::exact('owner_id'), - AllowedFilter::custom('*', new AdminServerFilter), + AllowedFilter::custom('*', new AdminServerFilter()), ]) ->paginate(config()->get('pterodactyl.paginate.admin.servers')); diff --git a/app/Http/Controllers/Admin/Servers/ServerTransferController.php b/app/Http/Controllers/Admin/Servers/ServerTransferController.php index c85f28e3..b4afa2ca 100644 --- a/app/Http/Controllers/Admin/Servers/ServerTransferController.php +++ b/app/Http/Controllers/Admin/Servers/ServerTransferController.php @@ -53,14 +53,6 @@ class ServerTransferController extends Controller /** * ServerTransferController constructor. - * - * @param \Prologue\Alerts\AlertsMessageBag $alert - * @param \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface $allocationRepository - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository - * @param \Pterodactyl\Repositories\Eloquent\LocationRepository $locationRepository - * @param \Pterodactyl\Repositories\Eloquent\NodeRepository $nodeRepository - * @param \Pterodactyl\Services\Servers\TransferService $transferService - * @param \Pterodactyl\Repositories\Wings\DaemonConfigurationRepository $daemonConfigurationRepository */ public function __construct( AlertsMessageBag $alert, @@ -83,8 +75,6 @@ class ServerTransferController extends Controller /** * Starts a transfer of a server to a new node. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\RedirectResponse * * @throws \Throwable @@ -108,7 +98,7 @@ class ServerTransferController extends Controller $this->daemonConfigurationRepository->setNode($node)->getSystemInformation(); // Create a new ServerTransfer entry. - $transfer = new ServerTransfer; + $transfer = new ServerTransfer(); $transfer->server_id = $server->id; $transfer->old_node = $server->node_id; @@ -136,11 +126,6 @@ class ServerTransferController extends Controller /** * Assigns the specified allocations to the specified server. - * - * @param Server $server - * @param int $node_id - * @param int $allocation_id - * @param array $additional_allocations */ private function assignAllocationsToServer(Server $server, int $node_id, int $allocation_id, array $additional_allocations) { @@ -151,14 +136,14 @@ class ServerTransferController extends Controller $updateIds = []; foreach ($allocations as $allocation) { - if (! in_array($allocation, $unassigned)) { + if (!in_array($allocation, $unassigned)) { continue; } $updateIds[] = $allocation; } - if (! empty($updateIds)) { + if (!empty($updateIds)) { $this->allocationRepository->updateWhereIn('id', $updateIds, ['server_id' => $server->id]); } } diff --git a/app/Http/Controllers/Admin/Servers/ServerViewController.php b/app/Http/Controllers/Admin/Servers/ServerViewController.php index 5c2440b2..1edad1a4 100644 --- a/app/Http/Controllers/Admin/Servers/ServerViewController.php +++ b/app/Http/Controllers/Admin/Servers/ServerViewController.php @@ -64,15 +64,6 @@ class ServerViewController extends Controller /** * ServerViewController constructor. - * - * @param \Illuminate\Contracts\View\Factory $view - * @param \Pterodactyl\Repositories\Eloquent\DatabaseHostRepository $databaseHostRepository - * @param \Pterodactyl\Repositories\Eloquent\LocationRepository $locationRepository - * @param \Pterodactyl\Repositories\Eloquent\MountRepository $mountRepository - * @param \Pterodactyl\Repositories\Eloquent\NestRepository $nestRepository - * @param \Pterodactyl\Repositories\Eloquent\NodeRepository $nodeRepository - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository - * @param \Pterodactyl\Services\Servers\EnvironmentService $environmentService */ public function __construct( Factory $view, @@ -97,8 +88,6 @@ class ServerViewController extends Controller /** * Returns the index view for a server. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Contracts\View\View */ public function index(Request $request, Server $server) @@ -109,8 +98,6 @@ class ServerViewController extends Controller /** * Returns the server details page. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Contracts\View\View */ public function details(Request $request, Server $server) @@ -121,8 +108,6 @@ class ServerViewController extends Controller /** * Returns a view of server build settings. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Contracts\View\View */ public function build(Request $request, Server $server) @@ -139,8 +124,6 @@ class ServerViewController extends Controller /** * Returns the server startup management page. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Contracts\View\View * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -166,8 +149,6 @@ class ServerViewController extends Controller /** * Returns all of the databases that exist for the server. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Contracts\View\View */ public function database(Request $request, Server $server) @@ -181,8 +162,6 @@ class ServerViewController extends Controller /** * Returns all of the mounts that exist for the server. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Contracts\View\View */ public function mounts(Request $request, Server $server) @@ -199,8 +178,6 @@ class ServerViewController extends Controller * Returns the base server management page, or an exception if the server * is in a state that cannot be recovered from. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Contracts\View\View * * @throws \Pterodactyl\Exceptions\DisplayException @@ -208,9 +185,7 @@ class ServerViewController extends Controller public function manage(Request $request, Server $server) { if ($server->installed > 1) { - throw new DisplayException( - 'This server is in a failed install state and cannot be recovered. Please delete and re-create the server.' - ); + throw new DisplayException('This server is in a failed install state and cannot be recovered. Please delete and re-create the server.'); } // Check if the panel doesn't have at least 2 nodes configured. @@ -234,8 +209,6 @@ class ServerViewController extends Controller /** * Returns the server deletion page. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Contracts\View\View */ public function delete(Request $request, Server $server) diff --git a/app/Http/Controllers/Admin/ServersController.php b/app/Http/Controllers/Admin/ServersController.php index 0f77ce5f..f92f1cb1 100644 --- a/app/Http/Controllers/Admin/ServersController.php +++ b/app/Http/Controllers/Admin/ServersController.php @@ -132,25 +132,6 @@ class ServersController extends Controller /** * ServersController constructor. - * - * @param \Prologue\Alerts\AlertsMessageBag $alert - * @param \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface $allocationRepository - * @param \Pterodactyl\Services\Servers\BuildModificationService $buildModificationService - * @param \Illuminate\Contracts\Config\Repository $config - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonServerRepository - * @param \Pterodactyl\Services\Databases\DatabaseManagementService $databaseManagementService - * @param \Pterodactyl\Services\Databases\DatabasePasswordService $databasePasswordService - * @param \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface $databaseRepository - * @param \Pterodactyl\Repositories\Eloquent\DatabaseHostRepository $databaseHostRepository - * @param \Pterodactyl\Services\Servers\ServerDeletionService $deletionService - * @param \Pterodactyl\Services\Servers\DetailsModificationService $detailsModificationService - * @param \Pterodactyl\Services\Servers\ReinstallServerService $reinstallService - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository - * @param \Pterodactyl\Repositories\Eloquent\MountRepository $mountRepository - * @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $nestRepository - * @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $serverConfigurationStructureService - * @param \Pterodactyl\Services\Servers\StartupModificationService $startupModificationService - * @param \Pterodactyl\Services\Servers\SuspensionService $suspensionService */ public function __construct( AlertsMessageBag $alert, @@ -195,8 +176,6 @@ class ServersController extends Controller /** * Update the details for a server. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\RedirectResponse * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -216,7 +195,6 @@ class ServersController extends Controller /** * Toggles the install status for a server. * - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\RedirectResponse * * @throws \Pterodactyl\Exceptions\DisplayException @@ -230,7 +208,7 @@ class ServersController extends Controller } $this->repository->update($server->id, [ - 'installed' => ! $server->installed, + 'installed' => !$server->installed, ], true, true); $this->alert->success(trans('admin/server.alerts.install_toggled'))->flash(); @@ -241,7 +219,6 @@ class ServersController extends Controller /** * Reinstalls the server with the currently assigned service. * - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\RedirectResponse * * @throws \Pterodactyl\Exceptions\DisplayException @@ -259,8 +236,6 @@ class ServersController extends Controller /** * Manage the suspension status for a server. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\RedirectResponse * * @throws \Pterodactyl\Exceptions\DisplayException @@ -280,8 +255,6 @@ class ServersController extends Controller /** * Update the build configuration for a server. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\RedirectResponse * * @throws \Pterodactyl\Exceptions\DisplayException @@ -308,8 +281,6 @@ class ServersController extends Controller /** * Start the server deletion process. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\RedirectResponse * * @throws \Pterodactyl\Exceptions\DisplayException @@ -326,8 +297,6 @@ class ServersController extends Controller /** * Update the startup command as well as variables. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\RedirectResponse * * @throws \Illuminate\Validation\ValidationException @@ -335,7 +304,7 @@ class ServersController extends Controller public function saveStartup(Request $request, Server $server) { $data = $request->except('_token'); - if (! empty($data['custom_docker_image'])) { + if (!empty($data['custom_docker_image'])) { $data['docker_image'] = $data['custom_docker_image']; unset($data['custom_docker_image']); } @@ -356,8 +325,6 @@ class ServersController extends Controller /** * Creates a new database assigned to a specific server. * - * @param \Pterodactyl\Http\Requests\Admin\Servers\Databases\StoreServerDatabaseRequest $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\RedirectResponse * * @throws \Throwable @@ -377,8 +344,8 @@ class ServersController extends Controller /** * Resets the database password for a specific database on this server. * - * @param \Illuminate\Http\Request $request * @param int $server + * * @return \Illuminate\Http\RedirectResponse * * @throws \Throwable @@ -400,6 +367,7 @@ class ServersController extends Controller * * @param int $server * @param int $database + * * @return \Illuminate\Http\RedirectResponse * * @throws \Exception @@ -420,15 +388,13 @@ class ServersController extends Controller /** * Add a mount to a server. * - * @param Server $server - * @param \Pterodactyl\Models\Mount $mount * @return \Illuminate\Http\RedirectResponse * * @throws \Throwable */ public function addMount(Server $server, Mount $mount) { - $mountServer = (new MountServer)->forceFill([ + $mountServer = (new MountServer())->forceFill([ 'mount_id' => $mount->id, 'server_id' => $server->id, ]); @@ -443,8 +409,6 @@ class ServersController extends Controller /** * Remove a mount from a server. * - * @param Server $server - * @param \Pterodactyl\Models\Mount $mount * @return \Illuminate\Http\RedirectResponse */ public function deleteMount(Server $server, Mount $mount) diff --git a/app/Http/Controllers/Admin/Settings/AdvancedController.php b/app/Http/Controllers/Admin/Settings/AdvancedController.php index 54409d19..49959bdd 100644 --- a/app/Http/Controllers/Admin/Settings/AdvancedController.php +++ b/app/Http/Controllers/Admin/Settings/AdvancedController.php @@ -35,11 +35,6 @@ class AdvancedController extends Controller /** * AdvancedController constructor. - * - * @param \Prologue\Alerts\AlertsMessageBag $alert - * @param \Illuminate\Contracts\Config\Repository $config - * @param \Illuminate\Contracts\Console\Kernel $kernel - * @param \Pterodactyl\Contracts\Repository\SettingsRepositoryInterface $settings */ public function __construct( AlertsMessageBag $alert, @@ -55,8 +50,6 @@ class AdvancedController extends Controller /** * Render advanced Panel settings UI. - * - * @return \Illuminate\View\View */ public function index(): View { @@ -74,8 +67,6 @@ class AdvancedController extends Controller } /** - * @param \Pterodactyl\Http\Requests\Admin\Settings\AdvancedSettingsFormRequest $request - * @return \Illuminate\Http\RedirectResponse * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ diff --git a/app/Http/Controllers/Admin/Settings/IndexController.php b/app/Http/Controllers/Admin/Settings/IndexController.php index 1bf61d65..5fb225e9 100644 --- a/app/Http/Controllers/Admin/Settings/IndexController.php +++ b/app/Http/Controllers/Admin/Settings/IndexController.php @@ -38,17 +38,13 @@ class IndexController extends Controller /** * IndexController constructor. - * - * @param \Prologue\Alerts\AlertsMessageBag $alert - * @param \Illuminate\Contracts\Console\Kernel $kernel - * @param \Pterodactyl\Contracts\Repository\SettingsRepositoryInterface $settings - * @param \Pterodactyl\Services\Helpers\SoftwareVersionService $versionService */ public function __construct( AlertsMessageBag $alert, Kernel $kernel, SettingsRepositoryInterface $settings, - SoftwareVersionService $versionService) + SoftwareVersionService $versionService + ) { $this->alert = $alert; $this->kernel = $kernel; @@ -58,8 +54,6 @@ class IndexController extends Controller /** * Render the UI for basic Panel settings. - * - * @return \Illuminate\View\View */ public function index(): View { @@ -72,8 +66,6 @@ class IndexController extends Controller /** * Handle settings update. * - * @param \Pterodactyl\Http\Requests\Admin\Settings\BaseSettingsFormRequest $request - * @return \Illuminate\Http\RedirectResponse * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ diff --git a/app/Http/Controllers/Admin/Settings/MailController.php b/app/Http/Controllers/Admin/Settings/MailController.php index ccd84fa5..8f3e15ed 100644 --- a/app/Http/Controllers/Admin/Settings/MailController.php +++ b/app/Http/Controllers/Admin/Settings/MailController.php @@ -47,12 +47,6 @@ class MailController extends Controller /** * MailController constructor. - * - * @param \Prologue\Alerts\AlertsMessageBag $alert - * @param \Illuminate\Contracts\Config\Repository $config - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter - * @param \Illuminate\Contracts\Console\Kernel $kernel - * @param \Pterodactyl\Contracts\Repository\SettingsRepositoryInterface $settings */ public function __construct( AlertsMessageBag $alert, @@ -71,8 +65,6 @@ class MailController extends Controller /** * Render UI for editing mail settings. This UI should only display if * the server is configured to send mail using SMTP. - * - * @return \Illuminate\View\View */ public function index(): View { @@ -84,9 +76,6 @@ class MailController extends Controller /** * Handle request to update SMTP mail settings. * - * @param \Pterodactyl\Http\Requests\Admin\Settings\MailSettingsFormRequest $request - * @return \Illuminate\Http\Response - * * @throws DisplayException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -103,7 +92,7 @@ class MailController extends Controller } foreach ($values as $key => $value) { - if (in_array($key, SettingsServiceProvider::getEncryptedKeys()) && ! empty($value)) { + if (in_array($key, SettingsServiceProvider::getEncryptedKeys()) && !empty($value)) { $value = $this->encrypter->encrypt($value); } @@ -117,9 +106,6 @@ class MailController extends Controller /** * Submit a request to send a test mail message. - * - * @param Request $request - * @return \Illuminate\Http\Response */ public function test(Request $request): Response { diff --git a/app/Http/Controllers/Admin/StatisticsController.php b/app/Http/Controllers/Admin/StatisticsController.php index 612f04b6..5601e98e 100644 --- a/app/Http/Controllers/Admin/StatisticsController.php +++ b/app/Http/Controllers/Admin/StatisticsController.php @@ -46,7 +46,7 @@ class StatisticsController extends Controller public function index() { - throw new NotFoundHttpException; + throw new NotFoundHttpException(); $servers = $this->serverRepository->all(); $nodes = $this->nodeRepository->all(); $usersCount = $this->userRepository->count(); diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index b5126c76..60a2529b 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -52,13 +52,6 @@ class UserController extends Controller /** * UserController constructor. - * - * @param \Prologue\Alerts\AlertsMessageBag $alert - * @param \Pterodactyl\Services\Users\UserCreationService $creationService - * @param \Pterodactyl\Services\Users\UserDeletionService $deletionService - * @param \Illuminate\Contracts\Translation\Translator $translator - * @param \Pterodactyl\Services\Users\UserUpdateService $updateService - * @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository */ public function __construct( AlertsMessageBag $alert, @@ -79,7 +72,6 @@ class UserController extends Controller /** * Display user index page. * - * @param \Illuminate\Http\Request $request * @return \Illuminate\View\View */ public function index(Request $request) @@ -114,7 +106,6 @@ class UserController extends Controller /** * Display user view page. * - * @param \Pterodactyl\Models\User $user * @return \Illuminate\View\View */ public function view(User $user) @@ -128,8 +119,6 @@ class UserController extends Controller /** * Delete a user from the system. * - * @param \Illuminate\Http\Request $request - * @param \Pterodactyl\Models\User $user * @return \Illuminate\Http\RedirectResponse * * @throws \Exception @@ -149,7 +138,6 @@ class UserController extends Controller /** * Create a user. * - * @param \Pterodactyl\Http\Requests\Admin\UserFormRequest $request * @return \Illuminate\Http\RedirectResponse * * @throws \Exception @@ -166,8 +154,6 @@ class UserController extends Controller /** * Update a user on the system. * - * @param \Pterodactyl\Http\Requests\Admin\UserFormRequest $request - * @param \Pterodactyl\Models\User $user * @return \Illuminate\Http\RedirectResponse * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -187,7 +173,6 @@ class UserController extends Controller /** * Get a JSON response of users on the system. * - * @param \Illuminate\Http\Request $request * @return \Illuminate\Support\Collection|\Pterodactyl\Models\Model */ public function json(Request $request) diff --git a/app/Http/Controllers/Api/Application/ApplicationApiController.php b/app/Http/Controllers/Api/Application/ApplicationApiController.php index 903edeb6..6078b6f2 100644 --- a/app/Http/Controllers/Api/Application/ApplicationApiController.php +++ b/app/Http/Controllers/Api/Application/ApplicationApiController.php @@ -45,9 +45,6 @@ abstract class ApplicationApiController extends Controller /** * Perform dependency injection of certain classes needed for core functionality * without littering the constructors of classes that extend this abstract. - * - * @param \Pterodactyl\Extensions\Spatie\Fractalistic\Fractal $fractal - * @param \Illuminate\Http\Request $request */ public function loadDependencies(Fractal $fractal, Request $request) { @@ -58,7 +55,6 @@ abstract class ApplicationApiController extends Controller /** * Return an instance of an application transformer. * - * @param string $abstract * @return \Pterodactyl\Transformers\Api\Application\BaseTransformer */ public function getTransformer(string $abstract) @@ -74,8 +70,6 @@ abstract class ApplicationApiController extends Controller /** * Return a HTTP/204 response for the API. - * - * @return \Illuminate\Http\Response */ protected function returnNoContent(): Response { diff --git a/app/Http/Controllers/Api/Application/Locations/LocationController.php b/app/Http/Controllers/Api/Application/Locations/LocationController.php index 62ab4ea4..cdcf013b 100644 --- a/app/Http/Controllers/Api/Application/Locations/LocationController.php +++ b/app/Http/Controllers/Api/Application/Locations/LocationController.php @@ -42,11 +42,6 @@ class LocationController extends ApplicationApiController /** * LocationController constructor. - * - * @param \Pterodactyl\Services\Locations\LocationCreationService $creationService - * @param \Pterodactyl\Services\Locations\LocationDeletionService $deletionService - * @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $repository - * @param \Pterodactyl\Services\Locations\LocationUpdateService $updateService */ public function __construct( LocationCreationService $creationService, @@ -64,9 +59,6 @@ class LocationController extends ApplicationApiController /** * Return all of the locations currently registered on the Panel. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Locations\GetLocationsRequest $request - * @return array */ public function index(GetLocationsRequest $request): array { @@ -82,9 +74,6 @@ class LocationController extends ApplicationApiController /** * Return a single location. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Locations\GetLocationRequest $request - * @return array */ public function view(GetLocationRequest $request): array { @@ -97,9 +86,6 @@ class LocationController extends ApplicationApiController * Store a new location on the Panel and return a HTTP/201 response code with the * new location attached. * - * @param \Pterodactyl\Http\Requests\Api\Application\Locations\StoreLocationRequest $request - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ public function store(StoreLocationRequest $request): JsonResponse @@ -119,9 +105,6 @@ class LocationController extends ApplicationApiController /** * Update a location on the Panel and return the updated record to the user. * - * @param \Pterodactyl\Http\Requests\Api\Application\Locations\UpdateLocationRequest $request - * @return array - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -137,9 +120,6 @@ class LocationController extends ApplicationApiController /** * Delete a location from the Panel. * - * @param \Pterodactyl\Http\Requests\Api\Application\Locations\DeleteLocationRequest $request - * @return \Illuminate\Http\Response - * * @throws \Pterodactyl\Exceptions\Service\Location\HasActiveNodesException */ public function delete(DeleteLocationRequest $request): Response diff --git a/app/Http/Controllers/Api/Application/Nests/EggController.php b/app/Http/Controllers/Api/Application/Nests/EggController.php index 21ce4ec9..1eb596f9 100644 --- a/app/Http/Controllers/Api/Application/Nests/EggController.php +++ b/app/Http/Controllers/Api/Application/Nests/EggController.php @@ -19,8 +19,6 @@ class EggController extends ApplicationApiController /** * EggController constructor. - * - * @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository */ public function __construct(EggRepositoryInterface $repository) { @@ -31,9 +29,6 @@ class EggController extends ApplicationApiController /** * Return all eggs that exist for a given nest. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Nests\Eggs\GetEggsRequest $request - * @return array */ public function index(GetEggsRequest $request): array { @@ -48,9 +43,6 @@ class EggController extends ApplicationApiController /** * Return a single egg that exists on the specified nest. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Nests\Eggs\GetEggRequest $request - * @return array */ public function view(GetEggRequest $request): array { diff --git a/app/Http/Controllers/Api/Application/Nests/NestController.php b/app/Http/Controllers/Api/Application/Nests/NestController.php index adeacc56..92de473e 100644 --- a/app/Http/Controllers/Api/Application/Nests/NestController.php +++ b/app/Http/Controllers/Api/Application/Nests/NestController.php @@ -17,8 +17,6 @@ class NestController extends ApplicationApiController /** * NestController constructor. - * - * @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $repository */ public function __construct(NestRepositoryInterface $repository) { @@ -29,9 +27,6 @@ class NestController extends ApplicationApiController /** * Return all Nests that exist on the Panel. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Nests\GetNestsRequest $request - * @return array */ public function index(GetNestsRequest $request): array { @@ -44,9 +39,6 @@ class NestController extends ApplicationApiController /** * Return information about a single Nest model. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Nests\GetNestsRequest $request - * @return array */ public function view(GetNestsRequest $request): array { diff --git a/app/Http/Controllers/Api/Application/Nodes/AllocationController.php b/app/Http/Controllers/Api/Application/Nodes/AllocationController.php index 01ec37fe..c6670149 100644 --- a/app/Http/Controllers/Api/Application/Nodes/AllocationController.php +++ b/app/Http/Controllers/Api/Application/Nodes/AllocationController.php @@ -27,9 +27,6 @@ class AllocationController extends ApplicationApiController /** * AllocationController constructor. - * - * @param \Pterodactyl\Services\Allocations\AssignmentService $assignmentService - * @param \Pterodactyl\Services\Allocations\AllocationDeletionService $deletionService */ public function __construct( AssignmentService $assignmentService, @@ -43,10 +40,6 @@ class AllocationController extends ApplicationApiController /** * Return all of the allocations that exist for a given node. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Allocations\GetAllocationsRequest $request - * @param \Pterodactyl\Models\Node $node - * @return array */ public function index(GetAllocationsRequest $request, Node $node): array { @@ -60,10 +53,6 @@ class AllocationController extends ApplicationApiController /** * Store new allocations for a given node. * - * @param \Pterodactyl\Http\Requests\Api\Application\Allocations\StoreAllocationRequest $request - * @param \Pterodactyl\Models\Node $node - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Service\Allocation\CidrOutOfRangeException * @throws \Pterodactyl\Exceptions\Service\Allocation\InvalidPortMappingException * @throws \Pterodactyl\Exceptions\Service\Allocation\PortOutOfRangeException @@ -79,11 +68,6 @@ class AllocationController extends ApplicationApiController /** * Delete a specific allocation from the Panel. * - * @param \Pterodactyl\Http\Requests\Api\Application\Allocations\DeleteAllocationRequest $request - * @param \Pterodactyl\Models\Node $node - * @param \Pterodactyl\Models\Allocation $allocation - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Service\Allocation\ServerUsingAllocationException */ public function delete(DeleteAllocationRequest $request, Node $node, Allocation $allocation): JsonResponse diff --git a/app/Http/Controllers/Api/Application/Nodes/NodeConfigurationController.php b/app/Http/Controllers/Api/Application/Nodes/NodeConfigurationController.php index fc0c35f7..058f542b 100644 --- a/app/Http/Controllers/Api/Application/Nodes/NodeConfigurationController.php +++ b/app/Http/Controllers/Api/Application/Nodes/NodeConfigurationController.php @@ -14,8 +14,6 @@ class NodeConfigurationController extends ApplicationApiController * to remote machines so long as an API key is provided to the machine to make the request * with, and the node is known. * - * @param \Pterodactyl\Http\Requests\Api\Application\Nodes\GetNodeRequest $request - * @param \Pterodactyl\Models\Node $node * @return \Illuminate\Http\JsonResponse */ public function __invoke(GetNodeRequest $request, Node $node) diff --git a/app/Http/Controllers/Api/Application/Nodes/NodeController.php b/app/Http/Controllers/Api/Application/Nodes/NodeController.php index 7198611b..61f27b82 100644 --- a/app/Http/Controllers/Api/Application/Nodes/NodeController.php +++ b/app/Http/Controllers/Api/Application/Nodes/NodeController.php @@ -41,11 +41,6 @@ class NodeController extends ApplicationApiController /** * NodeController constructor. - * - * @param \Pterodactyl\Services\Nodes\NodeCreationService $creationService - * @param \Pterodactyl\Services\Nodes\NodeDeletionService $deletionService - * @param \Pterodactyl\Services\Nodes\NodeUpdateService $updateService - * @param \Pterodactyl\Contracts\Repository\NodeRepositoryInterface $repository */ public function __construct( NodeCreationService $creationService, @@ -63,9 +58,6 @@ class NodeController extends ApplicationApiController /** * Return all of the nodes currently available on the Panel. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Nodes\GetNodesRequest $request - * @return array */ public function index(GetNodesRequest $request): array { @@ -81,10 +73,6 @@ class NodeController extends ApplicationApiController /** * Return data for a single instance of a node. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Nodes\GetNodeRequest $request - * @param \Pterodactyl\Models\Node $node - * @return array */ public function view(GetNodeRequest $request, Node $node): array { @@ -97,9 +85,6 @@ class NodeController extends ApplicationApiController * Create a new node on the Panel. Returns the created node and a HTTP/201 * status response on success. * - * @param \Pterodactyl\Http\Requests\Api\Application\Nodes\StoreNodeRequest $request - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ public function store(StoreNodeRequest $request): JsonResponse @@ -119,16 +104,14 @@ class NodeController extends ApplicationApiController /** * Update an existing node on the Panel. * - * @param \Pterodactyl\Http\Requests\Api\Application\Nodes\UpdateNodeRequest $request - * @param \Pterodactyl\Models\Node $node - * @return array - * * @throws \Throwable */ public function update(UpdateNodeRequest $request, Node $node): array { $node = $this->updateService->handle( - $node, $request->validated(), $request->input('reset_secret') === true + $node, + $request->validated(), + $request->input('reset_secret') === true ); return $this->fractal->item($node) @@ -140,10 +123,6 @@ class NodeController extends ApplicationApiController * Deletes a given node from the Panel as long as there are no servers * currently attached to it. * - * @param \Pterodactyl\Http\Requests\Api\Application\Nodes\DeleteNodeRequest $request - * @param \Pterodactyl\Models\Node $node - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Service\HasActiveServersException */ public function delete(DeleteNodeRequest $request, Node $node): JsonResponse diff --git a/app/Http/Controllers/Api/Application/Nodes/NodeDeploymentController.php b/app/Http/Controllers/Api/Application/Nodes/NodeDeploymentController.php index 411b7d45..1714bf7c 100644 --- a/app/Http/Controllers/Api/Application/Nodes/NodeDeploymentController.php +++ b/app/Http/Controllers/Api/Application/Nodes/NodeDeploymentController.php @@ -16,8 +16,6 @@ class NodeDeploymentController extends ApplicationApiController /** * NodeDeploymentController constructor. - * - * @param \Pterodactyl\Services\Deployment\FindViableNodesService $viableNodesService */ public function __construct(FindViableNodesService $viableNodesService) { @@ -31,9 +29,6 @@ class NodeDeploymentController extends ApplicationApiController * similarly to the server creation process, but allows you to pass the deployment object * to this endpoint and get back a list of all Nodes satisfying the requirements. * - * @param \Pterodactyl\Http\Requests\Api\Application\Nodes\GetDeployableNodesRequest $request - * @return array - * * @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableNodeException */ public function __invoke(GetDeployableNodesRequest $request): array diff --git a/app/Http/Controllers/Api/Application/Servers/DatabaseController.php b/app/Http/Controllers/Api/Application/Servers/DatabaseController.php index 829a6ca5..73f96737 100644 --- a/app/Http/Controllers/Api/Application/Servers/DatabaseController.php +++ b/app/Http/Controllers/Api/Application/Servers/DatabaseController.php @@ -35,10 +35,6 @@ class DatabaseController extends ApplicationApiController /** * DatabaseController constructor. - * - * @param \Pterodactyl\Services\Databases\DatabaseManagementService $databaseManagementService - * @param \Pterodactyl\Services\Databases\DatabasePasswordService $databasePasswordService - * @param \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface $repository */ public function __construct( DatabaseManagementService $databaseManagementService, @@ -55,10 +51,6 @@ class DatabaseController extends ApplicationApiController /** * Return a listing of all databases currently available to a single * server. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\Databases\GetServerDatabasesRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array */ public function index(GetServerDatabasesRequest $request, Server $server): array { @@ -69,11 +61,6 @@ class DatabaseController extends ApplicationApiController /** * Return a single server database. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\Databases\GetServerDatabaseRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Database $database - * @return array */ public function view(GetServerDatabaseRequest $request, Server $server, Database $database): array { @@ -85,11 +72,6 @@ class DatabaseController extends ApplicationApiController /** * Reset the password for a specific server database. * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\Databases\ServerDatabaseWriteRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Database $database - * @return \Illuminate\Http\JsonResponse - * * @throws \Throwable */ public function resetPassword(ServerDatabaseWriteRequest $request, Server $server, Database $database): JsonResponse @@ -102,10 +84,6 @@ class DatabaseController extends ApplicationApiController /** * Create a new database on the Panel for a given server. * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\Databases\StoreServerDatabaseRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\JsonResponse - * * @throws \Throwable */ public function store(StoreServerDatabaseRequest $request, Server $server): JsonResponse @@ -128,9 +106,6 @@ class DatabaseController extends ApplicationApiController /** * Handle a request to delete a specific server database from the Panel. * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\Databases\ServerDatabaseWriteRequest $request - * @return \Illuminate\Http\Response - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function delete(ServerDatabaseWriteRequest $request): Response diff --git a/app/Http/Controllers/Api/Application/Servers/ExternalServerController.php b/app/Http/Controllers/Api/Application/Servers/ExternalServerController.php index 391c5645..0cecb977 100644 --- a/app/Http/Controllers/Api/Application/Servers/ExternalServerController.php +++ b/app/Http/Controllers/Api/Application/Servers/ExternalServerController.php @@ -10,9 +10,6 @@ class ExternalServerController extends ApplicationApiController { /** * Retrieve a specific server from the database using its external ID. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\GetExternalServerRequest $request - * @return array */ public function index(GetExternalServerRequest $request): array { diff --git a/app/Http/Controllers/Api/Application/Servers/ServerController.php b/app/Http/Controllers/Api/Application/Servers/ServerController.php index 126c9192..79599972 100644 --- a/app/Http/Controllers/Api/Application/Servers/ServerController.php +++ b/app/Http/Controllers/Api/Application/Servers/ServerController.php @@ -35,10 +35,6 @@ class ServerController extends ApplicationApiController /** * ServerController constructor. - * - * @param \Pterodactyl\Services\Servers\ServerCreationService $creationService - * @param \Pterodactyl\Services\Servers\ServerDeletionService $deletionService - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository */ public function __construct( ServerCreationService $creationService, @@ -54,9 +50,6 @@ class ServerController extends ApplicationApiController /** * Return all of the servers that currently exist on the Panel. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\GetServersRequest $request - * @return array */ public function index(GetServersRequest $request): array { @@ -73,9 +66,6 @@ class ServerController extends ApplicationApiController /** * Create a new server on the system. * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\StoreServerRequest $request - * @return \Illuminate\Http\JsonResponse - * * @throws \Throwable * @throws \Illuminate\Validation\ValidationException * @throws \Pterodactyl\Exceptions\DisplayException @@ -95,9 +85,6 @@ class ServerController extends ApplicationApiController /** * Show a single server transformed for the application API. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\GetServerRequest $request - * @return array */ public function view(GetServerRequest $request): array { @@ -107,11 +94,6 @@ class ServerController extends ApplicationApiController } /** - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest $request - * @param \Pterodactyl\Models\Server $server - * @param string $force - * @return \Illuminate\Http\Response - * * @throws \Pterodactyl\Exceptions\DisplayException */ public function delete(ServerWriteRequest $request, Server $server, string $force = ''): Response diff --git a/app/Http/Controllers/Api/Application/Servers/ServerDetailsController.php b/app/Http/Controllers/Api/Application/Servers/ServerDetailsController.php index c2c3fa1c..06bbf6bc 100644 --- a/app/Http/Controllers/Api/Application/Servers/ServerDetailsController.php +++ b/app/Http/Controllers/Api/Application/Servers/ServerDetailsController.php @@ -24,9 +24,6 @@ class ServerDetailsController extends ApplicationApiController /** * ServerDetailsController constructor. - * - * @param \Pterodactyl\Services\Servers\BuildModificationService $buildModificationService - * @param \Pterodactyl\Services\Servers\DetailsModificationService $detailsModificationService */ public function __construct( BuildModificationService $buildModificationService, @@ -41,9 +38,6 @@ class ServerDetailsController extends ApplicationApiController /** * Update the details for a specific server. * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\UpdateServerDetailsRequest $request - * @return array - * * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -51,7 +45,8 @@ class ServerDetailsController extends ApplicationApiController public function details(UpdateServerDetailsRequest $request): array { $server = $this->detailsModificationService->returnUpdatedModel()->handle( - $request->getModel(Server::class), $request->validated() + $request->getModel(Server::class), + $request->validated() ); return $this->fractal->item($server) @@ -62,10 +57,6 @@ class ServerDetailsController extends ApplicationApiController /** * Update the build details for a specific server. * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\UpdateServerBuildConfigurationRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array - * * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException diff --git a/app/Http/Controllers/Api/Application/Servers/ServerManagementController.php b/app/Http/Controllers/Api/Application/Servers/ServerManagementController.php index 5052c884..ddbbbe1d 100644 --- a/app/Http/Controllers/Api/Application/Servers/ServerManagementController.php +++ b/app/Http/Controllers/Api/Application/Servers/ServerManagementController.php @@ -23,9 +23,6 @@ class ServerManagementController extends ApplicationApiController /** * SuspensionController constructor. - * - * @param \Pterodactyl\Services\Servers\ReinstallServerService $reinstallServerService - * @param \Pterodactyl\Services\Servers\SuspensionService $suspensionService */ public function __construct( ReinstallServerService $reinstallServerService, @@ -40,10 +37,6 @@ class ServerManagementController extends ApplicationApiController /** * Suspend a server on the Panel. * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\Response - * * @throws \Throwable */ public function suspend(ServerWriteRequest $request, Server $server): Response @@ -56,10 +49,6 @@ class ServerManagementController extends ApplicationApiController /** * Unsuspend a server on the Panel. * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\Response - * * @throws \Throwable */ public function unsuspend(ServerWriteRequest $request, Server $server): Response @@ -72,10 +61,6 @@ class ServerManagementController extends ApplicationApiController /** * Mark a server as needing to be reinstalled. * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\Response - * * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException diff --git a/app/Http/Controllers/Api/Application/Servers/StartupController.php b/app/Http/Controllers/Api/Application/Servers/StartupController.php index 0265af46..e8300754 100644 --- a/app/Http/Controllers/Api/Application/Servers/StartupController.php +++ b/app/Http/Controllers/Api/Application/Servers/StartupController.php @@ -18,8 +18,6 @@ class StartupController extends ApplicationApiController /** * StartupController constructor. - * - * @param \Pterodactyl\Services\Servers\StartupModificationService $modificationService */ public function __construct(StartupModificationService $modificationService) { @@ -31,9 +29,6 @@ class StartupController extends ApplicationApiController /** * Update the startup and environment settings for a specific server. * - * @param \Pterodactyl\Http\Requests\Api\Application\Servers\UpdateServerStartupRequest $request - * @return array - * * @throws \Illuminate\Validation\ValidationException * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException * @throws \Pterodactyl\Exceptions\Model\DataValidationException diff --git a/app/Http/Controllers/Api/Application/Users/ExternalUserController.php b/app/Http/Controllers/Api/Application/Users/ExternalUserController.php index f5813817..a253b6e1 100644 --- a/app/Http/Controllers/Api/Application/Users/ExternalUserController.php +++ b/app/Http/Controllers/Api/Application/Users/ExternalUserController.php @@ -10,9 +10,6 @@ class ExternalUserController extends ApplicationApiController { /** * Retrieve a specific user from the database using their external ID. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Users\GetExternalUserRequest $request - * @return array */ public function index(GetExternalUserRequest $request): array { diff --git a/app/Http/Controllers/Api/Application/Users/UserController.php b/app/Http/Controllers/Api/Application/Users/UserController.php index c8b309d8..41a13f66 100644 --- a/app/Http/Controllers/Api/Application/Users/UserController.php +++ b/app/Http/Controllers/Api/Application/Users/UserController.php @@ -41,11 +41,6 @@ class UserController extends ApplicationApiController /** * UserController constructor. - * - * @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository - * @param \Pterodactyl\Services\Users\UserCreationService $creationService - * @param \Pterodactyl\Services\Users\UserDeletionService $deletionService - * @param \Pterodactyl\Services\Users\UserUpdateService $updateService */ public function __construct( UserRepositoryInterface $repository, @@ -65,9 +60,6 @@ class UserController extends ApplicationApiController * Handle request to list all users on the panel. Returns a JSON-API representation * of a collection of users including any defined relations passed in * the request. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Users\GetUsersRequest $request - * @return array */ public function index(GetUsersRequest $request): array { @@ -84,10 +76,6 @@ class UserController extends ApplicationApiController /** * Handle a request to view a single user. Includes any relations that * were defined in the request. - * - * @param \Pterodactyl\Http\Requests\Api\Application\Users\GetUsersRequest $request - * @param \Pterodactyl\Models\User $user - * @return array */ public function view(GetUsersRequest $request, User $user): array { @@ -104,10 +92,6 @@ class UserController extends ApplicationApiController * Revocation errors are returned under the 'revocation_errors' key in the response * meta. If there are no errors this is an empty array. * - * @param \Pterodactyl\Http\Requests\Api\Application\Users\UpdateUserRequest $request - * @param \Pterodactyl\Models\User $user - * @return array - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -126,9 +110,6 @@ class UserController extends ApplicationApiController * Store a new user on the system. Returns the created user and a HTTP/201 * header on successful creation. * - * @param \Pterodactyl\Http\Requests\Api\Application\Users\StoreUserRequest $request - * @return \Illuminate\Http\JsonResponse - * * @throws \Exception * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ @@ -150,10 +131,6 @@ class UserController extends ApplicationApiController * Handle a request to delete a user from the Panel. Returns a HTTP/204 response * on successful deletion. * - * @param \Pterodactyl\Http\Requests\Api\Application\Users\DeleteUserRequest $request - * @param \Pterodactyl\Models\User $user - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\DisplayException */ public function delete(DeleteUserRequest $request, User $user): JsonResponse diff --git a/app/Http/Controllers/Api/Client/AccountController.php b/app/Http/Controllers/Api/Client/AccountController.php index 25900f05..5e790d47 100644 --- a/app/Http/Controllers/Api/Client/AccountController.php +++ b/app/Http/Controllers/Api/Client/AccountController.php @@ -25,9 +25,6 @@ class AccountController extends ClientApiController /** * AccountController constructor. - * - * @param \Illuminate\Auth\AuthManager $sessionGuard - * @param \Pterodactyl\Services\Users\UserUpdateService $updateService */ public function __construct(AuthManager $sessionGuard, UserUpdateService $updateService) { @@ -37,10 +34,6 @@ class AccountController extends ClientApiController $this->sessionGuard = $sessionGuard; } - /** - * @param Request $request - * @return array - */ public function index(Request $request): array { return $this->fractal->item($request->user()) @@ -51,9 +44,6 @@ class AccountController extends ClientApiController /** * Update the authenticated user's email address. * - * @param \Pterodactyl\Http\Requests\Api\Client\Account\UpdateEmailRequest $request - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -68,9 +58,6 @@ class AccountController extends ClientApiController * Update the authenticated user's password. All existing sessions will be logged * out immediately. * - * @param \Pterodactyl\Http\Requests\Api\Client\Account\UpdatePasswordRequest $request - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ diff --git a/app/Http/Controllers/Api/Client/ApiKeyController.php b/app/Http/Controllers/Api/Client/ApiKeyController.php index 5662e19c..34694d66 100644 --- a/app/Http/Controllers/Api/Client/ApiKeyController.php +++ b/app/Http/Controllers/Api/Client/ApiKeyController.php @@ -32,10 +32,6 @@ class ApiKeyController extends ClientApiController /** * ApiKeyController constructor. - * - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter - * @param \Pterodactyl\Services\Api\KeyCreationService $keyCreationService - * @param \Pterodactyl\Repositories\Eloquent\ApiKeyRepository $repository */ public function __construct( Encrypter $encrypter, @@ -52,7 +48,6 @@ class ApiKeyController extends ClientApiController /** * Returns all of the API keys that exist for the given client. * - * @param \Pterodactyl\Http\Requests\Api\Client\ClientApiRequest $request * @return array */ public function index(ClientApiRequest $request) @@ -65,7 +60,6 @@ class ApiKeyController extends ClientApiController /** * Store a new API key for a user's account. * - * @param \Pterodactyl\Http\Requests\Api\Client\Account\StoreApiKeyRequest $request * @return array * * @throws \Pterodactyl\Exceptions\DisplayException @@ -74,9 +68,7 @@ class ApiKeyController extends ClientApiController public function store(StoreApiKeyRequest $request) { if ($request->user()->apiKeys->count() >= 5) { - throw new DisplayException( - 'You have reached the account limit for number of API keys.' - ); + throw new DisplayException('You have reached the account limit for number of API keys.'); } $key = $this->keyCreationService->setKeyType(ApiKey::TYPE_ACCOUNT)->handle([ @@ -96,8 +88,6 @@ class ApiKeyController extends ClientApiController /** * Deletes a given API key. * - * @param \Pterodactyl\Http\Requests\Api\Client\ClientApiRequest $request - * @param string $identifier * @return \Illuminate\Http\JsonResponse */ public function delete(ClientApiRequest $request, string $identifier) @@ -108,8 +98,8 @@ class ApiKeyController extends ClientApiController 'identifier' => $identifier, ]); - if (! $response) { - throw new NotFoundHttpException; + if (!$response) { + throw new NotFoundHttpException(); } return JsonResponse::create([], JsonResponse::HTTP_NO_CONTENT); diff --git a/app/Http/Controllers/Api/Client/ClientApiController.php b/app/Http/Controllers/Api/Client/ClientApiController.php index 56c3db1f..c7f6f1a4 100644 --- a/app/Http/Controllers/Api/Client/ClientApiController.php +++ b/app/Http/Controllers/Api/Client/ClientApiController.php @@ -13,8 +13,6 @@ abstract class ClientApiController extends ApplicationApiController /** * Returns only the includes which are valid for the given transformer. * - * @param \Pterodactyl\Transformers\Api\Client\BaseClientTransformer $transformer - * @param array $merge * @return string[] */ protected function getIncludesForTransformer(BaseClientTransformer $transformer, array $merge = []) @@ -35,7 +33,7 @@ abstract class ClientApiController extends ApplicationApiController { $includes = $this->request->query('include') ?? []; - if (! is_string($includes)) { + if (!is_string($includes)) { return $includes; } @@ -47,7 +45,6 @@ abstract class ClientApiController extends ApplicationApiController /** * Return an instance of an application transformer. * - * @param string $abstract * @return \Pterodactyl\Transformers\Api\Client\BaseClientTransformer */ public function getTransformer(string $abstract) diff --git a/app/Http/Controllers/Api/Client/ClientController.php b/app/Http/Controllers/Api/Client/ClientController.php index 7c66b742..16923c56 100644 --- a/app/Http/Controllers/Api/Client/ClientController.php +++ b/app/Http/Controllers/Api/Client/ClientController.php @@ -20,8 +20,6 @@ class ClientController extends ClientApiController /** * ClientController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository */ public function __construct(ServerRepository $repository) { @@ -33,9 +31,6 @@ class ClientController extends ClientApiController /** * Return all of the servers available to the client making the API * request, including servers the user has access to as a subuser. - * - * @param \Pterodactyl\Http\Requests\Api\Client\GetServersRequest $request - * @return array */ public function index(GetServersRequest $request): array { @@ -49,7 +44,7 @@ class ClientController extends ClientApiController 'uuid', 'name', 'external_id', - AllowedFilter::custom('*', new MultiFieldServerFilter), + AllowedFilter::custom('*', new MultiFieldServerFilter()), ]); $type = $request->input('type'); @@ -60,7 +55,7 @@ class ClientController extends ClientApiController if (in_array($type, ['admin', 'admin-all'])) { // If they aren't an admin but want all the admin servers don't fail the request, just // make it a query that will never return any results back. - if (! $user->root_admin) { + if (!$user->root_admin) { $builder->whereRaw('1 = 2'); } else { $builder = $type === 'admin-all' diff --git a/app/Http/Controllers/Api/Client/Servers/BackupController.php b/app/Http/Controllers/Api/Client/Servers/BackupController.php index 84f7496b..2b83c63e 100644 --- a/app/Http/Controllers/Api/Client/Servers/BackupController.php +++ b/app/Http/Controllers/Api/Client/Servers/BackupController.php @@ -33,10 +33,6 @@ class BackupController extends ClientApiController /** * BackupController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\BackupRepository $repository - * @param \Pterodactyl\Services\Backups\DeleteBackupService $deleteBackupService - * @param \Pterodactyl\Services\Backups\InitiateBackupService $initiateBackupService */ public function __construct( BackupRepository $repository, @@ -54,8 +50,6 @@ class BackupController extends ClientApiController * Returns all of the backups for a given server instance in a paginated * result set. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Backups\GetBackupsRequest $request - * @param \Pterodactyl\Models\Server $server * @return array */ public function index(GetBackupsRequest $request, Server $server) @@ -70,8 +64,6 @@ class BackupController extends ClientApiController /** * Starts the backup process for a server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Backups\StoreBackupRequest $request - * @param \Pterodactyl\Models\Server $server * @return array * * @throws \Exception|\Throwable @@ -92,9 +84,6 @@ class BackupController extends ClientApiController /** * Returns information about a single backup. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Backups\GetBackupsRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Backup $backup * @return array */ public function view(GetBackupsRequest $request, Server $server, Backup $backup) @@ -108,9 +97,6 @@ class BackupController extends ClientApiController * Deletes a backup from the panel as well as the remote source where it is currently * being stored. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Backups\DeleteBackupRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Backup $backup * @return \Illuminate\Http\JsonResponse * * @throws \Throwable diff --git a/app/Http/Controllers/Api/Client/Servers/CommandController.php b/app/Http/Controllers/Api/Client/Servers/CommandController.php index b8390673..f9663138 100644 --- a/app/Http/Controllers/Api/Client/Servers/CommandController.php +++ b/app/Http/Controllers/Api/Client/Servers/CommandController.php @@ -21,8 +21,6 @@ class CommandController extends ClientApiController /** * CommandController constructor. - * - * @param \Pterodactyl\Repositories\Wings\DaemonCommandRepository $repository */ public function __construct(DaemonCommandRepository $repository) { @@ -34,10 +32,6 @@ class CommandController extends ClientApiController /** * Send a command to a running server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\SendCommandRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\Response - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function index(SendCommandRequest $request, Server $server): Response @@ -52,9 +46,7 @@ class CommandController extends ClientApiController $previous->getResponse() instanceof ResponseInterface && $previous->getResponse()->getStatusCode() === Response::HTTP_BAD_GATEWAY ) { - throw new HttpException( - Response::HTTP_BAD_GATEWAY, 'Server must be online in order to send commands.', $exception - ); + throw new HttpException(Response::HTTP_BAD_GATEWAY, 'Server must be online in order to send commands.', $exception); } } diff --git a/app/Http/Controllers/Api/Client/Servers/DatabaseController.php b/app/Http/Controllers/Api/Client/Servers/DatabaseController.php index 2eacfb9e..4f9aed59 100644 --- a/app/Http/Controllers/Api/Client/Servers/DatabaseController.php +++ b/app/Http/Controllers/Api/Client/Servers/DatabaseController.php @@ -40,11 +40,6 @@ class DatabaseController extends ClientApiController /** * DatabaseController constructor. - * - * @param \Pterodactyl\Services\Databases\DatabaseManagementService $managementService - * @param \Pterodactyl\Services\Databases\DatabasePasswordService $passwordService - * @param \Pterodactyl\Repositories\Eloquent\DatabaseRepository $repository - * @param \Pterodactyl\Services\Databases\DeployServerDatabaseService $deployDatabaseService */ public function __construct( DatabaseManagementService $managementService, @@ -62,10 +57,6 @@ class DatabaseController extends ClientApiController /** * Return all of the databases that belong to the given server. - * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Databases\GetDatabasesRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array */ public function index(GetDatabasesRequest $request, Server $server): array { @@ -77,10 +68,6 @@ class DatabaseController extends ClientApiController /** * Create a new database for the given server and return it. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Databases\StoreDatabaseRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array - * * @throws \Throwable * @throws \Pterodactyl\Exceptions\Service\Database\TooManyDatabasesException * @throws \Pterodactyl\Exceptions\Service\Database\DatabaseClientFeatureNotEnabledException @@ -99,9 +86,6 @@ class DatabaseController extends ClientApiController * Rotates the password for the given server model and returns a fresh instance to * the caller. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Databases\RotatePasswordRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Database $database * @return array * * @throws \Throwable @@ -120,11 +104,6 @@ class DatabaseController extends ClientApiController /** * Removes a database from the server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Databases\DeleteDatabaseRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Database $database - * @return \Illuminate\Http\Response - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function delete(DeleteDatabaseRequest $request, Server $server, Database $database): Response diff --git a/app/Http/Controllers/Api/Client/Servers/DownloadBackupController.php b/app/Http/Controllers/Api/Client/Servers/DownloadBackupController.php index 0c6d09ce..c45f92c1 100644 --- a/app/Http/Controllers/Api/Client/Servers/DownloadBackupController.php +++ b/app/Http/Controllers/Api/Client/Servers/DownloadBackupController.php @@ -39,11 +39,6 @@ class DownloadBackupController extends ClientApiController /** * DownloadBackupController constructor. - * - * @param \Pterodactyl\Repositories\Wings\DaemonBackupRepository $daemonBackupRepository - * @param \Pterodactyl\Services\Nodes\NodeJWTService $jwtService - * @param \Pterodactyl\Extensions\Backups\BackupManager $backupManager - * @param \Illuminate\Contracts\Routing\ResponseFactory $responseFactory */ public function __construct( DaemonBackupRepository $daemonBackupRepository, @@ -64,9 +59,6 @@ class DownloadBackupController extends ClientApiController * will be streamed back through the Panel. For AWS S3 files, a signed URL will be generated * which the user is redirected to. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Backups\DownloadBackupRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Backup $backup * @return \Illuminate\Http\JsonResponse */ public function __invoke(DownloadBackupRequest $request, Server $server, Backup $backup) @@ -79,7 +71,7 @@ class DownloadBackupController extends ClientApiController $url = $this->getS3BackupUrl($backup, $server); break; default: - throw new BadRequestHttpException; + throw new BadRequestHttpException(); } return new JsonResponse([ @@ -94,8 +86,6 @@ class DownloadBackupController extends ClientApiController * Returns a signed URL that allows us to download a file directly out of a non-public * S3 bucket by using a signed URL. * - * @param \Pterodactyl\Models\Backup $backup - * @param \Pterodactyl\Models\Server $server * @return string */ protected function getS3BackupUrl(Backup $backup, Server $server) @@ -120,9 +110,6 @@ class DownloadBackupController extends ClientApiController /** * Returns a download link a backup stored on a wings instance. * - * @param \Pterodactyl\Models\Backup $backup - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\User $user * @return string */ protected function getLocalBackupUrl(Backup $backup, Server $server, User $user) diff --git a/app/Http/Controllers/Api/Client/Servers/FileController.php b/app/Http/Controllers/Api/Client/Servers/FileController.php index 0b764e5d..9e199786 100644 --- a/app/Http/Controllers/Api/Client/Servers/FileController.php +++ b/app/Http/Controllers/Api/Client/Servers/FileController.php @@ -42,10 +42,6 @@ class FileController extends ClientApiController /** * FileController constructor. - * - * @param \Illuminate\Contracts\Routing\ResponseFactory $responseFactory - * @param \Pterodactyl\Services\Nodes\NodeJWTService $jwtService - * @param \Pterodactyl\Repositories\Wings\DaemonFileRepository $fileRepository */ public function __construct( ResponseFactory $responseFactory, @@ -62,10 +58,6 @@ class FileController extends ClientApiController /** * Returns a listing of files in a given directory. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\ListFilesRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function directory(ListFilesRequest $request, Server $server): array @@ -82,10 +74,6 @@ class FileController extends ClientApiController /** * Return the contents of a specified file for the user. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\GetFileContentsRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\Response - * * @throws \Pterodactyl\Exceptions\Http\Server\FileSizeTooLargeException * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ @@ -93,7 +81,8 @@ class FileController extends ClientApiController { return new Response( $this->fileRepository->setServer($server)->getContent( - $request->get('file'), config('pterodactyl.files.max_edit_size') + $request->get('file'), + config('pterodactyl.files.max_edit_size') ), Response::HTTP_OK, ['Content-Type' => 'text/plain'] @@ -104,8 +93,6 @@ class FileController extends ClientApiController * Generates a one-time token with a link that the user can use to * download a given file. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\GetFileContentsRequest $request - * @param \Pterodactyl\Models\Server $server * @return array * * @throws \Exception @@ -135,10 +122,6 @@ class FileController extends ClientApiController /** * Writes the contents of the specified file to the server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\WriteFileContentRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function write(WriteFileContentRequest $request, Server $server): JsonResponse @@ -151,10 +134,6 @@ class FileController extends ClientApiController /** * Creates a new folder on the server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\CreateFolderRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function create(CreateFolderRequest $request, Server $server): JsonResponse @@ -169,10 +148,6 @@ class FileController extends ClientApiController /** * Renames a file on the remote machine. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\RenameFileRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function rename(RenameFileRequest $request, Server $server): JsonResponse @@ -187,10 +162,6 @@ class FileController extends ClientApiController /** * Copies a file on the server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\CopyFileRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function copy(CopyFileRequest $request, Server $server): JsonResponse @@ -203,10 +174,6 @@ class FileController extends ClientApiController } /** - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\CompressFilesRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function compress(CompressFilesRequest $request, Server $server): array @@ -216,7 +183,8 @@ class FileController extends ClientApiController $file = $this->fileRepository->setServer($server) ->compressFiles( - $request->input('root'), $request->input('files') + $request->input('root'), + $request->input('files') ); return $this->fractal->item($file) @@ -225,10 +193,6 @@ class FileController extends ClientApiController } /** - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\DecompressFilesRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function decompress(DecompressFilesRequest $request, Server $server): JsonResponse @@ -245,17 +209,14 @@ class FileController extends ClientApiController /** * Deletes files or folders for the server in the given root directory. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\DeleteFileRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function delete(DeleteFileRequest $request, Server $server): JsonResponse { $this->fileRepository->setServer($server) ->deleteFiles( - $request->input('root'), $request->input('files') + $request->input('root'), + $request->input('files') ); return new JsonResponse([], Response::HTTP_NO_CONTENT); @@ -264,17 +225,14 @@ class FileController extends ClientApiController /** * Updates file permissions for file(s) in the given root directory. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\ChmodFilesRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function chmod(ChmodFilesRequest $request, Server $server): JsonResponse { $this->fileRepository->setServer($server) ->chmodFiles( - $request->input('root'), $request->input('files') + $request->input('root'), + $request->input('files') ); return new JsonResponse([], Response::HTTP_NO_CONTENT); @@ -284,8 +242,6 @@ class FileController extends ClientApiController * Requests that a file be downloaded from a remote location by Wings. * * @param $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\JsonResponse * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ diff --git a/app/Http/Controllers/Api/Client/Servers/FileUploadController.php b/app/Http/Controllers/Api/Client/Servers/FileUploadController.php index 3ba84362..236273c7 100644 --- a/app/Http/Controllers/Api/Client/Servers/FileUploadController.php +++ b/app/Http/Controllers/Api/Client/Servers/FileUploadController.php @@ -19,8 +19,6 @@ class FileUploadController extends ClientApiController /** * FileUploadController constructor. - * - * @param \Pterodactyl\Services\Nodes\NodeJWTService $jwtService */ public function __construct( NodeJWTService $jwtService @@ -33,9 +31,6 @@ class FileUploadController extends ClientApiController /** * Returns a url where files can be uploaded to. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Files\UploadFileRequest $request - * @param \Pterodactyl\Models\Server $server - * * @return \Illuminate\Http\JsonResponse */ public function __invoke(UploadFileRequest $request, Server $server) @@ -51,8 +46,6 @@ class FileUploadController extends ClientApiController /** * Returns a url where files can be uploaded to. * - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\User $user * @return string */ protected function getUploadUrl(Server $server, User $user) diff --git a/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php b/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php index 5af97ab5..855cb678 100644 --- a/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php +++ b/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php @@ -36,10 +36,6 @@ class NetworkAllocationController extends ClientApiController /** * NetworkController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\AllocationRepository $repository - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $serverRepository - * @param \Pterodactyl\Services\Allocations\FindAssignableAllocationService $assignableAllocationService */ public function __construct( AllocationRepository $repository, @@ -56,10 +52,6 @@ class NetworkAllocationController extends ClientApiController /** * Lists all of the allocations available to a server and wether or * not they are currently assigned as the primary for this server. - * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Network\GetNetworkRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array */ public function index(GetNetworkRequest $request, Server $server): array { @@ -71,11 +63,6 @@ class NetworkAllocationController extends ClientApiController /** * Set the primary allocation for a server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Network\UpdateAllocationRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Allocation $allocation - * @return array - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -93,11 +80,6 @@ class NetworkAllocationController extends ClientApiController /** * Set the primary allocation for a server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Network\SetPrimaryAllocationRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Allocation $allocation - * @return array - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -114,18 +96,12 @@ class NetworkAllocationController extends ClientApiController * Set the notes for the allocation for a server. *s. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Network\NewAllocationRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array - * * @throws \Pterodactyl\Exceptions\DisplayException */ public function store(NewAllocationRequest $request, Server $server): array { if ($server->allocations()->count() >= $server->allocation_limit) { - throw new DisplayException( - 'Cannot assign additional allocations to this server: limit has been reached.' - ); + throw new DisplayException('Cannot assign additional allocations to this server: limit has been reached.'); } $allocation = $this->assignableAllocationService->handle($server); @@ -138,9 +114,6 @@ class NetworkAllocationController extends ClientApiController /** * Delete an allocation from a server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Network\DeleteAllocationRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Allocation $allocation * @return \Illuminate\Http\JsonResponse * * @throws \Pterodactyl\Exceptions\DisplayException @@ -148,9 +121,7 @@ class NetworkAllocationController extends ClientApiController public function delete(DeleteAllocationRequest $request, Server $server, Allocation $allocation) { if ($allocation->id === $server->allocation_id) { - throw new DisplayException( - 'You cannot delete the primary allocation for this server.' - ); + throw new DisplayException('You cannot delete the primary allocation for this server.'); } Allocation::query()->where('id', $allocation->id)->update([ diff --git a/app/Http/Controllers/Api/Client/Servers/PowerController.php b/app/Http/Controllers/Api/Client/Servers/PowerController.php index 12e2d75b..984a1edc 100644 --- a/app/Http/Controllers/Api/Client/Servers/PowerController.php +++ b/app/Http/Controllers/Api/Client/Servers/PowerController.php @@ -17,8 +17,6 @@ class PowerController extends ClientApiController /** * PowerController constructor. - * - * @param \Pterodactyl\Repositories\Wings\DaemonPowerRepository $repository */ public function __construct(DaemonPowerRepository $repository) { @@ -30,10 +28,6 @@ class PowerController extends ClientApiController /** * Send a power action to a server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\SendPowerRequest $request - * @param \Pterodactyl\Models\Server $server - * @return \Illuminate\Http\Response - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function index(SendPowerRequest $request, Server $server): Response diff --git a/app/Http/Controllers/Api/Client/Servers/ResourceUtilizationController.php b/app/Http/Controllers/Api/Client/Servers/ResourceUtilizationController.php index 0d56c21b..4cf0d249 100644 --- a/app/Http/Controllers/Api/Client/Servers/ResourceUtilizationController.php +++ b/app/Http/Controllers/Api/Client/Servers/ResourceUtilizationController.php @@ -17,8 +17,6 @@ class ResourceUtilizationController extends ClientApiController /** * ResourceUtilizationController constructor. - * - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $repository */ public function __construct(DaemonServerRepository $repository) { @@ -30,10 +28,6 @@ class ResourceUtilizationController extends ClientApiController /** * Return the current resource utilization for a server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\GetServerRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function __invoke(GetServerRequest $request, Server $server): array diff --git a/app/Http/Controllers/Api/Client/Servers/ScheduleController.php b/app/Http/Controllers/Api/Client/Servers/ScheduleController.php index 5d86c759..32013359 100644 --- a/app/Http/Controllers/Api/Client/Servers/ScheduleController.php +++ b/app/Http/Controllers/Api/Client/Servers/ScheduleController.php @@ -37,9 +37,6 @@ class ScheduleController extends ClientApiController /** * ScheduleController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\ScheduleRepository $repository - * @param \Pterodactyl\Services\Schedules\ProcessScheduleService $service */ public function __construct(ScheduleRepository $repository, ProcessScheduleService $service) { @@ -52,8 +49,6 @@ class ScheduleController extends ClientApiController /** * Returns all of the schedules belonging to a given server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\ViewScheduleRequest $request - * @param \Pterodactyl\Models\Server $server * @return array */ public function index(ViewScheduleRequest $request, Server $server) @@ -69,8 +64,6 @@ class ScheduleController extends ClientApiController /** * Store a new schedule for a server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\StoreScheduleRequest $request - * @param \Pterodactyl\Models\Server $server * @return array * * @throws \Pterodactyl\Exceptions\DisplayException @@ -99,15 +92,12 @@ class ScheduleController extends ClientApiController /** * Returns a specific schedule for the server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\ViewScheduleRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Schedule $schedule * @return array */ public function view(ViewScheduleRequest $request, Server $server, Schedule $schedule) { if ($schedule->server_id !== $server->id) { - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } $schedule->loadMissing('tasks'); @@ -120,9 +110,6 @@ class ScheduleController extends ClientApiController /** * Updates a given schedule with the new data provided. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\UpdateScheduleRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Schedule $schedule * @return array * * @throws \Pterodactyl\Exceptions\DisplayException @@ -163,19 +150,14 @@ class ScheduleController extends ClientApiController * Executes a given schedule immediately rather than waiting on it's normally scheduled time * to pass. This does not care about the schedule state. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\TriggerScheduleRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Schedule $schedule * @return \Illuminate\Http\JsonResponse * * @throws \Throwable */ public function execute(TriggerScheduleRequest $request, Server $server, Schedule $schedule) { - if (! $schedule->is_active) { - throw new BadRequestHttpException( - 'Cannot trigger schedule exection for a schedule that is not currently active.' - ); + if (!$schedule->is_active) { + throw new BadRequestHttpException('Cannot trigger schedule exection for a schedule that is not currently active.'); } $this->service->handle($schedule, true); @@ -186,9 +168,6 @@ class ScheduleController extends ClientApiController /** * Deletes a schedule and it's associated tasks. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\DeleteScheduleRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Schedule $schedule * @return \Illuminate\Http\JsonResponse */ public function delete(DeleteScheduleRequest $request, Server $server, Schedule $schedule) @@ -201,8 +180,6 @@ class ScheduleController extends ClientApiController /** * Get the next run timestamp based on the cron data provided. * - * @param \Illuminate\Http\Request $request - * @return \Carbon\Carbon * @throws \Pterodactyl\Exceptions\DisplayException */ protected function getNextRunAt(Request $request): Carbon @@ -216,9 +193,7 @@ class ScheduleController extends ClientApiController $request->input('day_of_week') ); } catch (Exception $exception) { - throw new DisplayException( - 'The cron data provided does not evaluate to a valid expression.' - ); + throw new DisplayException('The cron data provided does not evaluate to a valid expression.'); } } } diff --git a/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php b/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php index c6f8ee33..a652071a 100644 --- a/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php +++ b/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php @@ -26,8 +26,6 @@ class ScheduleTaskController extends ClientApiController /** * ScheduleTaskController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\TaskRepository $repository */ public function __construct(TaskRepository $repository) { @@ -39,9 +37,6 @@ class ScheduleTaskController extends ClientApiController /** * Create a new task for a given schedule and store it in the database. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\StoreTaskRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Schedule $schedule * @return array * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -51,9 +46,7 @@ class ScheduleTaskController extends ClientApiController { $limit = config('pterodactyl.client_features.schedules.per_schedule_task_limit', 10); if ($schedule->tasks()->count() >= $limit) { - throw new ServiceLimitExceededException( - "Schedules may not have more than {$limit} tasks associated with them. Creating this task would put this schedule over the limit." - ); + throw new ServiceLimitExceededException("Schedules may not have more than {$limit} tasks associated with them. Creating this task would put this schedule over the limit."); } /** @var \Pterodactyl\Models\Task|null $lastTask */ @@ -76,10 +69,6 @@ class ScheduleTaskController extends ClientApiController /** * Updates a given task for a server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\StoreTaskRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Schedule $schedule - * @param \Pterodactyl\Models\Task $task * @return array * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -88,7 +77,7 @@ class ScheduleTaskController extends ClientApiController public function update(StoreTaskRequest $request, Server $server, Schedule $schedule, Task $task) { if ($schedule->id !== $task->schedule_id || $server->id !== $schedule->server_id) { - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } $this->repository->update($task->id, [ @@ -106,10 +95,6 @@ class ScheduleTaskController extends ClientApiController * Delete a given task for a schedule. If there are subsequent tasks stored in the database * for this schedule their sequence IDs are decremented properly. * - * @param \Pterodactyl\Http\Requests\Api\Client\ClientApiRequest $request - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\Schedule $schedule - * @param \Pterodactyl\Models\Task $task * @return \Illuminate\Http\JsonResponse * * @throws \Exception @@ -117,10 +102,10 @@ class ScheduleTaskController extends ClientApiController public function delete(ClientApiRequest $request, Server $server, Schedule $schedule, Task $task) { if ($task->schedule_id !== $schedule->id || $schedule->server_id !== $server->id) { - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } - if (! $request->user()->can(Permission::ACTION_SCHEDULE_UPDATE, $server)) { + if (!$request->user()->can(Permission::ACTION_SCHEDULE_UPDATE, $server)) { throw new HttpForbiddenException('You do not have permission to perform this action.'); } diff --git a/app/Http/Controllers/Api/Client/Servers/ServerController.php b/app/Http/Controllers/Api/Client/Servers/ServerController.php index 96e27632..82091c48 100644 --- a/app/Http/Controllers/Api/Client/Servers/ServerController.php +++ b/app/Http/Controllers/Api/Client/Servers/ServerController.php @@ -23,9 +23,6 @@ class ServerController extends ClientApiController /** * ServerController constructor. - * - * @param \Pterodactyl\Services\Servers\GetUserPermissionsService $permissionsService - * @param \Pterodactyl\Repositories\Eloquent\SubuserRepository $repository */ public function __construct(GetUserPermissionsService $permissionsService, SubuserRepository $repository) { @@ -38,10 +35,6 @@ class ServerController extends ClientApiController /** * Transform an individual server into a response that can be consumed by a * client using the API. - * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\GetServerRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array */ public function index(GetServerRequest $request, Server $server): array { diff --git a/app/Http/Controllers/Api/Client/Servers/SettingsController.php b/app/Http/Controllers/Api/Client/Servers/SettingsController.php index 1e0b4aad..110cd086 100644 --- a/app/Http/Controllers/Api/Client/Servers/SettingsController.php +++ b/app/Http/Controllers/Api/Client/Servers/SettingsController.php @@ -27,9 +27,6 @@ class SettingsController extends ClientApiController /** * SettingsController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository - * @param \Pterodactyl\Services\Servers\ReinstallServerService $reinstallServerService */ public function __construct( ServerRepository $repository, @@ -44,8 +41,6 @@ class SettingsController extends ClientApiController /** * Renames a server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Settings\RenameServerRequest $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\JsonResponse * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -63,8 +58,6 @@ class SettingsController extends ClientApiController /** * Reinstalls the server on the daemon. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Settings\ReinstallServerRequest $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\JsonResponse * * @throws \Throwable @@ -79,18 +72,14 @@ class SettingsController extends ClientApiController /** * Changes the Docker image in use by the server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Settings\SetDockerImageRequest $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\JsonResponse * * @throws \Throwable */ public function dockerImage(SetDockerImageRequest $request, Server $server) { - if (! in_array($server->image, $server->egg->docker_images)) { - throw new BadRequestHttpException( - 'This server\'s Docker image has been manually set by an administrator and cannot be updated.' - ); + 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.'); } $server->forceFill(['image' => $request->input('docker_image')])->saveOrFail(); diff --git a/app/Http/Controllers/Api/Client/Servers/StartupController.php b/app/Http/Controllers/Api/Client/Servers/StartupController.php index 76f59546..06b4a506 100644 --- a/app/Http/Controllers/Api/Client/Servers/StartupController.php +++ b/app/Http/Controllers/Api/Client/Servers/StartupController.php @@ -31,10 +31,6 @@ class StartupController extends ClientApiController /** * StartupController constructor. - * - * @param \Pterodactyl\Services\Servers\VariableValidatorService $service - * @param \Pterodactyl\Services\Servers\StartupCommandService $startupCommandService - * @param \Pterodactyl\Repositories\Eloquent\ServerVariableRepository $repository */ public function __construct(VariableValidatorService $service, StartupCommandService $startupCommandService, ServerVariableRepository $repository) { @@ -48,8 +44,6 @@ class StartupController extends ClientApiController /** * Returns the startup information for the server including all of the variables. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Startup\GetStartupRequest $request - * @param \Pterodactyl\Models\Server $server * @return array */ public function index(GetStartupRequest $request, Server $server) @@ -71,8 +65,6 @@ class StartupController extends ClientApiController /** * Updates a single variable for a server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Startup\UpdateStartupVariableRequest $request - * @param \Pterodactyl\Models\Server $server * @return array * * @throws \Illuminate\Validation\ValidationException @@ -84,14 +76,10 @@ class StartupController extends ClientApiController /** @var \Pterodactyl\Models\EggVariable $variable */ $variable = $server->variables()->where('env_variable', $request->input('key'))->first(); - if (is_null($variable) || ! $variable->user_viewable) { - throw new BadRequestHttpException( - 'The environment variable you are trying to edit does not exist.' - ); - } elseif (! $variable->user_editable) { - throw new BadRequestHttpException( - 'The environment variable you are trying to edit is read-only.' - ); + if (is_null($variable) || !$variable->user_viewable) { + throw new BadRequestHttpException('The environment variable you are trying to edit does not exist.'); + } elseif (!$variable->user_editable) { + throw new BadRequestHttpException('The environment variable you are trying to edit is read-only.'); } // Revalidate the variable value using the egg variable specific validation rules for it. diff --git a/app/Http/Controllers/Api/Client/Servers/SubuserController.php b/app/Http/Controllers/Api/Client/Servers/SubuserController.php index 81238d33..68f32cf8 100644 --- a/app/Http/Controllers/Api/Client/Servers/SubuserController.php +++ b/app/Http/Controllers/Api/Client/Servers/SubuserController.php @@ -37,10 +37,6 @@ class SubuserController extends ClientApiController /** * SubuserController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\SubuserRepository $repository - * @param \Pterodactyl\Services\Subusers\SubuserCreationService $creationService - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $serverRepository */ public function __construct( SubuserRepository $repository, @@ -57,8 +53,6 @@ class SubuserController extends ClientApiController /** * Return the users associated with this server instance. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Subusers\GetSubuserRequest $request - * @param \Pterodactyl\Models\Server $server * @return array */ public function index(GetSubuserRequest $request, Server $server) @@ -71,7 +65,6 @@ class SubuserController extends ClientApiController /** * Returns a single subuser associated with this server instance. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Subusers\GetSubuserRequest $request * @return array */ public function view(GetSubuserRequest $request) @@ -86,8 +79,6 @@ class SubuserController extends ClientApiController /** * Create a new subuser for the given server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Subusers\StoreSubuserRequest $request - * @param \Pterodactyl\Models\Server $server * @return array * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -98,7 +89,9 @@ class SubuserController extends ClientApiController public function store(StoreSubuserRequest $request, Server $server) { $response = $this->creationService->handle( - $server, $request->input('email'), $this->getDefaultPermissions($request) + $server, + $request->input('email'), + $this->getDefaultPermissions($request) ); return $this->fractal->item($response) @@ -109,10 +102,6 @@ class SubuserController extends ClientApiController /** * Update a given subuser in the system for the server. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Subusers\UpdateSubuserRequest $request - * @param \Pterodactyl\Models\Server $server - * @return array - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -151,8 +140,6 @@ class SubuserController extends ClientApiController /** * Removes a subusers from a server's assignment. * - * @param \Pterodactyl\Http\Requests\Api\Client\Servers\Subusers\DeleteSubuserRequest $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\JsonResponse */ public function delete(DeleteSubuserRequest $request, Server $server) @@ -174,9 +161,6 @@ class SubuserController extends ClientApiController /** * Returns the default permissions for all subusers to ensure none are ever removed wrongly. - * - * @param \Illuminate\Http\Request $request - * @return array */ protected function getDefaultPermissions(Request $request): array { diff --git a/app/Http/Controllers/Api/Client/Servers/WebsocketController.php b/app/Http/Controllers/Api/Client/Servers/WebsocketController.php index b1a82f53..08abee27 100644 --- a/app/Http/Controllers/Api/Client/Servers/WebsocketController.php +++ b/app/Http/Controllers/Api/Client/Servers/WebsocketController.php @@ -26,9 +26,6 @@ class WebsocketController extends ClientApiController /** * WebsocketController constructor. - * - * @param \Pterodactyl\Services\Nodes\NodeJWTService $jwtService - * @param \Pterodactyl\Services\Servers\GetUserPermissionsService $permissionsService */ public function __construct( NodeJWTService $jwtService, @@ -46,8 +43,6 @@ class WebsocketController extends ClientApiController * allows us to continually renew this token and avoid users mainitaining sessions wrongly, * as well as ensure that user's only perform actions they're allowed to. * - * @param \Pterodactyl\Http\Requests\Api\Client\ClientApiRequest $request - * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\JsonResponse */ public function __invoke(ClientApiRequest $request, Server $server) @@ -60,9 +55,9 @@ class WebsocketController extends ClientApiController $permissions = $this->permissionsService->handle($server, $user); $node = $server->node; - if (! is_null($server->transfer)) { + if (!is_null($server->transfer)) { // Check if the user has permissions to receive transfer logs. - if (! in_array('admin.websocket.transfer', $permissions)) { + if (!in_array('admin.websocket.transfer', $permissions)) { throw new HttpForbiddenException('You do not have permission to view server transfer logs.'); } diff --git a/app/Http/Controllers/Api/Client/TwoFactorController.php b/app/Http/Controllers/Api/Client/TwoFactorController.php index 93be78fb..4f7145ad 100644 --- a/app/Http/Controllers/Api/Client/TwoFactorController.php +++ b/app/Http/Controllers/Api/Client/TwoFactorController.php @@ -31,10 +31,6 @@ class TwoFactorController extends ClientApiController /** * TwoFactorController constructor. - * - * @param \Pterodactyl\Services\Users\ToggleTwoFactorService $toggleTwoFactorService - * @param \Pterodactyl\Services\Users\TwoFactorSetupService $setupService - * @param \Illuminate\Contracts\Validation\Factory $validation */ public function __construct( ToggleTwoFactorService $toggleTwoFactorService, @@ -53,7 +49,6 @@ class TwoFactorController extends ClientApiController * it on their account. If two-factor is already enabled this endpoint * will return a 400 error. * - * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\JsonResponse * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -75,7 +70,6 @@ class TwoFactorController extends ClientApiController /** * Updates a user's account to have two-factor enabled. * - * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\JsonResponse * * @throws \Illuminate\Validation\ValidationException @@ -110,15 +104,12 @@ class TwoFactorController extends ClientApiController * Disables two-factor authentication on an account if the password provided * is valid. * - * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\JsonResponse */ public function delete(Request $request) { - if (! password_verify($request->input('password') ?? '', $request->user()->password)) { - throw new BadRequestHttpException( - 'The password provided was not valid.' - ); + if (!password_verify($request->input('password') ?? '', $request->user()->password)) { + throw new BadRequestHttpException('The password provided was not valid.'); } /** @var \Pterodactyl\Models\User $user */ diff --git a/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php b/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php index e89783b7..042486c2 100644 --- a/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php +++ b/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php @@ -15,7 +15,7 @@ use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; class BackupRemoteUploadController extends Controller { - const PART_SIZE = 5 * 1024 * 1024 * 1024; + public const PART_SIZE = 5 * 1024 * 1024 * 1024; /** * @var \Pterodactyl\Repositories\Eloquent\BackupRepository @@ -29,9 +29,6 @@ class BackupRemoteUploadController extends Controller /** * BackupRemoteUploadController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\BackupRepository $repository - * @param \Pterodactyl\Extensions\Backups\BackupManager $backupManager */ public function __construct(BackupRepository $repository, BackupManager $backupManager) { @@ -42,9 +39,6 @@ class BackupRemoteUploadController extends Controller /** * Returns the required presigned urls to upload a backup to S3 cloud storage. * - * @param \Illuminate\Http\Request $request - * @param string $backup - * * @return \Illuminate\Http\JsonResponse * * @throws \Exception @@ -64,13 +58,13 @@ class BackupRemoteUploadController extends Controller // Prevent backups that have already been completed from trying to // be uploaded again. - if (! is_null($backup->completed_at)) { + if (!is_null($backup->completed_at)) { throw new ConflictHttpException('This backup is already in a completed state.'); } // Ensure we are using the S3 adapter. $adapter = $this->backupManager->adapter(); - if (! $adapter instanceof AwsS3Adapter) { + if (!$adapter instanceof AwsS3Adapter) { throw new BadRequestHttpException('The configured backup adapter is not an S3 compatible adapter.'); } @@ -97,9 +91,10 @@ class BackupRemoteUploadController extends Controller // Create as many UploadPart presigned urls as needed $parts = []; - for ($i = 0; $i < ($size / self::PART_SIZE); $i++) { + for ($i = 0; $i < ($size / self::PART_SIZE); ++$i) { $parts[] = $client->createPresignedRequest( - $client->getCommand('UploadPart', array_merge($params, ['PartNumber' => $i + 1])), $expires + $client->getCommand('UploadPart', array_merge($params, ['PartNumber' => $i + 1])), + $expires )->getUri()->__toString(); } diff --git a/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php b/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php index 92d911f9..6f1959e9 100644 --- a/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php +++ b/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php @@ -27,9 +27,6 @@ class BackupStatusController extends Controller /** * BackupStatusController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\BackupRepository $repository - * @param \Pterodactyl\Extensions\Backups\BackupManager $backupManager */ public function __construct(BackupRepository $repository, BackupManager $backupManager) { @@ -40,8 +37,6 @@ class BackupStatusController extends Controller /** * Handles updating the state of a backup. * - * @param \Pterodactyl\Http\Requests\Api\Remote\ReportBackupCompleteRequest $request - * @param string $backup * @return \Illuminate\Http\JsonResponse * * @throws \Exception @@ -51,10 +46,8 @@ class BackupStatusController extends Controller /** @var \Pterodactyl\Models\Backup $model */ $model = Backup::query()->where('uuid', $backup)->firstOrFail(); - if (! is_null($model->completed_at)) { - throw new BadRequestHttpException( - 'Cannot update the status of a backup that is already marked as completed.' - ); + if (!is_null($model->completed_at)) { + throw new BadRequestHttpException('Cannot update the status of a backup that is already marked as completed.'); } $successful = $request->input('successful') ? true : false; @@ -80,10 +73,6 @@ class BackupStatusController extends Controller * Marks a multipart upload in a given S3-compatiable instance as failed or successful for * the given backup. * - * @param \Pterodactyl\Models\Backup $backup - * @param \League\Flysystem\AwsS3v3\AwsS3Adapter $adapter - * @param bool $successful - * * @throws \Exception * @throws \Pterodactyl\Exceptions\DisplayException */ @@ -95,7 +84,7 @@ class BackupStatusController extends Controller // A failed backup doesn't need to error here, this can happen if the backup encouters // an error before we even start the upload. AWS gives you tooling to clear these failed // multipart uploads as needed too. - if (! $successful) { + if (!$successful) { return; } throw new DisplayException('Cannot complete backup request: no upload_id present on model.'); @@ -108,7 +97,7 @@ class BackupStatusController extends Controller ]; $client = $adapter->getClient(); - if (! $successful) { + if (!$successful) { $client->execute($client->getCommand('AbortMultipartUpload', $params)); return; diff --git a/app/Http/Controllers/Api/Remote/EggInstallController.php b/app/Http/Controllers/Api/Remote/EggInstallController.php index d26da5c8..e1f804be 100644 --- a/app/Http/Controllers/Api/Remote/EggInstallController.php +++ b/app/Http/Controllers/Api/Remote/EggInstallController.php @@ -22,9 +22,6 @@ class EggInstallController extends Controller /** * EggInstallController constructor. - * - * @param \Pterodactyl\Services\Servers\EnvironmentService $environment - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository */ public function __construct(EnvironmentService $environment, ServerRepositoryInterface $repository) { @@ -36,10 +33,6 @@ class EggInstallController extends Controller * Handle request to get script and installation information for a server * that is being created on the node. * - * @param \Illuminate\Http\Request $request - * @param string $uuid - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function index(Request $request, string $uuid): JsonResponse @@ -57,7 +50,7 @@ class EggInstallController extends Controller return response()->json([ 'scripts' => [ - 'install' => ! $egg->copy_script_install ? null : str_replace(["\r\n", "\n", "\r"], "\n", $egg->copy_script_install), + 'install' => !$egg->copy_script_install ? null : str_replace(["\r\n", "\n", "\r"], "\n", $egg->copy_script_install), 'privileged' => $egg->script_is_privileged, ], 'config' => [ diff --git a/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php b/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php index 5bbd2d55..a409d494 100644 --- a/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php +++ b/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php @@ -31,11 +31,6 @@ class ServerDetailsController extends Controller /** * ServerConfigurationController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository - * @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $configurationStructureService - * @param \Pterodactyl\Services\Eggs\EggConfigurationService $eggConfigurationService - * @param \Pterodactyl\Repositories\Eloquent\NodeRepository $nodeRepository */ public function __construct( ServerRepository $repository, @@ -52,8 +47,8 @@ class ServerDetailsController extends Controller * Returns details about the server that allows Wings to self-recover and ensure * that the state of the server matches the Panel at all times. * - * @param \Illuminate\Http\Request $request * @param string $uuid + * * @return \Illuminate\Http\JsonResponse * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -71,7 +66,6 @@ class ServerDetailsController extends Controller /** * Lists all servers with their configurations that are assigned to the requesting node. * - * @param \Illuminate\Http\Request $request * @return \Pterodactyl\Http\Resources\Wings\ServerConfigurationCollection */ public function list(Request $request) diff --git a/app/Http/Controllers/Api/Remote/Servers/ServerInstallController.php b/app/Http/Controllers/Api/Remote/Servers/ServerInstallController.php index 530832d4..8009742c 100644 --- a/app/Http/Controllers/Api/Remote/Servers/ServerInstallController.php +++ b/app/Http/Controllers/Api/Remote/Servers/ServerInstallController.php @@ -18,8 +18,6 @@ class ServerInstallController extends Controller /** * ServerInstallController constructor. - * - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository */ public function __construct(ServerRepository $repository) { @@ -29,8 +27,6 @@ class ServerInstallController extends Controller /** * Returns installation information for a server. * - * @param \Illuminate\Http\Request $request - * @param string $uuid * @return \Illuminate\Http\JsonResponse * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -50,8 +46,6 @@ class ServerInstallController extends Controller /** * Updates the installation state of a server. * - * @param \Pterodactyl\Http\Requests\Api\Remote\InstallationDataRequest $request - * @param string $uuid * @return \Illuminate\Http\JsonResponse * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException diff --git a/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php b/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php index 221ddbeb..9259c32d 100644 --- a/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php +++ b/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php @@ -53,13 +53,6 @@ class ServerTransferController extends Controller /** * ServerTransferController constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonServerRepository - * @param \Pterodactyl\Repositories\Wings\DaemonTransferRepository $daemonTransferRepository - * @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $configurationStructureService - * @param \Pterodactyl\Services\Nodes\NodeJWTService $jwtService */ public function __construct( ConnectionInterface $connection, @@ -80,8 +73,6 @@ class ServerTransferController extends Controller /** * The daemon notifies us about the archive status. * - * @param \Illuminate\Http\Request $request - * @param string $uuid * @return \Illuminate\Http\JsonResponse * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -92,7 +83,7 @@ class ServerTransferController extends Controller $server = $this->repository->getByUuid($uuid); // Unsuspend the server and don't continue the transfer. - if (! $request->input('successful')) { + if (!$request->input('successful')) { return $this->processFailedTransfer($server->transfer); } @@ -137,7 +128,6 @@ class ServerTransferController extends Controller /** * The daemon notifies us about a transfer failure. * - * @param string $uuid * @return \Illuminate\Http\JsonResponse * * @throws \Throwable @@ -152,7 +142,6 @@ class ServerTransferController extends Controller /** * The daemon notifies us about a transfer success. * - * @param string $uuid * @return \Illuminate\Http\JsonResponse * * @throws \Throwable @@ -165,7 +154,7 @@ class ServerTransferController extends Controller /** @var \Pterodactyl\Models\Server $server */ $server = $this->connection->transaction(function () use ($server, $transfer) { $allocations = [$transfer->old_allocation]; - if (! empty($transfer->old_additional_allocations)) { + if (!empty($transfer->old_additional_allocations)) { array_push($allocations, $transfer->old_additional_allocations); } @@ -201,7 +190,6 @@ class ServerTransferController extends Controller * Release all of the reserved allocations for this transfer and mark it as failed in * the database. * - * @param \Pterodactyl\Models\ServerTransfer $transfer * @return \Illuminate\Http\JsonResponse * * @throws \Throwable @@ -212,7 +200,7 @@ class ServerTransferController extends Controller $transfer->forceFill(['successful' => false])->saveOrFail(); $allocations = [$transfer->new_allocation]; - if (! empty($transfer->new_additional_allocations)) { + if (!empty($transfer->new_additional_allocations)) { array_push($allocations, $transfer->new_additional_allocations); } diff --git a/app/Http/Controllers/Api/Remote/SftpAuthenticationController.php b/app/Http/Controllers/Api/Remote/SftpAuthenticationController.php index cab532e8..461dade4 100644 --- a/app/Http/Controllers/Api/Remote/SftpAuthenticationController.php +++ b/app/Http/Controllers/Api/Remote/SftpAuthenticationController.php @@ -38,10 +38,6 @@ class SftpAuthenticationController extends Controller /** * SftpController constructor. - * - * @param \Pterodactyl\Services\Servers\GetUserPermissionsService $permissionsService - * @param \Pterodactyl\Repositories\Eloquent\UserRepository $userRepository - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $serverRepository */ public function __construct( GetUserPermissionsService $permissionsService, @@ -57,9 +53,6 @@ class SftpAuthenticationController extends Controller * Authenticate a set of credentials and return the associated server details * for a SFTP connection on the daemon. * - * @param \Pterodactyl\Http\Requests\Api\Remote\SftpAuthenticationFormRequest $request - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function __invoke(SftpAuthenticationFormRequest $request): JsonResponse @@ -76,15 +69,13 @@ class SftpAuthenticationController extends Controller if ($this->hasTooManyLoginAttempts($request)) { $seconds = $this->limiter()->availableIn($this->throttleKey($request)); - throw new TooManyRequestsHttpException( - $seconds, "Too many login attempts for this account, please try again in {$seconds} seconds." - ); + throw new TooManyRequestsHttpException($seconds, "Too many login attempts for this account, please try again in {$seconds} seconds."); } /** @var \Pterodactyl\Models\Node $node */ $node = $request->attributes->get('node'); if (empty($connection['server'])) { - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } /** @var \Pterodactyl\Models\User $user */ @@ -93,35 +84,29 @@ class SftpAuthenticationController extends Controller ]); $server = $this->serverRepository->getByUuid($connection['server'] ?? ''); - if (! password_verify($request->input('password'), $user->password) || $server->node_id !== $node->id) { + if (!password_verify($request->input('password'), $user->password) || $server->node_id !== $node->id) { $this->incrementLoginAttempts($request); - throw new HttpForbiddenException( - 'Authorization credentials were not correct, please try again.' - ); + throw new HttpForbiddenException('Authorization credentials were not correct, please try again.'); } - if (! $user->root_admin && $server->owner_id !== $user->id) { + if (!$user->root_admin && $server->owner_id !== $user->id) { $permissions = $this->permissionsService->handle($server, $user); - if (! in_array(Permission::ACTION_FILE_SFTP, $permissions)) { - throw new HttpForbiddenException( - 'You do not have permission to access SFTP for this server.' - ); + if (!in_array(Permission::ACTION_FILE_SFTP, $permissions)) { + throw new HttpForbiddenException('You do not have permission to access SFTP for this server.'); } } // Prevent SFTP access to servers that are being transferred. - if (! is_null($server->transfer)) { - throw new ServerTransferringException; + if (!is_null($server->transfer)) { + throw new ServerTransferringException(); } // Remember, for security purposes, only reveal the existence of the server to people that // have provided valid credentials, and have permissions to know about it. if ($server->installed !== 1 || $server->suspended) { - throw new BadRequestHttpException( - 'Server is not installed or is currently suspended.' - ); + throw new BadRequestHttpException('Server is not installed or is currently suspended.'); } return new JsonResponse([ @@ -134,9 +119,6 @@ class SftpAuthenticationController extends Controller /** * Get the throttle key for the given request. - * - * @param \Illuminate\Http\Request $request - * @return string */ protected function throttleKey(Request $request): string { diff --git a/app/Http/Controllers/Auth/AbstractLoginController.php b/app/Http/Controllers/Auth/AbstractLoginController.php index b24a1a62..601cdc14 100644 --- a/app/Http/Controllers/Auth/AbstractLoginController.php +++ b/app/Http/Controllers/Auth/AbstractLoginController.php @@ -50,9 +50,6 @@ abstract class AbstractLoginController extends Controller /** * LoginController constructor. - * - * @param \Illuminate\Auth\AuthManager $auth - * @param \Illuminate\Contracts\Config\Repository $config */ public function __construct(AuthManager $auth, Repository $config) { @@ -66,10 +63,6 @@ abstract class AbstractLoginController extends Controller /** * Get the failed login response instance. * - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Contracts\Auth\Authenticatable|null $user - * @param string|null $message - * * @throws \Pterodactyl\Exceptions\DisplayException */ protected function sendFailedLoginResponse(Request $request, Authenticatable $user = null, string $message = null) @@ -80,9 +73,7 @@ abstract class AbstractLoginController extends Controller ]); if ($request->route()->named('auth.login-checkpoint')) { - throw new DisplayException( - $message ?? trans('auth.two_factor.checkpoint_failed') - ); + throw new DisplayException($message ?? trans('auth.two_factor.checkpoint_failed')); } throw new DisplayException(trans('auth.failed')); @@ -90,10 +81,6 @@ abstract class AbstractLoginController extends Controller /** * Send the response after the user was authenticated. - * - * @param \Pterodactyl\Models\User $user - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\JsonResponse */ protected function sendLoginResponse(User $user, Request $request): JsonResponse { @@ -115,7 +102,6 @@ abstract class AbstractLoginController extends Controller * Determine if the user is logging in using an email or username,. * * @param string $input - * @return string */ protected function getField(string $input = null): string { @@ -124,9 +110,6 @@ abstract class AbstractLoginController extends Controller /** * Fire a failed login event. - * - * @param \Illuminate\Contracts\Auth\Authenticatable|null $user - * @param array $credentials */ protected function fireFailedLoginEvent(Authenticatable $user = null, array $credentials = []) { diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index 8f78f8c0..7b409e51 100644 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -18,7 +18,6 @@ class ForgotPasswordController extends Controller * * @param \Illuminate\Http\Request * @param string $response - * @return \Illuminate\Http\JsonResponse */ protected function sendResetLinkFailedResponse(Request $request, $response): JsonResponse { @@ -33,9 +32,7 @@ class ForgotPasswordController extends Controller /** * Get the response for a successful password reset link. * - * @param \Illuminate\Http\Request $request * @param string $response - * @return \Illuminate\Http\JsonResponse */ protected function sendResetLinkResponse(Request $request, $response): JsonResponse { diff --git a/app/Http/Controllers/Auth/LoginCheckpointController.php b/app/Http/Controllers/Auth/LoginCheckpointController.php index 4a5d6e87..3710da3a 100644 --- a/app/Http/Controllers/Auth/LoginCheckpointController.php +++ b/app/Http/Controllers/Auth/LoginCheckpointController.php @@ -43,14 +43,6 @@ class LoginCheckpointController extends AbstractLoginController /** * LoginCheckpointController constructor. - * - * @param \Illuminate\Auth\AuthManager $auth - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter - * @param \PragmaRX\Google2FA\Google2FA $google2FA - * @param \Illuminate\Contracts\Config\Repository $config - * @param \Illuminate\Contracts\Cache\Repository $cache - * @param \Pterodactyl\Repositories\Eloquent\RecoveryTokenRepository $recoveryTokenRepository - * @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository */ public function __construct( AuthManager $auth, @@ -75,7 +67,6 @@ class LoginCheckpointController extends AbstractLoginController * token. Once a user has reached this stage it is assumed that they have already * provided a valid username and password. * - * @param \Pterodactyl\Http\Requests\Auth\LoginCheckpointRequest $request * @return \Illuminate\Http\JsonResponse|void * * @throws \PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException @@ -98,12 +89,14 @@ class LoginCheckpointController extends AbstractLoginController $this->incrementLoginAttempts($request); return $this->sendFailedLoginResponse( - $request, null, 'The authentication token provided has expired, please refresh the page and try again.' + $request, + null, + 'The authentication token provided has expired, please refresh the page and try again.' ); } // Recovery tokens go through a slightly different pathway for usage. - if (! is_null($recoveryToken = $request->input('recovery_token'))) { + if (!is_null($recoveryToken = $request->input('recovery_token'))) { if ($this->isValidRecoveryToken($user, $recoveryToken)) { return $this->sendLoginResponse($user, $request); } @@ -119,15 +112,13 @@ class LoginCheckpointController extends AbstractLoginController $this->incrementLoginAttempts($request); - return $this->sendFailedLoginResponse($request, $user, ! empty($recoveryToken) ? 'The recovery token provided is not valid.' : null); + return $this->sendFailedLoginResponse($request, $user, !empty($recoveryToken) ? 'The recovery token provided is not valid.' : null); } /** * Determines if a given recovery token is valid for the user account. If we find a matching token * it will be deleted from the database. * - * @param \Pterodactyl\Models\User $user - * @param string $value * @return bool * * @throws \Exception diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 178be84f..db74ab12 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -33,12 +33,6 @@ class LoginController extends AbstractLoginController /** * LoginController constructor. - * - * @param \Illuminate\Auth\AuthManager $auth - * @param \Illuminate\Contracts\Config\Repository $config - * @param \Illuminate\Contracts\Cache\Repository $cache - * @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository - * @param \Illuminate\Contracts\View\Factory $view */ public function __construct( AuthManager $auth, @@ -58,8 +52,6 @@ class LoginController extends AbstractLoginController * Handle all incoming requests for the authentication routes and render the * base authentication view component. Vuejs will take over at this point and * turn the login area into a SPA. - * - * @return \Illuminate\Contracts\View\View */ public function index(): View { @@ -69,7 +61,6 @@ class LoginController extends AbstractLoginController /** * Handle a login request to the application. * - * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\JsonResponse|void * * @throws \Pterodactyl\Exceptions\DisplayException @@ -95,7 +86,7 @@ class LoginController extends AbstractLoginController // continue. Previously this was handled in the 2FA checkpoint, however that has // a flaw in which you can discover if an account exists simply by seeing if you // can proceede to the next step in the login process. - if (! password_verify($request->input('password'), $user->password)) { + if (!password_verify($request->input('password'), $user->password)) { return $this->sendFailedLoginResponse($request, $user); } diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index fe559151..b8a02ee7 100644 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -47,10 +47,6 @@ class ResetPasswordController extends Controller /** * ResetPasswordController constructor. - * - * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher - * @param \Illuminate\Contracts\Hashing\Hasher $hasher - * @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $userRepository */ public function __construct(Dispatcher $dispatcher, Hasher $hasher, UserRepositoryInterface $userRepository) { @@ -62,9 +58,6 @@ class ResetPasswordController extends Controller /** * Reset the given user's password. * - * @param \Pterodactyl\Http\Requests\Auth\ResetPasswordRequest $request - * @return \Illuminate\Http\JsonResponse - * * @throws \Pterodactyl\Exceptions\DisplayException */ public function __invoke(ResetPasswordRequest $request): JsonResponse @@ -73,7 +66,8 @@ class ResetPasswordController extends Controller // will update the password on an actual user model and persist it to the // database. Otherwise we will parse the error and return the response. $response = $this->broker()->reset( - $this->credentials($request), function ($user, $password) { + $this->credentials($request), + function ($user, $password) { $this->resetPassword($user, $password); } ); @@ -94,7 +88,7 @@ class ResetPasswordController extends Controller * form with a note telling them their password was changed and to log back in. * * @param \Illuminate\Contracts\Auth\CanResetPassword|\Pterodactyl\Models\User $user - * @param string $password + * @param string $password * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -110,7 +104,7 @@ class ResetPasswordController extends Controller // If the user is not using 2FA log them in, otherwise skip this step and force a // fresh login where they'll be prompted to enter a token. - if (! $user->use_totp) { + if (!$user->use_totp) { $this->guard()->login($user); } @@ -119,8 +113,6 @@ class ResetPasswordController extends Controller /** * Send a successful password reset response back to the callee. - * - * @return \Illuminate\Http\JsonResponse */ protected function sendResetResponse(): JsonResponse { diff --git a/app/Http/Controllers/Base/IndexController.php b/app/Http/Controllers/Base/IndexController.php index 41ff988f..058280be 100644 --- a/app/Http/Controllers/Base/IndexController.php +++ b/app/Http/Controllers/Base/IndexController.php @@ -14,8 +14,6 @@ class IndexController extends Controller /** * IndexController constructor. - * - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository */ public function __construct(ServerRepositoryInterface $repository) { diff --git a/app/Http/Controllers/Base/LocaleController.php b/app/Http/Controllers/Base/LocaleController.php index f29ba23d..3bb6fbfb 100644 --- a/app/Http/Controllers/Base/LocaleController.php +++ b/app/Http/Controllers/Base/LocaleController.php @@ -16,8 +16,6 @@ class LocaleController extends Controller /** * LocaleController constructor. - * - * @param \Illuminate\Translation\Translator $translator */ public function __construct(Translator $translator) { @@ -27,9 +25,6 @@ class LocaleController extends Controller /** * Returns translation data given a specific locale and namespace. * - * @param \Illuminate\Http\Request $request - * @param string $locale - * @param string $namespace * @return \Illuminate\Http\JsonResponse */ public function __invoke(Request $request, string $locale, string $namespace) diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 2581e8b9..ee7af2f7 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -9,5 +9,7 @@ use Illuminate\Foundation\Auth\Access\AuthorizesRequests; abstract class Controller extends BaseController { - use AuthorizesRequests, DispatchesJobs, ValidatesRequests; + use AuthorizesRequests; + use DispatchesJobs; + use ValidatesRequests; } diff --git a/app/Http/Middleware/Admin/Servers/ServerInstalled.php b/app/Http/Middleware/Admin/Servers/ServerInstalled.php index 2f0a384f..919d27ad 100644 --- a/app/Http/Middleware/Admin/Servers/ServerInstalled.php +++ b/app/Http/Middleware/Admin/Servers/ServerInstalled.php @@ -14,8 +14,6 @@ class ServerInstalled /** * Checks that the server is installed before allowing access through the route. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed */ public function handle(Request $request, Closure $next) @@ -23,16 +21,12 @@ class ServerInstalled /** @var \Pterodactyl\Models\Server|null $server */ $server = $request->route()->parameter('server'); - if (! $server instanceof Server) { - throw new NotFoundHttpException( - 'No server resource was located in the request parameters.' - ); + if (!$server instanceof Server) { + throw new NotFoundHttpException('No server resource was located in the request parameters.'); } if ($server->installed !== 1) { - throw new HttpException( - Response::HTTP_FORBIDDEN, 'Access to this resource is not allowed due to the current installation state.' - ); + throw new HttpException(Response::HTTP_FORBIDDEN, 'Access to this resource is not allowed due to the current installation state.'); } return $next($request); diff --git a/app/Http/Middleware/AdminAuthenticate.php b/app/Http/Middleware/AdminAuthenticate.php index 878e56bb..72a7c862 100644 --- a/app/Http/Middleware/AdminAuthenticate.php +++ b/app/Http/Middleware/AdminAuthenticate.php @@ -18,16 +18,14 @@ class AdminAuthenticate /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed * * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException */ public function handle(Request $request, Closure $next) { - if (! $request->user() || ! $request->user()->root_admin) { - throw new AccessDeniedHttpException; + if (!$request->user() || !$request->user()->root_admin) { + throw new AccessDeniedHttpException(); } return $next($request); diff --git a/app/Http/Middleware/Api/ApiSubstituteBindings.php b/app/Http/Middleware/Api/ApiSubstituteBindings.php index 5ef3bca3..7ade7452 100644 --- a/app/Http/Middleware/Api/ApiSubstituteBindings.php +++ b/app/Http/Middleware/Api/ApiSubstituteBindings.php @@ -42,7 +42,7 @@ class ApiSubstituteBindings extends SubstituteBindings * a 404 error if a model is not found. * * @param \Illuminate\Http\Request $request - * @param \Closure $next + * * @return mixed */ public function handle($request, Closure $next) @@ -50,7 +50,7 @@ class ApiSubstituteBindings extends SubstituteBindings $route = $request->route(); foreach (self::$mappings as $key => $model) { - if (! is_null($this->router->getBindingCallback($key))) { + if (!is_null($this->router->getBindingCallback($key))) { continue; } diff --git a/app/Http/Middleware/Api/Application/AuthenticateApplicationUser.php b/app/Http/Middleware/Api/Application/AuthenticateApplicationUser.php index 70c52f5b..bf9a6460 100644 --- a/app/Http/Middleware/Api/Application/AuthenticateApplicationUser.php +++ b/app/Http/Middleware/Api/Application/AuthenticateApplicationUser.php @@ -12,13 +12,11 @@ class AuthenticateApplicationUser * Authenticate that the currently authenticated user is an administrator * and should be allowed to proceed through the application API. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed */ public function handle(Request $request, Closure $next) { - if (is_null($request->user()) || ! $request->user()->root_admin) { + if (is_null($request->user()) || !$request->user()->root_admin) { throw new AccessDeniedHttpException('This account does not have permission to access the API.'); } diff --git a/app/Http/Middleware/Api/AuthenticateIPAccess.php b/app/Http/Middleware/Api/AuthenticateIPAccess.php index 8f57b820..2af34cfd 100644 --- a/app/Http/Middleware/Api/AuthenticateIPAccess.php +++ b/app/Http/Middleware/Api/AuthenticateIPAccess.php @@ -13,8 +13,6 @@ class AuthenticateIPAccess /** * Determine if a request IP has permission to access the API. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed * * @throws \Exception diff --git a/app/Http/Middleware/Api/AuthenticateKey.php b/app/Http/Middleware/Api/AuthenticateKey.php index 6256a1ba..db469bc5 100644 --- a/app/Http/Middleware/Api/AuthenticateKey.php +++ b/app/Http/Middleware/Api/AuthenticateKey.php @@ -33,10 +33,6 @@ class AuthenticateKey /** * AuthenticateKey constructor. - * - * @param \Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface $repository - * @param \Illuminate\Auth\AuthManager $auth - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter */ public function __construct(ApiKeyRepositoryInterface $repository, AuthManager $auth, Encrypter $encrypter) { @@ -49,9 +45,6 @@ class AuthenticateKey * Handle an API request by verifying that the provided API key * is in a valid format and exists in the database. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param int $keyType * @return mixed * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -85,10 +78,6 @@ class AuthenticateKey /** * Authenticate an API key. * - * @param string $key - * @param int $keyType - * @return \Pterodactyl\Models\ApiKey - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -103,11 +92,11 @@ class AuthenticateKey ['key_type', '=', $keyType], ]); } catch (RecordNotFoundException $exception) { - throw new AccessDeniedHttpException; + throw new AccessDeniedHttpException(); } - if (! hash_equals($this->encrypter->decrypt($model->token), $token)) { - throw new AccessDeniedHttpException; + if (!hash_equals($this->encrypter->decrypt($model->token), $token)) { + throw new AccessDeniedHttpException(); } $this->repository->withoutFreshModel()->update($model->id, ['last_used_at' => CarbonImmutable::now()]); diff --git a/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php b/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php index 01462317..4ab87ce4 100644 --- a/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php +++ b/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php @@ -29,8 +29,6 @@ class AuthenticateServerAccess /** * AuthenticateServerAccess constructor. - * - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository */ public function __construct(ServerRepositoryInterface $repository) { @@ -40,8 +38,6 @@ class AuthenticateServerAccess /** * Authenticate that this server exists and is not suspended or marked as installing. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed */ public function handle(Request $request, Closure $next) @@ -50,39 +46,37 @@ class AuthenticateServerAccess $user = $request->user(); $server = $request->route()->parameter('server'); - if (! $server instanceof Server) { + if (!$server instanceof Server) { throw new NotFoundHttpException(trans('exceptions.api.resource_not_found')); } // At the very least, ensure that the user trying to make this request is the // server owner, a subuser, or a root admin. We'll leave it up to the controllers // to authenticate more detailed permissions if needed. - if ($user->id !== $server->owner_id && ! $user->root_admin) { + if ($user->id !== $server->owner_id && !$user->root_admin) { // Check for subuser status. - if (! $server->subusers->contains('user_id', $user->id)) { + if (!$server->subusers->contains('user_id', $user->id)) { throw new NotFoundHttpException(trans('exceptions.api.resource_not_found')); } } - if ($server->suspended && ! $request->routeIs('api:client:server.resources')) { - throw new BadRequestHttpException( - 'This server is currently suspended and the functionality requested is unavailable.' - ); + if ($server->suspended && !$request->routeIs('api:client:server.resources')) { + throw new BadRequestHttpException('This server is currently suspended and the functionality requested is unavailable.'); } // Still allow users to get information about their server if it is installing or being transferred. - if (! $request->routeIs('api:client:server.view')) { - if (! $server->isInstalled()) { + if (!$request->routeIs('api:client:server.view')) { + if (!$server->isInstalled()) { // Throw an exception for all server routes; however if the user is an admin and requesting the // server details, don't throw the exception for them. - if (! $user->root_admin || ($user->root_admin && ! $request->routeIs($this->except))) { + if (!$user->root_admin || ($user->root_admin && !$request->routeIs($this->except))) { throw new ConflictHttpException('Server has not completed the installation process.'); } } - if (! is_null($server->transfer)) { - if (! $user->root_admin || ($user->root_admin && ! $request->routeIs($this->except))) { - throw new ServerTransferringException; + if (!is_null($server->transfer)) { + if (!$user->root_admin || ($user->root_admin && !$request->routeIs($this->except))) { + throw new ServerTransferringException(); } } } diff --git a/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php b/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php index 81254f17..d8c4731d 100644 --- a/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php +++ b/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php @@ -26,14 +26,12 @@ class ResourceBelongsToServer * server that is expected, and that we're not accessing a resource completely * unrelated to the server provided in the request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed */ public function handle(Request $request, Closure $next) { $params = $request->route()->parameters(); - if (is_null($params) || ! $params['server'] instanceof Server) { + if (is_null($params) || !$params['server'] instanceof Server) { throw new InvalidArgumentException('This middleware cannot be used in a context that is missing a server in the parameters.'); } @@ -45,7 +43,7 @@ class ResourceBelongsToServer // other resources are assigned to this server. Also skip anything that // is not currently a Model instance since those will just end up being // a 404 down the road. - if ($key === 'server' || ! $model instanceof Model) { + if ($key === 'server' || !$model instanceof Model) { continue; } diff --git a/app/Http/Middleware/Api/Client/SubstituteClientApiBindings.php b/app/Http/Middleware/Api/Client/SubstituteClientApiBindings.php index c5a20f29..31590f28 100644 --- a/app/Http/Middleware/Api/Client/SubstituteClientApiBindings.php +++ b/app/Http/Middleware/Api/Client/SubstituteClientApiBindings.php @@ -19,7 +19,7 @@ class SubstituteClientApiBindings extends ApiSubstituteBindings * a 404 error if a model is not found. * * @param \Illuminate\Http\Request $request - * @param \Closure $next + * * @return mixed */ public function handle($request, Closure $next) diff --git a/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php b/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php index d222f58e..174cef43 100644 --- a/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php +++ b/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php @@ -34,9 +34,6 @@ class DaemonAuthenticate /** * DaemonAuthenticate constructor. - * - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter - * @param \Pterodactyl\Repositories\Eloquent\NodeRepository $repository */ public function __construct(Encrypter $encrypter, NodeRepository $repository) { @@ -47,8 +44,6 @@ class DaemonAuthenticate /** * Check if a request from the daemon can be properly attributed back to a single node instance. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed * * @throws \Symfony\Component\HttpKernel\Exception\HttpException @@ -60,17 +55,13 @@ class DaemonAuthenticate } if (is_null($bearer = $request->bearerToken())) { - throw new HttpException( - 401, 'Access this this endpoint must include an Authorization header.', null, ['WWW-Authenticate' => 'Bearer'] - ); + throw new HttpException(401, 'Access this this endpoint must include an Authorization header.', null, ['WWW-Authenticate' => 'Bearer']); } $parts = explode('.', $bearer); // Ensure that all of the correct parts are provided in the header. if (count($parts) !== 2 || empty($parts[0]) || empty($parts[1])) { - throw new BadRequestHttpException( - 'The Authorization header provided was not in a valid format.' - ); + throw new BadRequestHttpException('The Authorization header provided was not in a valid format.'); } try { @@ -88,8 +79,6 @@ class DaemonAuthenticate // Do nothing, we don't want to expose a node not existing at all. } - throw new AccessDeniedHttpException( - 'You are not authorized to access this resource.' - ); + throw new AccessDeniedHttpException('You are not authorized to access this resource.'); } } diff --git a/app/Http/Middleware/Api/IsValidJson.php b/app/Http/Middleware/Api/IsValidJson.php index 20c54dab..c3c8d6c8 100644 --- a/app/Http/Middleware/Api/IsValidJson.php +++ b/app/Http/Middleware/Api/IsValidJson.php @@ -13,23 +13,15 @@ class IsValidJson * parsing the data. This avoids confusing validation errors where every field is flagged and * it is not immediately clear that there is an issue with the JSON being passed. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed */ public function handle(Request $request, Closure $next) { - if ($request->isJson() && ! empty($request->getContent())) { + if ($request->isJson() && !empty($request->getContent())) { json_decode($request->getContent(), true); if (json_last_error() !== JSON_ERROR_NONE) { - throw new BadRequestHttpException( - sprintf( - 'The JSON data passed in the request appears to be malformed. err_code: %d err_message: "%s"', - json_last_error(), - json_last_error_msg() - ) - ); + throw new BadRequestHttpException(sprintf('The JSON data passed in the request appears to be malformed. err_code: %d err_message: "%s"', json_last_error(), json_last_error_msg())); } } diff --git a/app/Http/Middleware/Api/SetSessionDriver.php b/app/Http/Middleware/Api/SetSessionDriver.php index a04db7fa..1c8f59a0 100644 --- a/app/Http/Middleware/Api/SetSessionDriver.php +++ b/app/Http/Middleware/Api/SetSessionDriver.php @@ -15,8 +15,6 @@ class SetSessionDriver /** * SetSessionDriver constructor. - * - * @param \Illuminate\Contracts\Config\Repository $config */ public function __construct(ConfigRepository $config) { @@ -26,8 +24,6 @@ class SetSessionDriver /** * Set the session for API calls to only last for the one request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed */ public function handle(Request $request, Closure $next) diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index ed8d31e0..f95180b2 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -11,16 +11,14 @@ class Authenticate /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed * * @throws \Illuminate\Auth\AuthenticationException */ public function handle(Request $request, Closure $next) { - if (! $request->user()) { - throw new AuthenticationException; + if (!$request->user()) { + throw new AuthenticationException(); } return $next($request); diff --git a/app/Http/Middleware/LanguageMiddleware.php b/app/Http/Middleware/LanguageMiddleware.php index 3dba67e2..914d4395 100644 --- a/app/Http/Middleware/LanguageMiddleware.php +++ b/app/Http/Middleware/LanguageMiddleware.php @@ -15,8 +15,6 @@ class LanguageMiddleware /** * LanguageMiddleware constructor. - * - * @param \Illuminate\Foundation\Application $app */ public function __construct(Application $app) { @@ -26,8 +24,6 @@ class LanguageMiddleware /** * Handle an incoming request and set the user's preferred language. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed */ public function handle(Request $request, Closure $next) diff --git a/app/Http/Middleware/MaintenanceMiddleware.php b/app/Http/Middleware/MaintenanceMiddleware.php index 8f733bcd..58262616 100644 --- a/app/Http/Middleware/MaintenanceMiddleware.php +++ b/app/Http/Middleware/MaintenanceMiddleware.php @@ -14,8 +14,6 @@ class MaintenanceMiddleware /** * MaintenanceMiddleware constructor. - * - * @param \Illuminate\Contracts\Routing\ResponseFactory $response */ public function __construct(ResponseFactory $response) { @@ -26,7 +24,7 @@ class MaintenanceMiddleware * Handle an incoming request. * * @param \Illuminate\Http\Request $request - * @param \Closure $next + * * @return mixed */ public function handle($request, Closure $next) diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index a8c51bb0..6c4019af 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -15,8 +15,6 @@ class RedirectIfAuthenticated /** * RedirectIfAuthenticated constructor. - * - * @param \Illuminate\Auth\AuthManager $authManager */ public function __construct(AuthManager $authManager) { @@ -26,9 +24,6 @@ class RedirectIfAuthenticated /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string|null $guard * @return mixed */ public function handle(Request $request, Closure $next, string $guard = null) diff --git a/app/Http/Middleware/RequireTwoFactorAuthentication.php b/app/Http/Middleware/RequireTwoFactorAuthentication.php index d3c8ec6f..6691179a 100644 --- a/app/Http/Middleware/RequireTwoFactorAuthentication.php +++ b/app/Http/Middleware/RequireTwoFactorAuthentication.php @@ -10,9 +10,9 @@ use Pterodactyl\Exceptions\Http\TwoFactorAuthRequiredException; class RequireTwoFactorAuthentication { - const LEVEL_NONE = 0; - const LEVEL_ADMIN = 1; - const LEVEL_ALL = 2; + public const LEVEL_NONE = 0; + public const LEVEL_ADMIN = 1; + public const LEVEL_ALL = 2; /** * @var \Prologue\Alerts\AlertsMessageBag @@ -28,8 +28,6 @@ class RequireTwoFactorAuthentication /** * RequireTwoFactorAuthentication constructor. - * - * @param \Prologue\Alerts\AlertsMessageBag $alert */ public function __construct(AlertsMessageBag $alert) { @@ -42,8 +40,6 @@ class RequireTwoFactorAuthentication * order to perform actions. If so, we check the level at which it is required (all users * or just admins) and then check if the user has enabled it for their account. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed * * @throws \Pterodactyl\Exceptions\Http\TwoFactorAuthRequiredException @@ -55,7 +51,7 @@ class RequireTwoFactorAuthentication $uri = rtrim($request->getRequestUri(), '/') . '/'; $current = $request->route()->getName(); - if (! $user || Str::startsWith($uri, ['/auth/']) || Str::startsWith($current, ['auth.', 'account.'])) { + if (!$user || Str::startsWith($uri, ['/auth/']) || Str::startsWith($current, ['auth.', 'account.'])) { return $next($request); } @@ -66,13 +62,13 @@ class RequireTwoFactorAuthentication // 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); - } elseif ($level === self::LEVEL_ADMIN && ! $user->root_admin) { + } elseif ($level === self::LEVEL_ADMIN && !$user->root_admin) { return $next($request); } // For API calls return an exception which gets rendered nicely in the API response. if ($request->isJson() || Str::startsWith($uri, '/api/')) { - throw new TwoFactorAuthRequiredException; + throw new TwoFactorAuthRequiredException(); } $this->alert->danger(trans('auth.2fa_must_be_enabled'))->flash(); diff --git a/app/Http/Middleware/Server/AccessingValidServer.php b/app/Http/Middleware/Server/AccessingValidServer.php index 2491414c..8f66bbec 100644 --- a/app/Http/Middleware/Server/AccessingValidServer.php +++ b/app/Http/Middleware/Server/AccessingValidServer.php @@ -31,10 +31,6 @@ class AccessingValidServer /** * AccessingValidServer constructor. - * - * @param \Illuminate\Contracts\Config\Repository $config - * @param \Illuminate\Contracts\Routing\ResponseFactory $response - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository */ public function __construct( ConfigRepository $config, @@ -49,8 +45,6 @@ class AccessingValidServer /** * Determine if a given user has permission to access a server. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return \Illuminate\Http\Response|mixed * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -81,9 +75,9 @@ class AccessingValidServer return $this->response->view('errors.installing', [], 409); } - if (! is_null($server->transfer)) { + if (!is_null($server->transfer)) { if ($isApiRequest) { - throw new ServerTransferringException; + throw new ServerTransferringException(); } return $this->response->view('errors.transferring', [], 409); diff --git a/app/Http/Middleware/VerifyReCaptcha.php b/app/Http/Middleware/VerifyReCaptcha.php index 71036047..c0841f2c 100644 --- a/app/Http/Middleware/VerifyReCaptcha.php +++ b/app/Http/Middleware/VerifyReCaptcha.php @@ -26,9 +26,6 @@ class VerifyReCaptcha /** * VerifyReCaptcha constructor. - * - * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher - * @param \Illuminate\Contracts\Config\Repository $config */ public function __construct(Dispatcher $dispatcher, Repository $config) { @@ -40,12 +37,12 @@ class VerifyReCaptcha * Handle an incoming request. * * @param \Illuminate\Http\Request $request - * @param \Closure $next + * * @return \Illuminate\Http\RedirectResponse|mixed */ public function handle($request, Closure $next) { - if (! $this->config->get('recaptcha.enabled')) { + if (!$this->config->get('recaptcha.enabled')) { return $next($request); } @@ -61,7 +58,7 @@ class VerifyReCaptcha if ($res->getStatusCode() === 200) { $result = json_decode($res->getBody()); - if ($result->success && (! $this->config->get('recaptcha.verify_domain') || $this->isResponseVerified($result, $request))) { + if ($result->success && (!$this->config->get('recaptcha.verify_domain') || $this->isResponseVerified($result, $request))) { return $next($request); } } @@ -69,25 +66,20 @@ class VerifyReCaptcha $this->dispatcher->dispatch( new FailedCaptcha( - $request->ip(), ! empty($result) ? ($result->hostname ?? null) : null + $request->ip(), + !empty($result) ? ($result->hostname ?? null) : null ) ); - throw new HttpException( - Response::HTTP_BAD_REQUEST, 'Failed to validate reCAPTCHA data.' - ); + throw new HttpException(Response::HTTP_BAD_REQUEST, 'Failed to validate reCAPTCHA data.'); } /** * Determine if the response from the recaptcha servers was valid. - * - * @param stdClass $result - * @param \Illuminate\Http\Request $request - * @return bool */ private function isResponseVerified(stdClass $result, Request $request): bool { - if (! $this->config->get('recaptcha.verify_domain')) { + if (!$this->config->get('recaptcha.verify_domain')) { return false; } diff --git a/app/Http/Requests/Admin/AdminFormRequest.php b/app/Http/Requests/Admin/AdminFormRequest.php index 012d7336..e3107e26 100644 --- a/app/Http/Requests/Admin/AdminFormRequest.php +++ b/app/Http/Requests/Admin/AdminFormRequest.php @@ -32,7 +32,6 @@ abstract class AdminFormRequest extends FormRequest * Return only the fields that we are interested in from the request. * This will include empty fields as a null value. * - * @param array|null $only * @return array */ public function normalize(array $only = null) diff --git a/app/Http/Requests/Admin/Api/StoreApplicationApiKeyRequest.php b/app/Http/Requests/Admin/Api/StoreApplicationApiKeyRequest.php index a2949628..40aa732f 100644 --- a/app/Http/Requests/Admin/Api/StoreApplicationApiKeyRequest.php +++ b/app/Http/Requests/Admin/Api/StoreApplicationApiKeyRequest.php @@ -10,6 +10,7 @@ class StoreApplicationApiKeyRequest extends AdminFormRequest { /** * @return array + * * @throws \ReflectionException * @throws \ReflectionException */ diff --git a/app/Http/Requests/Admin/DatabaseHostFormRequest.php b/app/Http/Requests/Admin/DatabaseHostFormRequest.php index c6b2468a..7fdd0cdc 100644 --- a/app/Http/Requests/Admin/DatabaseHostFormRequest.php +++ b/app/Http/Requests/Admin/DatabaseHostFormRequest.php @@ -25,7 +25,7 @@ class DatabaseHostFormRequest extends AdminFormRequest */ protected function getValidatorInstance() { - if (! $this->filled('node_id')) { + if (!$this->filled('node_id')) { $this->merge(['node_id' => null]); } diff --git a/app/Http/Requests/Admin/Node/NodeFormRequest.php b/app/Http/Requests/Admin/Node/NodeFormRequest.php index caef04f9..a1224678 100644 --- a/app/Http/Requests/Admin/Node/NodeFormRequest.php +++ b/app/Http/Requests/Admin/Node/NodeFormRequest.php @@ -35,7 +35,7 @@ class NodeFormRequest extends AdminFormRequest { $validator->after(function ($validator) { // Check that the FQDN is a valid IP address. - if (! filter_var(gethostbyname($this->input('fqdn')), FILTER_VALIDATE_IP)) { + if (!filter_var(gethostbyname($this->input('fqdn')), FILTER_VALIDATE_IP)) { $validator->errors()->add('fqdn', trans('admin/node.validation.fqdn_not_resolvable')); } diff --git a/app/Http/Requests/Admin/ServerFormRequest.php b/app/Http/Requests/Admin/ServerFormRequest.php index 58583422..e20210b3 100644 --- a/app/Http/Requests/Admin/ServerFormRequest.php +++ b/app/Http/Requests/Admin/ServerFormRequest.php @@ -30,7 +30,7 @@ class ServerFormRequest extends AdminFormRequest { $validator->after(function ($validator) { $validator->sometimes('node_id', 'required|numeric|bail|exists:nodes,id', function ($input) { - return ! ($input->auto_deploy); + return !($input->auto_deploy); }); $validator->sometimes('allocation_id', [ @@ -42,7 +42,7 @@ class ServerFormRequest extends AdminFormRequest $query->whereNull('server_id'); }), ], function ($input) { - return ! ($input->auto_deploy); + return !($input->auto_deploy); }); $validator->sometimes('allocation_additional.*', [ @@ -54,7 +54,7 @@ class ServerFormRequest extends AdminFormRequest $query->whereNull('server_id'); }), ], function ($input) { - return ! ($input->auto_deploy); + return !($input->auto_deploy); }); }); } diff --git a/app/Http/Requests/Admin/Servers/Databases/StoreServerDatabaseRequest.php b/app/Http/Requests/Admin/Servers/Databases/StoreServerDatabaseRequest.php index 40a4b06b..144755d2 100644 --- a/app/Http/Requests/Admin/Servers/Databases/StoreServerDatabaseRequest.php +++ b/app/Http/Requests/Admin/Servers/Databases/StoreServerDatabaseRequest.php @@ -10,8 +10,6 @@ class StoreServerDatabaseRequest extends AdminFormRequest { /** * Validation rules for database creation. - * - * @return array */ public function rules(): array { diff --git a/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php b/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php index 728283af..0ad24181 100644 --- a/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php +++ b/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php @@ -30,6 +30,7 @@ class MailSettingsFormRequest extends AdminFormRequest * as we need to accept empty values on the keys. * * @param array $only + * * @return array */ public function normalize(array $only = null) diff --git a/app/Http/Requests/Api/Application/Allocations/DeleteAllocationRequest.php b/app/Http/Requests/Api/Application/Allocations/DeleteAllocationRequest.php index 21da6bfb..9fab4e2c 100644 --- a/app/Http/Requests/Api/Application/Allocations/DeleteAllocationRequest.php +++ b/app/Http/Requests/Api/Application/Allocations/DeleteAllocationRequest.php @@ -22,8 +22,6 @@ class DeleteAllocationRequest extends ApplicationApiRequest /** * Determine if the requested allocation exists and belongs to the node that * is being passed in the URL. - * - * @return bool */ public function resourceExists(): bool { diff --git a/app/Http/Requests/Api/Application/Allocations/GetAllocationsRequest.php b/app/Http/Requests/Api/Application/Allocations/GetAllocationsRequest.php index 150bdb95..524e201e 100644 --- a/app/Http/Requests/Api/Application/Allocations/GetAllocationsRequest.php +++ b/app/Http/Requests/Api/Application/Allocations/GetAllocationsRequest.php @@ -21,8 +21,6 @@ class GetAllocationsRequest extends ApplicationApiRequest /** * Determine if the node that we are requesting the allocations * for exists on the Panel. - * - * @return bool */ public function resourceExists(): bool { diff --git a/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php b/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php index 1e68b82e..d1f5415a 100644 --- a/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php +++ b/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php @@ -17,9 +17,6 @@ class StoreAllocationRequest extends ApplicationApiRequest */ protected $permission = AdminAcl::WRITE; - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Application/ApplicationApiRequest.php b/app/Http/Requests/Api/Application/ApplicationApiRequest.php index 13353271..11deab45 100644 --- a/app/Http/Requests/Api/Application/ApplicationApiRequest.php +++ b/app/Http/Requests/Api/Application/ApplicationApiRequest.php @@ -40,8 +40,6 @@ abstract class ApplicationApiRequest extends FormRequest * Determine if the current user is authorized to perform * the requested action against the API. * - * @return bool - * * @throws \Pterodactyl\Exceptions\PterodactylException */ public function authorize(): bool @@ -55,8 +53,6 @@ abstract class ApplicationApiRequest extends FormRequest /** * Determine if the requested resource exists on the server. - * - * @return bool */ public function resourceExists(): bool { @@ -65,8 +61,6 @@ abstract class ApplicationApiRequest extends FormRequest /** * Default set of rules to apply to API requests. - * - * @return array */ public function rules(): array { @@ -75,8 +69,6 @@ abstract class ApplicationApiRequest extends FormRequest /** * Return the API key being used for the request. - * - * @return \Pterodactyl\Models\ApiKey */ public function key(): ApiKey { @@ -87,8 +79,8 @@ abstract class ApplicationApiRequest extends FormRequest * Grab a model from the route parameters. If no model is found in the * binding mappings an exception will be thrown. * - * @param string $model * @return mixed + * * @deprecated * * @throws \Symfony\Component\Routing\Exception\InvalidParameterException @@ -98,7 +90,7 @@ abstract class ApplicationApiRequest extends FormRequest $parameterKey = array_get(array_flip(ApiSubstituteBindings::getMappings()), $model); if (is_null($parameterKey)) { - throw new InvalidParameterException; + throw new InvalidParameterException(); } return $this->route()->parameter($parameterKey); @@ -112,7 +104,7 @@ abstract class ApplicationApiRequest extends FormRequest */ protected function prepareForValidation() { - if (! $this->passesAuthorization()) { + if (!$this->passesAuthorization()) { $this->failedAuthorization(); } @@ -137,7 +129,7 @@ abstract class ApplicationApiRequest extends FormRequest return true; } - if (! parent::passesAuthorization()) { + if (!parent::passesAuthorization()) { return false; } @@ -145,7 +137,7 @@ abstract class ApplicationApiRequest extends FormRequest // authenticated to access the endpoint. This avoids exposing that // an item exists (or does not exist) to the user until they can prove // that they have permission to know about it. - if ($this->attributes->get('is_missing_model', false) || ! $this->resourceExists()) { + if ($this->attributes->get('is_missing_model', false) || !$this->resourceExists()) { throw new NotFoundHttpException(trans('exceptions.api.resource_not_found')); } diff --git a/app/Http/Requests/Api/Application/Locations/DeleteLocationRequest.php b/app/Http/Requests/Api/Application/Locations/DeleteLocationRequest.php index d1863eea..ac58314f 100644 --- a/app/Http/Requests/Api/Application/Locations/DeleteLocationRequest.php +++ b/app/Http/Requests/Api/Application/Locations/DeleteLocationRequest.php @@ -20,8 +20,6 @@ class DeleteLocationRequest extends ApplicationApiRequest /** * Determine if the requested location exists on the Panel. - * - * @return bool */ public function resourceExists(): bool { diff --git a/app/Http/Requests/Api/Application/Locations/GetLocationRequest.php b/app/Http/Requests/Api/Application/Locations/GetLocationRequest.php index d49fb266..f7c10e0c 100644 --- a/app/Http/Requests/Api/Application/Locations/GetLocationRequest.php +++ b/app/Http/Requests/Api/Application/Locations/GetLocationRequest.php @@ -8,8 +8,6 @@ class GetLocationRequest extends GetLocationsRequest { /** * Determine if the requested location exists on the Panel. - * - * @return bool */ public function resourceExists(): bool { diff --git a/app/Http/Requests/Api/Application/Locations/StoreLocationRequest.php b/app/Http/Requests/Api/Application/Locations/StoreLocationRequest.php index a02a38ca..c5586ead 100644 --- a/app/Http/Requests/Api/Application/Locations/StoreLocationRequest.php +++ b/app/Http/Requests/Api/Application/Locations/StoreLocationRequest.php @@ -20,8 +20,6 @@ class StoreLocationRequest extends ApplicationApiRequest /** * Rules to validate the request against. - * - * @return array */ public function rules(): array { diff --git a/app/Http/Requests/Api/Application/Locations/UpdateLocationRequest.php b/app/Http/Requests/Api/Application/Locations/UpdateLocationRequest.php index 0877fa45..c775e2b1 100644 --- a/app/Http/Requests/Api/Application/Locations/UpdateLocationRequest.php +++ b/app/Http/Requests/Api/Application/Locations/UpdateLocationRequest.php @@ -8,8 +8,6 @@ class UpdateLocationRequest extends StoreLocationRequest { /** * Determine if the requested location exists on the Panel. - * - * @return bool */ public function resourceExists(): bool { @@ -20,8 +18,6 @@ class UpdateLocationRequest extends StoreLocationRequest /** * Rules to validate this request against. - * - * @return array */ public function rules(): array { diff --git a/app/Http/Requests/Api/Application/Nests/Eggs/GetEggRequest.php b/app/Http/Requests/Api/Application/Nests/Eggs/GetEggRequest.php index fb364d1a..80304ab2 100644 --- a/app/Http/Requests/Api/Application/Nests/Eggs/GetEggRequest.php +++ b/app/Http/Requests/Api/Application/Nests/Eggs/GetEggRequest.php @@ -21,8 +21,6 @@ class GetEggRequest extends ApplicationApiRequest /** * Determine if the requested egg exists for the selected nest. - * - * @return bool */ public function resourceExists(): bool { diff --git a/app/Http/Requests/Api/Application/Nodes/DeleteNodeRequest.php b/app/Http/Requests/Api/Application/Nodes/DeleteNodeRequest.php index 77dd24ea..eb1d1d9a 100644 --- a/app/Http/Requests/Api/Application/Nodes/DeleteNodeRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/DeleteNodeRequest.php @@ -21,8 +21,6 @@ class DeleteNodeRequest extends ApplicationApiRequest /** * Determine if the node being requested for editing exists * on the Panel before validating the data. - * - * @return bool */ public function resourceExists(): bool { diff --git a/app/Http/Requests/Api/Application/Nodes/GetNodeRequest.php b/app/Http/Requests/Api/Application/Nodes/GetNodeRequest.php index fbf957ed..bbb15703 100644 --- a/app/Http/Requests/Api/Application/Nodes/GetNodeRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/GetNodeRequest.php @@ -8,8 +8,6 @@ class GetNodeRequest extends GetNodesRequest { /** * Determine if the requested node exists on the Panel. - * - * @return bool */ public function resourceExists(): bool { diff --git a/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php b/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php index 8e23db43..8c05c5a3 100644 --- a/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php @@ -20,9 +20,6 @@ class StoreNodeRequest extends ApplicationApiRequest /** * Validation rules to apply to this request. - * - * @param array|null $rules - * @return array */ public function rules(array $rules = null): array { @@ -74,7 +71,7 @@ class StoreNodeRequest extends ApplicationApiRequest $response = parent::validated(); $response['daemonListen'] = $response['daemon_listen']; $response['daemonSFTP'] = $response['daemon_sftp']; - $response['daemonBase'] = $response['daemon_base'] ?? (new Node)->getAttribute('daemonBase'); + $response['daemonBase'] = $response['daemon_base'] ?? (new Node())->getAttribute('daemonBase'); unset($response['daemon_base'], $response['daemon_listen'], $response['daemon_sftp']); diff --git a/app/Http/Requests/Api/Application/Nodes/UpdateNodeRequest.php b/app/Http/Requests/Api/Application/Nodes/UpdateNodeRequest.php index bf228049..2da2d406 100644 --- a/app/Http/Requests/Api/Application/Nodes/UpdateNodeRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/UpdateNodeRequest.php @@ -9,9 +9,6 @@ class UpdateNodeRequest extends StoreNodeRequest /** * Apply validation rules to this request. Uses the parent class rules() * function but passes in the rules for updating rather than creating. - * - * @param array|null $rules - * @return array */ public function rules(array $rules = null): array { diff --git a/app/Http/Requests/Api/Application/Servers/Databases/GetServerDatabaseRequest.php b/app/Http/Requests/Api/Application/Servers/Databases/GetServerDatabaseRequest.php index e398a5bb..2dff1374 100644 --- a/app/Http/Requests/Api/Application/Servers/Databases/GetServerDatabaseRequest.php +++ b/app/Http/Requests/Api/Application/Servers/Databases/GetServerDatabaseRequest.php @@ -19,8 +19,6 @@ class GetServerDatabaseRequest extends ApplicationApiRequest /** * Determine if the requested server database exists. - * - * @return bool */ public function resourceExists(): bool { diff --git a/app/Http/Requests/Api/Application/Servers/Databases/StoreServerDatabaseRequest.php b/app/Http/Requests/Api/Application/Servers/Databases/StoreServerDatabaseRequest.php index 4ca01941..c37de870 100644 --- a/app/Http/Requests/Api/Application/Servers/Databases/StoreServerDatabaseRequest.php +++ b/app/Http/Requests/Api/Application/Servers/Databases/StoreServerDatabaseRequest.php @@ -24,8 +24,6 @@ class StoreServerDatabaseRequest extends ApplicationApiRequest /** * Validation rules for database creation. - * - * @return array */ public function rules(): array { @@ -76,8 +74,6 @@ class StoreServerDatabaseRequest extends ApplicationApiRequest /** * Returns the database name in the expected format. - * - * @return string */ public function databaseName(): string { diff --git a/app/Http/Requests/Api/Application/Servers/GetExternalServerRequest.php b/app/Http/Requests/Api/Application/Servers/GetExternalServerRequest.php index f783dc71..902bc60c 100644 --- a/app/Http/Requests/Api/Application/Servers/GetExternalServerRequest.php +++ b/app/Http/Requests/Api/Application/Servers/GetExternalServerRequest.php @@ -27,8 +27,6 @@ class GetExternalServerRequest extends ApplicationApiRequest /** * Determine if the requested external user exists. - * - * @return bool */ public function resourceExists(): bool { @@ -47,8 +45,6 @@ class GetExternalServerRequest extends ApplicationApiRequest /** * Return the server model for the requested external server. - * - * @return \Pterodactyl\Models\Server */ public function getServerModel(): Server { diff --git a/app/Http/Requests/Api/Application/Servers/GetServersRequest.php b/app/Http/Requests/Api/Application/Servers/GetServersRequest.php index 8a0a3053..ece97766 100644 --- a/app/Http/Requests/Api/Application/Servers/GetServersRequest.php +++ b/app/Http/Requests/Api/Application/Servers/GetServersRequest.php @@ -4,9 +4,6 @@ namespace Pterodactyl\Http\Requests\Api\Application\Servers; class GetServersRequest extends GetServerRequest { - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Application/Servers/StoreServerRequest.php b/app/Http/Requests/Api/Application/Servers/StoreServerRequest.php index 5e4f9c20..dd24e1ef 100644 --- a/app/Http/Requests/Api/Application/Servers/StoreServerRequest.php +++ b/app/Http/Requests/Api/Application/Servers/StoreServerRequest.php @@ -23,8 +23,6 @@ class StoreServerRequest extends ApplicationApiRequest /** * Rules to be applied to this request. - * - * @return array */ public function rules(): array { @@ -120,7 +118,7 @@ class StoreServerRequest extends ApplicationApiRequest $query->whereNull('server_id'); }), ], function ($input) { - return ! ($input->deploy); + return !($input->deploy); }); $validator->sometimes('allocation.additional.*', [ @@ -129,7 +127,7 @@ class StoreServerRequest extends ApplicationApiRequest $query->whereNull('server_id'); }), ], function ($input) { - return ! ($input->deploy); + return !($input->deploy); }); $validator->sometimes('deploy.locations', 'present', function ($input) { @@ -152,7 +150,7 @@ class StoreServerRequest extends ApplicationApiRequest return null; } - $object = new DeploymentObject; + $object = new DeploymentObject(); $object->setDedicated($this->input('deploy.dedicated_ip', false)); $object->setLocations($this->input('deploy.locations', [])); $object->setPorts($this->input('deploy.port_range', [])); diff --git a/app/Http/Requests/Api/Application/Servers/UpdateServerBuildConfigurationRequest.php b/app/Http/Requests/Api/Application/Servers/UpdateServerBuildConfigurationRequest.php index a387634c..3f534b08 100644 --- a/app/Http/Requests/Api/Application/Servers/UpdateServerBuildConfigurationRequest.php +++ b/app/Http/Requests/Api/Application/Servers/UpdateServerBuildConfigurationRequest.php @@ -9,8 +9,6 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest { /** * Return the rules to validate this request against. - * - * @return array */ public function rules(): array { @@ -67,7 +65,7 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest unset($data['allocation'], $data['feature_limits']); // Adjust the limits field to match what is expected by the model. - if (! empty($data['limits'])) { + if (!empty($data['limits'])) { foreach ($data['limits'] as $key => $value) { $data[$key] = $value; } @@ -101,16 +99,13 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest * compatability with the old API endpoint while also supporting a more correct API * call. * - * @param string $field - * @param array $rules - * @param bool $limits * @return array * * @see https://github.com/pterodactyl/panel/issues/1500 */ protected function requiredToOptional(string $field, array $rules, bool $limits = false) { - if (! in_array('required', $rules)) { + if (!in_array('required', $rules)) { return $rules; } diff --git a/app/Http/Requests/Api/Application/Servers/UpdateServerDetailsRequest.php b/app/Http/Requests/Api/Application/Servers/UpdateServerDetailsRequest.php index 172dd1e3..06bd22f5 100644 --- a/app/Http/Requests/Api/Application/Servers/UpdateServerDetailsRequest.php +++ b/app/Http/Requests/Api/Application/Servers/UpdateServerDetailsRequest.php @@ -8,8 +8,6 @@ class UpdateServerDetailsRequest extends ServerWriteRequest { /** * Rules to apply to a server details update request. - * - * @return array */ public function rules(): array { @@ -26,8 +24,6 @@ class UpdateServerDetailsRequest extends ServerWriteRequest /** * Convert the posted data into the correct format that is expected * by the application. - * - * @return array */ public function validated(): array { @@ -42,8 +38,6 @@ class UpdateServerDetailsRequest extends ServerWriteRequest /** * Rename some of the attributes in error messages to clarify the field * being discussed. - * - * @return array */ public function attributes(): array { diff --git a/app/Http/Requests/Api/Application/Servers/UpdateServerStartupRequest.php b/app/Http/Requests/Api/Application/Servers/UpdateServerStartupRequest.php index fc367cda..a873e019 100644 --- a/app/Http/Requests/Api/Application/Servers/UpdateServerStartupRequest.php +++ b/app/Http/Requests/Api/Application/Servers/UpdateServerStartupRequest.php @@ -20,8 +20,6 @@ class UpdateServerStartupRequest extends ApplicationApiRequest /** * Validation rules to run the input against. - * - * @return array */ public function rules(): array { diff --git a/app/Http/Requests/Api/Application/Users/DeleteUserRequest.php b/app/Http/Requests/Api/Application/Users/DeleteUserRequest.php index 571b29c6..56c028a6 100644 --- a/app/Http/Requests/Api/Application/Users/DeleteUserRequest.php +++ b/app/Http/Requests/Api/Application/Users/DeleteUserRequest.php @@ -20,8 +20,6 @@ class DeleteUserRequest extends ApplicationApiRequest /** * Determine if the requested user exists on the Panel. - * - * @return bool */ public function resourceExists(): bool { diff --git a/app/Http/Requests/Api/Application/Users/GetExternalUserRequest.php b/app/Http/Requests/Api/Application/Users/GetExternalUserRequest.php index 4ad98c0f..5f63d04b 100644 --- a/app/Http/Requests/Api/Application/Users/GetExternalUserRequest.php +++ b/app/Http/Requests/Api/Application/Users/GetExternalUserRequest.php @@ -27,8 +27,6 @@ class GetExternalUserRequest extends ApplicationApiRequest /** * Determine if the requested external user exists. - * - * @return bool */ public function resourceExists(): bool { @@ -47,8 +45,6 @@ class GetExternalUserRequest extends ApplicationApiRequest /** * Return the user model for the requested external user. - * - * @return \Pterodactyl\Models\User */ public function getUserModel(): User { diff --git a/app/Http/Requests/Api/Application/Users/StoreUserRequest.php b/app/Http/Requests/Api/Application/Users/StoreUserRequest.php index 9cddad7e..10a2d6b2 100644 --- a/app/Http/Requests/Api/Application/Users/StoreUserRequest.php +++ b/app/Http/Requests/Api/Application/Users/StoreUserRequest.php @@ -20,9 +20,6 @@ class StoreUserRequest extends ApplicationApiRequest /** * Return the validation rules for this request. - * - * @param array|null $rules - * @return array */ public function rules(array $rules = null): array { diff --git a/app/Http/Requests/Api/Application/Users/UpdateUserRequest.php b/app/Http/Requests/Api/Application/Users/UpdateUserRequest.php index ce38348d..b341eaa2 100644 --- a/app/Http/Requests/Api/Application/Users/UpdateUserRequest.php +++ b/app/Http/Requests/Api/Application/Users/UpdateUserRequest.php @@ -8,9 +8,6 @@ class UpdateUserRequest extends StoreUserRequest { /** * Return the validation rules for this request. - * - * @param array|null $rules - * @return array */ public function rules(array $rules = null): array { diff --git a/app/Http/Requests/Api/Client/Account/StoreApiKeyRequest.php b/app/Http/Requests/Api/Client/Account/StoreApiKeyRequest.php index 1a263286..c2a21c4c 100644 --- a/app/Http/Requests/Api/Client/Account/StoreApiKeyRequest.php +++ b/app/Http/Requests/Api/Client/Account/StoreApiKeyRequest.php @@ -7,9 +7,6 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class StoreApiKeyRequest extends ClientApiRequest { - /** - * @return array - */ public function rules(): array { $rules = ApiKey::getRules(); diff --git a/app/Http/Requests/Api/Client/Account/UpdateEmailRequest.php b/app/Http/Requests/Api/Client/Account/UpdateEmailRequest.php index c9936508..193d2fd7 100644 --- a/app/Http/Requests/Api/Client/Account/UpdateEmailRequest.php +++ b/app/Http/Requests/Api/Client/Account/UpdateEmailRequest.php @@ -9,27 +9,22 @@ use Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException; class UpdateEmailRequest extends ClientApiRequest { /** - * @return bool - * * @throws \Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException */ public function authorize(): bool { - if (! parent::authorize()) { + if (!parent::authorize()) { return false; } // Verify password matches when changing password or email. - if (! password_verify($this->input('password'), $this->user()->password)) { + if (!password_verify($this->input('password'), $this->user()->password)) { throw new InvalidPasswordProvidedException(trans('validation.internal.invalid_password')); } return true; } - /** - * @return array - */ public function rules(): array { $rules = User::getRulesForUpdate($this->user()); diff --git a/app/Http/Requests/Api/Client/Account/UpdatePasswordRequest.php b/app/Http/Requests/Api/Client/Account/UpdatePasswordRequest.php index 3bbff3d4..c0e27bdb 100644 --- a/app/Http/Requests/Api/Client/Account/UpdatePasswordRequest.php +++ b/app/Http/Requests/Api/Client/Account/UpdatePasswordRequest.php @@ -8,27 +8,22 @@ use Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException; class UpdatePasswordRequest extends ClientApiRequest { /** - * @return bool - * * @throws \Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException */ public function authorize(): bool { - if (! parent::authorize()) { + if (!parent::authorize()) { return false; } // Verify password matches when changing password or email. - if (! password_verify($this->input('current_password'), $this->user()->password)) { + if (!password_verify($this->input('current_password'), $this->user()->password)) { throw new InvalidPasswordProvidedException(trans('validation.internal.invalid_password')); } return true; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/ClientApiRequest.php b/app/Http/Requests/Api/Client/ClientApiRequest.php index 465d5a48..5ae1680a 100644 --- a/app/Http/Requests/Api/Client/ClientApiRequest.php +++ b/app/Http/Requests/Api/Client/ClientApiRequest.php @@ -13,8 +13,6 @@ class ClientApiRequest extends ApplicationApiRequest { /** * Determine if the current user is authorized to perform the requested action against the API. - * - * @return bool */ public function authorize(): bool { diff --git a/app/Http/Requests/Api/Client/GetServersRequest.php b/app/Http/Requests/Api/Client/GetServersRequest.php index 9b4601f2..28b4c2de 100644 --- a/app/Http/Requests/Api/Client/GetServersRequest.php +++ b/app/Http/Requests/Api/Client/GetServersRequest.php @@ -4,9 +4,6 @@ namespace Pterodactyl\Http\Requests\Api\Client; class GetServersRequest extends ClientApiRequest { - /** - * @return bool - */ public function authorize(): bool { return true; diff --git a/app/Http/Requests/Api/Client/Servers/Backups/DownloadBackupRequest.php b/app/Http/Requests/Api/Client/Servers/Backups/DownloadBackupRequest.php index cfa38e68..de02f44b 100644 --- a/app/Http/Requests/Api/Client/Servers/Backups/DownloadBackupRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Backups/DownloadBackupRequest.php @@ -20,8 +20,6 @@ class DownloadBackupRequest extends ClientApiRequest /** * Ensure that this backup belongs to the server that is also present in the * request. - * - * @return bool */ public function resourceExists(): bool { diff --git a/app/Http/Requests/Api/Client/Servers/Backups/StoreBackupRequest.php b/app/Http/Requests/Api/Client/Servers/Backups/StoreBackupRequest.php index 4ca89215..538588ab 100644 --- a/app/Http/Requests/Api/Client/Servers/Backups/StoreBackupRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Backups/StoreBackupRequest.php @@ -15,9 +15,6 @@ class StoreBackupRequest extends ClientApiRequest return Permission::ACTION_BACKUP_CREATE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Databases/DeleteDatabaseRequest.php b/app/Http/Requests/Api/Client/Servers/Databases/DeleteDatabaseRequest.php index c2161680..92b14157 100644 --- a/app/Http/Requests/Api/Client/Servers/Databases/DeleteDatabaseRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Databases/DeleteDatabaseRequest.php @@ -10,17 +10,11 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class DeleteDatabaseRequest extends ClientApiRequest implements ClientPermissionsRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_DATABASE_DELETE; } - /** - * @return bool - */ public function resourceExists(): bool { return $this->getModel(Server::class)->id === $this->getModel(Database::class)->server_id; diff --git a/app/Http/Requests/Api/Client/Servers/Databases/GetDatabasesRequest.php b/app/Http/Requests/Api/Client/Servers/Databases/GetDatabasesRequest.php index be78b5eb..80eabf94 100644 --- a/app/Http/Requests/Api/Client/Servers/Databases/GetDatabasesRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Databases/GetDatabasesRequest.php @@ -8,9 +8,6 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class GetDatabasesRequest extends ClientApiRequest implements ClientPermissionsRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_DATABASE_READ; diff --git a/app/Http/Requests/Api/Client/Servers/Databases/RotatePasswordRequest.php b/app/Http/Requests/Api/Client/Servers/Databases/RotatePasswordRequest.php index 7869cbf3..b2a9163a 100644 --- a/app/Http/Requests/Api/Client/Servers/Databases/RotatePasswordRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Databases/RotatePasswordRequest.php @@ -9,8 +9,6 @@ class RotatePasswordRequest extends ClientApiRequest { /** * Check that the user has permission to rotate the password. - * - * @return string */ public function permission(): string { diff --git a/app/Http/Requests/Api/Client/Servers/Databases/StoreDatabaseRequest.php b/app/Http/Requests/Api/Client/Servers/Databases/StoreDatabaseRequest.php index 42bc8587..b8f12bd8 100644 --- a/app/Http/Requests/Api/Client/Servers/Databases/StoreDatabaseRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Databases/StoreDatabaseRequest.php @@ -13,17 +13,11 @@ use Pterodactyl\Services\Databases\DatabaseManagementService; class StoreDatabaseRequest extends ClientApiRequest implements ClientPermissionsRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_DATABASE_CREATE; } - /** - * @return array - */ public function rules(): array { $server = $this->route()->parameter('server'); diff --git a/app/Http/Requests/Api/Client/Servers/Files/ChmodFilesRequest.php b/app/Http/Requests/Api/Client/Servers/Files/ChmodFilesRequest.php index 158a0a7f..bf94cb6b 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/ChmodFilesRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/ChmodFilesRequest.php @@ -8,17 +8,11 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class ChmodFilesRequest extends ClientApiRequest implements ClientPermissionsRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_FILE_UPDATE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Files/CompressFilesRequest.php b/app/Http/Requests/Api/Client/Servers/Files/CompressFilesRequest.php index bd574cf5..3d6e96aa 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/CompressFilesRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/CompressFilesRequest.php @@ -9,17 +9,12 @@ class CompressFilesRequest extends ClientApiRequest { /** * Checks that the authenticated user is allowed to create archives for this server. - * - * @return string */ public function permission(): string { return Permission::ACTION_FILE_ARCHIVE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Files/CopyFileRequest.php b/app/Http/Requests/Api/Client/Servers/Files/CopyFileRequest.php index 97bfc3fb..686c23a2 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/CopyFileRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/CopyFileRequest.php @@ -8,17 +8,11 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class CopyFileRequest extends ClientApiRequest implements ClientPermissionsRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_FILE_CREATE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Files/CreateFolderRequest.php b/app/Http/Requests/Api/Client/Servers/Files/CreateFolderRequest.php index 10457ffe..e4655575 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/CreateFolderRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/CreateFolderRequest.php @@ -9,17 +9,12 @@ class CreateFolderRequest extends ClientApiRequest { /** * Checks that the authenticated user is allowed to create files on the server. - * - * @return string */ public function permission(): string { return Permission::ACTION_FILE_CREATE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Files/DecompressFilesRequest.php b/app/Http/Requests/Api/Client/Servers/Files/DecompressFilesRequest.php index f8493ec4..6e24682e 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/DecompressFilesRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/DecompressFilesRequest.php @@ -11,17 +11,12 @@ class DecompressFilesRequest extends ClientApiRequest * Checks that the authenticated user is allowed to create new files for the server. We don't * rely on the archive permission here as it makes more sense to make sure the user can create * additional files rather than make an archive. - * - * @return string */ public function permission(): string { return Permission::ACTION_FILE_CREATE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Files/DeleteFileRequest.php b/app/Http/Requests/Api/Client/Servers/Files/DeleteFileRequest.php index 7f5ccbf7..10db3281 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/DeleteFileRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/DeleteFileRequest.php @@ -8,17 +8,11 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class DeleteFileRequest extends ClientApiRequest implements ClientPermissionsRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_FILE_DELETE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Files/DownloadFileRequest.php b/app/Http/Requests/Api/Client/Servers/Files/DownloadFileRequest.php index 0eb9791c..0386b855 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/DownloadFileRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/DownloadFileRequest.php @@ -10,8 +10,6 @@ class DownloadFileRequest extends ClientApiRequest /** * Ensure that the user making this request has permission to download files * from this server. - * - * @return bool */ public function authorize(): bool { diff --git a/app/Http/Requests/Api/Client/Servers/Files/GetFileContentsRequest.php b/app/Http/Requests/Api/Client/Servers/Files/GetFileContentsRequest.php index 008b4443..ea6ed7b6 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/GetFileContentsRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/GetFileContentsRequest.php @@ -12,17 +12,12 @@ class GetFileContentsRequest extends ClientApiRequest implements ClientPermissio * Returns the permissions string indicating which permission should be used to * validate that the authenticated user has permission to perform this action aganist * the given resource (server). - * - * @return string */ public function permission(): string { return Permission::ACTION_FILE_READ_CONTENT; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Files/ListFilesRequest.php b/app/Http/Requests/Api/Client/Servers/Files/ListFilesRequest.php index 4f71648c..cc66d69b 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/ListFilesRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/ListFilesRequest.php @@ -10,17 +10,12 @@ class ListFilesRequest extends ClientApiRequest /** * Check that the user making this request to the API is authorized to list all * of the files that exist for a given server. - * - * @return string */ public function permission(): string { return Permission::ACTION_FILE_READ; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Files/PullFileRequest.php b/app/Http/Requests/Api/Client/Servers/Files/PullFileRequest.php index 02a2fd37..ad3d5789 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/PullFileRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/PullFileRequest.php @@ -8,9 +8,6 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class PullFileRequest extends ClientApiRequest implements ClientPermissionsRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_FILE_CREATE; diff --git a/app/Http/Requests/Api/Client/Servers/Files/RenameFileRequest.php b/app/Http/Requests/Api/Client/Servers/Files/RenameFileRequest.php index c8529a35..61c4a0c5 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/RenameFileRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/RenameFileRequest.php @@ -11,17 +11,12 @@ class RenameFileRequest extends ClientApiRequest implements ClientPermissionsReq /** * The permission the user is required to have in order to perform this * request action. - * - * @return string */ public function permission(): string { return Permission::ACTION_FILE_UPDATE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Files/WriteFileContentRequest.php b/app/Http/Requests/Api/Client/Servers/Files/WriteFileContentRequest.php index d5db8c24..82a994c3 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/WriteFileContentRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/WriteFileContentRequest.php @@ -12,8 +12,6 @@ class WriteFileContentRequest extends ClientApiRequest implements ClientPermissi * Returns the permissions string indicating which permission should be used to * validate that the authenticated user has permission to perform this action aganist * the given resource (server). - * - * @return string */ public function permission(): string { @@ -24,8 +22,6 @@ class WriteFileContentRequest extends ClientApiRequest implements ClientPermissi * There is no rule here for the file contents since we just use the body content * on the request to set the file contents. If nothing is passed that is fine since * it just means we want to set the file to be empty. - * - * @return array */ public function rules(): array { diff --git a/app/Http/Requests/Api/Client/Servers/GetServerRequest.php b/app/Http/Requests/Api/Client/Servers/GetServerRequest.php index b69203fc..3798d77a 100644 --- a/app/Http/Requests/Api/Client/Servers/GetServerRequest.php +++ b/app/Http/Requests/Api/Client/Servers/GetServerRequest.php @@ -10,8 +10,6 @@ class GetServerRequest extends ClientApiRequest * Determine if a client has permission to view this server on the API. This * should never be false since this would be checking the same permission as * resourceExists(). - * - * @return bool */ public function authorize(): bool { diff --git a/app/Http/Requests/Api/Client/Servers/Network/DeleteAllocationRequest.php b/app/Http/Requests/Api/Client/Servers/Network/DeleteAllocationRequest.php index 9c0d911f..b7f6ca7b 100644 --- a/app/Http/Requests/Api/Client/Servers/Network/DeleteAllocationRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Network/DeleteAllocationRequest.php @@ -7,9 +7,6 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class DeleteAllocationRequest extends ClientApiRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_ALLOCATION_DELETE; diff --git a/app/Http/Requests/Api/Client/Servers/Network/GetNetworkRequest.php b/app/Http/Requests/Api/Client/Servers/Network/GetNetworkRequest.php index bf737de7..7304bbd9 100644 --- a/app/Http/Requests/Api/Client/Servers/Network/GetNetworkRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Network/GetNetworkRequest.php @@ -10,8 +10,6 @@ class GetNetworkRequest extends ClientApiRequest /** * Check that the user has permission to view the allocations for * this server. - * - * @return string */ public function permission(): string { diff --git a/app/Http/Requests/Api/Client/Servers/Network/NewAllocationRequest.php b/app/Http/Requests/Api/Client/Servers/Network/NewAllocationRequest.php index 4a29378d..e6fc19b3 100644 --- a/app/Http/Requests/Api/Client/Servers/Network/NewAllocationRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Network/NewAllocationRequest.php @@ -7,9 +7,6 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class NewAllocationRequest extends ClientApiRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_ALLOCATION_CREATE; diff --git a/app/Http/Requests/Api/Client/Servers/Network/SetPrimaryAllocationRequest.php b/app/Http/Requests/Api/Client/Servers/Network/SetPrimaryAllocationRequest.php index f698f18e..30186d73 100644 --- a/app/Http/Requests/Api/Client/Servers/Network/SetPrimaryAllocationRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Network/SetPrimaryAllocationRequest.php @@ -4,9 +4,6 @@ namespace Pterodactyl\Http\Requests\Api\Client\Servers\Network; class SetPrimaryAllocationRequest extends UpdateAllocationRequest { - /** - * @return array - */ public function rules(): array { return []; diff --git a/app/Http/Requests/Api/Client/Servers/Network/UpdateAllocationRequest.php b/app/Http/Requests/Api/Client/Servers/Network/UpdateAllocationRequest.php index 766a66b7..570a8df9 100644 --- a/app/Http/Requests/Api/Client/Servers/Network/UpdateAllocationRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Network/UpdateAllocationRequest.php @@ -8,17 +8,11 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class UpdateAllocationRequest extends ClientApiRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_ALLOCATION_UPDATE; } - /** - * @return array - */ public function rules(): array { $rules = Allocation::getRules(); diff --git a/app/Http/Requests/Api/Client/Servers/Schedules/DeleteScheduleRequest.php b/app/Http/Requests/Api/Client/Servers/Schedules/DeleteScheduleRequest.php index 8ecc7af0..19d97226 100644 --- a/app/Http/Requests/Api/Client/Servers/Schedules/DeleteScheduleRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Schedules/DeleteScheduleRequest.php @@ -6,9 +6,6 @@ use Pterodactyl\Models\Permission; class DeleteScheduleRequest extends ViewScheduleRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_SCHEDULE_DELETE; diff --git a/app/Http/Requests/Api/Client/Servers/Schedules/StoreScheduleRequest.php b/app/Http/Requests/Api/Client/Servers/Schedules/StoreScheduleRequest.php index a8dfbc3a..771407f1 100644 --- a/app/Http/Requests/Api/Client/Servers/Schedules/StoreScheduleRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Schedules/StoreScheduleRequest.php @@ -7,17 +7,11 @@ use Pterodactyl\Models\Permission; class StoreScheduleRequest extends ViewScheduleRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_SCHEDULE_CREATE; } - /** - * @return array - */ public function rules(): array { $rules = Schedule::getRules(); diff --git a/app/Http/Requests/Api/Client/Servers/Schedules/StoreTaskRequest.php b/app/Http/Requests/Api/Client/Servers/Schedules/StoreTaskRequest.php index cd95bf5e..811b87df 100644 --- a/app/Http/Requests/Api/Client/Servers/Schedules/StoreTaskRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Schedules/StoreTaskRequest.php @@ -10,17 +10,12 @@ class StoreTaskRequest extends ViewScheduleRequest * Determine if the user is allowed to create a new task for this schedule. We simply * check if they can modify a schedule to determine if they're able to do this. There * are no task specific permissions. - * - * @return string */ public function permission(): string { return Permission::ACTION_SCHEDULE_UPDATE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Schedules/TriggerScheduleRequest.php b/app/Http/Requests/Api/Client/Servers/Schedules/TriggerScheduleRequest.php index d89f5ed3..216274ac 100644 --- a/app/Http/Requests/Api/Client/Servers/Schedules/TriggerScheduleRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Schedules/TriggerScheduleRequest.php @@ -7,17 +7,11 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class TriggerScheduleRequest extends ClientApiRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_SCHEDULE_UPDATE; } - /** - * @return array - */ public function rules(): array { return []; diff --git a/app/Http/Requests/Api/Client/Servers/Schedules/UpdateScheduleRequest.php b/app/Http/Requests/Api/Client/Servers/Schedules/UpdateScheduleRequest.php index 844388e2..4b9fe431 100644 --- a/app/Http/Requests/Api/Client/Servers/Schedules/UpdateScheduleRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Schedules/UpdateScheduleRequest.php @@ -6,9 +6,6 @@ use Pterodactyl\Models\Permission; class UpdateScheduleRequest extends StoreScheduleRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_SCHEDULE_UPDATE; diff --git a/app/Http/Requests/Api/Client/Servers/Schedules/ViewScheduleRequest.php b/app/Http/Requests/Api/Client/Servers/Schedules/ViewScheduleRequest.php index f57afef6..72674a35 100644 --- a/app/Http/Requests/Api/Client/Servers/Schedules/ViewScheduleRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Schedules/ViewScheduleRequest.php @@ -13,12 +13,10 @@ class ViewScheduleRequest extends ClientApiRequest { /** * Determine if this resource can be viewed. - * - * @return bool */ public function authorize(): bool { - if (! parent::authorize()) { + if (!parent::authorize()) { return false; } @@ -31,18 +29,13 @@ class ViewScheduleRequest extends ClientApiRequest $task = $this->route()->parameter('task'); if ($schedule->server_id !== $server->id || ($task instanceof Task && $task->schedule_id !== $schedule->id)) { - throw new NotFoundHttpException( - 'The requested resource does not exist on the system.' - ); + throw new NotFoundHttpException('The requested resource does not exist on the system.'); } } return true; } - /** - * @return string - */ public function permission(): string { return Permission::ACTION_SCHEDULE_READ; diff --git a/app/Http/Requests/Api/Client/Servers/SendCommandRequest.php b/app/Http/Requests/Api/Client/Servers/SendCommandRequest.php index 3f2f6c19..171cd19d 100644 --- a/app/Http/Requests/Api/Client/Servers/SendCommandRequest.php +++ b/app/Http/Requests/Api/Client/Servers/SendCommandRequest.php @@ -9,8 +9,6 @@ class SendCommandRequest extends ClientApiRequest { /** * Determine if the API user has permission to perform this action. - * - * @return string */ public function permission(): string { @@ -19,8 +17,6 @@ class SendCommandRequest extends ClientApiRequest /** * Rules to validate this request against. - * - * @return array */ public function rules(): array { diff --git a/app/Http/Requests/Api/Client/Servers/SendPowerRequest.php b/app/Http/Requests/Api/Client/Servers/SendPowerRequest.php index ea7e00fc..e071388c 100644 --- a/app/Http/Requests/Api/Client/Servers/SendPowerRequest.php +++ b/app/Http/Requests/Api/Client/Servers/SendPowerRequest.php @@ -9,8 +9,6 @@ class SendPowerRequest extends ClientApiRequest { /** * Determine if the user has permission to send a power command to a server. - * - * @return string */ public function permission(): string { @@ -29,8 +27,6 @@ class SendPowerRequest extends ClientApiRequest /** * Rules to validate this request against. - * - * @return array */ public function rules(): array { diff --git a/app/Http/Requests/Api/Client/Servers/Settings/RenameServerRequest.php b/app/Http/Requests/Api/Client/Servers/Settings/RenameServerRequest.php index 14b11721..8cb5efa3 100644 --- a/app/Http/Requests/Api/Client/Servers/Settings/RenameServerRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Settings/RenameServerRequest.php @@ -13,8 +13,6 @@ class RenameServerRequest extends ClientApiRequest implements ClientPermissionsR * Returns the permissions string indicating which permission should be used to * validate that the authenticated user has permission to perform this action aganist * the given resource (server). - * - * @return string */ public function permission(): string { @@ -23,8 +21,6 @@ class RenameServerRequest extends ClientApiRequest implements ClientPermissionsR /** * The rules to apply when validating this request. - * - * @return array */ public function rules(): array { diff --git a/app/Http/Requests/Api/Client/Servers/Settings/SetDockerImageRequest.php b/app/Http/Requests/Api/Client/Servers/Settings/SetDockerImageRequest.php index be0b7213..bd3a1e65 100644 --- a/app/Http/Requests/Api/Client/Servers/Settings/SetDockerImageRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Settings/SetDockerImageRequest.php @@ -11,9 +11,6 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; class SetDockerImageRequest extends ClientApiRequest implements ClientPermissionsRequest { - /** - * @return string - */ public function permission(): string { return Permission::ACTION_STARTUP_DOCKER_IMAGE; diff --git a/app/Http/Requests/Api/Client/Servers/Subusers/GetSubuserRequest.php b/app/Http/Requests/Api/Client/Servers/Subusers/GetSubuserRequest.php index 3affcbac..ee43e0d6 100644 --- a/app/Http/Requests/Api/Client/Servers/Subusers/GetSubuserRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Subusers/GetSubuserRequest.php @@ -8,8 +8,6 @@ class GetSubuserRequest extends SubuserRequest { /** * Confirm that a user is able to view subusers for the specified server. - * - * @return string */ public function permission(): string { diff --git a/app/Http/Requests/Api/Client/Servers/Subusers/StoreSubuserRequest.php b/app/Http/Requests/Api/Client/Servers/Subusers/StoreSubuserRequest.php index 0848770f..5bc93ab2 100644 --- a/app/Http/Requests/Api/Client/Servers/Subusers/StoreSubuserRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Subusers/StoreSubuserRequest.php @@ -14,9 +14,6 @@ class StoreSubuserRequest extends SubuserRequest return Permission::ACTION_USER_CREATE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php b/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php index 98d0d964..5a20084d 100644 --- a/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php @@ -18,13 +18,11 @@ abstract class SubuserRequest extends ClientApiRequest /** * Authorize the request and ensure that a user is not trying to modify themselves. * - * @return bool - * * @throws \Illuminate\Contracts\Container\BindingResolutionException */ public function authorize(): bool { - if (! parent::authorize()) { + if (!parent::authorize()) { return false; } @@ -51,8 +49,6 @@ abstract class SubuserRequest extends ClientApiRequest * Validates that the permissions we are trying to assign can actually be assigned * by the user making the request. * - * @param array $permissions - * * @throws \Illuminate\Contracts\Container\BindingResolutionException */ protected function validatePermissionsCanBeAssigned(array $permissions) @@ -74,9 +70,7 @@ abstract class SubuserRequest extends ClientApiRequest $service = $this->container->make(GetUserPermissionsService::class); if (count(array_diff($permissions, $service->handle($server, $user))) > 0) { - throw new HttpForbiddenException( - 'Cannot assign permissions to a subuser that your account does not actively possess.' - ); + throw new HttpForbiddenException('Cannot assign permissions to a subuser that your account does not actively possess.'); } } } diff --git a/app/Http/Requests/Api/Client/Servers/Subusers/UpdateSubuserRequest.php b/app/Http/Requests/Api/Client/Servers/Subusers/UpdateSubuserRequest.php index 3a84a027..997b2dae 100644 --- a/app/Http/Requests/Api/Client/Servers/Subusers/UpdateSubuserRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Subusers/UpdateSubuserRequest.php @@ -14,9 +14,6 @@ class UpdateSubuserRequest extends SubuserRequest return Permission::ACTION_USER_UPDATE; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Auth/LoginCheckpointRequest.php b/app/Http/Requests/Auth/LoginCheckpointRequest.php index 87d84ce9..3c9392a6 100644 --- a/app/Http/Requests/Auth/LoginCheckpointRequest.php +++ b/app/Http/Requests/Auth/LoginCheckpointRequest.php @@ -9,8 +9,6 @@ class LoginCheckpointRequest extends FormRequest { /** * Determine if the request is authorized. - * - * @return bool */ public function authorize(): bool { @@ -19,8 +17,6 @@ class LoginCheckpointRequest extends FormRequest /** * Rules to apply to the request. - * - * @return array */ public function rules(): array { diff --git a/app/Http/Requests/Auth/LoginRequest.php b/app/Http/Requests/Auth/LoginRequest.php index 7fed2093..d0884692 100644 --- a/app/Http/Requests/Auth/LoginRequest.php +++ b/app/Http/Requests/Auth/LoginRequest.php @@ -6,17 +6,11 @@ use Illuminate\Foundation\Http\FormRequest; class LoginRequest extends FormRequest { - /** - * @return bool - */ public function authorized(): bool { return true; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Auth/ResetPasswordRequest.php b/app/Http/Requests/Auth/ResetPasswordRequest.php index e06883c2..e5bb3299 100644 --- a/app/Http/Requests/Auth/ResetPasswordRequest.php +++ b/app/Http/Requests/Auth/ResetPasswordRequest.php @@ -6,17 +6,11 @@ use Illuminate\Foundation\Http\FormRequest; class ResetPasswordRequest extends FormRequest { - /** - * @return bool - */ public function authorize(): bool { return true; } - /** - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/FrontendUserFormRequest.php b/app/Http/Requests/FrontendUserFormRequest.php index 6be818e7..b5553dc1 100644 --- a/app/Http/Requests/FrontendUserFormRequest.php +++ b/app/Http/Requests/FrontendUserFormRequest.php @@ -22,7 +22,7 @@ abstract class FrontendUserFormRequest extends FormRequest */ public function authorize() { - return ! is_null($this->user()); + return !is_null($this->user()); } /** diff --git a/app/Http/Resources/Wings/ServerConfigurationCollection.php b/app/Http/Resources/Wings/ServerConfigurationCollection.php index 8cf6ec7f..fe352301 100644 --- a/app/Http/Resources/Wings/ServerConfigurationCollection.php +++ b/app/Http/Resources/Wings/ServerConfigurationCollection.php @@ -17,6 +17,7 @@ class ServerConfigurationCollection extends ResourceCollection * have some serious performance issues from all of the N+1 queries. * * @param \Illuminate\Http\Request $request + * * @return array */ public function toArray($request) diff --git a/app/Http/ViewComposers/AssetComposer.php b/app/Http/ViewComposers/AssetComposer.php index 6da825ad..32ec9fb8 100644 --- a/app/Http/ViewComposers/AssetComposer.php +++ b/app/Http/ViewComposers/AssetComposer.php @@ -14,8 +14,6 @@ class AssetComposer /** * AssetComposer constructor. - * - * @param \Pterodactyl\Services\Helpers\AssetHashService $assetHashService */ public function __construct(AssetHashService $assetHashService) { @@ -24,8 +22,6 @@ class AssetComposer /** * Provide access to the asset service in the views. - * - * @param \Illuminate\View\View $view */ public function compose(View $view) { diff --git a/app/Jobs/Schedule/RunTaskJob.php b/app/Jobs/Schedule/RunTaskJob.php index 9b0497bb..3dd8e920 100644 --- a/app/Jobs/Schedule/RunTaskJob.php +++ b/app/Jobs/Schedule/RunTaskJob.php @@ -18,7 +18,9 @@ use Pterodactyl\Repositories\Wings\DaemonCommandRepository; class RunTaskJob extends Job implements ShouldQueue { - use DispatchesJobs, InteractsWithQueue, SerializesModels; + use DispatchesJobs; + use InteractsWithQueue; + use SerializesModels; /** * @var \Pterodactyl\Models\Task @@ -27,8 +29,6 @@ class RunTaskJob extends Job implements ShouldQueue /** * RunTaskJob constructor. - * - * @param \Pterodactyl\Models\Task $task */ public function __construct(Task $task) { @@ -39,10 +39,6 @@ class RunTaskJob extends Job implements ShouldQueue /** * Run the job and send actions to the daemon running the server. * - * @param \Pterodactyl\Repositories\Wings\DaemonCommandRepository $commandRepository - * @param \Pterodactyl\Services\Backups\InitiateBackupService $backupService - * @param \Pterodactyl\Repositories\Wings\DaemonPowerRepository $powerRepository - * * @throws \Throwable */ public function handle( @@ -51,7 +47,7 @@ class RunTaskJob extends Job implements ShouldQueue DaemonPowerRepository $powerRepository ) { // Do not process a task that is not set to active. - if (! $this->task->schedule->is_active) { + if (!$this->task->schedule->is_active) { $this->markTaskNotQueued(); $this->markScheduleComplete(); @@ -80,8 +76,6 @@ class RunTaskJob extends Job implements ShouldQueue /** * Handle a failure while sending the action to the daemon or otherwise processing the job. - * - * @param \Exception|null $exception */ public function failed(Exception $exception = null) { diff --git a/app/Models/Allocation.php b/app/Models/Allocation.php index 81e59652..9d609ba2 100644 --- a/app/Models/Allocation.php +++ b/app/Models/Allocation.php @@ -3,21 +3,19 @@ namespace Pterodactyl\Models; /** - * @property int $id - * @property int $node_id - * @property string $ip - * @property string|null $ip_alias - * @property int $port - * @property int|null $server_id - * @property string|null $notes - * @property \Carbon\Carbon|null $created_at - * @property \Carbon\Carbon|null $updated_at - * - * @property string $alias - * @property bool $has_alias - * + * @property int $id + * @property int $node_id + * @property string $ip + * @property string|null $ip_alias + * @property int $port + * @property int|null $server_id + * @property string|null $notes + * @property \Carbon\Carbon|null $created_at + * @property \Carbon\Carbon|null $updated_at + * @property string $alias + * @property bool $has_alias * @property \Pterodactyl\Models\Server|null $server - * @property \Pterodactyl\Models\Node $node + * @property \Pterodactyl\Models\Node $node */ class Allocation extends Model { @@ -25,7 +23,7 @@ class Allocation extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'allocation'; + public const RESOURCE_NAME = 'allocation'; /** * The table associated with the model. @@ -78,6 +76,7 @@ class Allocation extends Model * Accessor to automatically provide the IP alias if defined. * * @param string|null $value + * * @return string */ public function getAliasAttribute($value) @@ -89,11 +88,12 @@ class Allocation extends Model * Accessor to quickly determine if this allocation has an alias. * * @param string|null $value + * * @return bool */ public function getHasAliasAttribute($value) { - return ! is_null($this->ip_alias); + return !is_null($this->ip_alias); } /** diff --git a/app/Models/ApiKey.php b/app/Models/ApiKey.php index 3b15ca99..b05e22f3 100644 --- a/app/Models/ApiKey.php +++ b/app/Models/ApiKey.php @@ -5,16 +5,16 @@ namespace Pterodactyl\Models; use Pterodactyl\Services\Acl\Api\AdminAcl; /** - * @property int $id - * @property int $user_id - * @property int $key_type - * @property string $identifier - * @property string $token - * @property array $allowed_ips - * @property string $memo + * @property int $id + * @property int $user_id + * @property int $key_type + * @property string $identifier + * @property string $token + * @property array $allowed_ips + * @property string $memo * @property \Carbon\Carbon|null $last_used_at - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at */ class ApiKey extends Model { @@ -22,27 +22,27 @@ class ApiKey extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'api_key'; + public const RESOURCE_NAME = 'api_key'; /** * Different API keys that can exist on the system. */ - const TYPE_NONE = 0; - const TYPE_ACCOUNT = 1; - const TYPE_APPLICATION = 2; - const TYPE_DAEMON_USER = 3; - const TYPE_DAEMON_APPLICATION = 4; + public const TYPE_NONE = 0; + public const TYPE_ACCOUNT = 1; + public const TYPE_APPLICATION = 2; + public const TYPE_DAEMON_USER = 3; + public const TYPE_DAEMON_APPLICATION = 4; /** * The length of API key identifiers. */ - const IDENTIFIER_LENGTH = 16; + public const IDENTIFIER_LENGTH = 16; /** * The length of the actual API key that is encrypted and stored * in the database. */ - const KEY_LENGTH = 32; + public const KEY_LENGTH = 32; /** * The table associated with the model. diff --git a/app/Models/Backup.php b/app/Models/Backup.php index 6569d9f3..5e3940a8 100644 --- a/app/Models/Backup.php +++ b/app/Models/Backup.php @@ -5,31 +5,30 @@ namespace Pterodactyl\Models; use Illuminate\Database\Eloquent\SoftDeletes; /** - * @property int $id - * @property int $server_id - * @property string $uuid - * @property bool $is_successful - * @property string $name - * @property string[] $ignored_files - * @property string $disk - * @property string|null $checksum - * @property int $bytes - * @property string|null $upload_id + * @property int $id + * @property int $server_id + * @property string $uuid + * @property bool $is_successful + * @property string $name + * @property string[] $ignored_files + * @property string $disk + * @property string|null $checksum + * @property int $bytes + * @property string|null $upload_id * @property \Carbon\CarbonImmutable|null $completed_at - * @property \Carbon\CarbonImmutable $created_at - * @property \Carbon\CarbonImmutable $updated_at + * @property \Carbon\CarbonImmutable $created_at + * @property \Carbon\CarbonImmutable $updated_at * @property \Carbon\CarbonImmutable|null $deleted_at - * - * @property \Pterodactyl\Models\Server $server + * @property \Pterodactyl\Models\Server $server */ class Backup extends Model { use SoftDeletes; - const RESOURCE_NAME = 'backup'; + public const RESOURCE_NAME = 'backup'; - const ADAPTER_WINGS = 'wings'; - const ADAPTER_AWS_S3 = 's3'; + public const ADAPTER_WINGS = 'wings'; + public const ADAPTER_AWS_S3 = 's3'; /** * @var string diff --git a/app/Models/Database.php b/app/Models/Database.php index 8e66219f..8fb121d1 100644 --- a/app/Models/Database.php +++ b/app/Models/Database.php @@ -3,18 +3,17 @@ namespace Pterodactyl\Models; /** - * @property int $id - * @property int $server_id - * @property int $database_host_id - * @property string $database - * @property string $username - * @property string $remote - * @property string $password - * @property int $max_connections - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at - * - * @property \Pterodactyl\Models\Server $server + * @property int $id + * @property int $server_id + * @property int $database_host_id + * @property string $database + * @property string $username + * @property string $remote + * @property string $password + * @property int $max_connections + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at + * @property \Pterodactyl\Models\Server $server * @property \Pterodactyl\Models\DatabaseHost $host */ class Database extends Model @@ -23,7 +22,7 @@ class Database extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'server_database'; + public const RESOURCE_NAME = 'server_database'; /** * The table associated with the model. diff --git a/app/Models/DatabaseHost.php b/app/Models/DatabaseHost.php index 59471fce..1fb8a5c7 100644 --- a/app/Models/DatabaseHost.php +++ b/app/Models/DatabaseHost.php @@ -3,14 +3,14 @@ namespace Pterodactyl\Models; /** - * @property int $id - * @property string $name - * @property string $host - * @property int $port - * @property string $username - * @property string $password - * @property int|null $max_databases - * @property int|null $node_id + * @property int $id + * @property string $name + * @property string $host + * @property int $port + * @property string $username + * @property string $password + * @property int|null $max_databases + * @property int|null $node_id * @property \Carbon\CarbonImmutable $created_at * @property \Carbon\CarbonImmutable $updated_at */ @@ -20,7 +20,7 @@ class DatabaseHost extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'database_host'; + public const RESOURCE_NAME = 'database_host'; /** * @var bool diff --git a/app/Models/Egg.php b/app/Models/Egg.php index 03d5fa5f..70e7b305 100644 --- a/app/Models/Egg.php +++ b/app/Models/Egg.php @@ -3,46 +3,44 @@ namespace Pterodactyl\Models; /** - * @property int $id - * @property string $uuid - * @property int $nest_id - * @property string $author - * @property string $name - * @property string|null $description - * @property array|null $features - * @property string $docker_image -- deprecated, use $docker_images - * @property string $update_url - * @property array $docker_images - * @property string $file_denylist - * @property string|null $config_files - * @property string|null $config_startup - * @property string|null $config_logs - * @property string|null $config_stop - * @property int|null $config_from - * @property string|null $startup - * @property bool $script_is_privileged - * @property string|null $script_install - * @property string $script_entry - * @property string $script_container - * @property int|null $copy_script_from - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at - * - * @property string|null $copy_script_install - * @property string $copy_script_entry - * @property string $copy_script_container - * @property string|null $inherit_config_files - * @property string|null $inherit_config_startup - * @property string|null $inherit_config_logs - * @property string|null $inherit_config_stop - * @property string $inherit_file_denylist - * @property array|null $inherit_features - * - * @property \Pterodactyl\Models\Nest $nest - * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Server[] $servers + * @property int $id + * @property string $uuid + * @property int $nest_id + * @property string $author + * @property string $name + * @property string|null $description + * @property array|null $features + * @property string $docker_image -- deprecated, use $docker_images + * @property string $update_url + * @property array $docker_images + * @property string $file_denylist + * @property string|null $config_files + * @property string|null $config_startup + * @property string|null $config_logs + * @property string|null $config_stop + * @property int|null $config_from + * @property string|null $startup + * @property bool $script_is_privileged + * @property string|null $script_install + * @property string $script_entry + * @property string $script_container + * @property int|null $copy_script_from + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at + * @property string|null $copy_script_install + * @property string $copy_script_entry + * @property string $copy_script_container + * @property string|null $inherit_config_files + * @property string|null $inherit_config_startup + * @property string|null $inherit_config_logs + * @property string|null $inherit_config_stop + * @property string $inherit_file_denylist + * @property array|null $inherit_features + * @property \Pterodactyl\Models\Nest $nest + * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Server[] $servers * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\EggVariable[] $variables - * @property \Pterodactyl\Models\Egg|null $scriptFrom - * @property \Pterodactyl\Models\Egg|null $configFrom + * @property \Pterodactyl\Models\Egg|null $scriptFrom + * @property \Pterodactyl\Models\Egg|null $configFrom */ class Egg extends Model { @@ -50,7 +48,7 @@ class Egg extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'egg'; + public const RESOURCE_NAME = 'egg'; /** * Different features that can be enabled on any given egg. These are used internally @@ -61,8 +59,8 @@ class Egg extends Model * To skip copying the features, an empty array value should be passed in ("[]") rather * than leaving it null. */ - const FEATURE_EULA_POPUP = 'eula'; - const FEATURE_FASTDL = 'fastdl'; + public const FEATURE_EULA_POPUP = 'eula'; + public const FEATURE_FASTDL = 'fastdl'; /** * The table associated with the model. @@ -150,7 +148,7 @@ class Egg extends Model */ public function getCopyScriptInstallAttribute() { - if (! is_null($this->script_install) || is_null($this->copy_script_from)) { + if (!is_null($this->script_install) || is_null($this->copy_script_from)) { return $this->script_install; } @@ -165,7 +163,7 @@ class Egg extends Model */ public function getCopyScriptEntryAttribute() { - if (! is_null($this->script_entry) || is_null($this->copy_script_from)) { + if (!is_null($this->script_entry) || is_null($this->copy_script_from)) { return $this->script_entry; } @@ -180,7 +178,7 @@ class Egg extends Model */ public function getCopyScriptContainerAttribute() { - if (! is_null($this->script_container) || is_null($this->copy_script_from)) { + if (!is_null($this->script_container) || is_null($this->copy_script_from)) { return $this->script_container; } @@ -194,7 +192,7 @@ class Egg extends Model */ public function getInheritConfigFilesAttribute() { - if (! is_null($this->config_files) || is_null($this->config_from)) { + if (!is_null($this->config_files) || is_null($this->config_from)) { return $this->config_files; } @@ -208,7 +206,7 @@ class Egg extends Model */ public function getInheritConfigStartupAttribute() { - if (! is_null($this->config_startup) || is_null($this->config_from)) { + if (!is_null($this->config_startup) || is_null($this->config_from)) { return $this->config_startup; } @@ -222,7 +220,7 @@ class Egg extends Model */ public function getInheritConfigLogsAttribute() { - if (! is_null($this->config_logs) || is_null($this->config_from)) { + if (!is_null($this->config_logs) || is_null($this->config_from)) { return $this->config_logs; } @@ -236,7 +234,7 @@ class Egg extends Model */ public function getInheritConfigStopAttribute() { - if (! is_null($this->config_stop) || is_null($this->config_from)) { + if (!is_null($this->config_stop) || is_null($this->config_from)) { return $this->config_stop; } @@ -251,7 +249,7 @@ class Egg extends Model */ public function getInheritFeaturesAttribute() { - if (! is_null($this->features) || is_null($this->config_from)) { + if (!is_null($this->features) || is_null($this->config_from)) { return $this->features; } diff --git a/app/Models/EggVariable.php b/app/Models/EggVariable.php index 2adc3513..aaddf121 100644 --- a/app/Models/EggVariable.php +++ b/app/Models/EggVariable.php @@ -3,20 +3,19 @@ namespace Pterodactyl\Models; /** - * @property int $id - * @property int $egg_id - * @property string $name - * @property string $description - * @property string $env_variable - * @property string $default_value - * @property bool $user_viewable - * @property bool $user_editable - * @property string $rules - * @property \Carbon\CarbonImmutable $created_at - * @property \Carbon\CarbonImmutable $updated_at - * - * @property bool $required - * @property \Pterodactyl\Models\Egg $egg + * @property int $id + * @property int $egg_id + * @property string $name + * @property string $description + * @property string $env_variable + * @property string $default_value + * @property bool $user_viewable + * @property bool $user_editable + * @property string $rules + * @property \Carbon\CarbonImmutable $created_at + * @property \Carbon\CarbonImmutable $updated_at + * @property bool $required + * @property \Pterodactyl\Models\Egg $egg * @property \Pterodactyl\Models\ServerVariable $serverVariable * * The "server_value" variable is only present on the object if you've loaded this model @@ -29,14 +28,14 @@ class EggVariable extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'egg_variable'; + public const RESOURCE_NAME = 'egg_variable'; /** * Reserved environment variable names. * * @var string */ - const RESERVED_ENV_NAMES = 'SERVER_MEMORY,SERVER_IP,SERVER_PORT,ENV,HOME,USER,STARTUP,SERVER_UUID,UUID'; + public const RESERVED_ENV_NAMES = 'SERVER_MEMORY,SERVER_IP,SERVER_PORT,ENV,HOME,USER,STARTUP,SERVER_UUID,UUID'; /** * @var bool diff --git a/app/Models/Filters/AdminServerFilter.php b/app/Models/Filters/AdminServerFilter.php index d523e48e..32580ea5 100644 --- a/app/Models/Filters/AdminServerFilter.php +++ b/app/Models/Filters/AdminServerFilter.php @@ -12,16 +12,12 @@ class AdminServerFilter implements Filter * A multi-column filter for the servers table that allows an administrative user to search * across UUID, name, owner username, and owner email. * - * @param \Illuminate\Database\Eloquent\Builder $query * @param string $value - * @param string $property */ public function __invoke(Builder $query, $value, string $property) { if ($query->getQuery()->from !== 'servers') { - throw new BadMethodCallException( - 'Cannot use the AdminServerFilter against a non-server model.' - ); + throw new BadMethodCallException('Cannot use the AdminServerFilter against a non-server model.'); } $query ->select('servers.*') diff --git a/app/Models/Filters/MultiFieldServerFilter.php b/app/Models/Filters/MultiFieldServerFilter.php index 2d6cd2c0..2aac64e8 100644 --- a/app/Models/Filters/MultiFieldServerFilter.php +++ b/app/Models/Filters/MultiFieldServerFilter.php @@ -20,16 +20,12 @@ class MultiFieldServerFilter implements Filter * search across multiple columns. This allows us to provide a very generic search ability for * the frontend. * - * @param \Illuminate\Database\Eloquent\Builder $query * @param string $value - * @param string $property */ public function __invoke(Builder $query, $value, string $property) { if ($query->getQuery()->from !== 'servers') { - throw new BadMethodCallException( - 'Cannot use the MultiFieldServerFilter against a non-server model.' - ); + throw new BadMethodCallException('Cannot use the MultiFieldServerFilter against a non-server model.'); } if (preg_match(self::IPV4_REGEX, $value) || preg_match('/^:\d{1,5}$/', $value)) { @@ -42,12 +38,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/Location.php b/app/Models/Location.php index 74fed181..5e497fc9 100644 --- a/app/Models/Location.php +++ b/app/Models/Location.php @@ -3,13 +3,12 @@ namespace Pterodactyl\Models; /** - * @property int $id - * @property string $short - * @property string $long - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at - * - * @property \Pterodactyl\Models\Node[] $nodes + * @property int $id + * @property string $short + * @property string $long + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at + * @property \Pterodactyl\Models\Node[] $nodes * @property \Pterodactyl\Models\Server[] $servers */ class Location extends Model @@ -18,7 +17,7 @@ class Location extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'location'; + public const RESOURCE_NAME = 'location'; /** * The table associated with the model. diff --git a/app/Models/Model.php b/app/Models/Model.php index 90207474..e5e7fb97 100644 --- a/app/Models/Model.php +++ b/app/Models/Model.php @@ -59,7 +59,7 @@ abstract class Model extends IlluminateModel static::$validatorFactory = Container::getInstance()->make(Factory::class); static::saving(function (Model $model) { - if (! $model->validate()) { + if (!$model->validate()) { throw new DataValidationException($model->getValidator()); } @@ -89,7 +89,10 @@ abstract class Model extends IlluminateModel $rules = $this->getKey() ? static::getRulesForUpdate($this) : static::getRules(); return $this->validator ?: $this->validator = static::$validatorFactory->make( - [], $rules, [], [] + [], + $rules, + [], + [] ); } @@ -113,7 +116,7 @@ abstract class Model extends IlluminateModel * rather than just creating it. * * @param \Illuminate\Database\Eloquent\Model|int|string $id - * @param string $primaryKey + * * @return array */ public static function getRulesForUpdate($id, string $primaryKey = 'id') @@ -129,7 +132,7 @@ abstract class Model extends IlluminateModel // working model so we don't run into errors due to the way that field validation // works. foreach ($data as &$datum) { - if (! is_string($datum) || ! Str::startsWith($datum, 'unique')) { + if (!is_string($datum) || !Str::startsWith($datum, 'unique')) { continue; } @@ -159,7 +162,8 @@ abstract class Model extends IlluminateModel // for that model. Doing this will return all of the attributes in a format that can // properly be validated. $this->addCastAttributesToArray( - $this->getAttributes(), $this->getMutatedAttributes() + $this->getAttributes(), + $this->getMutatedAttributes() ) )->passes(); } @@ -168,11 +172,12 @@ abstract class Model extends IlluminateModel * Return a timestamp as DateTime object. * * @param mixed $value + * * @return \Illuminate\Support\Carbon|\Carbon\CarbonImmutable */ protected function asDateTime($value) { - if (! $this->immutableDates) { + if (!$this->immutableDates) { return parent::asDateTime($value); } diff --git a/app/Models/Mount.php b/app/Models/Mount.php index 99dd6234..fb4f511e 100644 --- a/app/Models/Mount.php +++ b/app/Models/Mount.php @@ -5,17 +5,16 @@ namespace Pterodactyl\Models; use Illuminate\Validation\Rules\NotIn; /** - * @property int $id - * @property string $uuid - * @property string $name - * @property string $description - * @property string $source - * @property string $target - * @property bool $read_only - * @property bool $user_mountable - * - * @property \Pterodactyl\Models\Egg[]|\Illuminate\Database\Eloquent\Collection $eggs - * @property \Pterodactyl\Models\Node[]|\Illuminate\Database\Eloquent\Collection $nodes + * @property int $id + * @property string $uuid + * @property string $name + * @property string $description + * @property string $source + * @property string $target + * @property bool $read_only + * @property bool $user_mountable + * @property \Pterodactyl\Models\Egg[]|\Illuminate\Database\Eloquent\Collection $eggs + * @property \Pterodactyl\Models\Node[]|\Illuminate\Database\Eloquent\Collection $nodes * @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers */ class Mount extends Model @@ -24,7 +23,7 @@ class Mount extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'mount'; + public const RESOURCE_NAME = 'mount'; /** * The table associated with the model. diff --git a/app/Models/Nest.php b/app/Models/Nest.php index 770c5baf..0c460bfd 100644 --- a/app/Models/Nest.php +++ b/app/Models/Nest.php @@ -3,16 +3,15 @@ namespace Pterodactyl\Models; /** - * @property int $id - * @property string $uuid - * @property string $author - * @property string $name - * @property string|null $description - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at - * + * @property int $id + * @property string $uuid + * @property string $author + * @property string $name + * @property string|null $description + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Server[] $servers - * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Egg[] $eggs + * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Egg[] $eggs */ class Nest extends Model { @@ -20,7 +19,7 @@ class Nest extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'nest'; + public const RESOURCE_NAME = 'nest'; /** * The table associated with the model. diff --git a/app/Models/Node.php b/app/Models/Node.php index 8a711ad7..b267a669 100644 --- a/app/Models/Node.php +++ b/app/Models/Node.php @@ -8,32 +8,31 @@ use Illuminate\Notifications\Notifiable; use Illuminate\Contracts\Encryption\Encrypter; /** - * @property int $id - * @property string $uuid - * @property bool $public - * @property string $name - * @property string|null $description - * @property int $location_id - * @property string $fqdn - * @property string $scheme - * @property bool $behind_proxy - * @property bool $maintenance_mode - * @property int $memory - * @property int $memory_overallocate - * @property int $disk - * @property int $disk_overallocate - * @property int $upload_size - * @property string $daemon_token_id - * @property string $daemon_token - * @property int $daemonListen - * @property int $daemonSFTP - * @property string $daemonBase - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at - * - * @property \Pterodactyl\Models\Location $location - * @property \Pterodactyl\Models\Mount[]|\Illuminate\Database\Eloquent\Collection $mounts - * @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers + * @property int $id + * @property string $uuid + * @property bool $public + * @property string $name + * @property string|null $description + * @property int $location_id + * @property string $fqdn + * @property string $scheme + * @property bool $behind_proxy + * @property bool $maintenance_mode + * @property int $memory + * @property int $memory_overallocate + * @property int $disk + * @property int $disk_overallocate + * @property int $upload_size + * @property string $daemon_token_id + * @property string $daemon_token + * @property int $daemonListen + * @property int $daemonSFTP + * @property string $daemonBase + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at + * @property \Pterodactyl\Models\Location $location + * @property \Pterodactyl\Models\Mount[]|\Illuminate\Database\Eloquent\Collection $mounts + * @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers * @property \Pterodactyl\Models\Allocation[]|\Illuminate\Database\Eloquent\Collection $allocations */ class Node extends Model @@ -44,10 +43,10 @@ class Node extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'node'; + public const RESOURCE_NAME = 'node'; - const DAEMON_TOKEN_ID_LENGTH = 16; - const DAEMON_TOKEN_LENGTH = 64; + public const DAEMON_TOKEN_ID_LENGTH = 16; + public const DAEMON_TOKEN_LENGTH = 64; /** * The table associated with the model. @@ -133,8 +132,6 @@ class Node extends Model /** * Get the connection address to use when making calls to this node. - * - * @return string */ public function getConnectionAddress(): string { @@ -157,7 +154,7 @@ class Node extends Model 'host' => '0.0.0.0', 'port' => $this->daemonListen, 'ssl' => [ - 'enabled' => (! $this->behind_proxy && $this->scheme === 'https'), + 'enabled' => (!$this->behind_proxy && $this->scheme === 'https'), 'cert' => '/etc/letsencrypt/live/' . $this->fqdn . '/fullchain.pem', 'key' => '/etc/letsencrypt/live/' . $this->fqdn . '/privkey.pem', ], @@ -187,7 +184,6 @@ class Node extends Model /** * Returns the configuration in JSON format. * - * @param bool $pretty * @return string */ public function getJsonConfiguration(bool $pretty = false) @@ -197,8 +193,6 @@ class Node extends Model /** * Helper function to return the decrypted key for a node. - * - * @return string */ public function getDecryptedKey(): string { @@ -247,10 +241,6 @@ class Node extends Model /** * Returns a boolean if the node is viable for an additional server to be placed on it. - * - * @param int $memory - * @param int $disk - * @return bool */ public function isViable(int $memory, int $disk): bool { diff --git a/app/Models/Objects/DeploymentObject.php b/app/Models/Objects/DeploymentObject.php index 52857410..3c62f0ba 100644 --- a/app/Models/Objects/DeploymentObject.php +++ b/app/Models/Objects/DeploymentObject.php @@ -19,16 +19,12 @@ class DeploymentObject */ private $ports = []; - /** - * @return bool - */ public function isDedicated(): bool { return $this->dedicated; } /** - * @param bool $dedicated * @return $this */ public function setDedicated(bool $dedicated) @@ -38,16 +34,12 @@ class DeploymentObject return $this; } - /** - * @return array - */ public function getLocations(): array { return $this->locations; } /** - * @param array $locations * @return $this */ public function setLocations(array $locations) @@ -57,16 +49,12 @@ class DeploymentObject return $this; } - /** - * @return array - */ public function getPorts(): array { return $this->ports; } /** - * @param array $ports * @return $this */ public function setPorts(array $ports) diff --git a/app/Models/Permission.php b/app/Models/Permission.php index 8f6f219c..3fc2efdf 100644 --- a/app/Models/Permission.php +++ b/app/Models/Permission.php @@ -10,58 +10,58 @@ class Permission extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'subuser_permission'; + public const RESOURCE_NAME = 'subuser_permission'; /** * Constants defining different permissions available. */ - const ACTION_WEBSOCKET_CONNECT = 'websocket.connect'; - const ACTION_CONTROL_CONSOLE = 'control.console'; - const ACTION_CONTROL_START = 'control.start'; - const ACTION_CONTROL_STOP = 'control.stop'; - const ACTION_CONTROL_RESTART = 'control.restart'; + public const ACTION_WEBSOCKET_CONNECT = 'websocket.connect'; + public const ACTION_CONTROL_CONSOLE = 'control.console'; + public const ACTION_CONTROL_START = 'control.start'; + public const ACTION_CONTROL_STOP = 'control.stop'; + public const ACTION_CONTROL_RESTART = 'control.restart'; - const ACTION_DATABASE_READ = 'database.read'; - const ACTION_DATABASE_CREATE = 'database.create'; - const ACTION_DATABASE_UPDATE = 'database.update'; - const ACTION_DATABASE_DELETE = 'database.delete'; - const ACTION_DATABASE_VIEW_PASSWORD = 'database.view_password'; + public const ACTION_DATABASE_READ = 'database.read'; + public const ACTION_DATABASE_CREATE = 'database.create'; + public const ACTION_DATABASE_UPDATE = 'database.update'; + public const ACTION_DATABASE_DELETE = 'database.delete'; + public const ACTION_DATABASE_VIEW_PASSWORD = 'database.view_password'; - const ACTION_SCHEDULE_READ = 'schedule.read'; - const ACTION_SCHEDULE_CREATE = 'schedule.create'; - const ACTION_SCHEDULE_UPDATE = 'schedule.update'; - const ACTION_SCHEDULE_DELETE = 'schedule.delete'; + public const ACTION_SCHEDULE_READ = 'schedule.read'; + public const ACTION_SCHEDULE_CREATE = 'schedule.create'; + public const ACTION_SCHEDULE_UPDATE = 'schedule.update'; + public const ACTION_SCHEDULE_DELETE = 'schedule.delete'; - const ACTION_USER_READ = 'user.read'; - const ACTION_USER_CREATE = 'user.create'; - const ACTION_USER_UPDATE = 'user.update'; - const ACTION_USER_DELETE = 'user.delete'; + public const ACTION_USER_READ = 'user.read'; + public const ACTION_USER_CREATE = 'user.create'; + public const ACTION_USER_UPDATE = 'user.update'; + public const ACTION_USER_DELETE = 'user.delete'; - const ACTION_BACKUP_READ = 'backup.read'; - const ACTION_BACKUP_CREATE = 'backup.create'; - const ACTION_BACKUP_UPDATE = 'backup.update'; - const ACTION_BACKUP_DELETE = 'backup.delete'; - const ACTION_BACKUP_DOWNLOAD = 'backup.download'; + public const ACTION_BACKUP_READ = 'backup.read'; + public const ACTION_BACKUP_CREATE = 'backup.create'; + public const ACTION_BACKUP_UPDATE = 'backup.update'; + public const ACTION_BACKUP_DELETE = 'backup.delete'; + public const ACTION_BACKUP_DOWNLOAD = 'backup.download'; - const ACTION_ALLOCATION_READ = 'allocation.read'; - const ACTION_ALLOCATION_CREATE = 'allocation.create'; - const ACTION_ALLOCATION_UPDATE = 'allocation.update'; - const ACTION_ALLOCATION_DELETE = 'allocation.delete'; + public const ACTION_ALLOCATION_READ = 'allocation.read'; + public const ACTION_ALLOCATION_CREATE = 'allocation.create'; + public const ACTION_ALLOCATION_UPDATE = 'allocation.update'; + public const ACTION_ALLOCATION_DELETE = 'allocation.delete'; - const ACTION_FILE_READ = 'file.read'; - const ACTION_FILE_READ_CONTENT = 'file.read-content'; - const ACTION_FILE_CREATE = 'file.create'; - const ACTION_FILE_UPDATE = 'file.update'; - const ACTION_FILE_DELETE = 'file.delete'; - const ACTION_FILE_ARCHIVE = 'file.archive'; - const ACTION_FILE_SFTP = 'file.sftp'; + public const ACTION_FILE_READ = 'file.read'; + public const ACTION_FILE_READ_CONTENT = 'file.read-content'; + public const ACTION_FILE_CREATE = 'file.create'; + public const ACTION_FILE_UPDATE = 'file.update'; + public const ACTION_FILE_DELETE = 'file.delete'; + public const ACTION_FILE_ARCHIVE = 'file.archive'; + public const ACTION_FILE_SFTP = 'file.sftp'; - const ACTION_STARTUP_READ = 'startup.read'; - const ACTION_STARTUP_UPDATE = 'startup.update'; - const ACTION_STARTUP_DOCKER_IMAGE = 'startup.docker-image'; + public const ACTION_STARTUP_READ = 'startup.read'; + public const ACTION_STARTUP_UPDATE = 'startup.update'; + public const ACTION_STARTUP_DOCKER_IMAGE = 'startup.docker-image'; - const ACTION_SETTINGS_RENAME = 'settings.rename'; - const ACTION_SETTINGS_REINSTALL = 'settings.reinstall'; + public const ACTION_SETTINGS_RENAME = 'settings.rename'; + public const ACTION_SETTINGS_REINSTALL = 'settings.reinstall'; /** * Should timestamps be used on this model. @@ -106,6 +106,7 @@ class Permission extends Model * to retrieve them, and not directly access this array as it is subject to change. * * @var array + * * @see \Pterodactyl\Models\Permission::permissions() */ protected static $permissions = [ diff --git a/app/Models/RecoveryToken.php b/app/Models/RecoveryToken.php index 5cd00a9d..d4ef5a7a 100644 --- a/app/Models/RecoveryToken.php +++ b/app/Models/RecoveryToken.php @@ -3,11 +3,10 @@ namespace Pterodactyl\Models; /** - * @property int $id - * @property int $user_id - * @property string $token - * @property \Carbon\CarbonImmutable $created_at - * + * @property int $id + * @property int $user_id + * @property string $token + * @property \Carbon\CarbonImmutable $created_at * @property \Pterodactyl\Models\User $user */ class RecoveryToken extends Model @@ -15,7 +14,7 @@ class RecoveryToken extends Model /** * There are no updates to this model, only inserts and deletes. */ - const UPDATED_AT = null; + public const UPDATED_AT = null; /** * @var bool diff --git a/app/Models/Schedule.php b/app/Models/Schedule.php index 6d23f5c1..31eec5a6 100644 --- a/app/Models/Schedule.php +++ b/app/Models/Schedule.php @@ -8,24 +8,22 @@ use Illuminate\Container\Container; use Pterodactyl\Contracts\Extensions\HashidsInterface; /** - * @property int $id - * @property int $server_id - * @property string $name - * @property string $cron_day_of_week - * @property string $cron_month - * @property string $cron_day_of_month - * @property string $cron_hour - * @property string $cron_minute - * @property bool $is_active - * @property bool $is_processing - * @property \Carbon\Carbon|null $last_run_at - * @property \Carbon\Carbon|null $next_run_at - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at - * - * @property string $hashid - * - * @property \Pterodactyl\Models\Server $server + * @property int $id + * @property int $server_id + * @property string $name + * @property string $cron_day_of_week + * @property string $cron_month + * @property string $cron_day_of_month + * @property string $cron_hour + * @property string $cron_minute + * @property bool $is_active + * @property bool $is_processing + * @property \Carbon\Carbon|null $last_run_at + * @property \Carbon\Carbon|null $next_run_at + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at + * @property string $hashid + * @property \Pterodactyl\Models\Server $server * @property \Pterodactyl\Models\Task[]|\Illuminate\Support\Collection $tasks */ class Schedule extends Model @@ -34,7 +32,7 @@ class Schedule extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'server_schedule'; + public const RESOURCE_NAME = 'server_schedule'; /** * The table associated with the model. diff --git a/app/Models/Server.php b/app/Models/Server.php index aace86d0..1248d5b1 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -7,49 +7,48 @@ use Illuminate\Database\Query\JoinClause; use Znck\Eloquent\Traits\BelongsToThrough; /** - * @property int $id - * @property string|null $external_id - * @property string $uuid - * @property string $uuidShort - * @property int $node_id - * @property string $name - * @property string $description - * @property bool $skip_scripts - * @property bool $suspended - * @property int $owner_id - * @property int $memory - * @property int $swap - * @property int $disk - * @property int $io - * @property int $cpu - * @property string $threads - * @property bool $oom_disabled - * @property int $allocation_id - * @property int $nest_id - * @property int $egg_id - * @property string $startup - * @property string $image - * @property int $installed - * @property int $allocation_limit - * @property int $database_limit - * @property int $backup_limit - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at - * - * @property \Pterodactyl\Models\User $user - * @property \Pterodactyl\Models\Subuser[]|\Illuminate\Database\Eloquent\Collection $subusers - * @property \Pterodactyl\Models\Allocation $allocation - * @property \Pterodactyl\Models\Allocation[]|\Illuminate\Database\Eloquent\Collection $allocations - * @property \Pterodactyl\Models\Node $node - * @property \Pterodactyl\Models\Nest $nest - * @property \Pterodactyl\Models\Egg $egg + * @property int $id + * @property string|null $external_id + * @property string $uuid + * @property string $uuidShort + * @property int $node_id + * @property string $name + * @property string $description + * @property bool $skip_scripts + * @property bool $suspended + * @property int $owner_id + * @property int $memory + * @property int $swap + * @property int $disk + * @property int $io + * @property int $cpu + * @property string $threads + * @property bool $oom_disabled + * @property int $allocation_id + * @property int $nest_id + * @property int $egg_id + * @property string $startup + * @property string $image + * @property int $installed + * @property int $allocation_limit + * @property int $database_limit + * @property int $backup_limit + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at + * @property \Pterodactyl\Models\User $user + * @property \Pterodactyl\Models\Subuser[]|\Illuminate\Database\Eloquent\Collection $subusers + * @property \Pterodactyl\Models\Allocation $allocation + * @property \Pterodactyl\Models\Allocation[]|\Illuminate\Database\Eloquent\Collection $allocations + * @property \Pterodactyl\Models\Node $node + * @property \Pterodactyl\Models\Nest $nest + * @property \Pterodactyl\Models\Egg $egg * @property \Pterodactyl\Models\EggVariable[]|\Illuminate\Database\Eloquent\Collection $variables - * @property \Pterodactyl\Models\Schedule[]|\Illuminate\Database\Eloquent\Collection $schedule - * @property \Pterodactyl\Models\Database[]|\Illuminate\Database\Eloquent\Collection $databases - * @property \Pterodactyl\Models\Location $location - * @property \Pterodactyl\Models\ServerTransfer $transfer - * @property \Pterodactyl\Models\Backup[]|\Illuminate\Database\Eloquent\Collection $backups - * @property \Pterodactyl\Models\Mount[]|\Illuminate\Database\Eloquent\Collection $mounts + * @property \Pterodactyl\Models\Schedule[]|\Illuminate\Database\Eloquent\Collection $schedule + * @property \Pterodactyl\Models\Database[]|\Illuminate\Database\Eloquent\Collection $databases + * @property \Pterodactyl\Models\Location $location + * @property \Pterodactyl\Models\ServerTransfer $transfer + * @property \Pterodactyl\Models\Backup[]|\Illuminate\Database\Eloquent\Collection $backups + * @property \Pterodactyl\Models\Mount[]|\Illuminate\Database\Eloquent\Collection $mounts */ class Server extends Model { @@ -60,11 +59,11 @@ class Server extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'server'; + public const RESOURCE_NAME = 'server'; - const STATUS_INSTALLING = 0; - const STATUS_INSTALLED = 1; - const STATUS_INSTALL_FAILED = 2; + public const STATUS_INSTALLING = 0; + public const STATUS_INSTALLED = 1; + public const STATUS_INSTALL_FAILED = 2; /** * The table associated with the model. @@ -159,8 +158,6 @@ class Server extends Model /** * Returns the format for server allocations when communicating with the Daemon. - * - * @return array */ public function getAllocationMappings(): array { @@ -169,9 +166,6 @@ class Server extends Model })->toArray(); } - /** - * @return bool - */ public function isInstalled(): bool { return $this->installed === 1; diff --git a/app/Models/ServerTransfer.php b/app/Models/ServerTransfer.php index 1af9ab7e..d2b49771 100644 --- a/app/Models/ServerTransfer.php +++ b/app/Models/ServerTransfer.php @@ -3,22 +3,21 @@ namespace Pterodactyl\Models; /** - * @property int $id - * @property int $server_id - * @property int $old_node - * @property int $new_node - * @property int $old_allocation - * @property int $new_allocation - * @property array|null $old_additional_allocations - * @property array|null $new_additional_allocations - * @property bool|null $successful - * @property bool $archived - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at - * + * @property int $id + * @property int $server_id + * @property int $old_node + * @property int $new_node + * @property int $old_allocation + * @property int $new_allocation + * @property array|null $old_additional_allocations + * @property array|null $new_additional_allocations + * @property bool|null $successful + * @property bool $archived + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at * @property \Pterodactyl\Models\Server $server - * @property \Pterodactyl\Models\Node $oldNode - * @property \Pterodactyl\Models\Node $newNode + * @property \Pterodactyl\Models\Node $oldNode + * @property \Pterodactyl\Models\Node $newNode */ class ServerTransfer extends Model { @@ -26,7 +25,7 @@ class ServerTransfer extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'server_transfer'; + public const RESOURCE_NAME = 'server_transfer'; /** * The table associated with the model. diff --git a/app/Models/ServerVariable.php b/app/Models/ServerVariable.php index b2bb4b7d..7fdfbb1a 100644 --- a/app/Models/ServerVariable.php +++ b/app/Models/ServerVariable.php @@ -10,7 +10,7 @@ class ServerVariable extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'server_variable'; + public const RESOURCE_NAME = 'server_variable'; /** * The table associated with the model. diff --git a/app/Models/Subuser.php b/app/Models/Subuser.php index ab85b85d..87417cea 100644 --- a/app/Models/Subuser.php +++ b/app/Models/Subuser.php @@ -5,14 +5,13 @@ namespace Pterodactyl\Models; use Illuminate\Notifications\Notifiable; /** - * @property int $id - * @property int $user_id - * @property int $server_id - * @property array $permissions - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at - * - * @property \Pterodactyl\Models\User $user + * @property int $id + * @property int $user_id + * @property int $server_id + * @property array $permissions + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at + * @property \Pterodactyl\Models\User $user * @property \Pterodactyl\Models\Server $server */ class Subuser extends Model @@ -23,7 +22,7 @@ class Subuser extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'server_subuser'; + public const RESOURCE_NAME = 'server_subuser'; /** * The table associated with the model. diff --git a/app/Models/Task.php b/app/Models/Task.php index f241b071..d8899918 100644 --- a/app/Models/Task.php +++ b/app/Models/Task.php @@ -7,20 +7,18 @@ use Znck\Eloquent\Traits\BelongsToThrough; use Pterodactyl\Contracts\Extensions\HashidsInterface; /** - * @property int $id - * @property int $schedule_id - * @property int $sequence_id - * @property string $action - * @property string $payload - * @property int $time_offset - * @property bool $is_queued - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at - * - * @property string $hashid - * + * @property int $id + * @property int $schedule_id + * @property int $sequence_id + * @property string $action + * @property string $payload + * @property int $time_offset + * @property bool $is_queued + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at + * @property string $hashid * @property \Pterodactyl\Models\Schedule $schedule - * @property \Pterodactyl\Models\Server $server + * @property \Pterodactyl\Models\Server $server */ class Task extends Model { @@ -30,7 +28,7 @@ class Task extends Model * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'schedule_task'; + public const RESOURCE_NAME = 'schedule_task'; /** * The table associated with the model. @@ -119,6 +117,7 @@ class Task extends Model * Return the server a task is assigned to, acts as a belongsToThrough. * * @return \Znck\Eloquent\Relations\BelongsToThrough + * * @throws \Exception */ public function server() diff --git a/app/Models/User.php b/app/Models/User.php index 24ef981f..1797d378 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -17,27 +17,26 @@ use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; use Pterodactyl\Notifications\SendPasswordReset as ResetPasswordNotification; /** - * @property int $id - * @property string|null $external_id - * @property string $uuid - * @property string $username - * @property string $email - * @property string|null $name_first - * @property string|null $name_last - * @property string $password - * @property string|null $remeber_token - * @property string $language - * @property bool $root_admin - * @property bool $use_totp - * @property string|null $totp_secret - * @property \Carbon\Carbon|null $totp_authenticated_at - * @property bool $gravatar - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at - * - * @property string $name - * @property \Pterodactyl\Models\ApiKey[]|\Illuminate\Database\Eloquent\Collection $apiKeys - * @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers + * @property int $id + * @property string|null $external_id + * @property string $uuid + * @property string $username + * @property string $email + * @property string|null $name_first + * @property string|null $name_last + * @property string $password + * @property string|null $remeber_token + * @property string $language + * @property bool $root_admin + * @property bool $use_totp + * @property string|null $totp_secret + * @property \Carbon\Carbon|null $totp_authenticated_at + * @property bool $gravatar + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at + * @property string $name + * @property \Pterodactyl\Models\ApiKey[]|\Illuminate\Database\Eloquent\Collection $apiKeys + * @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers * @property \Pterodactyl\Models\RecoveryToken[]|\Illuminate\Database\Eloquent\Collection $recoveryTokens */ class User extends Model implements @@ -51,14 +50,14 @@ class User extends Model implements use CanResetPassword; use Notifiable; - const USER_LEVEL_USER = 0; - const USER_LEVEL_ADMIN = 1; + public const USER_LEVEL_USER = 0; + public const USER_LEVEL_ADMIN = 1; /** * The resource name for this model when it is transformed into an * API representation using fractal. */ - const RESOURCE_NAME = 'user'; + public const RESOURCE_NAME = 'user'; /** * Level of servers to display when using access() on a user. @@ -157,16 +156,14 @@ class User extends Model implements { $rules = parent::getRules(); - $rules['language'][] = new In(array_keys((new self)->getAvailableLanguages())); - $rules['username'][] = new Username; + $rules['language'][] = new In(array_keys((new self())->getAvailableLanguages())); + $rules['username'][] = new Username(); return $rules; } /** * Return the user model in a format that can be passed over to Vue templates. - * - * @return array */ public function toVueObject(): array { @@ -185,8 +182,6 @@ class User extends Model implements /** * Store the username as a lowercase string. - * - * @param string $value */ public function setUsernameAttribute(string $value) { diff --git a/app/Notifications/AccountCreated.php b/app/Notifications/AccountCreated.php index 30497804..e52bed5f 100644 --- a/app/Notifications/AccountCreated.php +++ b/app/Notifications/AccountCreated.php @@ -29,9 +29,6 @@ class AccountCreated extends Notification implements ShouldQueue /** * Create a new notification instance. - * - * @param \Pterodactyl\Models\User $user - * @param string|null $token */ public function __construct(User $user, string $token = null) { @@ -43,6 +40,7 @@ class AccountCreated extends Notification implements ShouldQueue * Get the notification's delivery channels. * * @param mixed $notifiable + * * @return array */ public function via($notifiable) @@ -54,17 +52,18 @@ class AccountCreated extends Notification implements ShouldQueue * Get the mail representation of the notification. * * @param mixed $notifiable + * * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { - $message = (new MailMessage) + $message = (new MailMessage()) ->greeting('Hello ' . $this->user->name . '!') ->line('You are receiving this email because an account has been created for you on ' . config('app.name') . '.') ->line('Username: ' . $this->user->username) ->line('Email: ' . $this->user->email); - if (! is_null($this->token)) { + if (!is_null($this->token)) { return $message->action('Setup Your Account', url('/auth/password/reset/' . $this->token . '?email=' . urlencode($this->user->email))); } diff --git a/app/Notifications/AddedToServer.php b/app/Notifications/AddedToServer.php index 7b6cac8c..c116a2e2 100644 --- a/app/Notifications/AddedToServer.php +++ b/app/Notifications/AddedToServer.php @@ -25,8 +25,6 @@ class AddedToServer extends Notification implements ShouldQueue /** * Create a new notification instance. - * - * @param array $server */ public function __construct(array $server) { @@ -37,6 +35,7 @@ class AddedToServer extends Notification implements ShouldQueue * Get the notification's delivery channels. * * @param mixed $notifiable + * * @return array */ public function via($notifiable) @@ -48,11 +47,12 @@ class AddedToServer extends Notification implements ShouldQueue * Get the mail representation of the notification. * * @param mixed $notifiable + * * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { - return (new MailMessage) + return (new MailMessage()) ->greeting('Hello ' . $this->server->user . '!') ->line('You have been added as a subuser for the following server, allowing you certain control over the server.') ->line('Server Name: ' . $this->server->name) diff --git a/app/Notifications/MailTested.php b/app/Notifications/MailTested.php index fdb95f5c..d0f083ac 100644 --- a/app/Notifications/MailTested.php +++ b/app/Notifications/MailTested.php @@ -25,7 +25,7 @@ class MailTested extends Notification public function toMail() { - return (new MailMessage) + return (new MailMessage()) ->subject('Pterodactyl Test Message') ->greeting('Hello ' . $this->user->name . '!') ->line('This is a test of the Pterodactyl mail system. You\'re good to go!'); diff --git a/app/Notifications/RemovedFromServer.php b/app/Notifications/RemovedFromServer.php index d23aae54..24418e51 100644 --- a/app/Notifications/RemovedFromServer.php +++ b/app/Notifications/RemovedFromServer.php @@ -25,8 +25,6 @@ class RemovedFromServer extends Notification implements ShouldQueue /** * Create a new notification instance. - * - * @param array $server */ public function __construct(array $server) { @@ -37,6 +35,7 @@ class RemovedFromServer extends Notification implements ShouldQueue * Get the notification's delivery channels. * * @param mixed $notifiable + * * @return array */ public function via($notifiable) @@ -48,11 +47,12 @@ class RemovedFromServer extends Notification implements ShouldQueue * Get the mail representation of the notification. * * @param mixed $notifiable + * * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { - return (new MailMessage) + return (new MailMessage()) ->error() ->greeting('Hello ' . $this->server->user . '.') ->line('You have been removed as a subuser for the following server.') diff --git a/app/Notifications/SendPasswordReset.php b/app/Notifications/SendPasswordReset.php index 83d88216..cd6d4605 100644 --- a/app/Notifications/SendPasswordReset.php +++ b/app/Notifications/SendPasswordReset.php @@ -39,6 +39,7 @@ class SendPasswordReset extends Notification implements ShouldQueue * Get the notification's delivery channels. * * @param mixed $notifiable + * * @return array */ public function via($notifiable) @@ -50,11 +51,12 @@ class SendPasswordReset extends Notification implements ShouldQueue * Get the mail representation of the notification. * * @param mixed $notifiable + * * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { - return (new MailMessage) + return (new MailMessage()) ->subject('Reset Password') ->line('You are receiving this email because we received a password reset request for your account.') ->action('Reset Password', url('/auth/password/reset/' . $this->token . '?email=' . urlencode($notifiable->email))) diff --git a/app/Notifications/ServerInstalled.php b/app/Notifications/ServerInstalled.php index fe974722..cc5a9431 100644 --- a/app/Notifications/ServerInstalled.php +++ b/app/Notifications/ServerInstalled.php @@ -60,7 +60,7 @@ class ServerInstalled extends Notification implements ShouldQueue, ReceivesEvent */ public function toMail() { - return (new MailMessage) + return (new MailMessage()) ->greeting('Hello ' . $this->user->username . '.') ->line('Your server has finished installing and is now ready for you to use.') ->line('Server Name: ' . $this->server->name) diff --git a/app/Observers/ServerObserver.php b/app/Observers/ServerObserver.php index 00db4b33..c6a62120 100644 --- a/app/Observers/ServerObserver.php +++ b/app/Observers/ServerObserver.php @@ -19,8 +19,6 @@ class ServerObserver /** * Listen to the Server creating event. - * - * @param \Pterodactyl\Models\Server $server */ public function creating(Server $server) { @@ -29,8 +27,6 @@ class ServerObserver /** * Listen to the Server created event. - * - * @param \Pterodactyl\Models\Server $server */ public function created(Server $server) { @@ -39,8 +35,6 @@ class ServerObserver /** * Listen to the Server deleting event. - * - * @param \Pterodactyl\Models\Server $server */ public function deleting(Server $server) { @@ -49,8 +43,6 @@ class ServerObserver /** * Listen to the Server deleted event. - * - * @param \Pterodactyl\Models\Server $server */ public function deleted(Server $server) { @@ -59,8 +51,6 @@ class ServerObserver /** * Listen to the Server saving event. - * - * @param \Pterodactyl\Models\Server $server */ public function saving(Server $server) { @@ -69,8 +59,6 @@ class ServerObserver /** * Listen to the Server saved event. - * - * @param \Pterodactyl\Models\Server $server */ public function saved(Server $server) { @@ -79,8 +67,6 @@ class ServerObserver /** * Listen to the Server updating event. - * - * @param \Pterodactyl\Models\Server $server */ public function updating(Server $server) { @@ -89,8 +75,6 @@ class ServerObserver /** * Listen to the Server saved event. - * - * @param \Pterodactyl\Models\Server $server */ public function updated(Server $server) { diff --git a/app/Observers/SubuserObserver.php b/app/Observers/SubuserObserver.php index 009e6529..128de77f 100644 --- a/app/Observers/SubuserObserver.php +++ b/app/Observers/SubuserObserver.php @@ -18,8 +18,6 @@ class SubuserObserver { /** * Listen to the Subuser creating event. - * - * @param \Pterodactyl\Models\Subuser $subuser */ public function creating(Subuser $subuser) { @@ -28,8 +26,6 @@ class SubuserObserver /** * Listen to the Subuser created event. - * - * @param \Pterodactyl\Models\Subuser $subuser */ public function created(Subuser $subuser) { @@ -44,8 +40,6 @@ class SubuserObserver /** * Listen to the Subuser deleting event. - * - * @param \Pterodactyl\Models\Subuser $subuser */ public function deleting(Subuser $subuser) { @@ -54,8 +48,6 @@ class SubuserObserver /** * Listen to the Subuser deleted event. - * - * @param \Pterodactyl\Models\Subuser $subuser */ public function deleted(Subuser $subuser) { diff --git a/app/Observers/UserObserver.php b/app/Observers/UserObserver.php index dd29d908..18d73bc1 100644 --- a/app/Observers/UserObserver.php +++ b/app/Observers/UserObserver.php @@ -11,8 +11,6 @@ class UserObserver /** * Listen to the User creating event. - * - * @param \Pterodactyl\Models\User $user */ public function creating(User $user) { @@ -21,8 +19,6 @@ class UserObserver /** * Listen to the User created event. - * - * @param \Pterodactyl\Models\User $user */ public function created(User $user) { @@ -31,8 +27,6 @@ class UserObserver /** * Listen to the User deleting event. - * - * @param \Pterodactyl\Models\User $user */ public function deleting(User $user) { @@ -41,8 +35,6 @@ class UserObserver /** * Listen to the User deleted event. - * - * @param \Pterodactyl\Models\User $user */ public function deleted(User $user) { diff --git a/app/Policies/ServerPolicy.php b/app/Policies/ServerPolicy.php index bc3fa7ac..311f0a4a 100644 --- a/app/Policies/ServerPolicy.php +++ b/app/Policies/ServerPolicy.php @@ -16,8 +16,6 @@ class ServerPolicy /** * ServerPolicy constructor. - * - * @param \Illuminate\Contracts\Cache\Repository $cache */ public function __construct(CacheRepository $cache) { @@ -27,9 +25,8 @@ class ServerPolicy /** * Checks if the user has the given permission on/for the server. * - * @param \Pterodactyl\Models\User $user - * @param \Pterodactyl\Models\Server $server * @param string $permission + * * @return bool */ protected function checkPermission(User $user, Server $server, $permission) @@ -49,9 +46,8 @@ class ServerPolicy /** * Runs before any of the functions are called. Used to determine if user is root admin, if so, ignore permissions. * - * @param \Pterodactyl\Models\User $user * @param string $ability - * @param \Pterodactyl\Models\Server $server + * * @return bool */ public function before(User $user, $ability, Server $server) @@ -69,7 +65,7 @@ class ServerPolicy * policy permission. * * @param string $name - * @param mixed $arguments + * @param mixed $arguments */ public function __call($name, $arguments) { diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index bb1fe434..11baa730 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -41,12 +41,12 @@ class AppServiceProvider extends ServiceProvider { // Only load the settings service provider if the environment // is configured to allow it. - if (! config('pterodactyl.load_environment_only', false) && $this->app->environment() !== 'testing') { + if (!config('pterodactyl.load_environment_only', false) && $this->app->environment() !== 'testing') { $this->app->register(SettingsServiceProvider::class); } $this->app->singleton('extensions.themes', function () { - return new Theme; + return new Theme(); }); } diff --git a/app/Providers/SettingsServiceProvider.php b/app/Providers/SettingsServiceProvider.php index 5cbcec10..71fda215 100644 --- a/app/Providers/SettingsServiceProvider.php +++ b/app/Providers/SettingsServiceProvider.php @@ -63,11 +63,6 @@ class SettingsServiceProvider extends ServiceProvider /** * Boot the service provider. - * - * @param \Illuminate\Contracts\Config\Repository $config - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter - * @param \Psr\Log\LoggerInterface $log - * @param \Pterodactyl\Contracts\Repository\SettingsRepositoryInterface $settings */ public function boot(ConfigRepository $config, Encrypter $encrypter, Log $log, SettingsRepositoryInterface $settings) { @@ -118,9 +113,6 @@ class SettingsServiceProvider extends ServiceProvider } } - /** - * @return array - */ public static function getEncryptedKeys(): array { return self::$encrypted; diff --git a/app/Repositories/Eloquent/AllocationRepository.php b/app/Repositories/Eloquent/AllocationRepository.php index 15a5db81..3723c1d1 100644 --- a/app/Repositories/Eloquent/AllocationRepository.php +++ b/app/Repositories/Eloquent/AllocationRepository.php @@ -21,9 +21,6 @@ class AllocationRepository extends EloquentRepository implements AllocationRepos /** * Return all of the allocations that exist for a node that are not currently * allocated. - * - * @param int $node - * @return array */ public function getUnassignedAllocationIds(int $node): array { @@ -42,15 +39,12 @@ class AllocationRepository extends EloquentRepository implements AllocationRepos * * If an array of nodes is passed the results will be limited to allocations * in those nodes. - * - * @param array $nodes - * @return array */ protected function getDiscardableDedicatedAllocations(array $nodes = []): array { $query = Allocation::query()->selectRaw('CONCAT_WS("-", node_id, ip) as result'); - if (! empty($nodes)) { + if (!empty($nodes)) { $query->whereIn('node_id', $nodes); } @@ -64,20 +58,17 @@ class AllocationRepository extends EloquentRepository implements AllocationRepos /** * Return a single allocation from those meeting the requirements. * - * @param array $nodes - * @param array $ports - * @param bool $dedicated * @return \Pterodactyl\Models\Allocation|null */ public function getRandomAllocation(array $nodes, array $ports, bool $dedicated = false) { $query = Allocation::query()->whereNull('server_id'); - if (! empty($nodes)) { + if (!empty($nodes)) { $query->whereIn('node_id', $nodes); } - if (! empty($ports)) { + if (!empty($ports)) { $query->where(function (Builder $inner) use ($ports) { $whereIn = []; foreach ($ports as $port) { @@ -89,7 +80,7 @@ class AllocationRepository extends EloquentRepository implements AllocationRepos $whereIn[] = $port; } - if (! empty($whereIn)) { + if (!empty($whereIn)) { $inner->orWhereIn('port', $whereIn); } }); @@ -100,9 +91,10 @@ class AllocationRepository extends EloquentRepository implements AllocationRepos if ($dedicated) { $discard = $this->getDiscardableDedicatedAllocations($nodes); - if (! empty($discard)) { + if (!empty($discard)) { $query->whereNotIn( - $this->getBuilder()->raw('CONCAT_WS("-", node_id, ip)'), $discard + $this->getBuilder()->raw('CONCAT_WS("-", node_id, ip)'), + $discard ); } } diff --git a/app/Repositories/Eloquent/ApiKeyRepository.php b/app/Repositories/Eloquent/ApiKeyRepository.php index 55d55954..67a7e6e6 100644 --- a/app/Repositories/Eloquent/ApiKeyRepository.php +++ b/app/Repositories/Eloquent/ApiKeyRepository.php @@ -21,9 +21,6 @@ class ApiKeyRepository extends EloquentRepository implements ApiKeyRepositoryInt /** * Get all of the account API keys that exist for a specific user. - * - * @param \Pterodactyl\Models\User $user - * @return \Illuminate\Support\Collection */ public function getAccountKeys(User $user): Collection { @@ -34,9 +31,6 @@ class ApiKeyRepository extends EloquentRepository implements ApiKeyRepositoryInt /** * Get all of the application API keys that exist for a specific user. - * - * @param \Pterodactyl\Models\User $user - * @return \Illuminate\Support\Collection */ public function getApplicationKeys(User $user): Collection { @@ -47,10 +41,6 @@ class ApiKeyRepository extends EloquentRepository implements ApiKeyRepositoryInt /** * Delete an account API key from the panel for a specific user. - * - * @param \Pterodactyl\Models\User $user - * @param string $identifier - * @return int */ public function deleteAccountKey(User $user, string $identifier): int { @@ -62,10 +52,6 @@ class ApiKeyRepository extends EloquentRepository implements ApiKeyRepositoryInt /** * Delete an application API key from the panel for a specific user. - * - * @param \Pterodactyl\Models\User $user - * @param string $identifier - * @return int */ public function deleteApplicationKey(User $user, string $identifier): int { diff --git a/app/Repositories/Eloquent/BackupRepository.php b/app/Repositories/Eloquent/BackupRepository.php index 46e40014..b53547e4 100644 --- a/app/Repositories/Eloquent/BackupRepository.php +++ b/app/Repositories/Eloquent/BackupRepository.php @@ -18,8 +18,6 @@ class BackupRepository extends EloquentRepository /** * Determines if too many backups have been generated by the server. * - * @param int $server - * @param int $seconds * @return \Pterodactyl\Models\Backup[]|\Illuminate\Support\Collection */ public function getBackupsGeneratedDuringTimespan(int $server, int $seconds = 600) diff --git a/app/Repositories/Eloquent/DatabaseHostRepository.php b/app/Repositories/Eloquent/DatabaseHostRepository.php index 4ed4d411..c55b0323 100644 --- a/app/Repositories/Eloquent/DatabaseHostRepository.php +++ b/app/Repositories/Eloquent/DatabaseHostRepository.php @@ -21,8 +21,6 @@ class DatabaseHostRepository extends EloquentRepository implements DatabaseHostR /** * Return database hosts with a count of databases and the node * information for which it is attached. - * - * @return \Illuminate\Support\Collection */ public function getWithViewDetails(): Collection { diff --git a/app/Repositories/Eloquent/DatabaseRepository.php b/app/Repositories/Eloquent/DatabaseRepository.php index 0ae6758d..4e421df4 100644 --- a/app/Repositories/Eloquent/DatabaseRepository.php +++ b/app/Repositories/Eloquent/DatabaseRepository.php @@ -23,9 +23,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * DatabaseRepository constructor. - * - * @param \Illuminate\Foundation\Application $application - * @param \Illuminate\Database\DatabaseManager $database */ public function __construct(Application $application, DatabaseManager $database) { @@ -47,7 +44,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * Set the connection name to execute statements against. * - * @param string $connection * @return $this */ public function setConnection(string $connection) @@ -59,8 +55,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * Return the connection to execute statements against. - * - * @return string */ public function getConnection(): string { @@ -69,9 +63,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * Return all of the databases belonging to a server. - * - * @param int $server - * @return \Illuminate\Support\Collection */ public function getDatabasesForServer(int $server): Collection { @@ -80,10 +71,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * Return all of the databases for a given host with the server relationship loaded. - * - * @param int $host - * @param int $count - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator */ public function getDatabasesForHost(int $host, int $count = 25): LengthAwarePaginator { @@ -94,9 +81,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * Create a new database on a given connection. - * - * @param string $database - * @return bool */ public function createDatabase(string $database): bool { @@ -106,15 +90,11 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * Create a new database user on a given connection. * - * @param string $username - * @param string $remote - * @param string $password * @param $max_connections - * @return bool */ public function createUser(string $username, string $remote, string $password, $max_connections): bool { - if (! $max_connections) { + if (!$max_connections) { return $this->run(sprintf('CREATE USER `%s`@`%s` IDENTIFIED BY \'%s\'', $username, $remote, $password)); } else { return $this->run(sprintf('CREATE USER `%s`@`%s` IDENTIFIED BY \'%s\' WITH MAX_USER_CONNECTIONS %s', $username, $remote, $password, $max_connections)); @@ -123,11 +103,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * Give a specific user access to a given database. - * - * @param string $database - * @param string $username - * @param string $remote - * @return bool */ public function assignUserToDatabase(string $database, string $username, string $remote): bool { @@ -141,8 +116,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * Flush the privileges for a given connection. - * - * @return bool */ public function flush(): bool { @@ -151,9 +124,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * Drop a given database on a specific connection. - * - * @param string $database - * @return bool */ public function dropDatabase(string $database): bool { @@ -163,8 +133,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * Drop a given user on a specific connection. * - * @param string $username - * @param string $remote * @return mixed */ public function dropUser(string $username, string $remote): bool @@ -174,9 +142,6 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor /** * Run the provided statement against the database on a given connection. - * - * @param string $statement - * @return bool */ private function run(string $statement): bool { diff --git a/app/Repositories/Eloquent/EggRepository.php b/app/Repositories/Eloquent/EggRepository.php index a716a5ec..98b7db45 100644 --- a/app/Repositories/Eloquent/EggRepository.php +++ b/app/Repositories/Eloquent/EggRepository.php @@ -24,9 +24,6 @@ class EggRepository extends EloquentRepository implements EggRepositoryInterface /** * Return an egg with the variables relation attached. * - * @param int $id - * @return \Pterodactyl\Models\Egg - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function getWithVariables(int $id): Egg @@ -34,14 +31,12 @@ class EggRepository extends EloquentRepository implements EggRepositoryInterface try { return $this->getBuilder()->with('variables')->findOrFail($id, $this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } /** * Return all eggs and their relations to be used in the daemon API. - * - * @return \Illuminate\Database\Eloquent\Collection */ public function getAllWithCopyAttributes(): Collection { @@ -52,8 +47,6 @@ class EggRepository extends EloquentRepository implements EggRepositoryInterface * Return an egg with the scriptFrom and configFrom relations loaded onto the model. * * @param int|string $value - * @param string $column - * @return \Pterodactyl\Models\Egg * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -64,16 +57,13 @@ class EggRepository extends EloquentRepository implements EggRepositoryInterface try { return $this->getBuilder()->with('scriptFrom', 'configFrom')->where($column, '=', $value)->firstOrFail($this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } /** * Return all of the data needed to export a service. * - * @param int $id - * @return \Pterodactyl\Models\Egg - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function getWithExportAttributes(int $id): Egg @@ -81,16 +71,12 @@ class EggRepository extends EloquentRepository implements EggRepositoryInterface try { return $this->getBuilder()->with('scriptFrom', 'configFrom', 'variables')->findOrFail($id, $this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } /** * Confirm a copy script belongs to the same nest as the item trying to use it. - * - * @param int $copyFromId - * @param int $service - * @return bool */ public function isCopyableScript(int $copyFromId, int $service): bool { diff --git a/app/Repositories/Eloquent/EggVariableRepository.php b/app/Repositories/Eloquent/EggVariableRepository.php index 9d84b9db..ce79a65f 100644 --- a/app/Repositories/Eloquent/EggVariableRepository.php +++ b/app/Repositories/Eloquent/EggVariableRepository.php @@ -21,9 +21,6 @@ class EggVariableRepository extends EloquentRepository implements EggVariableRep /** * Return editable variables for a given egg. Editable variables must be set to * user viewable in order to be picked up by this function. - * - * @param int $egg - * @return \Illuminate\Support\Collection */ public function getEditableVariables(int $egg): Collection { diff --git a/app/Repositories/Eloquent/EloquentRepository.php b/app/Repositories/Eloquent/EloquentRepository.php index 8e25a5e2..3d3e09cd 100644 --- a/app/Repositories/Eloquent/EloquentRepository.php +++ b/app/Repositories/Eloquent/EloquentRepository.php @@ -27,6 +27,7 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf * context's such that we can pass through ?filter[name]=Dane&sort=desc for example. * * @param bool $usingFilters + * * @return $this */ public function usingRequestFilters($usingFilters = true) @@ -49,14 +50,11 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Paginate the response data based on the page para. * - * @param \Illuminate\Database\Eloquent\Builder $instance - * @param int $default - * * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator */ protected function paginate(Builder $instance, int $default = 50) { - if (! $this->useRequestFilters) { + if (!$this->useRequestFilters) { return $instance->paginate($default); } @@ -87,9 +85,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Create a new record in the database and return the associated model. * - * @param array $fields - * @param bool $validate - * @param bool $force * @return \Illuminate\Database\Eloquent\Model|bool * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -99,10 +94,10 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf $instance = $this->getBuilder()->newModelInstance(); ($force) ? $instance->forceFill($fields) : $instance->fill($fields); - if (! $validate) { + if (!$validate) { $saved = $instance->skipValidation()->save(); } else { - if (! $saved = $instance->save()) { + if (!$saved = $instance->save()) { throw new DataValidationException($instance->getValidator()); } } @@ -113,7 +108,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Find a model that has the specific ID passed. * - * @param int $id * @return \Illuminate\Database\Eloquent\Model * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -123,15 +117,12 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf try { return $this->getBuilder()->findOrFail($id, $this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } /** * Find a model matching an array of where clauses. - * - * @param array $fields - * @return \Illuminate\Support\Collection */ public function findWhere(array $fields): Collection { @@ -141,7 +132,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Find and return the first matching instance for the given fields. * - * @param array $fields * @return \Illuminate\Database\Eloquent\Model * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -151,15 +141,12 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf try { return $this->getBuilder()->where($fields)->firstOrFail($this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } /** * Return a count of records matching the passed arguments. - * - * @param array $fields - * @return int */ public function findCountWhere(array $fields): int { @@ -168,10 +155,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Delete a given record from the database. - * - * @param int $id - * @param bool $destroy - * @return int */ public function delete(int $id, bool $destroy = false): int { @@ -180,10 +163,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Delete records matching the given attributes. - * - * @param array $attributes - * @param bool $force - * @return int */ public function deleteWhere(array $attributes, bool $force = false): int { @@ -196,9 +175,7 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf * Update a given ID with the passed array of fields. * * @param int $id - * @param array $fields - * @param bool $validate - * @param bool $force + * * @return \Illuminate\Database\Eloquent\Model|bool * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -209,15 +186,15 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf try { $instance = $this->getBuilder()->where('id', $id)->firstOrFail(); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } ($force) ? $instance->forceFill($fields) : $instance->fill($fields); - if (! $validate) { + if (!$validate) { $saved = $instance->skipValidation()->save(); } else { - if (! $saved = $instance->save()) { + if (!$saved = $instance->save()) { throw new DataValidationException($instance->getValidator()); } } @@ -229,7 +206,7 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf * Update a model using the attributes passed. * * @param array|\Closure $attributes - * @param array $values + * * @return int */ public function updateWhere($attributes, array $values) @@ -240,11 +217,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Perform a mass update where matching records are updated using whereIn. * This does not perform any model data validation. - * - * @param string $column - * @param array $values - * @param array $fields - * @return int */ public function updateWhereIn(string $column, array $values, array $fields): int { @@ -256,10 +228,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Update a record if it exists in the database, otherwise create it. * - * @param array $where - * @param array $fields - * @param bool $validate - * @param bool $force * @return \Illuminate\Database\Eloquent\Model * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -283,7 +251,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Return all records associated with the given model. * - * @return \Illuminate\Support\Collection * @deprecated Just use the model */ public function all(): Collection @@ -293,9 +260,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Return a paginated result set using a search term if set on the repository. - * - * @param int $perPage - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator */ public function paginated(int $perPage): LengthAwarePaginator { @@ -305,9 +269,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Insert a single or multiple records into the database at once skipping * validation and mass assignment checking. - * - * @param array $data - * @return bool */ public function insert(array $data): bool { @@ -316,9 +277,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Insert multiple records into the database and ignore duplicates. - * - * @param array $values - * @return bool */ public function insertIgnore(array $values): bool { @@ -332,7 +290,7 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf } $bindings = array_values(array_filter(array_flatten($values, 1), function ($binding) { - return ! $binding instanceof Expression; + return !$binding instanceof Expression; })); $grammar = $this->getBuilder()->toBase()->getGrammar(); @@ -351,7 +309,6 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf /** * Get the amount of entries in the database. * - * @return int * @deprecated just use the count method off a model */ public function count(): int diff --git a/app/Repositories/Eloquent/LocationRepository.php b/app/Repositories/Eloquent/LocationRepository.php index 6d14d5aa..c06d10a9 100644 --- a/app/Repositories/Eloquent/LocationRepository.php +++ b/app/Repositories/Eloquent/LocationRepository.php @@ -22,8 +22,6 @@ class LocationRepository extends EloquentRepository implements LocationRepositor /** * Return locations with a count of nodes and servers attached to it. - * - * @return \Illuminate\Support\Collection */ public function getAllWithDetails(): Collection { @@ -32,8 +30,6 @@ class LocationRepository extends EloquentRepository implements LocationRepositor /** * Return all of the available locations with the nodes as a relationship. - * - * @return \Illuminate\Support\Collection */ public function getAllWithNodes(): Collection { @@ -43,7 +39,6 @@ class LocationRepository extends EloquentRepository implements LocationRepositor /** * Return all of the nodes and their respective count of servers for a location. * - * @param int $id * @return mixed * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -53,14 +48,13 @@ class LocationRepository extends EloquentRepository implements LocationRepositor try { return $this->getBuilder()->with('nodes.servers')->findOrFail($id, $this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } /** * Return a location and the count of nodes in that location. * - * @param int $id * @return mixed * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -70,7 +64,7 @@ class LocationRepository extends EloquentRepository implements LocationRepositor try { return $this->getBuilder()->withCount('nodes')->findOrFail($id, $this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } } diff --git a/app/Repositories/Eloquent/MountRepository.php b/app/Repositories/Eloquent/MountRepository.php index 286e0791..490f76b6 100644 --- a/app/Repositories/Eloquent/MountRepository.php +++ b/app/Repositories/Eloquent/MountRepository.php @@ -22,8 +22,6 @@ class MountRepository extends EloquentRepository /** * Return mounts with a count of eggs, nodes, and servers attached to it. - * - * @return \Illuminate\Support\Collection */ public function getAllWithDetails(): Collection { @@ -33,7 +31,6 @@ class MountRepository extends EloquentRepository /** * Return all of the mounts and their respective relations. * - * @param string $id * @return mixed * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -43,15 +40,12 @@ class MountRepository extends EloquentRepository try { return $this->getBuilder()->with('eggs', 'nodes')->findOrFail($id, $this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } /** * Return mounts available to a server (ignoring if they are or are not mounted). - * - * @param Server $server - * @return \Illuminate\Support\Collection */ public function getMountListForServer(Server $server): Collection { diff --git a/app/Repositories/Eloquent/NestRepository.php b/app/Repositories/Eloquent/NestRepository.php index 96b3df36..6d4992e4 100644 --- a/app/Repositories/Eloquent/NestRepository.php +++ b/app/Repositories/Eloquent/NestRepository.php @@ -29,6 +29,7 @@ class NestRepository extends EloquentRepository implements NestRepositoryInterfa * Return a nest or all nests with their associated eggs and variables. * * @param int $id + * * @return \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Nest * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -37,10 +38,10 @@ class NestRepository extends EloquentRepository implements NestRepositoryInterfa { $instance = $this->getBuilder()->with('eggs', 'eggs.variables'); - if (! is_null($id)) { + if (!is_null($id)) { $instance = $instance->find($id, $this->getColumns()); - if (! $instance) { - throw new RecordNotFoundException; + if (!$instance) { + throw new RecordNotFoundException(); } return $instance; @@ -52,7 +53,6 @@ class NestRepository extends EloquentRepository implements NestRepositoryInterfa /** * Return a nest or all nests and the count of eggs and servers for that nest. * - * @param int|null $id * @return \Pterodactyl\Models\Nest|\Illuminate\Database\Eloquent\Collection * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -61,10 +61,10 @@ class NestRepository extends EloquentRepository implements NestRepositoryInterfa { $instance = $this->getBuilder()->withCount(['eggs', 'servers']); - if (! is_null($id)) { + if (!is_null($id)) { $instance = $instance->find($id, $this->getColumns()); - if (! $instance) { - throw new RecordNotFoundException; + if (!$instance) { + throw new RecordNotFoundException(); } return $instance; @@ -76,16 +76,13 @@ class NestRepository extends EloquentRepository implements NestRepositoryInterfa /** * Return a nest along with its associated eggs and the servers relation on those eggs. * - * @param int $id - * @return \Pterodactyl\Models\Nest - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function getWithEggServers(int $id): Nest { $instance = $this->getBuilder()->with('eggs.servers')->find($id, $this->getColumns()); - if (! $instance) { - throw new RecordNotFoundException; + if (!$instance) { + throw new RecordNotFoundException(); } /* @var Nest $instance */ diff --git a/app/Repositories/Eloquent/NodeRepository.php b/app/Repositories/Eloquent/NodeRepository.php index 57b98bb7..5d1a8bca 100644 --- a/app/Repositories/Eloquent/NodeRepository.php +++ b/app/Repositories/Eloquent/NodeRepository.php @@ -20,9 +20,6 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa /** * Return the usage stats for a single node. - * - * @param \Pterodactyl\Models\Node $node - * @return array */ public function getUsageStats(Node $node): array { @@ -55,9 +52,6 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa /** * Return the usage stats for a single node. - * - * @param \Pterodactyl\Models\Node $node - * @return array */ public function getUsageStatsRaw(Node $node): array { @@ -82,14 +76,10 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa /** * Return a single node with location and server information. - * - * @param \Pterodactyl\Models\Node $node - * @param bool $refresh - * @return \Pterodactyl\Models\Node */ public function loadLocationAndServerCount(Node $node, bool $refresh = false): Node { - if (! $node->relationLoaded('location') || $refresh) { + if (!$node->relationLoaded('location') || $refresh) { $node->load('location'); } @@ -107,14 +97,11 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa /** * Attach a paginated set of allocations to a node mode including * any servers that are also attached to those allocations. - * - * @param \Pterodactyl\Models\Node $node - * @param bool $refresh - * @return \Pterodactyl\Models\Node */ public function loadNodeAllocations(Node $node, bool $refresh = false): Node { - $node->setRelation('allocations', + $node->setRelation( + 'allocations', $node->allocations() ->orderByRaw('server_id IS NOT NULL DESC, server_id IS NULL') ->orderByRaw('INET_ATON(ip) ASC') @@ -128,8 +115,6 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa /** * Return a collection of nodes for all locations to use in server creation UI. - * - * @return \Illuminate\Support\Collection */ public function getNodesForServerCreation(): Collection { @@ -155,9 +140,6 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa /** * Returns a node with the given id with the Node's resource usage. - * - * @param int $node_id - * @return Node */ public function getNodeWithResourceUsage(int $node_id): Node { diff --git a/app/Repositories/Eloquent/PermissionRepository.php b/app/Repositories/Eloquent/PermissionRepository.php index e2d0b8cb..bcd97140 100644 --- a/app/Repositories/Eloquent/PermissionRepository.php +++ b/app/Repositories/Eloquent/PermissionRepository.php @@ -11,6 +11,7 @@ class PermissionRepository extends EloquentRepository implements PermissionRepos * Return the model backing this repository. * * @return string + * * @throws \Exception */ public function model() diff --git a/app/Repositories/Eloquent/ScheduleRepository.php b/app/Repositories/Eloquent/ScheduleRepository.php index cb1b2cbf..5c999df8 100644 --- a/app/Repositories/Eloquent/ScheduleRepository.php +++ b/app/Repositories/Eloquent/ScheduleRepository.php @@ -22,9 +22,6 @@ class ScheduleRepository extends EloquentRepository implements ScheduleRepositor /** * Return all of the schedules for a given server. - * - * @param int $server - * @return \Illuminate\Support\Collection */ public function findServerSchedules(int $server): Collection { @@ -34,9 +31,6 @@ class ScheduleRepository extends EloquentRepository implements ScheduleRepositor /** * Return a schedule model with all of the associated tasks as a relationship. * - * @param int $schedule - * @return \Pterodactyl\Models\Schedule - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function getScheduleWithTasks(int $schedule): Schedule @@ -44,7 +38,7 @@ class ScheduleRepository extends EloquentRepository implements ScheduleRepositor try { return $this->getBuilder()->with('tasks')->findOrFail($schedule, $this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } } diff --git a/app/Repositories/Eloquent/ServerRepository.php b/app/Repositories/Eloquent/ServerRepository.php index a96c4b65..2e308ce1 100644 --- a/app/Repositories/Eloquent/ServerRepository.php +++ b/app/Repositories/Eloquent/ServerRepository.php @@ -24,14 +24,10 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt /** * Load the egg relations onto the server model. - * - * @param \Pterodactyl\Models\Server $server - * @param bool $refresh - * @return \Pterodactyl\Models\Server */ public function loadEggRelations(Server $server, bool $refresh = false): Server { - if (! $server->relationLoaded('egg') || $refresh) { + if (!$server->relationLoaded('egg') || $refresh) { $server->load('egg.scriptFrom'); } @@ -40,18 +36,14 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt /** * Return a collection of servers with their associated data for rebuild operations. - * - * @param int|null $server - * @param int|null $node - * @return \Illuminate\Support\Collection */ public function getDataForRebuild(int $server = null, int $node = null): Collection { $instance = $this->getBuilder()->with(['allocation', 'allocations', 'egg', 'node']); - if (! is_null($server) && is_null($node)) { + if (!is_null($server) && is_null($node)) { $instance = $instance->where('id', '=', $server); - } elseif (is_null($server) && ! is_null($node)) { + } elseif (is_null($server) && !is_null($node)) { $instance = $instance->where('node_id', '=', $node); } @@ -60,18 +52,14 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt /** * Return a collection of servers with their associated data for reinstall operations. - * - * @param int|null $server - * @param int|null $node - * @return \Illuminate\Support\Collection */ public function getDataForReinstall(int $server = null, int $node = null): Collection { $instance = $this->getBuilder()->with(['allocation', 'allocations', 'egg', 'node']); - if (! is_null($server) && is_null($node)) { + if (!is_null($server) && is_null($node)) { $instance = $instance->where('id', '=', $server); - } elseif (is_null($server) && ! is_null($node)) { + } elseif (is_null($server) && !is_null($node)) { $instance = $instance->where('node_id', '=', $node); } @@ -81,9 +69,6 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt /** * Return a server model and all variables associated with the server. * - * @param int $id - * @return \Pterodactyl\Models\Server - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function findWithVariables(int $id): Server @@ -93,7 +78,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt ->where($this->getModel()->getKeyName(), '=', $id) ->firstOrFail($this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } @@ -101,14 +86,10 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt * Get the primary allocation for a given server. If a model is passed into * the function, load the allocation relationship onto it. Otherwise, find and * return the server from the database. - * - * @param \Pterodactyl\Models\Server $server - * @param bool $refresh - * @return \Pterodactyl\Models\Server */ public function getPrimaryAllocation(Server $server, bool $refresh = false): Server { - if (! $server->relationLoaded('allocation') || $refresh) { + if (!$server->relationLoaded('allocation') || $refresh) { $server->load('allocation'); } @@ -117,15 +98,11 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt /** * Return enough data to be used for the creation of a server via the daemon. - * - * @param \Pterodactyl\Models\Server $server - * @param bool $refresh - * @return \Pterodactyl\Models\Server */ public function getDataForCreation(Server $server, bool $refresh = false): Server { foreach (['allocation', 'allocations', 'egg'] as $relation) { - if (! $server->relationLoaded($relation) || $refresh) { + if (!$server->relationLoaded($relation) || $refresh) { $server->load($relation); } } @@ -135,14 +112,10 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt /** * Load associated databases onto the server model. - * - * @param \Pterodactyl\Models\Server $server - * @param bool $refresh - * @return \Pterodactyl\Models\Server */ public function loadDatabaseRelations(Server $server, bool $refresh = false): Server { - if (! $server->relationLoaded('databases') || $refresh) { + if (!$server->relationLoaded('databases') || $refresh) { $server->load('databases.host'); } @@ -153,14 +126,10 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt * Get data for use when updating a server on the Daemon. Returns an array of * the egg which is used for build and rebuild. Only loads relations * if they are missing, or refresh is set to true. - * - * @param \Pterodactyl\Models\Server $server - * @param bool $refresh - * @return array */ public function getDaemonServiceData(Server $server, bool $refresh = false): array { - if (! $server->relationLoaded('egg') || $refresh) { + if (!$server->relationLoaded('egg') || $refresh) { $server->load('egg'); } @@ -172,9 +141,6 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt /** * Return a server by UUID. * - * @param string $uuid - * @return \Pterodactyl\Models\Server - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function getByUuid(string $uuid): Server @@ -190,26 +156,20 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt return $model; } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } /** * Check if a given UUID and UUID-Short string are unique to a server. - * - * @param string $uuid - * @param string $short - * @return bool */ public function isUniqueUuidCombo(string $uuid, string $short): bool { - return ! $this->getBuilder()->where('uuid', '=', $uuid)->orWhere('uuidShort', '=', $short)->exists(); + return !$this->getBuilder()->where('uuid', '=', $uuid)->orWhere('uuidShort', '=', $short)->exists(); } /** * Get the amount of servers that are suspended. - * - * @return int */ public function getSuspendedServersCount(): int { @@ -218,11 +178,6 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt /** * Returns all of the servers that exist for a given node in a paginated response. - * - * @param int $node - * @param int $limit - * - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator */ public function loadAllServersForNode(int $node, int $limit): LengthAwarePaginator { diff --git a/app/Repositories/Eloquent/SessionRepository.php b/app/Repositories/Eloquent/SessionRepository.php index 54c4ff62..ad069abb 100644 --- a/app/Repositories/Eloquent/SessionRepository.php +++ b/app/Repositories/Eloquent/SessionRepository.php @@ -20,9 +20,6 @@ class SessionRepository extends EloquentRepository implements SessionRepositoryI /** * Return all of the active sessions for a user. - * - * @param int $user - * @return \Illuminate\Support\Collection */ public function getUserSessions(int $user): Collection { @@ -32,8 +29,6 @@ class SessionRepository extends EloquentRepository implements SessionRepositoryI /** * Delete a session for a given user. * - * @param int $user - * @param string $session * @return int|null */ public function deleteUserSession(int $user, string $session) diff --git a/app/Repositories/Eloquent/SettingsRepository.php b/app/Repositories/Eloquent/SettingsRepository.php index 42cc7efe..b39d3a2e 100644 --- a/app/Repositories/Eloquent/SettingsRepository.php +++ b/app/Repositories/Eloquent/SettingsRepository.php @@ -30,9 +30,6 @@ class SettingsRepository extends EloquentRepository implements SettingsRepositor /** * Store a new persistent setting in the database. * - * @param string $key - * @param string|null $value - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -48,8 +45,8 @@ class SettingsRepository extends EloquentRepository implements SettingsRepositor /** * Retrieve a persistent setting from the database. * - * @param string $key * @param mixed $default + * * @return mixed */ public function get(string $key, $default = null) @@ -74,8 +71,6 @@ class SettingsRepository extends EloquentRepository implements SettingsRepositor /** * Remove a key from the database cache. - * - * @param string $key */ public function forget(string $key) { @@ -85,8 +80,6 @@ class SettingsRepository extends EloquentRepository implements SettingsRepositor /** * Remove a key from the cache. - * - * @param string $key */ private function clearCache(string $key) { diff --git a/app/Repositories/Eloquent/SubuserRepository.php b/app/Repositories/Eloquent/SubuserRepository.php index c0fb930a..d40ed9fd 100644 --- a/app/Repositories/Eloquent/SubuserRepository.php +++ b/app/Repositories/Eloquent/SubuserRepository.php @@ -20,18 +20,14 @@ class SubuserRepository extends EloquentRepository implements SubuserRepositoryI /** * Return a subuser with the associated server relationship. - * - * @param \Pterodactyl\Models\Subuser $subuser - * @param bool $refresh - * @return \Pterodactyl\Models\Subuser */ public function loadServerAndUserRelations(Subuser $subuser, bool $refresh = false): Subuser { - if (! $subuser->relationLoaded('server') || $refresh) { + if (!$subuser->relationLoaded('server') || $refresh) { $subuser->load('server'); } - if (! $subuser->relationLoaded('user') || $refresh) { + if (!$subuser->relationLoaded('user') || $refresh) { $subuser->load('user'); } @@ -40,18 +36,14 @@ class SubuserRepository extends EloquentRepository implements SubuserRepositoryI /** * Return a subuser with the associated permissions relationship. - * - * @param \Pterodactyl\Models\Subuser $subuser - * @param bool $refresh - * @return \Pterodactyl\Models\Subuser */ public function getWithPermissions(Subuser $subuser, bool $refresh = false): Subuser { - if (! $subuser->relationLoaded('permissions') || $refresh) { + if (!$subuser->relationLoaded('permissions') || $refresh) { $subuser->load('permissions'); } - if (! $subuser->relationLoaded('user') || $refresh) { + if (!$subuser->relationLoaded('user') || $refresh) { $subuser->load('user'); } @@ -61,10 +53,6 @@ class SubuserRepository extends EloquentRepository implements SubuserRepositoryI /** * Return a subuser and associated permissions given a user_id and server_id. * - * @param int $user - * @param int $server - * @return \Pterodactyl\Models\Subuser - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function getWithPermissionsUsingUserAndServer(int $user, int $server): Subuser @@ -75,7 +63,7 @@ class SubuserRepository extends EloquentRepository implements SubuserRepositoryI ])->first(); if (is_null($instance)) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } return $instance; diff --git a/app/Repositories/Eloquent/TaskRepository.php b/app/Repositories/Eloquent/TaskRepository.php index 3b43221e..718f9949 100644 --- a/app/Repositories/Eloquent/TaskRepository.php +++ b/app/Repositories/Eloquent/TaskRepository.php @@ -22,9 +22,6 @@ class TaskRepository extends EloquentRepository implements TaskRepositoryInterfa /** * Get a task and the server relationship for that task. * - * @param int $id - * @return \Pterodactyl\Models\Task - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function getTaskForJobProcess(int $id): Task @@ -32,15 +29,13 @@ class TaskRepository extends EloquentRepository implements TaskRepositoryInterfa try { return $this->getBuilder()->with('server.user', 'schedule')->findOrFail($id, $this->getColumns()); } catch (ModelNotFoundException $exception) { - throw new RecordNotFoundException; + throw new RecordNotFoundException(); } } /** * Returns the next task in a schedule. * - * @param int $schedule - * @param int $index * @return \Pterodactyl\Models\Task|null */ public function getNextTask(int $schedule, int $index) diff --git a/app/Repositories/Repository.php b/app/Repositories/Repository.php index c209e33b..a8005194 100644 --- a/app/Repositories/Repository.php +++ b/app/Repositories/Repository.php @@ -30,8 +30,6 @@ abstract class Repository implements RepositoryInterface /** * Repository constructor. - * - * @param \Illuminate\Foundation\Application $application */ public function __construct(Application $application) { @@ -61,6 +59,7 @@ abstract class Repository implements RepositoryInterface * Setup column selection functionality. * * @param array|string $columns + * * @return $this */ public function setColumns($columns = ['*']) @@ -106,7 +105,6 @@ abstract class Repository implements RepositoryInterface * Set whether or not the repository should return a fresh model * when changes are committed. * - * @param bool $fresh * @return $this */ public function setFreshModel(bool $fresh = true) @@ -121,6 +119,7 @@ abstract class Repository implements RepositoryInterface * Take the provided model and make it accessible to the rest of the repository. * * @param array $model + * * @return mixed */ protected function initializeModel(...$model) diff --git a/app/Repositories/Wings/DaemonBackupRepository.php b/app/Repositories/Wings/DaemonBackupRepository.php index 20be7642..9b320e1b 100644 --- a/app/Repositories/Wings/DaemonBackupRepository.php +++ b/app/Repositories/Wings/DaemonBackupRepository.php @@ -19,7 +19,6 @@ class DaemonBackupRepository extends DaemonRepository /** * Sets the backup adapter for this execution instance. * - * @param string $adapter * @return $this */ public function setBackupAdapter(string $adapter) @@ -32,9 +31,6 @@ class DaemonBackupRepository extends DaemonRepository /** * Tells the remote Daemon to begin generating a backup for the server. * - * @param \Pterodactyl\Models\Backup $backup - * @return \Psr\Http\Message\ResponseInterface - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function backup(Backup $backup): ResponseInterface @@ -60,8 +56,6 @@ class DaemonBackupRepository extends DaemonRepository /** * Deletes a backup from the daemon. * - * @param \Pterodactyl\Models\Backup $backup - * @return \Psr\Http\Message\ResponseInterface * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function delete(Backup $backup): ResponseInterface diff --git a/app/Repositories/Wings/DaemonCommandRepository.php b/app/Repositories/Wings/DaemonCommandRepository.php index 38f2fb47..390434bf 100644 --- a/app/Repositories/Wings/DaemonCommandRepository.php +++ b/app/Repositories/Wings/DaemonCommandRepository.php @@ -14,7 +14,6 @@ class DaemonCommandRepository extends DaemonRepository * Sends a command or multiple commands to a running server instance. * * @param string|string[] $command - * @return \Psr\Http\Message\ResponseInterface * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ diff --git a/app/Repositories/Wings/DaemonConfigurationRepository.php b/app/Repositories/Wings/DaemonConfigurationRepository.php index ffd498cb..f2672ddf 100644 --- a/app/Repositories/Wings/DaemonConfigurationRepository.php +++ b/app/Repositories/Wings/DaemonConfigurationRepository.php @@ -11,7 +11,6 @@ class DaemonConfigurationRepository extends DaemonRepository /** * Returns system information from the wings instance. * - * @return array * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function getSystemInformation(): array @@ -30,15 +29,16 @@ class DaemonConfigurationRepository extends DaemonRepository * this instance using a passed-in model. This allows us to change plenty of information * in the model, and still use the old, pre-update model to actually make the HTTP request. * - * @param \Pterodactyl\Models\Node $node * @return \Psr\Http\Message\ResponseInterface + * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function update(Node $node) { try { return $this->getHttpClient()->post( - '/api/update', ['json' => $node->getConfiguration()] + '/api/update', + ['json' => $node->getConfiguration()] ); } catch (TransferException $exception) { throw new DaemonConnectionException($exception); diff --git a/app/Repositories/Wings/DaemonFileRepository.php b/app/Repositories/Wings/DaemonFileRepository.php index 9c403861..f1acdc7d 100644 --- a/app/Repositories/Wings/DaemonFileRepository.php +++ b/app/Repositories/Wings/DaemonFileRepository.php @@ -14,9 +14,7 @@ class DaemonFileRepository extends DaemonRepository /** * Return the contents of a given file. * - * @param string $path * @param int|null $notLargerThan the maximum content length in bytes - * @return string * * @throws \GuzzleHttp\Exception\TransferException * @throws \Pterodactyl\Exceptions\Http\Server\FileSizeTooLargeException @@ -40,7 +38,7 @@ class DaemonFileRepository extends DaemonRepository $length = (int) $response->getHeader('Content-Length')[0] ?? 0; if ($notLargerThan && $length > $notLargerThan) { - throw new FileSizeTooLargeException; + throw new FileSizeTooLargeException(); } return $response->getBody()->__toString(); @@ -50,10 +48,6 @@ class DaemonFileRepository extends DaemonRepository * Save new contents to a given file. This works for both creating and updating * a file. * - * @param string $path - * @param string $content - * @return \Psr\Http\Message\ResponseInterface - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function putContent(string $path, string $content): ResponseInterface @@ -76,9 +70,6 @@ class DaemonFileRepository extends DaemonRepository /** * Return a directory listing for a given path. * - * @param string $path - * @return array - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function getDirectory(string $path): array @@ -102,10 +93,6 @@ class DaemonFileRepository extends DaemonRepository /** * Creates a new directory for the server in the given $path. * - * @param string $name - * @param string $path - * @return \Psr\Http\Message\ResponseInterface - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function createDirectory(string $name, string $path): ResponseInterface @@ -130,10 +117,6 @@ class DaemonFileRepository extends DaemonRepository /** * Renames or moves a file on the remote machine. * - * @param string|null $root - * @param array $files - * @return \Psr\Http\Message\ResponseInterface - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function renameFiles(?string $root, array $files): ResponseInterface @@ -158,9 +141,6 @@ class DaemonFileRepository extends DaemonRepository /** * Copy a given file and give it a unique name. * - * @param string $location - * @return \Psr\Http\Message\ResponseInterface - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function copyFile(string $location): ResponseInterface @@ -184,10 +164,6 @@ class DaemonFileRepository extends DaemonRepository /** * Delete a file or folder for the server. * - * @param string|null $root - * @param array $files - * @return \Psr\Http\Message\ResponseInterface - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function deleteFiles(?string $root, array $files): ResponseInterface @@ -212,10 +188,6 @@ class DaemonFileRepository extends DaemonRepository /** * Compress the given files or folders in the given root. * - * @param string|null $root - * @param array $files - * @return array - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function compressFiles(?string $root, array $files): array @@ -245,10 +217,6 @@ class DaemonFileRepository extends DaemonRepository /** * Decompresses a given archive file. * - * @param string|null $root - * @param string $file - * @return \Psr\Http\Message\ResponseInterface - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function decompressFile(?string $root, string $file): ResponseInterface @@ -273,10 +241,6 @@ class DaemonFileRepository extends DaemonRepository /** * Chmods the given files. * - * @param string|null $root - * @param array $files - * @return \Psr\Http\Message\ResponseInterface - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function chmodFiles(?string $root, array $files): ResponseInterface @@ -301,10 +265,6 @@ class DaemonFileRepository extends DaemonRepository /** * Pulls a file from the given URL and saves it to the disk. * - * @param string $url - * @param string|null $directory - * @return \Psr\Http\Message\ResponseInterface - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function pull(string $url, ?string $directory): ResponseInterface diff --git a/app/Repositories/Wings/DaemonPowerRepository.php b/app/Repositories/Wings/DaemonPowerRepository.php index ccbf169f..4e290cfc 100644 --- a/app/Repositories/Wings/DaemonPowerRepository.php +++ b/app/Repositories/Wings/DaemonPowerRepository.php @@ -13,9 +13,6 @@ class DaemonPowerRepository extends DaemonRepository /** * Sends a power action to the server instance. * - * @param string $action - * @return \Psr\Http\Message\ResponseInterface - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function send(string $action): ResponseInterface diff --git a/app/Repositories/Wings/DaemonRepository.php b/app/Repositories/Wings/DaemonRepository.php index 4ebe249c..268a4a21 100644 --- a/app/Repositories/Wings/DaemonRepository.php +++ b/app/Repositories/Wings/DaemonRepository.php @@ -27,8 +27,6 @@ abstract class DaemonRepository /** * BaseWingsRepository constructor. - * - * @param \Illuminate\Contracts\Foundation\Application $application */ public function __construct(Application $application) { @@ -38,7 +36,6 @@ abstract class DaemonRepository /** * Set the server model this request is stemming from. * - * @param \Pterodactyl\Models\Server $server * @return $this */ public function setServer(Server $server) @@ -53,7 +50,6 @@ abstract class DaemonRepository /** * Set the node model this request is stemming from. * - * @param \Pterodactyl\Models\Node $node * @return $this */ public function setNode(Node $node) @@ -65,9 +61,6 @@ abstract class DaemonRepository /** * Return an instance of the Guzzle HTTP Client to be used for requests. - * - * @param array $headers - * @return \GuzzleHttp\Client */ public function getHttpClient(array $headers = []): Client { diff --git a/app/Repositories/Wings/DaemonServerRepository.php b/app/Repositories/Wings/DaemonServerRepository.php index 702b46a5..35df86d8 100644 --- a/app/Repositories/Wings/DaemonServerRepository.php +++ b/app/Repositories/Wings/DaemonServerRepository.php @@ -32,8 +32,6 @@ class DaemonServerRepository extends DaemonRepository /** * Creates a new server on the Wings daemon. * - * @param array $data - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function create(array $data): void @@ -42,7 +40,8 @@ class DaemonServerRepository extends DaemonRepository try { $this->getHttpClient()->post( - '/api/servers', [ + '/api/servers', + [ 'json' => $data, ] ); @@ -54,8 +53,6 @@ class DaemonServerRepository extends DaemonRepository /** * Updates details about a server on the Daemon. * - * @param array $data - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function update(array $data): void @@ -96,7 +93,8 @@ class DaemonServerRepository extends DaemonRepository try { $this->getHttpClient()->post(sprintf( - '/api/servers/%s/reinstall', $this->server->uuid + '/api/servers/%s/reinstall', + $this->server->uuid )); } catch (TransferException $exception) { throw new DaemonConnectionException($exception); @@ -107,8 +105,6 @@ class DaemonServerRepository extends DaemonRepository * By default this function will suspend a server instance on the daemon. However, passing * "true" as the first argument will unsuspend the server. * - * @param bool $unsuspend - * * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function suspend(bool $unsuspend = false): void @@ -118,7 +114,7 @@ class DaemonServerRepository extends DaemonRepository try { $this->getHttpClient()->patch( '/api/servers/' . $this->server->uuid, - ['json' => ['suspended' => ! $unsuspend]] + ['json' => ['suspended' => !$unsuspend]] ); } catch (TransferException $exception) { throw new DaemonConnectionException($exception); @@ -137,7 +133,8 @@ class DaemonServerRepository extends DaemonRepository try { $this->getHttpClient()->post(sprintf( - '/api/servers/%s/archive', $this->server->uuid + '/api/servers/%s/archive', + $this->server->uuid )); } catch (TransferException $exception) { throw new DaemonConnectionException($exception); @@ -149,7 +146,6 @@ class DaemonServerRepository extends DaemonRepository * make it easier to revoke tokens on the fly. This ensures that the JTI key is formatted * correctly and avoids any costly mistakes in the codebase. * - * @param int $id * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function revokeUserJTI(int $id): void @@ -163,7 +159,6 @@ class DaemonServerRepository extends DaemonRepository * Revokes an array of JWT JTI's by marking any token generated before the current time on * the Wings instance as being invalid. * - * @param array $jtis * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ protected function revokeJTIs(array $jtis): void diff --git a/app/Repositories/Wings/DaemonTransferRepository.php b/app/Repositories/Wings/DaemonTransferRepository.php index e8a51419..74a1e3dc 100644 --- a/app/Repositories/Wings/DaemonTransferRepository.php +++ b/app/Repositories/Wings/DaemonTransferRepository.php @@ -10,11 +10,6 @@ use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; class DaemonTransferRepository extends DaemonRepository { /** - * @param Server $server - * @param array $data - * @param Node $node - * @param string $token - * * @throws DaemonConnectionException */ public function notify(Server $server, array $data, Node $node, string $token): void diff --git a/app/Rules/Username.php b/app/Rules/Username.php index 1cceae5f..8d1373ea 100644 --- a/app/Rules/Username.php +++ b/app/Rules/Username.php @@ -18,8 +18,7 @@ class Username implements Rule * Allowed characters: a-z0-9_-. * * @param string $attribute - * @param mixed $value - * @return bool + * @param mixed $value */ public function passes($attribute, $value): bool { @@ -28,8 +27,6 @@ class Username implements Rule /** * Return a validation message for use when this rule fails. - * - * @return string */ public function message(): string { diff --git a/app/Services/Acl/Api/AdminAcl.php b/app/Services/Acl/Api/AdminAcl.php index 96085e15..880794ad 100644 --- a/app/Services/Acl/Api/AdminAcl.php +++ b/app/Services/Acl/Api/AdminAcl.php @@ -11,35 +11,33 @@ class AdminAcl * Resource permission columns in the api_keys table begin * with this identifier. */ - const COLUMN_IDENTIFIER = 'r_'; + public const COLUMN_IDENTIFIER = 'r_'; /** * The different types of permissions available for API keys. This * implements a read/write/none permissions scheme for all endpoints. */ - const NONE = 0; - const READ = 1; - const WRITE = 2; + public const NONE = 0; + public const READ = 1; + public const WRITE = 2; /** * Resources that are available on the API and can contain a permissions * set for each key. These are stored in the database as r_{resource}. */ - const RESOURCE_SERVERS = 'servers'; - const RESOURCE_NODES = 'nodes'; - const RESOURCE_ALLOCATIONS = 'allocations'; - const RESOURCE_USERS = 'users'; - const RESOURCE_LOCATIONS = 'locations'; - const RESOURCE_NESTS = 'nests'; - const RESOURCE_EGGS = 'eggs'; - const RESOURCE_DATABASE_HOSTS = 'database_hosts'; - const RESOURCE_SERVER_DATABASES = 'server_databases'; + public const RESOURCE_SERVERS = 'servers'; + public const RESOURCE_NODES = 'nodes'; + public const RESOURCE_ALLOCATIONS = 'allocations'; + public const RESOURCE_USERS = 'users'; + public const RESOURCE_LOCATIONS = 'locations'; + public const RESOURCE_NESTS = 'nests'; + public const RESOURCE_EGGS = 'eggs'; + public const RESOURCE_DATABASE_HOSTS = 'database_hosts'; + public const RESOURCE_SERVER_DATABASES = 'server_databases'; /** * Determine if an API key has permission to perform a specific read/write operation. * - * @param int $permission - * @param int $action * @return bool */ public static function can(int $permission, int $action = self::READ) @@ -55,9 +53,6 @@ class AdminAcl * Determine if an API Key model has permission to access a given resource * at a specific action level. * - * @param \Pterodactyl\Models\ApiKey $key - * @param string $resource - * @param int $action * @return bool */ public static function check(ApiKey $key, string $resource, int $action = self::READ) @@ -68,7 +63,6 @@ class AdminAcl /** * Return a list of all resource constants defined in this ACL. * - * @return array * @throws \ReflectionException */ public static function getResourceList(): array diff --git a/app/Services/Allocations/AllocationDeletionService.php b/app/Services/Allocations/AllocationDeletionService.php index 5e81a1d2..4b1bfec3 100644 --- a/app/Services/Allocations/AllocationDeletionService.php +++ b/app/Services/Allocations/AllocationDeletionService.php @@ -15,8 +15,6 @@ class AllocationDeletionService /** * AllocationDeletionService constructor. - * - * @param \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface $repository */ public function __construct(AllocationRepositoryInterface $repository) { @@ -27,14 +25,13 @@ class AllocationDeletionService * Delete an allocation from the database only if it does not have a server * that is actively attached to it. * - * @param \Pterodactyl\Models\Allocation $allocation * @return int * * @throws \Pterodactyl\Exceptions\Service\Allocation\ServerUsingAllocationException */ public function handle(Allocation $allocation) { - if (! is_null($allocation->server_id)) { + if (!is_null($allocation->server_id)) { throw new ServerUsingAllocationException(trans('exceptions.allocations.server_using')); } diff --git a/app/Services/Allocations/AssignmentService.php b/app/Services/Allocations/AssignmentService.php index 99ae40f2..09313e4c 100644 --- a/app/Services/Allocations/AssignmentService.php +++ b/app/Services/Allocations/AssignmentService.php @@ -13,12 +13,12 @@ use Pterodactyl\Exceptions\Service\Allocation\TooManyPortsInRangeException; class AssignmentService { - const CIDR_MAX_BITS = 27; - const CIDR_MIN_BITS = 32; - const PORT_FLOOR = 1024; - const PORT_CEIL = 65535; - const PORT_RANGE_LIMIT = 1000; - const PORT_RANGE_REGEX = '/^(\d{4,5})-(\d{4,5})$/'; + public const CIDR_MAX_BITS = 27; + public const CIDR_MIN_BITS = 32; + public const PORT_FLOOR = 1024; + public const PORT_CEIL = 65535; + public const PORT_RANGE_LIMIT = 1000; + public const PORT_RANGE_REGEX = '/^(\d{4,5})-(\d{4,5})$/'; /** * @var \Illuminate\Database\ConnectionInterface @@ -32,9 +32,6 @@ class AssignmentService /** * AssignmentService constructor. - * - * @param \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface $repository - * @param \Illuminate\Database\ConnectionInterface $connection */ public function __construct(AllocationRepositoryInterface $repository, ConnectionInterface $connection) { @@ -45,9 +42,6 @@ class AssignmentService /** * Insert allocations into the database and link them to a specific node. * - * @param \Pterodactyl\Models\Node $node - * @param array $data - * * @throws \Pterodactyl\Exceptions\Service\Allocation\CidrOutOfRangeException * @throws \Pterodactyl\Exceptions\Service\Allocation\PortOutOfRangeException * @throws \Pterodactyl\Exceptions\Service\Allocation\InvalidPortMappingException @@ -57,15 +51,15 @@ class AssignmentService { $explode = explode('/', $data['allocation_ip']); if (count($explode) !== 1) { - if (! ctype_digit($explode[1]) || ($explode[1] > self::CIDR_MIN_BITS || $explode[1] < self::CIDR_MAX_BITS)) { - throw new CidrOutOfRangeException; + if (!ctype_digit($explode[1]) || ($explode[1] > self::CIDR_MIN_BITS || $explode[1] < self::CIDR_MAX_BITS)) { + throw new CidrOutOfRangeException(); } } $this->connection->beginTransaction(); foreach (Network::parse(gethostbyname($data['allocation_ip'])) as $ip) { foreach ($data['allocation_ports'] as $port) { - if (! is_digit($port) && ! preg_match(self::PORT_RANGE_REGEX, $port)) { + if (!is_digit($port) && !preg_match(self::PORT_RANGE_REGEX, $port)) { throw new InvalidPortMappingException($port); } @@ -74,11 +68,11 @@ class AssignmentService $block = range($matches[1], $matches[2]); if (count($block) > self::PORT_RANGE_LIMIT) { - throw new TooManyPortsInRangeException; + throw new TooManyPortsInRangeException(); } if ((int) $matches[1] <= self::PORT_FLOOR || (int) $matches[2] > self::PORT_CEIL) { - throw new PortOutOfRangeException; + throw new PortOutOfRangeException(); } foreach ($block as $unit) { @@ -92,7 +86,7 @@ class AssignmentService } } else { if ((int) $port <= self::PORT_FLOOR || (int) $port > self::PORT_CEIL) { - throw new PortOutOfRangeException; + throw new PortOutOfRangeException(); } $insertData[] = [ diff --git a/app/Services/Allocations/FindAssignableAllocationService.php b/app/Services/Allocations/FindAssignableAllocationService.php index 6f523663..29c37123 100644 --- a/app/Services/Allocations/FindAssignableAllocationService.php +++ b/app/Services/Allocations/FindAssignableAllocationService.php @@ -30,7 +30,6 @@ class FindAssignableAllocationService * no allocation can be found, a new one will be created with a random port between the defined * range from the configuration. * - * @param \Pterodactyl\Models\Server $server * @return \Pterodactyl\Models\Allocation * * @throws \Pterodactyl\Exceptions\DisplayException @@ -41,8 +40,8 @@ class FindAssignableAllocationService */ public function handle(Server $server) { - if (! config('pterodactyl.client_features.allocations.enabled')) { - throw new AutoAllocationNotEnabledException; + if (!config('pterodactyl.client_features.allocations.enabled')) { + throw new AutoAllocationNotEnabledException(); } // Attempt to find a given available allocation for a server. If one cannot be found @@ -67,9 +66,6 @@ class FindAssignableAllocationService * in the settings. If there are no matches in that range, or something is wrong with the * range information provided an exception will be raised. * - * @param \Pterodactyl\Models\Server $server - * @return \Pterodactyl\Models\Allocation - * * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Service\Allocation\CidrOutOfRangeException * @throws \Pterodactyl\Exceptions\Service\Allocation\InvalidPortMappingException @@ -81,8 +77,8 @@ class FindAssignableAllocationService $start = config('pterodactyl.client_features.allocations.range_start', null); $end = config('pterodactyl.client_features.allocations.range_end', null); - if (! $start || ! $end) { - throw new NoAutoAllocationSpaceAvailableException; + if (!$start || !$end) { + throw new NoAutoAllocationSpaceAvailableException(); } Assert::integerish($start); @@ -102,7 +98,7 @@ class FindAssignableAllocationService // If we've already allocated all of the ports, just abort. if (empty($available)) { - throw new NoAutoAllocationSpaceAvailableException; + throw new NoAutoAllocationSpaceAvailableException(); } // Pick a random port out of the remaining available ports. diff --git a/app/Services/Api/KeyCreationService.php b/app/Services/Api/KeyCreationService.php index a1547897..20a11add 100644 --- a/app/Services/Api/KeyCreationService.php +++ b/app/Services/Api/KeyCreationService.php @@ -25,9 +25,6 @@ class KeyCreationService /** * ApiKeyService constructor. - * - * @param \Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface $repository - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter */ public function __construct(ApiKeyRepositoryInterface $repository, Encrypter $encrypter) { @@ -39,7 +36,6 @@ class KeyCreationService * Set the type of key that should be created. By default an orphaned key will be * created. These keys cannot be used for anything, and will not render in the UI. * - * @param int $type * @return \Pterodactyl\Services\Api\KeyCreationService */ public function setKeyType(int $type) @@ -54,10 +50,6 @@ class KeyCreationService * This will automatically generate an identifier and an encrypted token that are * stored in the database. * - * @param array $data - * @param array $permissions - * @return \Pterodactyl\Models\ApiKey - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ public function handle(array $data, array $permissions = []): ApiKey diff --git a/app/Services/Backups/DeleteBackupService.php b/app/Services/Backups/DeleteBackupService.php index cdb61844..6c612e04 100644 --- a/app/Services/Backups/DeleteBackupService.php +++ b/app/Services/Backups/DeleteBackupService.php @@ -35,11 +35,6 @@ class DeleteBackupService /** * DeleteBackupService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Repositories\Eloquent\BackupRepository $repository - * @param \Pterodactyl\Extensions\Backups\BackupManager $manager - * @param \Pterodactyl\Repositories\Wings\DaemonBackupRepository $daemonBackupRepository */ public function __construct( ConnectionInterface $connection, @@ -56,7 +51,6 @@ class DeleteBackupService /** * Deletes a backup from the system. * - * @param \Pterodactyl\Models\Backup $backup * @throws \Throwable */ public function handle(Backup $backup) @@ -74,7 +68,7 @@ class DeleteBackupService $previous = $exception->getPrevious(); // Don't fail the request if the Daemon responds with a 404, just assume the backup // doesn't actually exist and remove it's reference from the Panel as well. - if (! $previous instanceof ClientException || $previous->getResponse()->getStatusCode() !== Response::HTTP_NOT_FOUND) { + if (!$previous instanceof ClientException || $previous->getResponse()->getStatusCode() !== Response::HTTP_NOT_FOUND) { throw $exception; } } @@ -86,7 +80,6 @@ class DeleteBackupService /** * Deletes a backup from an S3 disk. * - * @param \Pterodactyl\Models\Backup $backup * @throws \Throwable */ protected function deleteFromS3(Backup $backup) diff --git a/app/Services/Backups/InitiateBackupService.php b/app/Services/Backups/InitiateBackupService.php index 0aa7ae4e..b55f0f8c 100644 --- a/app/Services/Backups/InitiateBackupService.php +++ b/app/Services/Backups/InitiateBackupService.php @@ -49,11 +49,7 @@ class InitiateBackupService /** * InitiateBackupService constructor. * - * @param \Pterodactyl\Repositories\Eloquent\BackupRepository $repository - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Repositories\Wings\DaemonBackupRepository $daemonBackupRepository * @param \Pterodactyl\Services\Backups\DeleteBackupService $deleteBackupService - * @param \Pterodactyl\Extensions\Backups\BackupManager $backupManager */ public function __construct( BackupRepository $repository, @@ -73,6 +69,7 @@ class InitiateBackupService * Sets the files to be ignored by this backup. * * @param string[]|null $ignored + * * @return $this */ public function setIgnoredFiles(?array $ignored) @@ -96,12 +93,6 @@ class InitiateBackupService /** * Initiates the backup process for a server on the daemon. * - * @param \Pterodactyl\Models\Server $server - * @param string|null $name - * @param bool $override - * - * @return \Pterodactyl\Models\Backup - * * @throws \Throwable * @throws \Pterodactyl\Exceptions\Service\Backup\TooManyBackupsException * @throws \Symfony\Component\HttpKernel\Exception\TooManyRequestsHttpException @@ -113,17 +104,14 @@ class InitiateBackupService if ($period > 0) { $previous = $this->repository->getBackupsGeneratedDuringTimespan($server->id, $period); if ($previous->count() >= $limit) { - throw new TooManyRequestsHttpException( - CarbonImmutable::now()->diffInSeconds($previous->last()->created_at->addSeconds($period)), - sprintf('Only %d backups may be generated within a %d second span of time.', $limit, $period) - ); + throw new TooManyRequestsHttpException(CarbonImmutable::now()->diffInSeconds($previous->last()->created_at->addSeconds($period)), sprintf('Only %d backups may be generated within a %d second span of time.', $limit, $period)); } } // Check if the server has reached or exceeded it's backup limit - if (! $server->backup_limit || $server->backups()->where('is_successful', true)->count() >= $server->backup_limit) { + if (!$server->backup_limit || $server->backups()->where('is_successful', true)->count() >= $server->backup_limit) { // Do not allow the user to continue if this server is already at its limit and can't override. - if (! $override || $server->backup_limit <= 0) { + if (!$override || $server->backup_limit <= 0) { throw new TooManyBackupsException($server->backup_limit); } diff --git a/app/Services/Databases/DatabaseManagementService.php b/app/Services/Databases/DatabaseManagementService.php index 8d7b2bfd..a10b2271 100644 --- a/app/Services/Databases/DatabaseManagementService.php +++ b/app/Services/Databases/DatabaseManagementService.php @@ -57,11 +57,6 @@ class DatabaseManagementService /** * CreationService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Extensions\DynamicDatabaseConnection $dynamic - * @param \Pterodactyl\Repositories\Eloquent\DatabaseRepository $repository - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter */ public function __construct( ConnectionInterface $connection, @@ -79,10 +74,6 @@ class DatabaseManagementService * Generates a unique database name for the given server. This name should be passed through when * calling this handle function for this service, otherwise the database will be created with * whatever name is provided. - * - * @param string $name - * @param int $serverId - * @return string */ public static function generateUniqueDatabaseName(string $name, int $serverId): string { @@ -94,7 +85,6 @@ class DatabaseManagementService * Set wether or not this class should validate that the server has enough slots * left before creating the new database. * - * @param bool $validate * @return $this */ public function setValidateDatabaseLimit(bool $validate): self @@ -107,8 +97,6 @@ class DatabaseManagementService /** * Create a new database that is linked to a specific host. * - * @param \Pterodactyl\Models\Server $server - * @param array $data * @return \Pterodactyl\Models\Database * * @throws \Throwable @@ -117,23 +105,21 @@ class DatabaseManagementService */ public function create(Server $server, array $data) { - if (! config('pterodactyl.client_features.databases.enabled')) { - throw new DatabaseClientFeatureNotEnabledException; + if (!config('pterodactyl.client_features.databases.enabled')) { + throw new DatabaseClientFeatureNotEnabledException(); } if ($this->validateDatabaseLimit) { // If the server has a limit assigned and we've already reached that limit, throw back // an exception and kill the process. - if (! is_null($server->database_limit) && $server->databases()->count() >= $server->database_limit) { - throw new TooManyDatabasesException; + if (!is_null($server->database_limit) && $server->databases()->count() >= $server->database_limit) { + throw new TooManyDatabasesException(); } } // Protect against developer mistakes... - if (empty($data['database']) || ! preg_match(self::MATCH_NAME_REGEX, $data['database'])) { - throw new InvalidArgumentException( - 'The database name passed to DatabaseManagementService::handle MUST be prefixed with "s{server_id}_".' - ); + if (empty($data['database']) || !preg_match(self::MATCH_NAME_REGEX, $data['database'])) { + throw new InvalidArgumentException('The database name passed to DatabaseManagementService::handle MUST be prefixed with "s{server_id}_".'); } $data = array_merge($data, [ @@ -154,7 +140,10 @@ class DatabaseManagementService $this->repository->createDatabase($database->database); $this->repository->createUser( - $database->username, $database->remote, $this->encrypter->decrypt($database->password), $database->max_connections + $database->username, + $database->remote, + $this->encrypter->decrypt($database->password), + $database->max_connections ); $this->repository->assignUserToDatabase($database->database, $database->username, $database->remote); $this->repository->flush(); @@ -180,7 +169,6 @@ class DatabaseManagementService /** * Delete a database from the given host server. * - * @param \Pterodactyl\Models\Database $database * @return bool|null * * @throws \Exception @@ -201,9 +189,6 @@ class DatabaseManagementService * have the same name across multiple hosts, for the sake of keeping this logic easy to understand * and avoiding user confusion we will ignore the specific host and just look across all hosts. * - * @param array $data - * @return \Pterodactyl\Models\Database - * * @throws \Pterodactyl\Exceptions\Repository\DuplicateDatabaseNameException * @throws \Throwable */ @@ -214,12 +199,10 @@ class DatabaseManagementService ->exists(); if ($exists) { - throw new DuplicateDatabaseNameException( - 'A database with that name already exists for this server.' - ); + throw new DuplicateDatabaseNameException('A database with that name already exists for this server.'); } - $database = (new Database)->forceFill($data); + $database = (new Database())->forceFill($data); $database->saveOrFail(); return $database; diff --git a/app/Services/Databases/DatabasePasswordService.php b/app/Services/Databases/DatabasePasswordService.php index 2a9ebcab..aabe9838 100644 --- a/app/Services/Databases/DatabasePasswordService.php +++ b/app/Services/Databases/DatabasePasswordService.php @@ -33,11 +33,6 @@ class DatabasePasswordService /** * DatabasePasswordService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface $repository - * @param \Pterodactyl\Extensions\DynamicDatabaseConnection $dynamic - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter */ public function __construct( ConnectionInterface $connection, @@ -55,7 +50,6 @@ class DatabasePasswordService * Updates a password for a given database. * * @param \Pterodactyl\Models\Database|int $database - * @return string * * @throws \Throwable */ diff --git a/app/Services/Databases/DeployServerDatabaseService.php b/app/Services/Databases/DeployServerDatabaseService.php index 4bc72a1f..3946cb83 100644 --- a/app/Services/Databases/DeployServerDatabaseService.php +++ b/app/Services/Databases/DeployServerDatabaseService.php @@ -26,10 +26,6 @@ class DeployServerDatabaseService } /** - * @param \Pterodactyl\Models\Server $server - * @param array $data - * @return \Pterodactyl\Models\Database - * * @throws \Throwable * @throws \Pterodactyl\Exceptions\Service\Database\TooManyDatabasesException * @throws \Pterodactyl\Exceptions\Service\Database\DatabaseClientFeatureNotEnabledException @@ -41,12 +37,12 @@ class DeployServerDatabaseService $hosts = DatabaseHost::query()->get()->toBase(); if ($hosts->isEmpty()) { - throw new NoSuitableDatabaseHostException; + throw new NoSuitableDatabaseHostException(); } else { $nodeHosts = $hosts->where('node_id', $server->node_id)->toBase(); - if ($nodeHosts->isEmpty() && ! config('pterodactyl.client_features.databases.allow_random')) { - throw new NoSuitableDatabaseHostException; + if ($nodeHosts->isEmpty() && !config('pterodactyl.client_features.databases.allow_random')) { + throw new NoSuitableDatabaseHostException(); } } diff --git a/app/Services/Databases/Hosts/HostCreationService.php b/app/Services/Databases/Hosts/HostCreationService.php index cbe3024f..275f4d29 100644 --- a/app/Services/Databases/Hosts/HostCreationService.php +++ b/app/Services/Databases/Hosts/HostCreationService.php @@ -38,12 +38,6 @@ class HostCreationService /** * HostCreationService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Illuminate\Database\DatabaseManager $databaseManager - * @param \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface $repository - * @param \Pterodactyl\Extensions\DynamicDatabaseConnection $dynamic - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter */ public function __construct( ConnectionInterface $connection, @@ -62,9 +56,6 @@ class HostCreationService /** * Create a new database host on the Panel. * - * @param array $data - * @return \Pterodactyl\Models\DatabaseHost - * * @throws \Throwable */ public function handle(array $data): DatabaseHost diff --git a/app/Services/Databases/Hosts/HostDeletionService.php b/app/Services/Databases/Hosts/HostDeletionService.php index f366305c..1538d482 100644 --- a/app/Services/Databases/Hosts/HostDeletionService.php +++ b/app/Services/Databases/Hosts/HostDeletionService.php @@ -20,9 +20,6 @@ class HostDeletionService /** * HostDeletionService constructor. - * - * @param \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface $databaseRepository - * @param \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface $repository */ public function __construct( DatabaseRepositoryInterface $databaseRepository, @@ -36,9 +33,6 @@ class HostDeletionService * Delete a specified host from the Panel if no databases are * attached to it. * - * @param int $host - * @return int - * * @throws \Pterodactyl\Exceptions\Service\HasActiveServersException */ public function handle(int $host): int diff --git a/app/Services/Databases/Hosts/HostUpdateService.php b/app/Services/Databases/Hosts/HostUpdateService.php index 9965abd9..4a281b85 100644 --- a/app/Services/Databases/Hosts/HostUpdateService.php +++ b/app/Services/Databases/Hosts/HostUpdateService.php @@ -45,12 +45,6 @@ class HostUpdateService /** * DatabaseHostService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Illuminate\Database\DatabaseManager $databaseManager - * @param \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface $repository - * @param \Pterodactyl\Extensions\DynamicDatabaseConnection $dynamic - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter */ public function __construct( ConnectionInterface $connection, @@ -69,15 +63,11 @@ class HostUpdateService /** * Update a database host and persist to the database. * - * @param int $hostId - * @param array $data - * @return \Pterodactyl\Models\DatabaseHost - * * @throws \Throwable */ public function handle(int $hostId, array $data): DatabaseHost { - if (! empty(array_get($data, 'password'))) { + if (!empty(array_get($data, 'password'))) { $data['password'] = $this->encrypter->encrypt($data['password']); } else { unset($data['password']); diff --git a/app/Services/Deployment/AllocationSelectionService.php b/app/Services/Deployment/AllocationSelectionService.php index 633ba1f5..d714700b 100644 --- a/app/Services/Deployment/AllocationSelectionService.php +++ b/app/Services/Deployment/AllocationSelectionService.php @@ -32,8 +32,6 @@ class AllocationSelectionService /** * AllocationSelectionService constructor. - * - * @param \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface $repository */ public function __construct(AllocationRepositoryInterface $repository) { @@ -45,7 +43,6 @@ class AllocationSelectionService * to the given IP address. If true an allocation will not be selected if an IP * already has another server set to use on if its allocations. * - * @param bool $dedicated * @return $this */ public function setDedicated(bool $dedicated) @@ -59,7 +56,6 @@ class AllocationSelectionService * A list of node IDs that should be used when selecting an allocation. If empty, all * nodes will be used to filter with. * - * @param array $nodes * @return $this */ public function setNodes(array $nodes) @@ -74,7 +70,6 @@ class AllocationSelectionService * empty, all ports will be considered when finding an allocation. If set, only ports appearing * in the array or range will be used. * - * @param array $ports * @return $this * * @throws \Pterodactyl\Exceptions\DisplayException @@ -106,8 +101,6 @@ class AllocationSelectionService /** * Return a single allocation that should be used as the default allocation for a server. * - * @return \Pterodactyl\Models\Allocation - * * @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableAllocationException */ public function handle(): Allocation diff --git a/app/Services/Deployment/FindViableNodesService.php b/app/Services/Deployment/FindViableNodesService.php index 7ebce9e8..76cb89ab 100644 --- a/app/Services/Deployment/FindViableNodesService.php +++ b/app/Services/Deployment/FindViableNodesService.php @@ -26,7 +26,6 @@ class FindViableNodesService /** * Set the locations that should be searched through to locate available nodes. * - * @param array $locations * @return $this */ public function setLocations(array $locations): self @@ -43,7 +42,6 @@ class FindViableNodesService * filtered out if they do not have enough available free disk space for this server * to be placed on. * - * @param int $disk * @return $this */ public function setDisk(int $disk): self @@ -57,7 +55,6 @@ class FindViableNodesService * Set the amount of memory that this server will be using. As with disk space, nodes that * do not have enough free memory will be filtered out. * - * @param int $memory * @return $this */ public function setMemory(int $memory): self @@ -81,6 +78,7 @@ class FindViableNodesService * up to 50 nodes at a time starting at the provided page. * If "null" is provided as the value no pagination will * be used. + * * @return \Illuminate\Support\Collection|\Illuminate\Contracts\Pagination\LengthAwarePaginator * * @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableNodeException @@ -96,7 +94,7 @@ class FindViableNodesService ->leftJoin('servers', 'servers.node_id', '=', 'nodes.id') ->where('nodes.public', 1); - if (! empty($this->locations)) { + if (!empty($this->locations)) { $query = $query->whereIn('nodes.location_id', $this->locations); } @@ -104,7 +102,7 @@ class FindViableNodesService ->havingRaw('(IFNULL(SUM(servers.memory), 0) + ?) <= (nodes.memory * (1 + (nodes.memory_overallocate / 100)))', [$this->memory]) ->havingRaw('(IFNULL(SUM(servers.disk), 0) + ?) <= (nodes.disk * (1 + (nodes.disk_overallocate / 100)))', [$this->disk]); - if (! is_null($page)) { + if (!is_null($page)) { $results = $results->paginate(50, ['*'], 'page', $page); } else { $results = $results->get()->toBase(); diff --git a/app/Services/Eggs/EggConfigurationService.php b/app/Services/Eggs/EggConfigurationService.php index b863b5e0..3b3ca2d1 100644 --- a/app/Services/Eggs/EggConfigurationService.php +++ b/app/Services/Eggs/EggConfigurationService.php @@ -16,8 +16,6 @@ class EggConfigurationService /** * EggConfigurationService constructor. - * - * @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $configurationStructureService */ public function __construct(ServerConfigurationStructureService $configurationStructureService) { @@ -26,14 +24,12 @@ class EggConfigurationService /** * Return an Egg file to be used by the Daemon. - * - * @param \Pterodactyl\Models\Server $server - * @return array */ public function handle(Server $server): array { $configs = $this->replacePlaceholders( - $server, json_decode($server->egg->inherit_config_files) + $server, + json_decode($server->egg->inherit_config_files) ); return [ @@ -46,7 +42,6 @@ class EggConfigurationService /** * Convert the "done" variable into an array if it is not currently one. * - * @param array $startup * @return array */ protected function convertStartupToNewFormat(array $startup) @@ -66,13 +61,10 @@ class EggConfigurationService * For most eggs, this ends up just being a command sent to the server console, but * if the stop command is something starting with a caret (^), it will be converted * into the associated kill signal for the instance. - * - * @param string $stop - * @return array */ protected function convertStopToNewFormat(string $stop): array { - if (! Str::startsWith($stop, '^')) { + if (!Str::startsWith($stop, '^')) { return [ 'type' => 'command', 'value' => $stop, @@ -94,8 +86,6 @@ class EggConfigurationService } /** - * @param \Pterodactyl\Models\Server $server - * @param object $configs * @return array */ protected function replacePlaceholders(Server $server, object $configs) @@ -142,10 +132,6 @@ class EggConfigurationService * set SERVER_MEMORY, SERVER_IP, and SERVER_PORT with their respective values on the Daemon * side. Ensure that anything referencing those properly replaces them with the matching config * value. - * - * @param string $key - * @param string $value - * @return string */ protected function replaceLegacyModifiers(string $key, string $value): string { @@ -175,7 +161,7 @@ class EggConfigurationService /** * @param mixed $value - * @param array $structure + * * @return mixed|null */ protected function matchAndReplaceKeys($value, array $structure) @@ -187,13 +173,13 @@ class EggConfigurationService // value from the server properties. // // The Daemon supports server.X, env.X, and config.X placeholders. - if (! Str::startsWith($key, ['server.', 'env.', 'config.'])) { + if (!Str::startsWith($key, ['server.', 'env.', 'config.'])) { continue; } // Don't do a replacement on anything that is not a string, we don't want to unintentionally // modify the resulting output. - if (! is_string($value)) { + if (!is_string($value)) { continue; } @@ -218,7 +204,9 @@ class EggConfigurationService // Finally, replace anything starting with env. with the expected environment // variable from the server configuration. $plucked = Arr::get( - $structure, preg_replace('/^env\./', 'build.env.', $key), '' + $structure, + preg_replace('/^env\./', 'build.env.', $key), + '' ); $value = str_replace("{{{$key}}}", $plucked, $value); @@ -233,12 +221,12 @@ class EggConfigurationService * a match & replace. * * @param mixed $data - * @param array $structure + * * @return mixed */ private function iterate($data, array $structure) { - if (! is_iterable($data) && ! is_object($data)) { + if (!is_iterable($data) && !is_object($data)) { return $data; } diff --git a/app/Services/Eggs/EggCreationService.php b/app/Services/Eggs/EggCreationService.php index 33a0a919..d7b5bb42 100644 --- a/app/Services/Eggs/EggCreationService.php +++ b/app/Services/Eggs/EggCreationService.php @@ -30,9 +30,6 @@ class EggCreationService /** * EggCreationService constructor. - * - * @param \Illuminate\Contracts\Config\Repository $config - * @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository */ public function __construct(ConfigRepository $config, EggRepositoryInterface $repository) { @@ -43,16 +40,13 @@ class EggCreationService /** * Create a new service option and assign it to the given service. * - * @param array $data - * @return \Pterodactyl\Models\Egg - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Service\Egg\NoParentConfigurationFoundException */ public function handle(array $data): Egg { $data['config_from'] = array_get($data, 'config_from'); - if (! is_null($data['config_from'])) { + if (!is_null($data['config_from'])) { $results = $this->repository->findCountWhere([ ['nest_id', '=', array_get($data, 'nest_id')], ['id', '=', array_get($data, 'config_from')], diff --git a/app/Services/Eggs/EggDeletionService.php b/app/Services/Eggs/EggDeletionService.php index 7b30e442..1c8f8cf6 100644 --- a/app/Services/Eggs/EggDeletionService.php +++ b/app/Services/Eggs/EggDeletionService.php @@ -28,9 +28,6 @@ class EggDeletionService /** * EggDeletionService constructor. - * - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $serverRepository - * @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository */ public function __construct( ServerRepositoryInterface $serverRepository, @@ -43,9 +40,6 @@ class EggDeletionService /** * Delete an Egg from the database if it has no active servers attached to it. * - * @param int $egg - * @return int - * * @throws \Pterodactyl\Exceptions\Service\HasActiveServersException * @throws \Pterodactyl\Exceptions\Service\Egg\HasChildrenException */ diff --git a/app/Services/Eggs/EggUpdateService.php b/app/Services/Eggs/EggUpdateService.php index 697ed059..e0cabbb0 100644 --- a/app/Services/Eggs/EggUpdateService.php +++ b/app/Services/Eggs/EggUpdateService.php @@ -22,8 +22,6 @@ class EggUpdateService /** * EggUpdateService constructor. - * - * @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository */ public function __construct(EggRepositoryInterface $repository) { @@ -33,16 +31,13 @@ class EggUpdateService /** * Update a service option. * - * @param \Pterodactyl\Models\Egg $egg - * @param array $data - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Service\Egg\NoParentConfigurationFoundException */ public function handle(Egg $egg, array $data) { - if (! is_null(array_get($data, 'config_from'))) { + if (!is_null(array_get($data, 'config_from'))) { $results = $this->repository->findCountWhere([ ['nest_id', '=', $egg->nest_id], ['id', '=', array_get($data, 'config_from')], diff --git a/app/Services/Eggs/Scripts/InstallScriptService.php b/app/Services/Eggs/Scripts/InstallScriptService.php index 70621c32..ecd1dc1f 100644 --- a/app/Services/Eggs/Scripts/InstallScriptService.php +++ b/app/Services/Eggs/Scripts/InstallScriptService.php @@ -15,8 +15,6 @@ class InstallScriptService /** * InstallScriptService constructor. - * - * @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository */ public function __construct(EggRepositoryInterface $repository) { @@ -27,7 +25,6 @@ class InstallScriptService * Modify the install script for a given Egg. * * @param int|\Pterodactyl\Models\Egg $egg - * @param array $data * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -35,8 +32,8 @@ class InstallScriptService */ public function handle(Egg $egg, array $data) { - if (! is_null(array_get($data, 'copy_script_from'))) { - if (! $this->repository->isCopyableScript(array_get($data, 'copy_script_from'), $egg->nest_id)) { + if (!is_null(array_get($data, 'copy_script_from'))) { + if (!$this->repository->isCopyableScript(array_get($data, 'copy_script_from'), $egg->nest_id)) { throw new InvalidCopyFromException(trans('exceptions.nest.egg.invalid_copy_id')); } } diff --git a/app/Services/Eggs/Sharing/EggExporterService.php b/app/Services/Eggs/Sharing/EggExporterService.php index 7b0cb3a4..2cdbd985 100644 --- a/app/Services/Eggs/Sharing/EggExporterService.php +++ b/app/Services/Eggs/Sharing/EggExporterService.php @@ -14,8 +14,6 @@ class EggExporterService /** * EggExporterService constructor. - * - * @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository */ public function __construct(EggRepositoryInterface $repository) { @@ -25,9 +23,6 @@ class EggExporterService /** * Return a JSON representation of an egg and its variables. * - * @param int $egg - * @return string - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function handle(int $egg): string diff --git a/app/Services/Eggs/Sharing/EggImporterService.php b/app/Services/Eggs/Sharing/EggImporterService.php index 1200e5ac..b3ea33c9 100644 --- a/app/Services/Eggs/Sharing/EggImporterService.php +++ b/app/Services/Eggs/Sharing/EggImporterService.php @@ -36,11 +36,6 @@ class EggImporterService /** * EggImporterService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository - * @param \Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface $eggVariableRepository - * @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $nestRepository */ public function __construct( ConnectionInterface $connection, @@ -57,10 +52,6 @@ class EggImporterService /** * Take an uploaded JSON file and parse it into a new egg. * - * @param \Illuminate\Http\UploadedFile $file - * @param int $nest - * @return \Pterodactyl\Models\Egg - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Service\Egg\BadJsonFormatException @@ -68,24 +59,13 @@ class EggImporterService */ public function handle(UploadedFile $file, int $nest): Egg { - if ($file->getError() !== UPLOAD_ERR_OK || ! $file->isFile()) { - throw new InvalidFileUploadException( - sprintf( - 'The selected file ["%s"] was not in a valid format to import. (is_file: %s is_valid: %s err_code: %s err: %s)', - $file->getFilename(), - $file->isFile() ? 'true' : 'false', - $file->isValid() ? 'true' : 'false', - $file->getError(), - $file->getErrorMessage() - ) - ); + if ($file->getError() !== UPLOAD_ERR_OK || !$file->isFile()) { + throw new InvalidFileUploadException(sprintf('The selected file ["%s"] was not in a valid format to import. (is_file: %s is_valid: %s err_code: %s err: %s)', $file->getFilename(), $file->isFile() ? 'true' : 'false', $file->isValid() ? 'true' : 'false', $file->getError(), $file->getErrorMessage())); } $parsed = json_decode($file->openFile()->fread($file->getSize())); if (json_last_error() !== 0) { - throw new BadJsonFormatException(trans('exceptions.nest.importer.json_error', [ - 'error' => json_last_error_msg(), - ])); + throw new BadJsonFormatException(trans('exceptions.nest.importer.json_error', ['error' => json_last_error_msg()])); } if (object_get($parsed, 'meta.version') !== 'PTDL_v1') { diff --git a/app/Services/Eggs/Sharing/EggUpdateImporterService.php b/app/Services/Eggs/Sharing/EggUpdateImporterService.php index b4705d25..20531431 100644 --- a/app/Services/Eggs/Sharing/EggUpdateImporterService.php +++ b/app/Services/Eggs/Sharing/EggUpdateImporterService.php @@ -29,10 +29,6 @@ class EggUpdateImporterService /** * EggUpdateImporterService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository - * @param \Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface $variableRepository */ public function __construct( ConnectionInterface $connection, @@ -47,9 +43,6 @@ class EggUpdateImporterService /** * Update an existing Egg using an uploaded JSON file. * - * @param \Pterodactyl\Models\Egg $egg - * @param \Illuminate\Http\UploadedFile $file - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Service\Egg\BadJsonFormatException @@ -57,24 +50,13 @@ class EggUpdateImporterService */ public function handle(Egg $egg, UploadedFile $file) { - if ($file->getError() !== UPLOAD_ERR_OK || ! $file->isFile()) { - throw new InvalidFileUploadException( - sprintf( - 'The selected file ["%s"] was not in a valid format to import. (is_file: %s is_valid: %s err_code: %s err: %s)', - $file->getFilename(), - $file->isFile() ? 'true' : 'false', - $file->isValid() ? 'true' : 'false', - $file->getError(), - $file->getErrorMessage() - ) - ); + if ($file->getError() !== UPLOAD_ERR_OK || !$file->isFile()) { + throw new InvalidFileUploadException(sprintf('The selected file ["%s"] was not in a valid format to import. (is_file: %s is_valid: %s err_code: %s err: %s)', $file->getFilename(), $file->isFile() ? 'true' : 'false', $file->isValid() ? 'true' : 'false', $file->getError(), $file->getErrorMessage())); } $parsed = json_decode($file->openFile()->fread($file->getSize())); if (json_last_error() !== 0) { - throw new BadJsonFormatException(trans('exceptions.nest.importer.json_error', [ - 'error' => json_last_error_msg(), - ])); + throw new BadJsonFormatException(trans('exceptions.nest.importer.json_error', ['error' => json_last_error_msg()])); } if (object_get($parsed, 'meta.version') !== 'PTDL_v1') { @@ -113,7 +95,7 @@ class EggUpdateImporterService // Delete variables not present in the import. collect($existing)->each(function ($variable) use ($egg, $imported) { - if (! in_array($variable->env_variable, $imported)) { + if (!in_array($variable->env_variable, $imported)) { $this->variableRepository->deleteWhere([ ['egg_id', '=', $egg->id], ['env_variable', '=', $variable->env_variable], diff --git a/app/Services/Eggs/Variables/VariableCreationService.php b/app/Services/Eggs/Variables/VariableCreationService.php index ed7e72a4..fa758265 100644 --- a/app/Services/Eggs/Variables/VariableCreationService.php +++ b/app/Services/Eggs/Variables/VariableCreationService.php @@ -24,9 +24,6 @@ class VariableCreationService /** * VariableCreationService constructor. - * - * @param \Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface $repository - * @param \Illuminate\Contracts\Validation\Factory $validator */ public function __construct(EggVariableRepositoryInterface $repository, Factory $validator) { @@ -37,8 +34,6 @@ class VariableCreationService /** * Return the validation factory instance to be used by rule validation * checking in the trait. - * - * @return \Illuminate\Contracts\Validation\Factory */ protected function getValidator(): Factory { @@ -48,10 +43,6 @@ class VariableCreationService /** * Create a new variable for a given Egg. * - * @param int $egg - * @param array $data - * @return \Pterodactyl\Models\EggVariable - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Service\Egg\Variable\BadValidationRuleException * @throws \Pterodactyl\Exceptions\Service\Egg\Variable\ReservedVariableNameException @@ -59,13 +50,10 @@ class VariableCreationService public function handle(int $egg, array $data): EggVariable { if (in_array(strtoupper(array_get($data, 'env_variable')), explode(',', EggVariable::RESERVED_ENV_NAMES))) { - throw new ReservedVariableNameException(sprintf( - 'Cannot use the protected name %s for this environment variable.', - array_get($data, 'env_variable') - )); + throw new ReservedVariableNameException(sprintf('Cannot use the protected name %s for this environment variable.', array_get($data, 'env_variable'))); } - if (! empty($data['rules'] ?? '')) { + if (!empty($data['rules'] ?? '')) { $this->validateRules($data['rules']); } diff --git a/app/Services/Eggs/Variables/VariableUpdateService.php b/app/Services/Eggs/Variables/VariableUpdateService.php index da1a9e98..da4426c3 100644 --- a/app/Services/Eggs/Variables/VariableUpdateService.php +++ b/app/Services/Eggs/Variables/VariableUpdateService.php @@ -26,9 +26,6 @@ class VariableUpdateService /** * VariableUpdateService constructor. - * - * @param \Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface $repository - * @param \Illuminate\Contracts\Validation\Factory $validator */ public function __construct(EggVariableRepositoryInterface $repository, Factory $validator) { @@ -39,8 +36,6 @@ class VariableUpdateService /** * Return the validation factory instance to be used by rule validation * checking in the trait. - * - * @return \Illuminate\Contracts\Validation\Factory */ protected function getValidator(): Factory { @@ -50,8 +45,6 @@ class VariableUpdateService /** * Update a specific egg variable. * - * @param \Pterodactyl\Models\EggVariable $variable - * @param array $data * @return mixed * * @throws \Pterodactyl\Exceptions\DisplayException @@ -61,11 +54,9 @@ class VariableUpdateService */ public function handle(EggVariable $variable, array $data) { - if (! is_null(array_get($data, 'env_variable'))) { + if (!is_null(array_get($data, 'env_variable'))) { if (in_array(strtoupper(array_get($data, 'env_variable')), explode(',', EggVariable::RESERVED_ENV_NAMES))) { - throw new ReservedVariableNameException(trans('exceptions.service.variables.reserved_name', [ - 'name' => array_get($data, 'env_variable'), - ])); + throw new ReservedVariableNameException(trans('exceptions.service.variables.reserved_name', ['name' => array_get($data, 'env_variable')])); } $search = $this->repository->setColumns('id')->findCountWhere([ @@ -75,13 +66,11 @@ class VariableUpdateService ]); if ($search > 0) { - throw new DisplayException(trans('exceptions.service.variables.env_not_unique', [ - 'name' => array_get($data, 'env_variable'), - ])); + throw new DisplayException(trans('exceptions.service.variables.env_not_unique', ['name' => array_get($data, 'env_variable')])); } } - if (! empty($data['rules'] ?? '')) { + if (!empty($data['rules'] ?? '')) { $this->validateRules( (is_string($data['rules']) && Str::contains($data['rules'], ';;')) ? explode(';;', $data['rules']) diff --git a/app/Services/Helpers/AssetHashService.php b/app/Services/Helpers/AssetHashService.php index 25aa3318..4b1bf7e0 100644 --- a/app/Services/Helpers/AssetHashService.php +++ b/app/Services/Helpers/AssetHashService.php @@ -30,9 +30,6 @@ class AssetHashService /** * AssetHashService constructor. - * - * @param \Illuminate\Contracts\Foundation\Application $application - * @param \Illuminate\Filesystem\FilesystemManager $filesystem */ public function __construct(Application $application, FilesystemManager $filesystem) { @@ -43,9 +40,6 @@ class AssetHashService /** * Modify a URL to append the asset hash. * - * @param string $resource - * @return string - * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ public function url(string $resource): string @@ -59,9 +53,6 @@ class AssetHashService /** * Return the data integrity hash for a resource. * - * @param string $resource - * @return string - * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ public function integrity(string $resource): string @@ -75,9 +66,6 @@ class AssetHashService /** * Return a built CSS import using the provided URL. * - * @param string $resource - * @return string - * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ public function css(string $resource): string @@ -105,9 +93,6 @@ class AssetHashService /** * Return a built JS import using the provided URL. * - * @param string $resource - * @return string - * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ public function js(string $resource): string @@ -132,14 +117,13 @@ class AssetHashService /** * Get the asset manifest and store it in the cache for quicker lookups. * - * @return array - * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ protected function manifest(): array { return self::$manifest ?: self::$manifest = json_decode( - $this->filesystem->get(self::MANIFEST_PATH), true + $this->filesystem->get(self::MANIFEST_PATH), + true ); } } diff --git a/app/Services/Helpers/SoftwareVersionService.php b/app/Services/Helpers/SoftwareVersionService.php index 893c097d..14a2b437 100644 --- a/app/Services/Helpers/SoftwareVersionService.php +++ b/app/Services/Helpers/SoftwareVersionService.php @@ -11,7 +11,7 @@ use Pterodactyl\Exceptions\Service\Helper\CdnVersionFetchingException; class SoftwareVersionService { - const VERSION_CACHE_KEY = 'pterodactyl:versioning_data'; + public const VERSION_CACHE_KEY = 'pterodactyl:versioning_data'; /** * @var array @@ -30,9 +30,6 @@ class SoftwareVersionService /** * SoftwareVersionService constructor. - * - * @param \Illuminate\Contracts\Cache\Repository $cache - * @param \GuzzleHttp\Client $client */ public function __construct( CacheRepository $cache, @@ -102,6 +99,7 @@ class SoftwareVersionService * Determine if a passed daemon version string is the latest. * * @param string $version + * * @return bool */ public function isLatestDaemon($version) @@ -128,7 +126,7 @@ class SoftwareVersionService return json_decode($response->getBody(), true); } - throw new CdnVersionFetchingException; + throw new CdnVersionFetchingException(); } catch (Exception $exception) { return []; } diff --git a/app/Services/Locations/LocationCreationService.php b/app/Services/Locations/LocationCreationService.php index cd2a9757..cff493a8 100644 --- a/app/Services/Locations/LocationCreationService.php +++ b/app/Services/Locations/LocationCreationService.php @@ -20,8 +20,6 @@ class LocationCreationService /** * LocationCreationService constructor. - * - * @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $repository */ public function __construct(LocationRepositoryInterface $repository) { @@ -31,7 +29,6 @@ class LocationCreationService /** * Create a new location. * - * @param array $data * @return \Pterodactyl\Models\Location * * @throws \Pterodactyl\Exceptions\Model\DataValidationException diff --git a/app/Services/Locations/LocationDeletionService.php b/app/Services/Locations/LocationDeletionService.php index 5fc528ea..2ffd3818 100644 --- a/app/Services/Locations/LocationDeletionService.php +++ b/app/Services/Locations/LocationDeletionService.php @@ -29,9 +29,6 @@ class LocationDeletionService /** * LocationDeletionService constructor. - * - * @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $repository - * @param \Pterodactyl\Contracts\Repository\NodeRepositoryInterface $nodeRepository */ public function __construct( LocationRepositoryInterface $repository, @@ -45,6 +42,7 @@ class LocationDeletionService * Delete an existing location. * * @param int|\Pterodactyl\Models\Location $location + * * @return int|null * * @throws \Pterodactyl\Exceptions\Service\Location\HasActiveNodesException diff --git a/app/Services/Locations/LocationUpdateService.php b/app/Services/Locations/LocationUpdateService.php index dfb5bcc5..87399201 100644 --- a/app/Services/Locations/LocationUpdateService.php +++ b/app/Services/Locations/LocationUpdateService.php @@ -21,8 +21,6 @@ class LocationUpdateService /** * LocationUpdateService constructor. - * - * @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $repository */ public function __construct(LocationRepositoryInterface $repository) { @@ -33,7 +31,7 @@ class LocationUpdateService * Update an existing location. * * @param int|\Pterodactyl\Models\Location $location - * @param array $data + * * @return \Pterodactyl\Models\Location * * @throws \Pterodactyl\Exceptions\Model\DataValidationException diff --git a/app/Services/Nests/NestCreationService.php b/app/Services/Nests/NestCreationService.php index 5cac1c11..af56496d 100644 --- a/app/Services/Nests/NestCreationService.php +++ b/app/Services/Nests/NestCreationService.php @@ -21,9 +21,6 @@ class NestCreationService /** * NestCreationService constructor. - * - * @param \Illuminate\Contracts\Config\Repository $config - * @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $repository */ public function __construct(ConfigRepository $config, NestRepositoryInterface $repository) { @@ -34,9 +31,6 @@ class NestCreationService /** * Create a new nest on the system. * - * @param array $data - * @param string|null $author - * @return \Pterodactyl\Models\Nest * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ public function handle(array $data, string $author = null): Nest diff --git a/app/Services/Nests/NestDeletionService.php b/app/Services/Nests/NestDeletionService.php index 990bbc59..777a41b6 100644 --- a/app/Services/Nests/NestDeletionService.php +++ b/app/Services/Nests/NestDeletionService.php @@ -27,9 +27,6 @@ class NestDeletionService /** * NestDeletionService constructor. - * - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $serverRepository - * @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $repository */ public function __construct( ServerRepositoryInterface $serverRepository, @@ -42,9 +39,6 @@ class NestDeletionService /** * Delete a nest from the system only if there are no servers attached to it. * - * @param int $nest - * @return int - * * @throws \Pterodactyl\Exceptions\Service\HasActiveServersException */ public function handle(int $nest): int diff --git a/app/Services/Nests/NestUpdateService.php b/app/Services/Nests/NestUpdateService.php index de04e7e2..7772ff38 100644 --- a/app/Services/Nests/NestUpdateService.php +++ b/app/Services/Nests/NestUpdateService.php @@ -20,8 +20,6 @@ class NestUpdateService /** * NestUpdateService constructor. - * - * @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $repository */ public function __construct(NestRepositoryInterface $repository) { @@ -31,14 +29,12 @@ class NestUpdateService /** * Update a nest and prevent changing the author once it is set. * - * @param int $nest - * @param array $data * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function handle(int $nest, array $data) { - if (! is_null(array_get($data, 'author'))) { + if (!is_null(array_get($data, 'author'))) { unset($data['author']); } diff --git a/app/Services/Nodes/NodeCreationService.php b/app/Services/Nodes/NodeCreationService.php index a44c036b..e8ea5b0d 100644 --- a/app/Services/Nodes/NodeCreationService.php +++ b/app/Services/Nodes/NodeCreationService.php @@ -22,9 +22,6 @@ class NodeCreationService /** * CreationService constructor. - * - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter - * @param \Pterodactyl\Contracts\Repository\NodeRepositoryInterface $repository */ public function __construct(Encrypter $encrypter, NodeRepositoryInterface $repository) { @@ -35,7 +32,6 @@ class NodeCreationService /** * Create a new node on the panel. * - * @param array $data * @return \Pterodactyl\Models\Node * * @throws \Pterodactyl\Exceptions\Model\DataValidationException diff --git a/app/Services/Nodes/NodeDeletionService.php b/app/Services/Nodes/NodeDeletionService.php index 75118fa3..30483a82 100644 --- a/app/Services/Nodes/NodeDeletionService.php +++ b/app/Services/Nodes/NodeDeletionService.php @@ -34,10 +34,6 @@ class NodeDeletionService /** * DeletionService constructor. - * - * @param \Pterodactyl\Contracts\Repository\NodeRepositoryInterface $repository - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $serverRepository - * @param \Illuminate\Contracts\Translation\Translator $translator */ public function __construct( NodeRepositoryInterface $repository, @@ -53,6 +49,7 @@ class NodeDeletionService * Delete a node from the panel if no servers are attached to it. * * @param int|\Pterodactyl\Models\Node $node + * * @return bool|null * * @throws \Pterodactyl\Exceptions\Service\HasActiveServersException diff --git a/app/Services/Nodes/NodeJWTService.php b/app/Services/Nodes/NodeJWTService.php index 035b6172..1b52479b 100644 --- a/app/Services/Nodes/NodeJWTService.php +++ b/app/Services/Nodes/NodeJWTService.php @@ -31,7 +31,6 @@ class NodeJWTService /** * Set the claims to include in this JWT. * - * @param array $claims * @return $this */ public function setClaims(array $claims) @@ -42,7 +41,6 @@ class NodeJWTService } /** - * @param \DateTimeImmutable $date * @return $this */ public function setExpiresAt(DateTimeImmutable $date) @@ -53,7 +51,6 @@ class NodeJWTService } /** - * @param string $subject * @return $this */ public function setSubject(string $subject) @@ -66,17 +63,16 @@ class NodeJWTService /** * Generate a new JWT for a given node. * - * @param \Pterodactyl\Models\Node $node * @param string|null $identifiedBy - * @param string $algo + * * @return \Lcobucci\JWT\Token\Plain */ public function handle(Node $node, string $identifiedBy, string $algo = 'md5') { $identifier = hash($algo, $identifiedBy); - $config = Configuration::forSymmetricSigner(new Sha256, InMemory::plainText($node->getDecryptedKey())); + $config = Configuration::forSymmetricSigner(new Sha256(), InMemory::plainText($node->getDecryptedKey())); - $builder = $config->builder(new TimestampDates) + $builder = $config->builder(new TimestampDates()) ->issuedBy(config('app.url')) ->permittedFor($node->getConnectionAddress()) ->identifiedBy($identifier) @@ -88,7 +84,7 @@ class NodeJWTService $builder = $builder->expiresAt($this->expiresAt); } - if (! empty($this->subject)) { + if (!empty($this->subject)) { $builder = $builder->relatedTo($this->subject)->withHeader('sub', $this->subject); } diff --git a/app/Services/Nodes/NodeUpdateService.php b/app/Services/Nodes/NodeUpdateService.php index 2a71924f..9ba56fb4 100644 --- a/app/Services/Nodes/NodeUpdateService.php +++ b/app/Services/Nodes/NodeUpdateService.php @@ -36,11 +36,6 @@ class NodeUpdateService /** * UpdateService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter - * @param \Pterodactyl\Repositories\Wings\DaemonConfigurationRepository $configurationRepository - * @param \Pterodactyl\Repositories\Eloquent\NodeRepository $repository */ public function __construct( ConnectionInterface $connection, @@ -57,11 +52,8 @@ class NodeUpdateService /** * Update the configuration values for a given node on the machine. * - * @param \Pterodactyl\Models\Node $node - * @param array $data - * @param bool $resetToken - * * @return \Pterodactyl\Models\Node + * * @throws \Throwable */ public function handle(Node $node, array $data, bool $resetToken = false) diff --git a/app/Services/Schedules/ProcessScheduleService.php b/app/Services/Schedules/ProcessScheduleService.php index 86775430..23c9ea5e 100644 --- a/app/Services/Schedules/ProcessScheduleService.php +++ b/app/Services/Schedules/ProcessScheduleService.php @@ -23,9 +23,6 @@ class ProcessScheduleService /** * ProcessScheduleService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Illuminate\Contracts\Bus\Dispatcher $dispatcher */ public function __construct(ConnectionInterface $connection, Dispatcher $dispatcher) { @@ -36,9 +33,6 @@ class ProcessScheduleService /** * Process a schedule and push the first task onto the queue worker. * - * @param \Pterodactyl\Models\Schedule $schedule - * @param bool $now - * * @throws \Throwable */ public function handle(Schedule $schedule, bool $now = false) @@ -47,9 +41,7 @@ class ProcessScheduleService $task = $schedule->tasks()->orderBy('sequence_id', 'asc')->first(); if (is_null($task)) { - throw new DisplayException( - 'Cannot process schedule for task execution: no tasks are registered.' - ); + throw new DisplayException('Cannot process schedule for task execution: no tasks are registered.'); } $this->connection->transaction(function () use ($schedule, $task) { @@ -63,7 +55,7 @@ class ProcessScheduleService $job = new RunTaskJob($task); - if (! $now) { + if (!$now) { $this->dispatcher->dispatch($job->delay($task->time_offset)); } else { // When using dispatchNow the RunTaskJob::failed() function is not called automatically diff --git a/app/Services/Servers/BuildModificationService.php b/app/Services/Servers/BuildModificationService.php index 69bcef26..6a96075c 100644 --- a/app/Services/Servers/BuildModificationService.php +++ b/app/Services/Servers/BuildModificationService.php @@ -31,8 +31,6 @@ class BuildModificationService * BuildModificationService constructor. * * @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $structureService - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonServerRepository */ public function __construct( ServerConfigurationStructureService $structureService, @@ -47,8 +45,6 @@ class BuildModificationService /** * Change the build details for a specified server. * - * @param \Pterodactyl\Models\Server $server - * @param array $data * @return \Pterodactyl\Models\Server * * @throws \Throwable @@ -82,7 +78,7 @@ class BuildModificationService $updateData = $this->structureService->handle($server); - if (! empty($updateData['build'])) { + if (!empty($updateData['build'])) { $this->daemonServerRepository->setServer($server)->update([ 'build' => $updateData['build'], ]); @@ -96,9 +92,6 @@ class BuildModificationService /** * Process the allocations being assigned in the data and ensure they are available for a server. * - * @param \Pterodactyl\Models\Server $server - * @param array $data - * * @throws \Pterodactyl\Exceptions\DisplayException */ private function processAllocations(Server $server, array &$data) @@ -109,7 +102,7 @@ class BuildModificationService // Handle the addition of allocations to this server. Only assign allocations that are not currently // assigned to a different server, and only allocations on the same node as the server. - if (! empty($data['add_allocations'])) { + if (!empty($data['add_allocations'])) { $query = Allocation::query() ->where('node_id', $server->node_id) ->whereIn('id', $data['add_allocations']) @@ -122,16 +115,14 @@ class BuildModificationService $query->update(['server_id' => $server->id, 'notes' => null]); } - if (! empty($data['remove_allocations'])) { + if (!empty($data['remove_allocations'])) { foreach ($data['remove_allocations'] as $allocation) { // If we are attempting to remove the default allocation for the server, see if we can reassign // to the first provided value in add_allocations. If there is no new first allocation then we // will throw an exception back. if ($allocation === ($data['allocation_id'] ?? $server->allocation_id)) { if (empty($freshlyAllocated)) { - throw new DisplayException( - 'You are attempting to delete the default allocation for this server but there is no fallback allocation to use.' - ); + throw new DisplayException('You are attempting to delete the default allocation for this server but there is no fallback allocation to use.'); } // Update the default allocation to be the first allocation that we are creating. diff --git a/app/Services/Servers/DetailsModificationService.php b/app/Services/Servers/DetailsModificationService.php index aa480a06..cbe2a6ed 100644 --- a/app/Services/Servers/DetailsModificationService.php +++ b/app/Services/Servers/DetailsModificationService.php @@ -25,9 +25,6 @@ class DetailsModificationService /** * DetailsModificationService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $serverRepository */ public function __construct(ConnectionInterface $connection, DaemonServerRepository $serverRepository) { @@ -38,10 +35,6 @@ class DetailsModificationService /** * Update the details for a single server instance. * - * @param \Pterodactyl\Models\Server $server - * @param array $data - * @return \Pterodactyl\Models\Server - * * @throws \Throwable */ public function handle(Server $server, array $data): Server diff --git a/app/Services/Servers/EnvironmentService.php b/app/Services/Servers/EnvironmentService.php index 6f7b590f..54b82bab 100644 --- a/app/Services/Servers/EnvironmentService.php +++ b/app/Services/Servers/EnvironmentService.php @@ -15,9 +15,6 @@ class EnvironmentService /** * Dynamically configure additional environment variables to be assigned * with a specific server. - * - * @param string $key - * @param callable $closure */ public function setEnvironmentKey(string $key, callable $closure) { @@ -26,8 +23,6 @@ class EnvironmentService /** * Return the dynamically added additional keys. - * - * @return array */ public function getEnvironmentKeys(): array { @@ -37,9 +32,6 @@ class EnvironmentService /** * Take all of the environment variables configured for this server and return * them in an easy to process format. - * - * @param \Pterodactyl\Models\Server $server - * @return array */ public function handle(Server $server): array { @@ -57,7 +49,8 @@ class EnvironmentService // Process variables set in the configuration file. foreach (config('pterodactyl.environment_variables', []) as $key => $object) { $variables->put( - $key, is_callable($object) ? call_user_func($object, $server) : object_get($server, $object) + $key, + is_callable($object) ? call_user_func($object, $server) : object_get($server, $object) ); } @@ -71,8 +64,6 @@ class EnvironmentService /** * Return a mapping of Panel default environment variables. - * - * @return array */ private function getEnvironmentMappings(): array { diff --git a/app/Services/Servers/GetUserPermissionsService.php b/app/Services/Servers/GetUserPermissionsService.php index 80ce35b5..fdac03bf 100644 --- a/app/Services/Servers/GetUserPermissionsService.php +++ b/app/Services/Servers/GetUserPermissionsService.php @@ -12,8 +12,6 @@ class GetUserPermissionsService * if they are an admin or a subuser for the server. If no permissions are * found, an empty array is returned. * - * @param \Pterodactyl\Models\Server $server - * @param \Pterodactyl\Models\User $user * @return string[] */ public function handle(Server $server, User $user) diff --git a/app/Services/Servers/ReinstallServerService.php b/app/Services/Servers/ReinstallServerService.php index 8a648ac8..cfb88045 100644 --- a/app/Services/Servers/ReinstallServerService.php +++ b/app/Services/Servers/ReinstallServerService.php @@ -20,9 +20,6 @@ class ReinstallServerService /** * ReinstallService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonServerRepository */ public function __construct( ConnectionInterface $connection, @@ -35,7 +32,6 @@ class ReinstallServerService /** * Reinstall a server on the remote daemon. * - * @param \Pterodactyl\Models\Server $server * @return \Pterodactyl\Models\Server * * @throws \Throwable diff --git a/app/Services/Servers/ServerConfigurationStructureService.php b/app/Services/Servers/ServerConfigurationStructureService.php index c726796e..0972a418 100644 --- a/app/Services/Servers/ServerConfigurationStructureService.php +++ b/app/Services/Servers/ServerConfigurationStructureService.php @@ -28,17 +28,14 @@ class ServerConfigurationStructureService * DO NOT MODIFY THIS FUNCTION. This powers legacy code handling for the new Wings * daemon, if you modify the structure eggs will break unexpectedly. * - * @param \Pterodactyl\Models\Server $server - * @param array $override * @param bool $legacy deprecated - * @return array */ public function handle(Server $server, array $override = [], bool $legacy = false): array { $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); @@ -53,7 +50,6 @@ class ServerConfigurationStructureService /** * Returns the new data format used for the Wings daemon. * - * @param \Pterodactyl\Models\Server $server * @return array */ protected function returnCurrentFormat(Server $server) @@ -106,8 +102,8 @@ class ServerConfigurationStructureService * Returns the legacy server data format to continue support for old egg configurations * that have not yet been updated. * - * @param \Pterodactyl\Models\Server $server * @return array + * * @deprecated */ protected function returnLegacyFormat(Server $server) diff --git a/app/Services/Servers/ServerCreationService.php b/app/Services/Servers/ServerCreationService.php index 76d371ab..d7d53363 100644 --- a/app/Services/Servers/ServerCreationService.php +++ b/app/Services/Servers/ServerCreationService.php @@ -75,16 +75,9 @@ class ServerCreationService /** * CreationService constructor. * - * @param \Pterodactyl\Services\Deployment\AllocationSelectionService $allocationSelectionService - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonServerRepository - * @param \Pterodactyl\Repositories\Eloquent\EggRepository $eggRepository - * @param \Pterodactyl\Services\Deployment\FindViableNodesService $findViableNodesService * @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $configurationStructureService - * @param \Pterodactyl\Services\Servers\ServerDeletionService $serverDeletionService - * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository - * @param \Pterodactyl\Repositories\Eloquent\ServerVariableRepository $serverVariableRepository - * @param \Pterodactyl\Services\Servers\VariableValidatorService $validatorService + * @param \Pterodactyl\Services\Servers\ServerDeletionService $serverDeletionService + * @param \Pterodactyl\Services\Servers\VariableValidatorService $validatorService */ public function __construct( AllocationSelectionService $allocationSelectionService, @@ -116,10 +109,6 @@ class ServerCreationService * as possible given the input data. For example, if an allocation_id is passed with * no node_id the node_is will be picked from the allocation. * - * @param array $data - * @param \Pterodactyl\Models\Objects\DeploymentObject|null $deployment - * @return \Pterodactyl\Models\Server - * * @throws \Throwable * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Illuminate\Validation\ValidationException @@ -187,10 +176,6 @@ class ServerCreationService /** * Gets an allocation to use for automatic deployment. * - * @param array $data - * @param \Pterodactyl\Models\Objects\DeploymentObject $deployment - * - * @return \Pterodactyl\Models\Allocation * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableAllocationException * @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableNodeException @@ -212,9 +197,6 @@ class ServerCreationService /** * Store the server in the database and return the model. * - * @param array $data - * @return \Pterodactyl\Models\Server - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ private function createModel(array $data): Server @@ -254,9 +236,6 @@ class ServerCreationService /** * Configure the allocations assigned to this server. - * - * @param \Pterodactyl\Models\Server $server - * @param array $data */ private function storeAssignedAllocations(Server $server, array $data) { @@ -272,9 +251,6 @@ class ServerCreationService /** * Process environment variables passed for this server and store them in the database. - * - * @param \Pterodactyl\Models\Server $server - * @param \Illuminate\Support\Collection $variables */ private function storeEggVariables(Server $server, Collection $variables) { @@ -286,21 +262,19 @@ class ServerCreationService ]; })->toArray(); - if (! empty($records)) { + if (!empty($records)) { $this->serverVariableRepository->insert($records); } } /** * Create a unique UUID and UUID-Short combo for a server. - * - * @return string */ private function generateUniqueUuidCombo(): string { $uuid = Uuid::uuid4()->toString(); - if (! $this->repository->isUniqueUuidCombo($uuid, substr($uuid, 0, 8))) { + if (!$this->repository->isUniqueUuidCombo($uuid, substr($uuid, 0, 8))) { return $this->generateUniqueUuidCombo(); } diff --git a/app/Services/Servers/ServerDeletionService.php b/app/Services/Servers/ServerDeletionService.php index a4841652..cc973ff8 100644 --- a/app/Services/Servers/ServerDeletionService.php +++ b/app/Services/Servers/ServerDeletionService.php @@ -35,10 +35,6 @@ class ServerDeletionService /** * DeletionService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonServerRepository - * @param \Pterodactyl\Services\Databases\DatabaseManagementService $databaseManagementService */ public function __construct( ConnectionInterface $connection, @@ -54,6 +50,7 @@ class ServerDeletionService * Set if the server should be forcibly deleted from the panel (ignoring daemon errors) or not. * * @param bool $bool + * * @return $this */ public function withForce($bool = true) @@ -66,8 +63,6 @@ class ServerDeletionService /** * Delete a server from the panel and remove any associated databases from hosts. * - * @param \Pterodactyl\Models\Server $server - * * @throws \Throwable * @throws \Pterodactyl\Exceptions\DisplayException */ @@ -80,7 +75,7 @@ class ServerDeletionService // go ahead and bail out. We specifically ignore a 404 since that can be assumed // to be a safe error, meaning the server doesn't exist at all on Wings so there // is no reason we need to bail out from that. - if (! $this->force && $exception->getStatusCode() !== Response::HTTP_NOT_FOUND) { + if (!$this->force && $exception->getStatusCode() !== Response::HTTP_NOT_FOUND) { throw $exception; } @@ -92,7 +87,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 1cb4e229..efdbbc5c 100644 --- a/app/Services/Servers/StartupCommandService.php +++ b/app/Services/Servers/StartupCommandService.php @@ -8,10 +8,6 @@ class StartupCommandService { /** * Generates a startup command for a given server instance. - * - * @param \Pterodactyl\Models\Server $server - * @param bool $hideAllValues - * @return string */ public function handle(Server $server, bool $hideAllValues = false): string { @@ -20,7 +16,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 aaad5c45..66645e4f 100644 --- a/app/Services/Servers/StartupModificationService.php +++ b/app/Services/Servers/StartupModificationService.php @@ -27,7 +27,6 @@ class StartupModificationService /** * StartupModificationService constructor. * - * @param \Illuminate\Database\ConnectionInterface $connection * @param \Pterodactyl\Services\Servers\VariableValidatorService $validatorService */ public function __construct(ConnectionInterface $connection, VariableValidatorService $validatorService) @@ -39,16 +38,12 @@ class StartupModificationService /** * Process startup modification for a server. * - * @param \Pterodactyl\Models\Server $server - * @param array $data - * @return \Pterodactyl\Models\Server - * * @throws \Throwable */ public function handle(Server $server, array $data): Server { return $this->connection->transaction(function () use ($server, $data) { - if (! empty($data['environment'])) { + if (!empty($data['environment'])) { $egg = $this->isUserLevel(User::USER_LEVEL_ADMIN) ? ($data['egg_id'] ?? $server->egg_id) : $server->egg_id; $results = $this->validatorService @@ -83,9 +78,6 @@ class StartupModificationService /** * Update certain administrative settings for a server in the DB. - * - * @param array $data - * @param \Pterodactyl\Models\Server $server */ protected function updateAdministrativeSettings(array $data, Server &$server) { diff --git a/app/Services/Servers/SuspensionService.php b/app/Services/Servers/SuspensionService.php index 7abd978a..f58fa098 100644 --- a/app/Services/Servers/SuspensionService.php +++ b/app/Services/Servers/SuspensionService.php @@ -10,8 +10,8 @@ use Pterodactyl\Exceptions\Http\Server\ServerTransferringException; class SuspensionService { - const ACTION_SUSPEND = 'suspend'; - const ACTION_UNSUSPEND = 'unsuspend'; + public const ACTION_SUSPEND = 'suspend'; + public const ACTION_UNSUSPEND = 'unsuspend'; /** * @var \Illuminate\Database\ConnectionInterface @@ -25,9 +25,6 @@ class SuspensionService /** * SuspensionService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonServerRepository */ public function __construct( ConnectionInterface $connection, @@ -40,7 +37,6 @@ class SuspensionService /** * Suspends a server on the system. * - * @param \Pterodactyl\Models\Server $server * @param string $action * * @throws \Throwable @@ -58,8 +54,8 @@ class SuspensionService } // Check if the server is currently being transferred. - if (! is_null($server->transfer)) { - throw new ServerTransferringException; + if (!is_null($server->transfer)) { + throw new ServerTransferringException(); } $this->connection->transaction(function () use ($action, $server) { diff --git a/app/Services/Servers/TransferService.php b/app/Services/Servers/TransferService.php index b45a78dc..35aed065 100644 --- a/app/Services/Servers/TransferService.php +++ b/app/Services/Servers/TransferService.php @@ -20,9 +20,6 @@ class TransferService /** * TransferService constructor. - * - * @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonServerRepository - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository */ public function __construct( DaemonServerRepository $daemonServerRepository, diff --git a/app/Services/Servers/VariableValidatorService.php b/app/Services/Servers/VariableValidatorService.php index 95dee555..2ac3879a 100644 --- a/app/Services/Servers/VariableValidatorService.php +++ b/app/Services/Servers/VariableValidatorService.php @@ -27,8 +27,6 @@ class VariableValidatorService /** * VariableValidatorService constructor. - * - * @param \Illuminate\Contracts\Validation\Factory $validator */ public function __construct(ValidationFactory $validator) { @@ -38,15 +36,12 @@ class VariableValidatorService /** * Validate all of the passed data against the given service option variables. * - * @param int $egg - * @param array $fields - * @return \Illuminate\Support\Collection * @throws \Illuminate\Validation\ValidationException */ public function handle(int $egg, array $fields = []): Collection { $query = EggVariable::query()->where('egg_id', $egg); - if (! $this->isUserLevel(User::USER_LEVEL_ADMIN)) { + if (!$this->isUserLevel(User::USER_LEVEL_ADMIN)) { // Don't attempt to validate variables if they aren't user editable // and we're not running this at an admin level. $query = $query->where('user_editable', true)->where('user_viewable', true); diff --git a/app/Services/Subusers/SubuserCreationService.php b/app/Services/Subusers/SubuserCreationService.php index 5efc700f..b1affd3f 100644 --- a/app/Services/Subusers/SubuserCreationService.php +++ b/app/Services/Subusers/SubuserCreationService.php @@ -37,11 +37,6 @@ class SubuserCreationService /** * SubuserCreationService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Pterodactyl\Repositories\Eloquent\SubuserRepository $subuserRepository - * @param \Pterodactyl\Services\Users\UserCreationService $userCreationService - * @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $userRepository */ public function __construct( ConnectionInterface $connection, @@ -60,11 +55,6 @@ class SubuserCreationService * If the email address already belongs to a user on the system a new user will not * be created. * - * @param \Pterodactyl\Models\Server $server - * @param string $email - * @param array $permissions - * @return \Pterodactyl\Models\Subuser - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Service\Subuser\ServerSubuserExistsException * @throws \Pterodactyl\Exceptions\Service\Subuser\UserIsServerOwnerException diff --git a/app/Services/Users/ToggleTwoFactorService.php b/app/Services/Users/ToggleTwoFactorService.php index f8b41b45..908fc35d 100644 --- a/app/Services/Users/ToggleTwoFactorService.php +++ b/app/Services/Users/ToggleTwoFactorService.php @@ -41,12 +41,6 @@ class ToggleTwoFactorService /** * ToggleTwoFactorService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter - * @param \PragmaRX\Google2FA\Google2FA $google2FA - * @param \Pterodactyl\Repositories\Eloquent\RecoveryTokenRepository $recoveryTokenRepository - * @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository */ public function __construct( ConnectionInterface $connection, @@ -65,9 +59,6 @@ class ToggleTwoFactorService /** * Toggle 2FA on an account only if the token provided is valid. * - * @param \Pterodactyl\Models\User $user - * @param string $token - * @param bool|null $toggleState * @return string[] * * @throws \Throwable @@ -82,7 +73,7 @@ class ToggleTwoFactorService $isValidToken = $this->google2FA->verifyKey($secret, $token, config()->get('pterodactyl.auth.2fa.window')); - if (! $isValidToken) { + if (!$isValidToken) { throw new TwoFactorAuthenticationTokenInvalid('The token provided is not valid.'); } @@ -95,9 +86,9 @@ class ToggleTwoFactorService // which will then be marked as deleted from the database and will also bypass 2FA protections // on their account. $tokens = []; - if ((! $toggleState && ! $user->use_totp) || $toggleState) { + if ((!$toggleState && !$user->use_totp) || $toggleState) { $inserts = []; - for ($i = 0; $i < 10; $i++) { + for ($i = 0; $i < 10; ++$i) { $token = Str::random(10); $inserts[] = [ @@ -118,7 +109,7 @@ class ToggleTwoFactorService $this->repository->withoutFreshModel()->update($user->id, [ 'totp_authenticated_at' => Carbon::now(), - 'use_totp' => (is_null($toggleState) ? ! $user->use_totp : $toggleState), + 'use_totp' => (is_null($toggleState) ? !$user->use_totp : $toggleState), ]); return $tokens; diff --git a/app/Services/Users/TwoFactorSetupService.php b/app/Services/Users/TwoFactorSetupService.php index 5dcb7879..e3649634 100644 --- a/app/Services/Users/TwoFactorSetupService.php +++ b/app/Services/Users/TwoFactorSetupService.php @@ -11,7 +11,7 @@ use Illuminate\Contracts\Config\Repository as ConfigRepository; class TwoFactorSetupService { - const VALID_BASE32_CHARACTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'; + public const VALID_BASE32_CHARACTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'; /** * @var \Illuminate\Contracts\Config\Repository @@ -30,10 +30,6 @@ class TwoFactorSetupService /** * TwoFactorSetupService constructor. - * - * @param \Illuminate\Contracts\Config\Repository $config - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter - * @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository */ public function __construct( ConfigRepository $config, @@ -50,9 +46,6 @@ class TwoFactorSetupService * QR code URL. This URL will need to be attached to a QR generating service in * order to function. * - * @param \Pterodactyl\Models\User $user - * @return string - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ @@ -60,7 +53,7 @@ class TwoFactorSetupService { $secret = ''; try { - for ($i = 0; $i < $this->config->get('pterodactyl.auth.2fa.bytes', 16); $i++) { + for ($i = 0; $i < $this->config->get('pterodactyl.auth.2fa.bytes', 16); ++$i) { $secret .= substr(self::VALID_BASE32_CHARACTERS, random_int(0, 31), 1); } } catch (Exception $exception) { diff --git a/app/Services/Users/UserCreationService.php b/app/Services/Users/UserCreationService.php index 5bc56dd4..2d0abcb9 100644 --- a/app/Services/Users/UserCreationService.php +++ b/app/Services/Users/UserCreationService.php @@ -33,11 +33,6 @@ class UserCreationService /** * CreationService constructor. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Illuminate\Contracts\Hashing\Hasher $hasher - * @param \Illuminate\Contracts\Auth\PasswordBroker $passwordBroker - * @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository */ public function __construct( ConnectionInterface $connection, @@ -54,7 +49,6 @@ class UserCreationService /** * Create a new user on the system. * - * @param array $data * @return \Pterodactyl\Models\User * * @throws \Exception @@ -62,12 +56,12 @@ class UserCreationService */ public function handle(array $data) { - if (array_key_exists('password', $data) && ! empty($data['password'])) { + if (array_key_exists('password', $data) && !empty($data['password'])) { $data['password'] = $this->hasher->make($data['password']); } $this->connection->beginTransaction(); - if (! isset($data['password']) || empty($data['password'])) { + if (!isset($data['password']) || empty($data['password'])) { $generateResetToken = true; $data['password'] = $this->hasher->make(str_random(30)); } diff --git a/app/Services/Users/UserDeletionService.php b/app/Services/Users/UserDeletionService.php index fd519682..87459773 100644 --- a/app/Services/Users/UserDeletionService.php +++ b/app/Services/Users/UserDeletionService.php @@ -34,10 +34,6 @@ class UserDeletionService /** * DeletionService constructor. - * - * @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $serverRepository - * @param \Illuminate\Contracts\Translation\Translator $translator - * @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository */ public function __construct( ServerRepositoryInterface $serverRepository, @@ -53,6 +49,7 @@ class UserDeletionService * Delete a user from the panel only if they have no servers attached to their account. * * @param int|\Pterodactyl\Models\User $user + * * @return bool|null * * @throws \Pterodactyl\Exceptions\DisplayException diff --git a/app/Services/Users/UserUpdateService.php b/app/Services/Users/UserUpdateService.php index 4e1911a3..0c7e1c17 100644 --- a/app/Services/Users/UserUpdateService.php +++ b/app/Services/Users/UserUpdateService.php @@ -23,9 +23,6 @@ class UserUpdateService /** * UpdateService constructor. - * - * @param \Illuminate\Contracts\Hashing\Hasher $hasher - * @param \Pterodactyl\Repositories\Eloquent\UserRepository $repository */ public function __construct(Hasher $hasher, UserRepository $repository) { @@ -36,8 +33,6 @@ class UserUpdateService /** * Update the user model instance. * - * @param \Pterodactyl\Models\User $user - * @param array $data * @return \Pterodactyl\Models\User * * @throws \Pterodactyl\Exceptions\Model\DataValidationException @@ -45,7 +40,7 @@ class UserUpdateService */ public function handle(User $user, array $data) { - if (! empty(array_get($data, 'password'))) { + if (!empty(array_get($data, 'password'))) { $data['password'] = $this->hasher->make($data['password']); } else { unset($data['password']); diff --git a/app/Traits/Commands/EnvironmentWriterTrait.php b/app/Traits/Commands/EnvironmentWriterTrait.php index 6726e931..10692a9a 100644 --- a/app/Traits/Commands/EnvironmentWriterTrait.php +++ b/app/Traits/Commands/EnvironmentWriterTrait.php @@ -16,14 +16,12 @@ trait EnvironmentWriterTrait /** * Update the .env file for the application using the passed in values. * - * @param array $values - * * @throws \Pterodactyl\Exceptions\PterodactylException */ public function writeToEnvironment(array $values = []) { $path = base_path('.env'); - if (! file_exists($path)) { + if (!file_exists($path)) { throw new PterodactylException('Cannot locate .env file, was this software installed correctly?'); } @@ -33,7 +31,7 @@ trait EnvironmentWriterTrait // If the key value is not sorrounded by quotation marks, and contains anything that could reasonably // cause environment parsing issues, wrap it in quotes before writing it. This also adds slashes to the // value to ensure quotes within it don't cause us issues. - if (! preg_match('/^\"(.*)\"$/', $value) && preg_match('/([^\w.\-+\/])+/', $value)) { + if (!preg_match('/^\"(.*)\"$/', $value) && preg_match('/([^\w.\-+\/])+/', $value)) { $value = sprintf('"%s"', addslashes($value)); } diff --git a/app/Traits/Controllers/JavascriptInjection.php b/app/Traits/Controllers/JavascriptInjection.php index 556c9955..4e7e0a12 100644 --- a/app/Traits/Controllers/JavascriptInjection.php +++ b/app/Traits/Controllers/JavascriptInjection.php @@ -22,7 +22,6 @@ trait JavascriptInjection /** * Set the request object to use when injecting JS. * - * @param \Illuminate\Http\Request $request * @return $this */ public function setRequest(Request $request) @@ -36,6 +35,7 @@ trait JavascriptInjection * Injects the exact array passed in, nothing more. * * @param array $args + * * @return array */ public function plainInject($args = []) diff --git a/app/Traits/Helpers/AvailableLanguages.php b/app/Traits/Helpers/AvailableLanguages.php index f44771f6..47972297 100644 --- a/app/Traits/Helpers/AvailableLanguages.php +++ b/app/Traits/Helpers/AvailableLanguages.php @@ -22,7 +22,6 @@ trait AvailableLanguages * that are present in the language folder. * * @param bool $localize - * @return array */ public function getAvailableLanguages($localize = false): array { @@ -36,8 +35,6 @@ trait AvailableLanguages /** * Return an instance of the filesystem for getting a folder listing. - * - * @return \Illuminate\Filesystem\Filesystem */ private function getFilesystemInstance(): Filesystem { @@ -46,8 +43,6 @@ trait AvailableLanguages /** * Return an instance of the ISO639 class for generating names. - * - * @return \Matriphe\ISO639\ISO639 */ private function getIsoInstance(): ISO639 { diff --git a/app/Traits/Services/HasUserLevels.php b/app/Traits/Services/HasUserLevels.php index 29e49e8e..293e7fce 100644 --- a/app/Traits/Services/HasUserLevels.php +++ b/app/Traits/Services/HasUserLevels.php @@ -14,7 +14,6 @@ trait HasUserLevels /** * Set the access level for running this function. * - * @param int $level * @return $this */ public function setUserLevel(int $level) @@ -26,8 +25,6 @@ trait HasUserLevels /** * Determine which level this function is running at. - * - * @return int */ public function getUserLevel(): int { @@ -36,9 +33,6 @@ trait HasUserLevels /** * Determine if the current user level is set to a specific level. - * - * @param int $level - * @return bool */ public function isUserLevel(int $level): bool { diff --git a/app/Traits/Services/ReturnsUpdatedModels.php b/app/Traits/Services/ReturnsUpdatedModels.php index 2d5ee64f..07e4f4fd 100644 --- a/app/Traits/Services/ReturnsUpdatedModels.php +++ b/app/Traits/Services/ReturnsUpdatedModels.php @@ -22,8 +22,6 @@ trait ReturnsUpdatedModels * for API calls, but is unnecessary for UI based updates where the page is * being reloaded and a fresh model will be pulled anyways. * - * @param bool $toggle - * * @return $this */ public function returnUpdatedModel(bool $toggle = true) diff --git a/app/Traits/Services/ValidatesValidationRules.php b/app/Traits/Services/ValidatesValidationRules.php index d2010c82..f4c1ea18 100644 --- a/app/Traits/Services/ValidatesValidationRules.php +++ b/app/Traits/Services/ValidatesValidationRules.php @@ -9,9 +9,6 @@ use Pterodactyl\Exceptions\Service\Egg\Variable\BadValidationRuleException; trait ValidatesValidationRules { - /** - * @return \Illuminate\Contracts\Validation\Factory - */ abstract protected function getValidator(): Factory; /** @@ -29,9 +26,7 @@ trait ValidatesValidationRules } catch (BadMethodCallException $exception) { $matches = []; if (preg_match('/Method \[(.+)\] does not exist\./', $exception->getMessage(), $matches)) { - throw new BadValidationRuleException(trans('exceptions.nest.variables.bad_validation_rule', [ - 'rule' => Str::snake(str_replace('validate', '', array_get($matches, 1, 'unknownRule'))), - ]), $exception); + throw new BadValidationRuleException(trans('exceptions.nest.variables.bad_validation_rule', ['rule' => Str::snake(str_replace('validate', '', array_get($matches, 1, 'unknownRule')))]), $exception); } throw $exception; diff --git a/app/Transformers/Api/Application/AllocationTransformer.php b/app/Transformers/Api/Application/AllocationTransformer.php index d0c71e63..13529477 100644 --- a/app/Transformers/Api/Application/AllocationTransformer.php +++ b/app/Transformers/Api/Application/AllocationTransformer.php @@ -18,8 +18,6 @@ class AllocationTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -29,7 +27,6 @@ class AllocationTransformer extends BaseTransformer /** * Return a generic transformed allocation array. * - * @param \Pterodactyl\Models\Allocation $allocation * @return array */ public function transform(Allocation $allocation) @@ -40,43 +37,47 @@ class AllocationTransformer extends BaseTransformer 'alias' => $allocation->ip_alias, 'port' => $allocation->port, 'notes' => $allocation->notes, - 'assigned' => ! is_null($allocation->server_id), + 'assigned' => !is_null($allocation->server_id), ]; } /** * Load the node relationship onto a given transformation. * - * @param \Pterodactyl\Models\Allocation $allocation * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeNode(Allocation $allocation) { - if (! $this->authorize(AdminAcl::RESOURCE_NODES)) { + if (!$this->authorize(AdminAcl::RESOURCE_NODES)) { return $this->null(); } return $this->item( - $allocation->node, $this->makeTransformer(NodeTransformer::class), Node::RESOURCE_NAME + $allocation->node, + $this->makeTransformer(NodeTransformer::class), + Node::RESOURCE_NAME ); } /** * Load the server relationship onto a given transformation. * - * @param \Pterodactyl\Models\Allocation $allocation * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeServer(Allocation $allocation) { - if (! $this->authorize(AdminAcl::RESOURCE_SERVERS) || ! $allocation->server) { + if (!$this->authorize(AdminAcl::RESOURCE_SERVERS) || !$allocation->server) { return $this->null(); } return $this->item( - $allocation->server, $this->makeTransformer(ServerTransformer::class), Server::RESOURCE_NAME + $allocation->server, + $this->makeTransformer(ServerTransformer::class), + Server::RESOURCE_NAME ); } } diff --git a/app/Transformers/Api/Application/BaseTransformer.php b/app/Transformers/Api/Application/BaseTransformer.php index 79f1b0c4..3c563036 100644 --- a/app/Transformers/Api/Application/BaseTransformer.php +++ b/app/Transformers/Api/Application/BaseTransformer.php @@ -15,7 +15,7 @@ use Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException; */ abstract class BaseTransformer extends TransformerAbstract { - const RESPONSE_TIMEZONE = 'UTC'; + public const RESPONSE_TIMEZONE = 'UTC'; /** * @var \Pterodactyl\Models\ApiKey @@ -24,8 +24,6 @@ abstract class BaseTransformer extends TransformerAbstract /** * Return the resource name for the JSONAPI output. - * - * @return string */ abstract public function getResourceName(): string; @@ -43,7 +41,6 @@ abstract class BaseTransformer extends TransformerAbstract /** * Set the HTTP request class being used for this request. * - * @param \Pterodactyl\Models\ApiKey $key * @return $this */ public function setKey(ApiKey $key) @@ -55,8 +52,6 @@ abstract class BaseTransformer extends TransformerAbstract /** * Return the request instance being used for this transformer. - * - * @return \Pterodactyl\Models\ApiKey */ public function getKey(): ApiKey { @@ -67,9 +62,6 @@ abstract class BaseTransformer extends TransformerAbstract * Determine if the API key loaded onto the transformer has permission * to access a different resource. This is used when including other * models on a transformation request. - * - * @param string $resource - * @return bool */ protected function authorize(string $resource): bool { @@ -80,8 +72,6 @@ abstract class BaseTransformer extends TransformerAbstract * Create a new instance of the transformer and pass along the currently * set API key. * - * @param string $abstract - * @param array $parameters * @return \Pterodactyl\Transformers\Api\Application\BaseTransformer * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException @@ -92,7 +82,7 @@ abstract class BaseTransformer extends TransformerAbstract $transformer = Container::getInstance()->makeWith($abstract, $parameters); $transformer->setKey($this->getKey()); - if (! $transformer instanceof self) { + if (!$transformer instanceof self) { throw new InvalidTransformerLevelException('Calls to ' . __METHOD__ . ' must return a transformer that is an instance of ' . __CLASS__); } @@ -101,9 +91,6 @@ abstract class BaseTransformer extends TransformerAbstract /** * Return an ISO-8601 formatted timestamp to use in the API response. - * - * @param string $timestamp - * @return string */ protected function formatTimestamp(string $timestamp): string { diff --git a/app/Transformers/Api/Application/DatabaseHostTransformer.php b/app/Transformers/Api/Application/DatabaseHostTransformer.php index adbc8834..be888df5 100644 --- a/app/Transformers/Api/Application/DatabaseHostTransformer.php +++ b/app/Transformers/Api/Application/DatabaseHostTransformer.php @@ -17,8 +17,6 @@ class DatabaseHostTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -28,7 +26,6 @@ class DatabaseHostTransformer extends BaseTransformer /** * Transform database host into a representation for the application API. * - * @param \Pterodactyl\Models\DatabaseHost $model * @return array */ public function transform(DatabaseHost $model) @@ -48,13 +45,13 @@ class DatabaseHostTransformer extends BaseTransformer /** * Include the databases associated with this host. * - * @param \Pterodactyl\Models\DatabaseHost $model * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeDatabases(DatabaseHost $model) { - if (! $this->authorize(AdminAcl::RESOURCE_SERVER_DATABASES)) { + if (!$this->authorize(AdminAcl::RESOURCE_SERVER_DATABASES)) { return $this->null(); } diff --git a/app/Transformers/Api/Application/EggTransformer.php b/app/Transformers/Api/Application/EggTransformer.php index 5982d009..a4d3d698 100644 --- a/app/Transformers/Api/Application/EggTransformer.php +++ b/app/Transformers/Api/Application/EggTransformer.php @@ -21,8 +21,6 @@ class EggTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -33,7 +31,6 @@ class EggTransformer extends BaseTransformer * Transform an Egg model into a representation that can be consumed by * the application api. * - * @param \Pterodactyl\Models\Egg $model * @return array */ public function transform(Egg $model) @@ -74,13 +71,13 @@ class EggTransformer extends BaseTransformer /** * Include the Nest relationship for the given Egg in the transformation. * - * @param \Pterodactyl\Models\Egg $model * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeNest(Egg $model) { - if (! $this->authorize(AdminAcl::RESOURCE_NESTS)) { + if (!$this->authorize(AdminAcl::RESOURCE_NESTS)) { return $this->null(); } @@ -92,13 +89,13 @@ class EggTransformer extends BaseTransformer /** * Include the Servers relationship for the given Egg in the transformation. * - * @param \Pterodactyl\Models\Egg $model * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeServers(Egg $model) { - if (! $this->authorize(AdminAcl::RESOURCE_SERVERS)) { + if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) { return $this->null(); } @@ -111,7 +108,6 @@ class EggTransformer extends BaseTransformer * Include more detailed information about the configuration if this Egg is * extending another. * - * @param \Pterodactyl\Models\Egg $model * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource */ public function includeConfig(Egg $model) @@ -136,7 +132,6 @@ class EggTransformer extends BaseTransformer * Include more detailed information about the script configuration if the * Egg is extending another. * - * @param \Pterodactyl\Models\Egg $model * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource */ public function includeScript(Egg $model) @@ -160,13 +155,13 @@ class EggTransformer extends BaseTransformer /** * Include the variables that are defined for this Egg. * - * @param \Pterodactyl\Models\Egg $model * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeVariables(Egg $model) { - if (! $this->authorize(AdminAcl::RESOURCE_EGGS)) { + if (!$this->authorize(AdminAcl::RESOURCE_EGGS)) { return $this->null(); } diff --git a/app/Transformers/Api/Application/EggVariableTransformer.php b/app/Transformers/Api/Application/EggVariableTransformer.php index decb038a..2088806d 100644 --- a/app/Transformers/Api/Application/EggVariableTransformer.php +++ b/app/Transformers/Api/Application/EggVariableTransformer.php @@ -9,8 +9,6 @@ class EggVariableTransformer extends BaseTransformer { /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { diff --git a/app/Transformers/Api/Application/LocationTransformer.php b/app/Transformers/Api/Application/LocationTransformer.php index 7d24cc97..dfa8315e 100644 --- a/app/Transformers/Api/Application/LocationTransformer.php +++ b/app/Transformers/Api/Application/LocationTransformer.php @@ -16,8 +16,6 @@ class LocationTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -26,9 +24,6 @@ class LocationTransformer extends BaseTransformer /** * Return a generic transformed location array. - * - * @param \Pterodactyl\Models\Location $location - * @return array */ public function transform(Location $location): array { @@ -44,14 +39,13 @@ class LocationTransformer extends BaseTransformer /** * Return the nodes associated with this location. * - * @param \Pterodactyl\Models\Location $location * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeServers(Location $location) { - if (! $this->authorize(AdminAcl::RESOURCE_SERVERS)) { + if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) { return $this->null(); } @@ -63,14 +57,13 @@ class LocationTransformer extends BaseTransformer /** * Return the nodes associated with this location. * - * @param \Pterodactyl\Models\Location $location * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeNodes(Location $location) { - if (! $this->authorize(AdminAcl::RESOURCE_NODES)) { + if (!$this->authorize(AdminAcl::RESOURCE_NODES)) { return $this->null(); } diff --git a/app/Transformers/Api/Application/NestTransformer.php b/app/Transformers/Api/Application/NestTransformer.php index 80154a68..506b0276 100644 --- a/app/Transformers/Api/Application/NestTransformer.php +++ b/app/Transformers/Api/Application/NestTransformer.php @@ -20,8 +20,6 @@ class NestTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -32,7 +30,6 @@ class NestTransformer extends BaseTransformer * Transform a Nest model into a representation that can be consumed by the * application API. * - * @param \Pterodactyl\Models\Nest $model * @return array */ public function transform(Nest $model) @@ -48,14 +45,13 @@ class NestTransformer extends BaseTransformer /** * Include the Eggs relationship on the given Nest model transformation. * - * @param \Pterodactyl\Models\Nest $model * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeEggs(Nest $model) { - if (! $this->authorize(AdminAcl::RESOURCE_EGGS)) { + if (!$this->authorize(AdminAcl::RESOURCE_EGGS)) { return $this->null(); } @@ -67,14 +63,13 @@ class NestTransformer extends BaseTransformer /** * Include the servers relationship on the given Nest model. * - * @param \Pterodactyl\Models\Nest $model * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeServers(Nest $model) { - if (! $this->authorize(AdminAcl::RESOURCE_SERVERS)) { + if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) { return $this->null(); } diff --git a/app/Transformers/Api/Application/NodeTransformer.php b/app/Transformers/Api/Application/NodeTransformer.php index c26d67ce..aaed68e9 100644 --- a/app/Transformers/Api/Application/NodeTransformer.php +++ b/app/Transformers/Api/Application/NodeTransformer.php @@ -16,8 +16,6 @@ class NodeTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -27,9 +25,6 @@ class NodeTransformer extends BaseTransformer /** * Return a node transformed into a format that can be consumed by the * external administrative API. - * - * @param \Pterodactyl\Models\Node $node - * @return array */ public function transform(Node $node): array { @@ -57,60 +52,66 @@ class NodeTransformer extends BaseTransformer /** * Return the nodes associated with this location. * - * @param \Pterodactyl\Models\Node $node * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeAllocations(Node $node) { - if (! $this->authorize(AdminAcl::RESOURCE_ALLOCATIONS)) { + if (!$this->authorize(AdminAcl::RESOURCE_ALLOCATIONS)) { return $this->null(); } $node->loadMissing('allocations'); return $this->collection( - $node->getRelation('allocations'), $this->makeTransformer(AllocationTransformer::class), 'allocation' + $node->getRelation('allocations'), + $this->makeTransformer(AllocationTransformer::class), + 'allocation' ); } /** * Return the nodes associated with this location. * - * @param \Pterodactyl\Models\Node $node * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeLocation(Node $node) { - if (! $this->authorize(AdminAcl::RESOURCE_LOCATIONS)) { + if (!$this->authorize(AdminAcl::RESOURCE_LOCATIONS)) { return $this->null(); } $node->loadMissing('location'); return $this->item( - $node->getRelation('location'), $this->makeTransformer(LocationTransformer::class), 'location' + $node->getRelation('location'), + $this->makeTransformer(LocationTransformer::class), + 'location' ); } /** * Return the nodes associated with this location. * - * @param \Pterodactyl\Models\Node $node * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeServers(Node $node) { - if (! $this->authorize(AdminAcl::RESOURCE_SERVERS)) { + if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) { return $this->null(); } $node->loadMissing('servers'); return $this->collection( - $node->getRelation('servers'), $this->makeTransformer(ServerTransformer::class), 'server' + $node->getRelation('servers'), + $this->makeTransformer(ServerTransformer::class), + 'server' ); } } diff --git a/app/Transformers/Api/Application/ServerDatabaseTransformer.php b/app/Transformers/Api/Application/ServerDatabaseTransformer.php index ad984626..95180e2d 100644 --- a/app/Transformers/Api/Application/ServerDatabaseTransformer.php +++ b/app/Transformers/Api/Application/ServerDatabaseTransformer.php @@ -21,8 +21,6 @@ class ServerDatabaseTransformer extends BaseTransformer /** * Perform dependency injection. - * - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter */ public function handle(Encrypter $encrypter) { @@ -31,8 +29,6 @@ class ServerDatabaseTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -41,9 +37,6 @@ class ServerDatabaseTransformer extends BaseTransformer /** * Transform a database model in a representation for the application API. - * - * @param \Pterodactyl\Models\Database $model - * @return array */ public function transform(Database $model): array { @@ -63,7 +56,6 @@ class ServerDatabaseTransformer extends BaseTransformer /** * Include the database password in the request. * - * @param \Pterodactyl\Models\Database $model * @return \League\Fractal\Resource\Item */ public function includePassword(Database $model) @@ -78,13 +70,13 @@ class ServerDatabaseTransformer extends BaseTransformer /** * Return the database host relationship for this server database. * - * @param \Pterodactyl\Models\Database $model * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeHost(Database $model) { - if (! $this->authorize(AdminAcl::RESOURCE_DATABASE_HOSTS)) { + if (!$this->authorize(AdminAcl::RESOURCE_DATABASE_HOSTS)) { return $this->null(); } diff --git a/app/Transformers/Api/Application/ServerTransformer.php b/app/Transformers/Api/Application/ServerTransformer.php index 10c343d8..92bdb821 100644 --- a/app/Transformers/Api/Application/ServerTransformer.php +++ b/app/Transformers/Api/Application/ServerTransformer.php @@ -33,8 +33,6 @@ class ServerTransformer extends BaseTransformer /** * Perform dependency injection. - * - * @param \Pterodactyl\Services\Servers\EnvironmentService $environmentService */ public function handle(EnvironmentService $environmentService) { @@ -43,8 +41,6 @@ class ServerTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -53,9 +49,6 @@ class ServerTransformer extends BaseTransformer /** * Return a generic transformed server array. - * - * @param \Pterodactyl\Models\Server $server - * @return array */ public function transform(Server $server): array { @@ -99,14 +92,13 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array of allocations for this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeAllocations(Server $server) { - if (! $this->authorize(AdminAcl::RESOURCE_ALLOCATIONS)) { + if (!$this->authorize(AdminAcl::RESOURCE_ALLOCATIONS)) { return $this->null(); } @@ -118,14 +110,13 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array of data about subusers for this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeSubusers(Server $server) { - if (! $this->authorize(AdminAcl::RESOURCE_USERS)) { + if (!$this->authorize(AdminAcl::RESOURCE_USERS)) { return $this->null(); } @@ -137,14 +128,13 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array of data about subusers for this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeUser(Server $server) { - if (! $this->authorize(AdminAcl::RESOURCE_USERS)) { + if (!$this->authorize(AdminAcl::RESOURCE_USERS)) { return $this->null(); } @@ -156,14 +146,13 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array with nest information for this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeNest(Server $server) { - if (! $this->authorize(AdminAcl::RESOURCE_NESTS)) { + if (!$this->authorize(AdminAcl::RESOURCE_NESTS)) { return $this->null(); } @@ -175,14 +164,13 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array with egg information for this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeEgg(Server $server) { - if (! $this->authorize(AdminAcl::RESOURCE_EGGS)) { + if (!$this->authorize(AdminAcl::RESOURCE_EGGS)) { return $this->null(); } @@ -194,14 +182,13 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array of data about subusers for this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeVariables(Server $server) { - if (! $this->authorize(AdminAcl::RESOURCE_SERVERS)) { + if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) { return $this->null(); } @@ -213,14 +200,13 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array with location information for this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeLocation(Server $server) { - if (! $this->authorize(AdminAcl::RESOURCE_LOCATIONS)) { + if (!$this->authorize(AdminAcl::RESOURCE_LOCATIONS)) { return $this->null(); } @@ -232,14 +218,13 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array with node information for this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeNode(Server $server) { - if (! $this->authorize(AdminAcl::RESOURCE_NODES)) { + if (!$this->authorize(AdminAcl::RESOURCE_NODES)) { return $this->null(); } @@ -251,14 +236,13 @@ class ServerTransformer extends BaseTransformer /** * Return a generic array with database information for this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeDatabases(Server $server) { - if (! $this->authorize(AdminAcl::RESOURCE_SERVER_DATABASES)) { + if (!$this->authorize(AdminAcl::RESOURCE_SERVER_DATABASES)) { return $this->null(); } diff --git a/app/Transformers/Api/Application/ServerVariableTransformer.php b/app/Transformers/Api/Application/ServerVariableTransformer.php index 3f7eeac4..aefa318e 100644 --- a/app/Transformers/Api/Application/ServerVariableTransformer.php +++ b/app/Transformers/Api/Application/ServerVariableTransformer.php @@ -16,8 +16,6 @@ class ServerVariableTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -27,7 +25,6 @@ class ServerVariableTransformer extends BaseTransformer /** * Return a generic transformed server variable array. * - * @param \Pterodactyl\Models\EggVariable $variable * @return array */ public function transform(EggVariable $variable) @@ -38,13 +35,13 @@ class ServerVariableTransformer extends BaseTransformer /** * Return the parent service variable data. * - * @param \Pterodactyl\Models\EggVariable $variable * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeParent(EggVariable $variable) { - if (! $this->authorize(AdminAcl::RESOURCE_EGGS)) { + if (!$this->authorize(AdminAcl::RESOURCE_EGGS)) { return $this->null(); } diff --git a/app/Transformers/Api/Application/SubuserTransformer.php b/app/Transformers/Api/Application/SubuserTransformer.php index 9be61716..08c62266 100644 --- a/app/Transformers/Api/Application/SubuserTransformer.php +++ b/app/Transformers/Api/Application/SubuserTransformer.php @@ -16,8 +16,6 @@ class SubuserTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -26,9 +24,6 @@ class SubuserTransformer extends BaseTransformer /** * Return a transformed Subuser model that can be consumed by external services. - * - * @param \Pterodactyl\Models\Subuser $subuser - * @return array */ public function transform(Subuser $subuser): array { @@ -45,14 +40,13 @@ class SubuserTransformer extends BaseTransformer /** * Return a generic item of user for this subuser. * - * @param \Pterodactyl\Models\Subuser $subuser * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeUser(Subuser $subuser) { - if (! $this->authorize(AdminAcl::RESOURCE_USERS)) { + if (!$this->authorize(AdminAcl::RESOURCE_USERS)) { return $this->null(); } @@ -64,14 +58,13 @@ class SubuserTransformer extends BaseTransformer /** * Return a generic item of server for this subuser. * - * @param \Pterodactyl\Models\Subuser $subuser * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeServer(Subuser $subuser) { - if (! $this->authorize(AdminAcl::RESOURCE_SERVERS)) { + if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) { return $this->null(); } diff --git a/app/Transformers/Api/Application/UserTransformer.php b/app/Transformers/Api/Application/UserTransformer.php index 2e55bbb1..b3b42350 100644 --- a/app/Transformers/Api/Application/UserTransformer.php +++ b/app/Transformers/Api/Application/UserTransformer.php @@ -16,8 +16,6 @@ class UserTransformer extends BaseTransformer /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -26,9 +24,6 @@ class UserTransformer extends BaseTransformer /** * Return a transformed User model that can be consumed by external services. - * - * @param \Pterodactyl\Models\User $user - * @return array */ public function transform(User $user): array { @@ -51,14 +46,13 @@ class UserTransformer extends BaseTransformer /** * Return the servers associated with this user. * - * @param \Pterodactyl\Models\User $user * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeServers(User $user) { - if (! $this->authorize(AdminAcl::RESOURCE_SERVERS)) { + if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) { return $this->null(); } diff --git a/app/Transformers/Api/Client/AccountTransformer.php b/app/Transformers/Api/Client/AccountTransformer.php index 2cdc92e3..405a4208 100644 --- a/app/Transformers/Api/Client/AccountTransformer.php +++ b/app/Transformers/Api/Client/AccountTransformer.php @@ -8,8 +8,6 @@ class AccountTransformer extends BaseClientTransformer { /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -19,7 +17,6 @@ class AccountTransformer extends BaseClientTransformer /** * Return basic information about the currently logged in user. * - * @param \Pterodactyl\Models\User $model * @return array */ public function transform(User $model) diff --git a/app/Transformers/Api/Client/AllocationTransformer.php b/app/Transformers/Api/Client/AllocationTransformer.php index 57f72eaf..0d9bfec7 100644 --- a/app/Transformers/Api/Client/AllocationTransformer.php +++ b/app/Transformers/Api/Client/AllocationTransformer.php @@ -8,8 +8,6 @@ class AllocationTransformer extends BaseClientTransformer { /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -19,7 +17,6 @@ class AllocationTransformer extends BaseClientTransformer /** * Return basic information about the currently logged in user. * - * @param \Pterodactyl\Models\Allocation $model * @return array */ public function transform(Allocation $model) diff --git a/app/Transformers/Api/Client/ApiKeyTransformer.php b/app/Transformers/Api/Client/ApiKeyTransformer.php index 4c30ea3a..c7c39c2b 100644 --- a/app/Transformers/Api/Client/ApiKeyTransformer.php +++ b/app/Transformers/Api/Client/ApiKeyTransformer.php @@ -17,7 +17,6 @@ class ApiKeyTransformer extends BaseClientTransformer /** * Transform this model into a representation that can be consumed by a client. * - * @param \Pterodactyl\Models\ApiKey $model * @return array */ public function transform(ApiKey $model) diff --git a/app/Transformers/Api/Client/BackupTransformer.php b/app/Transformers/Api/Client/BackupTransformer.php index d5acd41f..fe341ff1 100644 --- a/app/Transformers/Api/Client/BackupTransformer.php +++ b/app/Transformers/Api/Client/BackupTransformer.php @@ -6,16 +6,12 @@ use Pterodactyl\Models\Backup; class BackupTransformer extends BaseClientTransformer { - /** - * @return string - */ public function getResourceName(): string { return Backup::RESOURCE_NAME; } /** - * @param \Pterodactyl\Models\Backup $backup * @return array */ public function transform(Backup $backup) diff --git a/app/Transformers/Api/Client/BaseClientTransformer.php b/app/Transformers/Api/Client/BaseClientTransformer.php index c15e583e..efe53276 100644 --- a/app/Transformers/Api/Client/BaseClientTransformer.php +++ b/app/Transformers/Api/Client/BaseClientTransformer.php @@ -18,8 +18,6 @@ abstract class BaseClientTransformer extends BaseApplicationTransformer /** * Return the user model of the user requesting this transformation. - * - * @return \Pterodactyl\Models\User */ public function getUser(): User { @@ -28,8 +26,6 @@ abstract class BaseClientTransformer extends BaseApplicationTransformer /** * Set the user model of the user requesting this transformation. - * - * @param \Pterodactyl\Models\User $user */ public function setUser(User $user) { @@ -41,9 +37,7 @@ abstract class BaseClientTransformer extends BaseApplicationTransformer * to access a different resource. This is used when including other * models on a transformation request. * - * @param string $ability * @param \Pterodactyl\Models\Server $server - * @return bool */ protected function authorize(string $ability, Server $server = null): bool { @@ -56,8 +50,6 @@ abstract class BaseClientTransformer extends BaseApplicationTransformer * Create a new instance of the transformer and pass along the currently * set API key. * - * @param string $abstract - * @param array $parameters * @return self * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException @@ -68,7 +60,7 @@ abstract class BaseClientTransformer extends BaseApplicationTransformer $transformer = Container::getInstance()->makeWith($abstract, $parameters); $transformer->setKey($this->getKey()); - if (! $transformer instanceof self) { + if (!$transformer instanceof self) { throw new InvalidTransformerLevelException('Calls to ' . __METHOD__ . ' must return a transformer that is an instance of ' . __CLASS__); } diff --git a/app/Transformers/Api/Client/DatabaseTransformer.php b/app/Transformers/Api/Client/DatabaseTransformer.php index e63583de..9c5bd86d 100644 --- a/app/Transformers/Api/Client/DatabaseTransformer.php +++ b/app/Transformers/Api/Client/DatabaseTransformer.php @@ -23,9 +23,6 @@ class DatabaseTransformer extends BaseClientTransformer /** * Handle dependency injection. - * - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter - * @param \Pterodactyl\Contracts\Extensions\HashidsInterface $hashids */ public function handle(Encrypter $encrypter, HashidsInterface $hashids) { @@ -33,18 +30,11 @@ class DatabaseTransformer extends BaseClientTransformer $this->hashids = $hashids; } - /** - * @return string - */ public function getResourceName(): string { return Database::RESOURCE_NAME; } - /** - * @param \Pterodactyl\Models\Database $model - * @return array - */ public function transform(Database $model): array { $model->loadMissing('host'); @@ -65,12 +55,11 @@ class DatabaseTransformer extends BaseClientTransformer /** * Include the database password in the request. * - * @param \Pterodactyl\Models\Database $database * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource */ public function includePassword(Database $database) { - if (! $this->getUser()->can(Permission::ACTION_DATABASE_VIEW_PASSWORD, $database->server)) { + if (!$this->getUser()->can(Permission::ACTION_DATABASE_VIEW_PASSWORD, $database->server)) { return $this->null(); } diff --git a/app/Transformers/Api/Client/EggTransformer.php b/app/Transformers/Api/Client/EggTransformer.php index ed5b8c58..25e13500 100644 --- a/app/Transformers/Api/Client/EggTransformer.php +++ b/app/Transformers/Api/Client/EggTransformer.php @@ -8,8 +8,6 @@ class EggTransformer extends BaseClientTransformer { /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -17,7 +15,6 @@ class EggTransformer extends BaseClientTransformer } /** - * @param \Pterodactyl\Models\Egg $egg * @return array */ public function transform(Egg $egg) diff --git a/app/Transformers/Api/Client/EggVariableTransformer.php b/app/Transformers/Api/Client/EggVariableTransformer.php index b6a5784d..c7725b97 100644 --- a/app/Transformers/Api/Client/EggVariableTransformer.php +++ b/app/Transformers/Api/Client/EggVariableTransformer.php @@ -7,16 +7,12 @@ use Pterodactyl\Models\EggVariable; class EggVariableTransformer extends BaseClientTransformer { - /** - * @return string - */ public function getResourceName(): string { return EggVariable::RESOURCE_NAME; } /** - * @param \Pterodactyl\Models\EggVariable $variable * @return array */ public function transform(EggVariable $variable) @@ -24,10 +20,8 @@ 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) { - throw new BadMethodCallException( - 'Cannot transform a hidden egg variable in a client transformer.' - ); + if (!$variable->user_viewable) { + throw new BadMethodCallException('Cannot transform a hidden egg variable in a client transformer.'); } return [ diff --git a/app/Transformers/Api/Client/ScheduleTransformer.php b/app/Transformers/Api/Client/ScheduleTransformer.php index 09e8708e..44ea2c55 100644 --- a/app/Transformers/Api/Client/ScheduleTransformer.php +++ b/app/Transformers/Api/Client/ScheduleTransformer.php @@ -29,7 +29,6 @@ class ScheduleTransformer extends BaseClientTransformer /** * Returns a transformed schedule model such that a client can view the information. * - * @param \Pterodactyl\Models\Schedule $model * @return array */ public function transform(Schedule $model) @@ -56,7 +55,6 @@ class ScheduleTransformer extends BaseClientTransformer /** * Allows attaching the tasks specific to the schedule in the response. * - * @param \Pterodactyl\Models\Schedule $model * @return \League\Fractal\Resource\Collection * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException @@ -64,7 +62,9 @@ class ScheduleTransformer extends BaseClientTransformer public function includeTasks(Schedule $model) { return $this->collection( - $model->tasks, $this->makeTransformer(TaskTransformer::class), Task::RESOURCE_NAME + $model->tasks, + $this->makeTransformer(TaskTransformer::class), + Task::RESOURCE_NAME ); } } diff --git a/app/Transformers/Api/Client/ServerTransformer.php b/app/Transformers/Api/Client/ServerTransformer.php index 0673f9b5..03f85305 100644 --- a/app/Transformers/Api/Client/ServerTransformer.php +++ b/app/Transformers/Api/Client/ServerTransformer.php @@ -23,9 +23,6 @@ class ServerTransformer extends BaseClientTransformer */ protected $availableIncludes = ['egg', 'subusers']; - /** - * @return string - */ public function getResourceName(): string { return Server::RESOURCE_NAME; @@ -34,9 +31,6 @@ class ServerTransformer extends BaseClientTransformer /** * Transform a server model into a representation that can be returned * to a client. - * - * @param \Pterodactyl\Models\Server $server - * @return array */ public function transform(Server $server): array { @@ -62,7 +56,7 @@ class ServerTransformer extends BaseClientTransformer 'io' => $server->io, 'cpu' => $server->cpu, ], - 'invocation' => $service->handle($server, ! $this->getUser()->can(Permission::ACTION_STARTUP_READ, $server)), + 'invocation' => $service->handle($server, !$this->getUser()->can(Permission::ACTION_STARTUP_READ, $server)), 'docker_image' => $server->image, 'egg_features' => $server->egg->inherit_features, 'feature_limits' => [ @@ -72,14 +66,13 @@ class ServerTransformer extends BaseClientTransformer ], 'is_suspended' => $server->suspended, 'is_installing' => $server->installed !== 1, - 'is_transferring' => ! is_null($server->transfer), + 'is_transferring' => !is_null($server->transfer), ]; } /** * Returns the allocations associated with this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException @@ -95,7 +88,7 @@ class ServerTransformer extends BaseClientTransformer // // This allows us to avoid too much permission regression, without also hiding information that // is generally needed for the frontend to make sense when browsing or searching results. - if (! $this->getUser()->can(Permission::ACTION_ALLOCATION_READ, $server)) { + if (!$this->getUser()->can(Permission::ACTION_ALLOCATION_READ, $server)) { $primary = clone $server->allocation; $primary->notes = null; @@ -106,14 +99,13 @@ class ServerTransformer extends BaseClientTransformer } /** - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeVariables(Server $server) { - if (! $this->getUser()->can(Permission::ACTION_STARTUP_READ, $server)) { + if (!$this->getUser()->can(Permission::ACTION_STARTUP_READ, $server)) { return $this->null(); } @@ -127,8 +119,8 @@ class ServerTransformer extends BaseClientTransformer /** * Returns the egg associated with this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Item + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeEgg(Server $server) @@ -139,14 +131,13 @@ class ServerTransformer extends BaseClientTransformer /** * Returns the subusers associated with this server. * - * @param \Pterodactyl\Models\Server $server * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeSubusers(Server $server) { - if (! $this->getUser()->can(Permission::ACTION_USER_READ, $server)) { + if (!$this->getUser()->can(Permission::ACTION_USER_READ, $server)) { return $this->null(); } diff --git a/app/Transformers/Api/Client/StatsTransformer.php b/app/Transformers/Api/Client/StatsTransformer.php index 97989cc3..8ca7bea0 100644 --- a/app/Transformers/Api/Client/StatsTransformer.php +++ b/app/Transformers/Api/Client/StatsTransformer.php @@ -6,9 +6,6 @@ use Illuminate\Support\Arr; class StatsTransformer extends BaseClientTransformer { - /** - * @return string - */ public function getResourceName(): string { return 'stats'; @@ -18,7 +15,6 @@ class StatsTransformer extends BaseClientTransformer * Transform stats from the daemon into a result set that can be used in * the client API. * - * @param array $data * @return array */ public function transform(array $data) diff --git a/app/Transformers/Api/Client/SubuserTransformer.php b/app/Transformers/Api/Client/SubuserTransformer.php index d2e7ce0f..7a8bfde0 100644 --- a/app/Transformers/Api/Client/SubuserTransformer.php +++ b/app/Transformers/Api/Client/SubuserTransformer.php @@ -8,8 +8,6 @@ class SubuserTransformer extends BaseClientTransformer { /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -19,8 +17,8 @@ class SubuserTransformer extends BaseClientTransformer /** * Transforms a subuser into a model that can be shown to a front-end user. * - * @param \Pterodactyl\Models\Subuser $model * @return array|void + * * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function transform(Subuser $model) diff --git a/app/Transformers/Api/Client/TaskTransformer.php b/app/Transformers/Api/Client/TaskTransformer.php index c215479a..0b295626 100644 --- a/app/Transformers/Api/Client/TaskTransformer.php +++ b/app/Transformers/Api/Client/TaskTransformer.php @@ -17,7 +17,6 @@ class TaskTransformer extends BaseClientTransformer /** * Transforms a schedule's task into a client viewable format. * - * @param \Pterodactyl\Models\Task $model * @return array */ public function transform(Task $model) diff --git a/app/Transformers/Api/Client/UserTransformer.php b/app/Transformers/Api/Client/UserTransformer.php index 65849f06..468232f8 100644 --- a/app/Transformers/Api/Client/UserTransformer.php +++ b/app/Transformers/Api/Client/UserTransformer.php @@ -9,8 +9,6 @@ class UserTransformer extends BaseClientTransformer { /** * Return the resource name for the JSONAPI output. - * - * @return string */ public function getResourceName(): string { @@ -21,7 +19,6 @@ class UserTransformer extends BaseClientTransformer * Transforms a User model into a representation that can be shown to regular * users of the API. * - * @param \Pterodactyl\Models\User $model * @return array */ public function transform(User $model) diff --git a/app/Transformers/Daemon/FileObjectTransformer.php b/app/Transformers/Daemon/FileObjectTransformer.php index f19d9028..1ad86dce 100644 --- a/app/Transformers/Daemon/FileObjectTransformer.php +++ b/app/Transformers/Daemon/FileObjectTransformer.php @@ -17,7 +17,6 @@ class FileObjectTransformer extends BaseDaemonTransformer /** * Transform a file object response from the daemon into a standardized response. * - * @param array $item * @return array */ public function transform(array $item) @@ -35,9 +34,6 @@ class FileObjectTransformer extends BaseDaemonTransformer ]; } - /** - * @return string - */ public function getResourceName(): string { return 'file_object'; diff --git a/app/helpers.php b/app/helpers.php index 0716fd21..ac099f92 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -1,11 +1,12 @@ bootstrap(); // Register the collision service provider so that errors during the test // setup process are output nicely. -(new Provider)->register(); +(new Provider())->register(); -$output = new ConsoleOutput; +$output = new ConsoleOutput(); if (config('database.default') !== 'testing') { $output->writeln(PHP_EOL . 'Cannot run test process against non-testing database.'); @@ -32,7 +32,7 @@ if (config('database.default') !== 'testing') { * Perform database migrations and reseeding before continuing with * running the tests. */ -if (! env('SKIP_MIGRATIONS')) { +if (!env('SKIP_MIGRATIONS')) { $output->writeln(PHP_EOL . 'Refreshing database for Integration tests...'); $kernel->call('migrate:fresh', ['--database' => 'testing']); diff --git a/database/Factories/AllocationFactory.php b/database/Factories/AllocationFactory.php index 448cf43f..e7a5f7e6 100644 --- a/database/Factories/AllocationFactory.php +++ b/database/Factories/AllocationFactory.php @@ -16,8 +16,6 @@ class AllocationFactory extends Factory /** * Define the model's default state. - * - * @return array */ public function definition(): array { diff --git a/database/Factories/ApiKeyFactory.php b/database/Factories/ApiKeyFactory.php index 488c26cd..9da4bbf7 100644 --- a/database/Factories/ApiKeyFactory.php +++ b/database/Factories/ApiKeyFactory.php @@ -18,8 +18,6 @@ class ApiKeyFactory extends Factory /** * Define the model's default state. - * - * @return array */ public function definition(): array { diff --git a/database/Factories/BackupFactory.php b/database/Factories/BackupFactory.php index 4bbd5ec1..de9a1d92 100644 --- a/database/Factories/BackupFactory.php +++ b/database/Factories/BackupFactory.php @@ -17,8 +17,6 @@ class BackupFactory extends Factory /** * Define the model's default state. - * - * @return array */ public function definition(): array { diff --git a/database/Factories/DatabaseFactory.php b/database/Factories/DatabaseFactory.php index f3931069..d3c6f2a5 100644 --- a/database/Factories/DatabaseFactory.php +++ b/database/Factories/DatabaseFactory.php @@ -18,8 +18,6 @@ class DatabaseFactory extends Factory /** * Define the model's default state. - * - * @return array */ public function definition(): array { diff --git a/database/Factories/DatabaseHostFactory.php b/database/Factories/DatabaseHostFactory.php index fa606595..b65e856e 100644 --- a/database/Factories/DatabaseHostFactory.php +++ b/database/Factories/DatabaseHostFactory.php @@ -17,8 +17,6 @@ class DatabaseHostFactory extends Factory /** * Define the model's default state. - * - * @return array */ public function definition(): array { diff --git a/database/Factories/EggFactory.php b/database/Factories/EggFactory.php index b907b21a..4085b70e 100644 --- a/database/Factories/EggFactory.php +++ b/database/Factories/EggFactory.php @@ -17,8 +17,6 @@ class EggFactory extends Factory /** * Define the model's default state. - * - * @return array */ public function definition(): array { diff --git a/database/Factories/EggVariableFactory.php b/database/Factories/EggVariableFactory.php index 39d8754a..d288b4ee 100644 --- a/database/Factories/EggVariableFactory.php +++ b/database/Factories/EggVariableFactory.php @@ -17,8 +17,6 @@ class EggVariableFactory extends Factory /** * Define the model's default state. - * - * @return array */ public function definition(): array { @@ -35,8 +33,6 @@ class EggVariableFactory extends Factory /** * Indicate that the egg variable is viewable. - * - * @return \Illuminate\Database\Eloquent\Factories\Factory */ public function viewable(): Factory { @@ -49,8 +45,6 @@ class EggVariableFactory extends Factory /** * Indicate that the egg variable is editable. - * - * @return \Illuminate\Database\Eloquent\Factories\Factory */ public function editable(): Factory { diff --git a/database/Factories/LocationFactory.php b/database/Factories/LocationFactory.php index 15238be1..9e0af5dc 100644 --- a/database/Factories/LocationFactory.php +++ b/database/Factories/LocationFactory.php @@ -17,8 +17,6 @@ class LocationFactory extends Factory /** * Define the model's default state. - * - * @return array */ public function definition(): array { diff --git a/database/Factories/NestFactory.php b/database/Factories/NestFactory.php index 6912705f..9a5755ba 100644 --- a/database/Factories/NestFactory.php +++ b/database/Factories/NestFactory.php @@ -17,8 +17,6 @@ class NestFactory extends Factory /** * Define the model's default state. - * - * @return array */ public function definition(): array { diff --git a/database/Factories/NodeFactory.php b/database/Factories/NodeFactory.php index 3fa2ad40..683d8a48 100644 --- a/database/Factories/NodeFactory.php +++ b/database/Factories/NodeFactory.php @@ -19,8 +19,6 @@ class NodeFactory extends Factory /** * Define the model's default state. - * - * @return array */ public function definition(): array { diff --git a/database/Factories/ScheduleFactory.php b/database/Factories/ScheduleFactory.php index 4cb7bac6..0a28f4c4 100644 --- a/database/Factories/ScheduleFactory.php +++ b/database/Factories/ScheduleFactory.php @@ -16,8 +16,6 @@ class ScheduleFactory extends Factory /** * Define the model's default state. - * - * @return array */ public function definition(): array { diff --git a/database/Factories/SubuserFactory.php b/database/Factories/SubuserFactory.php index b0ce9dc3..7db93d4d 100644 --- a/database/Factories/SubuserFactory.php +++ b/database/Factories/SubuserFactory.php @@ -17,8 +17,6 @@ class SubuserFactory extends Factory /** * Define the model's default state. - * - * @return array */ public function definition(): array { diff --git a/database/Factories/TaskFactory.php b/database/Factories/TaskFactory.php index 9d33db9b..f04ebbe8 100644 --- a/database/Factories/TaskFactory.php +++ b/database/Factories/TaskFactory.php @@ -16,8 +16,6 @@ class TaskFactory extends Factory /** * Define the model's default state. - * - * @return array */ public function definition(): array { diff --git a/database/Factories/UserFactory.php b/database/Factories/UserFactory.php index 34c48941..b9e6062f 100644 --- a/database/Factories/UserFactory.php +++ b/database/Factories/UserFactory.php @@ -18,8 +18,6 @@ class UserFactory extends Factory /** * Define the model's default state. - * - * @return array */ public function definition(): array { @@ -43,8 +41,6 @@ class UserFactory extends Factory /** * Indicate that the user is an admin. - * - * @return \Illuminate\Database\Eloquent\Factories\Factory */ public function admin(): Factory { diff --git a/database/Seeders/EggSeeder.php b/database/Seeders/EggSeeder.php index 4b2eff00..631f0303 100644 --- a/database/Seeders/EggSeeder.php +++ b/database/Seeders/EggSeeder.php @@ -42,12 +42,6 @@ class EggSeeder extends Seeder /** * EggSeeder constructor. - * - * @param \Pterodactyl\Services\Eggs\Sharing\EggImporterService $importerService - * @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository - * @param \Pterodactyl\Services\Eggs\Sharing\EggUpdateImporterService $updateImporterService - * @param \Illuminate\Filesystem\Filesystem $filesystem - * @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $nestRepository */ public function __construct( EggImporterService $importerService, @@ -75,8 +69,6 @@ class EggSeeder extends Seeder /** * Return a list of eggs to import. - * - * @return \Illuminate\Support\Collection */ protected function getEggsToImport(): Collection { @@ -91,9 +83,6 @@ class EggSeeder extends Seeder /** * Find the nest that these eggs should be attached to. * - * @param string $nestName - * @return \Pterodactyl\Models\Nest - * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ private function findMatchingNest(string $nestName): Nest @@ -106,8 +95,6 @@ class EggSeeder extends Seeder /** * Loop through the list of egg files and import them. - * - * @param \Pterodactyl\Models\Nest $nest */ private function parseEggFiles(Nest $nest) { diff --git a/database/Seeders/NestSeeder.php b/database/Seeders/NestSeeder.php index 5e1fe407..eae7ae21 100644 --- a/database/Seeders/NestSeeder.php +++ b/database/Seeders/NestSeeder.php @@ -20,9 +20,6 @@ class NestSeeder extends Seeder /** * NestSeeder constructor. - * - * @param \Pterodactyl\Services\Nests\NestCreationService $creationService - * @param \Pterodactyl\Contracts\Repository\NestRepositoryInterface $repository */ public function __construct( NestCreationService $creationService, @@ -52,8 +49,6 @@ class NestSeeder extends Seeder /** * Create the Minecraft nest to be used later on. * - * @param array|null $nest - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ private function createMinecraftNest(array $nest = null) @@ -69,8 +64,6 @@ class NestSeeder extends Seeder /** * Create the Source Engine Games nest to be used later on. * - * @param array|null $nest - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ private function createSourceEngineNest(array $nest = null) @@ -86,8 +79,6 @@ class NestSeeder extends Seeder /** * Create the Voice Servers nest to be used later on. * - * @param array|null $nest - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ private function createVoiceServersNest(array $nest = null) @@ -103,8 +94,6 @@ class NestSeeder extends Seeder /** * Create the Rust nest to be used later on. * - * @param array|null $nest - * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ private function createRustNest(array $nest = null) diff --git a/database/migrations/2016_11_04_000949_add_ark_service_option_fixed.php b/database/migrations/2016_11_04_000949_add_ark_service_option_fixed.php index 4383c11c..1547e32c 100644 --- a/database/migrations/2016_11_04_000949_add_ark_service_option_fixed.php +++ b/database/migrations/2016_11_04_000949_add_ark_service_option_fixed.php @@ -13,7 +13,7 @@ class AddArkServiceOptionFixed extends Migration $service = DB::table('services')->select('id')->where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('name', 'Source Engine')->first(); // No SRCDS Service, Skipping - if (! $service) { + if (!$service) { return; } diff --git a/database/migrations/2017_03_10_173607_MigrateToNewServiceSystem.php b/database/migrations/2017_03_10_173607_MigrateToNewServiceSystem.php index 5dddb875..c786ab46 100644 --- a/database/migrations/2017_03_10_173607_MigrateToNewServiceSystem.php +++ b/database/migrations/2017_03_10_173607_MigrateToNewServiceSystem.php @@ -17,7 +17,7 @@ class MigrateToNewServiceSystem extends Migration { DB::transaction(function () { $service = DB::table('services')->where('author', config('pterodactyl.service.core'))->where('folder', 'srcds')->first(); - if (! $service) { + if (!$service) { return; } diff --git a/database/migrations/2017_09_13_211810_UpdateOldPermissionsToPointToNewScheduleSystem.php b/database/migrations/2017_09_13_211810_UpdateOldPermissionsToPointToNewScheduleSystem.php index b7c361f1..ba3a8bac 100644 --- a/database/migrations/2017_09_13_211810_UpdateOldPermissionsToPointToNewScheduleSystem.php +++ b/database/migrations/2017_09_13_211810_UpdateOldPermissionsToPointToNewScheduleSystem.php @@ -13,7 +13,7 @@ class UpdateOldPermissionsToPointToNewScheduleSystem extends Migration $permissions = DB::table('permissions')->where('permission', 'like', '%-task%')->get(); foreach ($permissions as $record) { $parts = explode('-', $record->permission); - if (! in_array(array_get($parts, 1), ['tasks', 'task']) || count($parts) !== 2) { + if (!in_array(array_get($parts, 1), ['tasks', 'task']) || count($parts) !== 2) { continue; } @@ -31,7 +31,7 @@ class UpdateOldPermissionsToPointToNewScheduleSystem extends Migration $permissions = DB::table('permissions')->where('permission', 'like', '%-schedule%')->get(); foreach ($permissions as $record) { $parts = explode('-', $record->permission); - if (! in_array(array_get($parts, 1), ['schedules', 'schedule']) || count($parts) !== 2) { + if (!in_array(array_get($parts, 1), ['schedules', 'schedule']) || count($parts) !== 2) { continue; } diff --git a/database/migrations/2018_01_13_142012_SetupTableForKeyEncryption.php b/database/migrations/2018_01_13_142012_SetupTableForKeyEncryption.php index 5dba9c11..1d36b364 100644 --- a/database/migrations/2018_01_13_142012_SetupTableForKeyEncryption.php +++ b/database/migrations/2018_01_13_142012_SetupTableForKeyEncryption.php @@ -10,6 +10,7 @@ class SetupTableForKeyEncryption extends Migration * Run the migrations. * * @return void + * * @throws \Exception * @throws \Throwable */ @@ -29,6 +30,7 @@ class SetupTableForKeyEncryption extends Migration * Reverse the migrations. * * @return void + * * @throws \Exception * @throws \Throwable */ diff --git a/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php b/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php index b204d172..27d26674 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 @@ -83,7 +83,7 @@ class MergePermissionsTableIntoSubusers extends Migration ->map(function ($value) { return self::$permissionsMap[$value] ?? null; })->filter(function ($value) { - return ! is_null($value) && $value !== Permission::ACTION_WEBSOCKET_CONNECT; + return !is_null($value) && $value !== Permission::ACTION_WEBSOCKET_CONNECT; }) // All subusers get this permission, so make sure it gets pushed into the array. ->merge([Permission::ACTION_WEBSOCKET_CONNECT]) @@ -109,13 +109,13 @@ class MergePermissionsTableIntoSubusers extends Migration $values = []; foreach (json_decode($datum->permissions, true) as $permission) { $v = $flipped[$permission] ?? null; - if (! empty($v)) { + if (!empty($v)) { $values[] = $datum->id; $values[] = $v; } } - if (! empty($values)) { + if (!empty($values)) { $string = 'VALUES ' . implode(', ', array_fill(0, count($values) / 2, '(?, ?)')); DB::insert('INSERT INTO permissions(`subuser_id`, `permission`) ' . $string, $values); diff --git a/database/migrations/2020_04_10_141024_store_node_tokens_as_encrypted_value.php b/database/migrations/2020_04_10_141024_store_node_tokens_as_encrypted_value.php index ff81f863..b3d94af8 100644 --- a/database/migrations/2020_04_10_141024_store_node_tokens_as_encrypted_value.php +++ b/database/migrations/2020_04_10_141024_store_node_tokens_as_encrypted_value.php @@ -14,6 +14,7 @@ class StoreNodeTokensAsEncryptedValue extends Migration * Run the migrations. * * @return void + * * @throws \Exception */ public function up() diff --git a/tests/Assertions/MiddlewareAttributeAssertionsTrait.php b/tests/Assertions/MiddlewareAttributeAssertionsTrait.php index 2e84999e..bd5ec0d1 100644 --- a/tests/Assertions/MiddlewareAttributeAssertionsTrait.php +++ b/tests/Assertions/MiddlewareAttributeAssertionsTrait.php @@ -8,8 +8,6 @@ trait MiddlewareAttributeAssertionsTrait { /** * Assert a request has an attribute assigned to it. - * - * @param string $attribute */ public function assertRequestHasAttribute(string $attribute) { @@ -18,8 +16,6 @@ trait MiddlewareAttributeAssertionsTrait /** * Assert a request does not have an attribute assigned to it. - * - * @param string $attribute */ public function assertRequestMissingAttribute(string $attribute) { @@ -29,8 +25,7 @@ trait MiddlewareAttributeAssertionsTrait /** * Assert a request attribute matches an expected value. * - * @param mixed $expected - * @param string $attribute + * @param mixed $expected */ public function assertRequestAttributeEquals($expected, string $attribute) { diff --git a/tests/Browser/BrowserTestCase.php b/tests/Browser/BrowserTestCase.php index 0216d0be..68a6ddc1 100644 --- a/tests/Browser/BrowserTestCase.php +++ b/tests/Browser/BrowserTestCase.php @@ -70,14 +70,16 @@ abstract class BrowserTestCase extends TestCase */ protected function driver() { - $options = (new ChromeOptions)->addArguments([ + $options = (new ChromeOptions())->addArguments([ '--disable-gpu', '--disable-infobars', ]); return RemoteWebDriver::create( - 'http://host.pterodactyl.local:4444/wd/hub', DesiredCapabilities::chrome()->setCapability( - ChromeOptions::CAPABILITY, $options + 'http://host.pterodactyl.local:4444/wd/hub', + DesiredCapabilities::chrome()->setCapability( + ChromeOptions::CAPABILITY, + $options ) ); } @@ -86,6 +88,7 @@ abstract class BrowserTestCase extends TestCase * Return an instance of the browser to be used for tests. * * @param \Facebook\WebDriver\Remote\RemoteWebDriver $driver + * * @return \Pterodactyl\Tests\Browser\PterodactylBrowser */ protected function newBrowser($driver): PterodactylBrowser @@ -109,9 +112,6 @@ abstract class BrowserTestCase extends TestCase /** * Return a user model to authenticate aganist and use in the tests. - * - * @param array $attributes - * @return \Pterodactyl\Models\User */ protected function user(array $attributes = []): User { diff --git a/tests/Browser/Pages/LoginPage.php b/tests/Browser/Pages/LoginPage.php index 5fd42cbf..ea60b058 100644 --- a/tests/Browser/Pages/LoginPage.php +++ b/tests/Browser/Pages/LoginPage.php @@ -4,9 +4,6 @@ namespace Pterodactyl\Tests\Browser\Pages; class LoginPage extends BasePage { - /** - * @return string - */ public function url(): string { return '/auth/login'; diff --git a/tests/Browser/Processes/Authentication/ForgotPasswordProcessTest.php b/tests/Browser/Processes/Authentication/ForgotPasswordProcessTest.php index ab8c9bc8..f6cef86c 100644 --- a/tests/Browser/Processes/Authentication/ForgotPasswordProcessTest.php +++ b/tests/Browser/Processes/Authentication/ForgotPasswordProcessTest.php @@ -15,7 +15,7 @@ class ForgotPasswordProcessTest extends BrowserTestCase public function testResetPasswordWithInvalidAccount() { $this->browse(function (PterodactylBrowser $browser) { - $browser->visit(new LoginPage) + $browser->visit(new LoginPage()) ->assertSee(trans('auth.forgot_password.label')) ->click('@forgotPassword') ->waitForLocation('/auth/password') @@ -39,7 +39,7 @@ class ForgotPasswordProcessTest extends BrowserTestCase public function testEmailCarryover() { $this->browse(function (PterodactylBrowser $browser) { - $browser->visit(new LoginPage) + $browser->visit(new LoginPage()) ->type('@username', 'dane@example.com') ->click('@forgotPassword') ->waitForLocation('/auth/password') diff --git a/tests/Browser/Processes/Authentication/LoginProcessTest.php b/tests/Browser/Processes/Authentication/LoginProcessTest.php index bf10fde5..0806cd78 100644 --- a/tests/Browser/Processes/Authentication/LoginProcessTest.php +++ b/tests/Browser/Processes/Authentication/LoginProcessTest.php @@ -27,7 +27,7 @@ class LoginProcessTest extends BrowserTestCase public function testLoginUsingEmail() { $this->browse(function (PterodactylBrowser $browser) { - $browser->visit(new LoginPage) + $browser->visit(new LoginPage()) ->waitFor('@username') ->type('@username', $this->user->email) ->type('@password', self::$userPassword) @@ -44,7 +44,7 @@ class LoginProcessTest extends BrowserTestCase public function testLoginUsingUsername() { $this->browse(function (PterodactylBrowser $browser) { - $browser->visit(new LoginPage) + $browser->visit(new LoginPage()) ->waitFor('@username') ->type('@username', $this->user->username) ->type('@password', self::$userPassword) diff --git a/tests/Browser/Processes/Dashboard/AccountEmailProcessTest.php b/tests/Browser/Processes/Dashboard/AccountEmailProcessTest.php index 311312b2..6efe4ee0 100644 --- a/tests/Browser/Processes/Dashboard/AccountEmailProcessTest.php +++ b/tests/Browser/Processes/Dashboard/AccountEmailProcessTest.php @@ -14,7 +14,7 @@ class AccountEmailProcessTest extends DashboardTestCase { $this->browse(function (PterodactylBrowser $browser) { $browser->loginAs($this->user) - ->visit(new AccountPage) + ->visit(new AccountPage()) ->assertValue('@email', $this->user->email) ->type('@email', 'new.email@example.com') ->type('@password', 'Password123') @@ -34,7 +34,7 @@ class AccountEmailProcessTest extends DashboardTestCase { $this->browse(function (PterodactylBrowser $browser) { $browser->loginAs($this->user) - ->visit(new AccountPage) + ->visit(new AccountPage()) ->assertMissing('@email ~ .input-help.error') ->type('@email', 'admin') ->assertVisible('@email ~ .input-help.error') @@ -51,7 +51,7 @@ class AccountEmailProcessTest extends DashboardTestCase { $this->browse(function (PterodactylBrowser $browser) { $browser->loginAs($this->user) - ->visit(new AccountPage) + ->visit(new AccountPage()) ->type('@email', 'new.email@example.com') ->click('@submit') ->assertFocused('@password') diff --git a/tests/Browser/Processes/Dashboard/AccountPasswordProcessTest.php b/tests/Browser/Processes/Dashboard/AccountPasswordProcessTest.php index 0b5e4878..4b8a5a3b 100644 --- a/tests/Browser/Processes/Dashboard/AccountPasswordProcessTest.php +++ b/tests/Browser/Processes/Dashboard/AccountPasswordProcessTest.php @@ -14,7 +14,7 @@ class AccountPasswordProcessTest extends DashboardTestCase { $this->browse(function (PterodactylBrowser $browser) { $browser->loginAs($this->user) - ->visit(new AccountPage) + ->visit(new AccountPage()) ->type('@current_password', self::$userPassword) ->assertMissing('@new_password ~ .input-help.error') ->type('@new_password', 'test') @@ -42,7 +42,7 @@ class AccountPasswordProcessTest extends DashboardTestCase { $this->browse(function (PterodactylBrowser $browser) { $browser->loginAs($this->user) - ->visit(new AccountPage) + ->visit(new AccountPage()) ->type('@current_password', 'badpassword') ->type('@new_password', 'testtest') ->type('@confirm_password', 'testtest') diff --git a/tests/Browser/Processes/Dashboard/TwoFactorAuthenticationProcessTest.php b/tests/Browser/Processes/Dashboard/TwoFactorAuthenticationProcessTest.php index 26a13048..463286dd 100644 --- a/tests/Browser/Processes/Dashboard/TwoFactorAuthenticationProcessTest.php +++ b/tests/Browser/Processes/Dashboard/TwoFactorAuthenticationProcessTest.php @@ -17,7 +17,7 @@ class TwoFactorAuthenticationProcessTest extends DashboardTestCase { $this->browse(function (PterodactylBrowser $browser) { $browser->loginAs($this->user) - ->visit(new AccountPage) + ->visit(new AccountPage()) ->assertMissing('.modal-mask') ->click('@2fa_button') ->waitFor('@2fa_modal') @@ -42,7 +42,7 @@ class TwoFactorAuthenticationProcessTest extends DashboardTestCase { $this->browse(function (PterodactylBrowser $browser) { $browser->loginAs($this->user) - ->visit(new AccountPage) + ->visit(new AccountPage()) ->click('@2fa_button') ->waitForText(trans('dashboard/account.two_factor.setup.title')) ->assertFocused('@2fa_token') @@ -76,7 +76,7 @@ class TwoFactorAuthenticationProcessTest extends DashboardTestCase */ public function testTwoFactorCanBeDisabled() { - $secret = (new Google2FA)->generateSecretKey(16); + $secret = (new Google2FA())->generateSecretKey(16); $this->user->update([ 'use_totp' => true, @@ -85,7 +85,7 @@ class TwoFactorAuthenticationProcessTest extends DashboardTestCase $this->browse(function (PterodactylBrowser $browser) use ($secret) { $browser->loginAs($this->user) - ->visit(new AccountPage) + ->visit(new AccountPage()) ->click('@2fa_button') ->waitForText(trans('dashboard/account.two_factor.disable.title')) ->click('@2fa_cancel') diff --git a/tests/Browser/PterodactylBrowser.php b/tests/Browser/PterodactylBrowser.php index c7465ff3..9136a6a6 100644 --- a/tests/Browser/PterodactylBrowser.php +++ b/tests/Browser/PterodactylBrowser.php @@ -11,8 +11,6 @@ class PterodactylBrowser extends Browser /** * Move the mouse to a specific location and then perform a left click action. * - * @param int $x - * @param int $y * @return $this */ public function clickPosition(int $x, int $y) @@ -26,6 +24,7 @@ class PterodactylBrowser extends Browser * Perform a case insensitive search for a string in the body. * * @param string $text + * * @return \Pterodactyl\Tests\Browser\PterodactylBrowser */ public function assertSee($text) @@ -38,6 +37,7 @@ class PterodactylBrowser extends Browser * * @param string $selector * @param string $text + * * @return \Pterodactyl\Tests\Browser\PterodactylBrowser */ public function assertSeeIn($selector, $text) diff --git a/tests/Integration/Api/Application/ApplicationApiIntegrationTestCase.php b/tests/Integration/Api/Application/ApplicationApiIntegrationTestCase.php index 18d217fe..daca1728 100644 --- a/tests/Integration/Api/Application/ApplicationApiIntegrationTestCase.php +++ b/tests/Integration/Api/Application/ApplicationApiIntegrationTestCase.php @@ -15,7 +15,9 @@ use Pterodactyl\Tests\Traits\Http\IntegrationJsonRequestAssertions; abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase { - use CreatesTestModels, DatabaseTransactions, IntegrationJsonRequestAssertions; + use CreatesTestModels; + use DatabaseTransactions; + use IntegrationJsonRequestAssertions; /** * @var \Pterodactyl\Models\ApiKey @@ -44,17 +46,11 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase $this->withMiddleware('api..key:' . ApiKey::TYPE_APPLICATION); } - /** - * @return \Pterodactyl\Models\User - */ public function getApiUser(): User { return $this->user; } - /** - * @return \Pterodactyl\Models\ApiKey - */ public function getApiKey(): ApiKey { return $this->key; @@ -62,10 +58,6 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase /** * Creates a new default API key and refreshes the headers using it. - * - * @param \Pterodactyl\Models\User $user - * @param array $permissions - * @return \Pterodactyl\Models\ApiKey */ protected function createNewDefaultApiKey(User $user, array $permissions = []): ApiKey { @@ -77,8 +69,6 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase /** * Refresh the authorization header for a request to use a different API key. - * - * @param \Pterodactyl\Models\ApiKey $key */ protected function refreshHeaders(ApiKey $key) { @@ -87,8 +77,6 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase /** * Create an administrative user. - * - * @return \Pterodactyl\Models\User */ protected function createApiUser(): User { @@ -99,10 +87,6 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase /** * Create a new application API key for a given user model. - * - * @param \Pterodactyl\Models\User $user - * @param array $permissions - * @return \Pterodactyl\Models\ApiKey */ protected function createApiKey(User $user, array $permissions = []): ApiKey { @@ -123,9 +107,6 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase /** * Return a transformer that can be used for testing purposes. - * - * @param string $abstract - * @return \Pterodactyl\Transformers\Api\Application\BaseTransformer */ protected function getTransformer(string $abstract): BaseTransformer { diff --git a/tests/Integration/Api/Application/Nests/EggControllerTest.php b/tests/Integration/Api/Application/Nests/EggControllerTest.php index f9b42dae..584a6452 100644 --- a/tests/Integration/Api/Application/Nests/EggControllerTest.php +++ b/tests/Integration/Api/Application/Nests/EggControllerTest.php @@ -61,7 +61,9 @@ class EggControllerTest extends ApplicationApiIntegrationTestCase $expected = json_encode(Arr::sortRecursive($datum['attributes'])); $actual = json_encode(Arr::sortRecursive($this->getTransformer(EggTransformer::class)->transform($egg))); - $this->assertSame($expected, $actual, + $this->assertSame( + $expected, + $actual, 'Unable to find JSON fragment: ' . PHP_EOL . PHP_EOL . "[{$expected}]" . PHP_EOL . PHP_EOL . 'within' . PHP_EOL . PHP_EOL . "[{$actual}]." ); } diff --git a/tests/Integration/Api/Application/Users/UserControllerTest.php b/tests/Integration/Api/Application/Users/UserControllerTest.php index 9d600132..00b09158 100644 --- a/tests/Integration/Api/Application/Users/UserControllerTest.php +++ b/tests/Integration/Api/Application/Users/UserControllerTest.php @@ -292,9 +292,6 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase * Test that an API key without write permissions cannot create, update, or * delete a user model. * - * @param string $method - * @param string $url - * * @dataProvider userWriteEndpointsDataProvider */ public function testApiKeyWithoutWritePermissions(string $method, string $url) @@ -313,8 +310,6 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase /** * Endpoints that should return a 403 error when the key does not have write * permissions for user management. - * - * @return array */ public function userWriteEndpointsDataProvider(): array { diff --git a/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php b/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php index 2cce8661..30667d51 100644 --- a/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php +++ b/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php @@ -44,6 +44,7 @@ abstract class ClientApiIntegrationTestCase extends IntegrationTestCase * to keep re-assigning variables. * * @param \Illuminate\Http\Response $response + * * @return \Illuminate\Testing\TestResponse */ protected function createTestResponse($response) @@ -54,10 +55,8 @@ abstract class ClientApiIntegrationTestCase extends IntegrationTestCase /** * Returns a link to the specific resource using the client API. * - * @param mixed $model + * @param mixed $model * @param string|null $append - * - * @return string */ protected function link($model, $append = null): string { @@ -87,8 +86,6 @@ abstract class ClientApiIntegrationTestCase extends IntegrationTestCase * is assumed that the user is actually a subuser of the server. * * @param string[] $permissions - * - * @return array */ protected function generateTestAccount(array $permissions = []): array { @@ -115,7 +112,6 @@ abstract class ClientApiIntegrationTestCase extends IntegrationTestCase * Asserts that the data passed through matches the output of the data from the transformer. This * will remove the "relationships" key when performing the comparison. * - * @param array $data * @param \Pterodactyl\Models\Model|\Illuminate\Database\Eloquent\Model $model */ protected function assertJsonTransformedWith(array $data, $model) @@ -123,7 +119,7 @@ abstract class ClientApiIntegrationTestCase extends IntegrationTestCase $reflect = new ReflectionClass($model); $transformer = sprintf('\\Pterodactyl\\Transformers\\Api\\Client\\%sTransformer', $reflect->getShortName()); - $transformer = new $transformer; + $transformer = new $transformer(); $this->assertInstanceOf(BaseClientTransformer::class, $transformer); $this->assertSame( diff --git a/tests/Integration/Api/Client/Server/Allocation/AllocationAuthorizationTest.php b/tests/Integration/Api/Client/Server/Allocation/AllocationAuthorizationTest.php index 3b54e400..b698d8c7 100644 --- a/tests/Integration/Api/Client/Server/Allocation/AllocationAuthorizationTest.php +++ b/tests/Integration/Api/Client/Server/Allocation/AllocationAuthorizationTest.php @@ -9,8 +9,6 @@ use Pterodactyl\Tests\Integration\Api\Client\ClientApiIntegrationTestCase; class AllocationAuthorizationTest extends ClientApiIntegrationTestCase { /** - * @param string $method - * @param string $endpoint * @dataProvider methodDataProvider */ public function testAccessToAServersAllocationsIsRestrictedProperly(string $method, string $endpoint) diff --git a/tests/Integration/Api/Client/Server/Allocation/CreateNewAllocationTest.php b/tests/Integration/Api/Client/Server/Allocation/CreateNewAllocationTest.php index 8793d421..6b8da404 100644 --- a/tests/Integration/Api/Client/Server/Allocation/CreateNewAllocationTest.php +++ b/tests/Integration/Api/Client/Server/Allocation/CreateNewAllocationTest.php @@ -24,7 +24,6 @@ class CreateNewAllocationTest extends ClientApiIntegrationTestCase /** * Tests that a new allocation can be properly assigned to a server. * - * @param array $permission * @dataProvider permissionDataProvider */ public function testNewAllocationCanBeAssignedToServer(array $permission) diff --git a/tests/Integration/Api/Client/Server/Allocation/DeleteAllocationTest.php b/tests/Integration/Api/Client/Server/Allocation/DeleteAllocationTest.php index 36575503..c986de78 100644 --- a/tests/Integration/Api/Client/Server/Allocation/DeleteAllocationTest.php +++ b/tests/Integration/Api/Client/Server/Allocation/DeleteAllocationTest.php @@ -13,7 +13,6 @@ class DeleteAllocationTest extends ClientApiIntegrationTestCase * Test that an allocation is deleted from the server and the notes are properly reset * to an empty value on assignment. * - * @param array $permission * @dataProvider permissionDataProvider */ public function testAllocationCanBeDeletedFromServer(array $permission) diff --git a/tests/Integration/Api/Client/Server/Backup/BackupAuthorizationTest.php b/tests/Integration/Api/Client/Server/Backup/BackupAuthorizationTest.php index f44209b2..aaaf38a6 100644 --- a/tests/Integration/Api/Client/Server/Backup/BackupAuthorizationTest.php +++ b/tests/Integration/Api/Client/Server/Backup/BackupAuthorizationTest.php @@ -12,8 +12,6 @@ use Pterodactyl\Tests\Integration\Api\Client\ClientApiIntegrationTestCase; class BackupAuthorizationTest extends ClientApiIntegrationTestCase { /** - * @param string $method - * @param string $endpoint * @dataProvider methodDataProvider */ public function testAccessToAServersBackupIsRestrictedProperly(string $method, string $endpoint) diff --git a/tests/Integration/Api/Client/Server/CommandControllerTest.php b/tests/Integration/Api/Client/Server/CommandControllerTest.php index f3e9df7b..d6010b67 100644 --- a/tests/Integration/Api/Client/Server/CommandControllerTest.php +++ b/tests/Integration/Api/Client/Server/CommandControllerTest.php @@ -69,7 +69,7 @@ class CommandControllerTest extends ClientApiIntegrationTestCase $this->repository->expects('setServer')->with(Mockery::on(function ($value) use ($server) { return $value->uuid === $server->uuid; }))->andReturnSelf(); - $this->repository->expects('send')->with('say Test')->andReturn(new GuzzleResponse); + $this->repository->expects('send')->with('say Test')->andReturn(new GuzzleResponse()); $response = $this->actingAs($user)->postJson("/api/client/servers/{$server->uuid}/command", [ 'command' => 'say Test', diff --git a/tests/Integration/Api/Client/Server/Database/DatabaseAuthorizationTest.php b/tests/Integration/Api/Client/Server/Database/DatabaseAuthorizationTest.php index dbc78522..d7063ea3 100644 --- a/tests/Integration/Api/Client/Server/Database/DatabaseAuthorizationTest.php +++ b/tests/Integration/Api/Client/Server/Database/DatabaseAuthorizationTest.php @@ -14,8 +14,6 @@ use Pterodactyl\Tests\Integration\Api\Client\ClientApiIntegrationTestCase; class DatabaseAuthorizationTest extends ClientApiIntegrationTestCase { /** - * @param string $method - * @param string $endpoint * @dataProvider methodDataProvider */ public function testAccessToAServersDatabasesIsRestrictedProperly(string $method, string $endpoint) diff --git a/tests/Integration/Api/Client/Server/NetworkAllocationControllerTest.php b/tests/Integration/Api/Client/Server/NetworkAllocationControllerTest.php index a6df3508..9741af97 100644 --- a/tests/Integration/Api/Client/Server/NetworkAllocationControllerTest.php +++ b/tests/Integration/Api/Client/Server/NetworkAllocationControllerTest.php @@ -49,7 +49,6 @@ class NetworkAllocationControllerTest extends ClientApiIntegrationTestCase /** * Tests that notes on an allocation can be set correctly. * - * @param array $permissions * @dataProvider updatePermissionsDataProvider */ public function testAllocationNotesCanBeUpdated(array $permissions) @@ -98,7 +97,6 @@ class NetworkAllocationControllerTest extends ClientApiIntegrationTestCase } /** - * @param array $permissions * @dataProvider updatePermissionsDataProvider */ public function testPrimaryAllocationCanBeModified(array $permissions) diff --git a/tests/Integration/Api/Client/Server/PowerControllerTest.php b/tests/Integration/Api/Client/Server/PowerControllerTest.php index 96911cf3..6aed481a 100644 --- a/tests/Integration/Api/Client/Server/PowerControllerTest.php +++ b/tests/Integration/Api/Client/Server/PowerControllerTest.php @@ -15,7 +15,6 @@ class PowerControllerTest extends ClientApiIntegrationTestCase * an error in response. This checks against the specific permission needed to send * the command to the server. * - * @param string $action * @param string[] $permissions * @dataProvider invalidPermissionDataProvider */ @@ -47,8 +46,6 @@ class PowerControllerTest extends ClientApiIntegrationTestCase /** * Test that sending a valid power actions works. * - * @param string $action - * @param string $permission * @dataProvider validPowerActionDataProvider */ public function testActionCanBeSentToServer(string $action, string $permission) @@ -74,8 +71,6 @@ class PowerControllerTest extends ClientApiIntegrationTestCase /** * Returns invalid permission combinations for a given power action. - * - * @return array */ public function invalidPermissionDataProvider(): array { @@ -88,9 +83,6 @@ class PowerControllerTest extends ClientApiIntegrationTestCase ]; } - /** - * @return array - */ public function validPowerActionDataProvider(): array { return [ diff --git a/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php b/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php index 6c6f9f85..cde99b09 100644 --- a/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php @@ -90,9 +90,6 @@ class CreateServerScheduleTest extends ClientApiIntegrationTestCase ->assertForbidden(); } - /** - * @return array - */ public function permissionsDataProvider(): array { return [[[]], [[Permission::ACTION_SCHEDULE_CREATE]]]; diff --git a/tests/Integration/Api/Client/Server/Schedule/DeleteServerScheduleTest.php b/tests/Integration/Api/Client/Server/Schedule/DeleteServerScheduleTest.php index cf41dc5e..25f27411 100644 --- a/tests/Integration/Api/Client/Server/Schedule/DeleteServerScheduleTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/DeleteServerScheduleTest.php @@ -78,9 +78,6 @@ class DeleteServerScheduleTest extends ClientApiIntegrationTestCase $this->assertDatabaseHas('schedules', ['id' => $schedule->id]); } - /** - * @return array - */ public function permissionsDataProvider(): array { return [[[]], [[Permission::ACTION_SCHEDULE_DELETE]]]; diff --git a/tests/Integration/Api/Client/Server/Schedule/ExecuteScheduleTest.php b/tests/Integration/Api/Client/Server/Schedule/ExecuteScheduleTest.php index fc9c7c73..7c9d34d1 100644 --- a/tests/Integration/Api/Client/Server/Schedule/ExecuteScheduleTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/ExecuteScheduleTest.php @@ -15,7 +15,6 @@ class ExecuteScheduleTest extends ClientApiIntegrationTestCase /** * Test that a schedule can be executed and is updated in the database correctly. * - * @param array $permissions * @dataProvider permissionsDataProvider */ public function testScheduleIsExecutedRightAway(array $permissions) @@ -85,9 +84,6 @@ class ExecuteScheduleTest extends ClientApiIntegrationTestCase $this->actingAs($user)->postJson($this->link($schedule, '/execute'))->assertForbidden(); } - /** - * @return array - */ public function permissionsDataProvider(): array { return [[[]], [[Permission::ACTION_SCHEDULE_UPDATE]]]; diff --git a/tests/Integration/Api/Client/Server/Schedule/GetServerSchedulesTest.php b/tests/Integration/Api/Client/Server/Schedule/GetServerSchedulesTest.php index 9ee44061..45ae9268 100644 --- a/tests/Integration/Api/Client/Server/Schedule/GetServerSchedulesTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/GetServerSchedulesTest.php @@ -24,7 +24,7 @@ class GetServerSchedulesTest extends ClientApiIntegrationTestCase * Test that schedules for a server are returned. * * @param array $permissions - * @param bool $individual + * @param bool $individual * @dataProvider permissionsDataProvider */ public function testServerSchedulesAreReturned($permissions, $individual) @@ -45,7 +45,7 @@ class GetServerSchedulesTest extends ClientApiIntegrationTestCase ->assertOk(); $prefix = $individual ? '' : 'data.0.'; - if (! $individual) { + if (!$individual) { $response->assertJsonCount(1, 'data'); } @@ -91,9 +91,6 @@ class GetServerSchedulesTest extends ClientApiIntegrationTestCase ->assertForbidden(); } - /** - * @return array - */ public function permissionsDataProvider(): array { return [ diff --git a/tests/Integration/Api/Client/Server/Schedule/ScheduleAuthorizationTest.php b/tests/Integration/Api/Client/Server/Schedule/ScheduleAuthorizationTest.php index 49f0e991..223e9a67 100644 --- a/tests/Integration/Api/Client/Server/Schedule/ScheduleAuthorizationTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/ScheduleAuthorizationTest.php @@ -17,8 +17,6 @@ class ScheduleAuthorizationTest extends ClientApiIntegrationTestCase * The comments within the test code itself are better at explaining exactly what is * being tested and protected against. * - * @param string $method - * @param string $endpoint * @dataProvider methodDataProvider */ public function testAccessToAServersSchedulesIsRestrictedProperly(string $method, string $endpoint) diff --git a/tests/Integration/Api/Client/Server/Schedule/UpdateServerScheduleTest.php b/tests/Integration/Api/Client/Server/Schedule/UpdateServerScheduleTest.php index b1e6e79f..e99486d4 100644 --- a/tests/Integration/Api/Client/Server/Schedule/UpdateServerScheduleTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/UpdateServerScheduleTest.php @@ -112,9 +112,6 @@ class UpdateServerScheduleTest extends ClientApiIntegrationTestCase $this->assertFalse($schedule->is_processing); } - /** - * @return array - */ public function permissionsDataProvider(): array { return [[[]], [[Permission::ACTION_SCHEDULE_UPDATE]]]; diff --git a/tests/Integration/Api/Client/Server/ScheduleTask/CreateServerScheduleTaskTest.php b/tests/Integration/Api/Client/Server/ScheduleTask/CreateServerScheduleTaskTest.php index 959cf7dd..6add744c 100644 --- a/tests/Integration/Api/Client/Server/ScheduleTask/CreateServerScheduleTaskTest.php +++ b/tests/Integration/Api/Client/Server/ScheduleTask/CreateServerScheduleTaskTest.php @@ -167,9 +167,6 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase ->assertForbidden(); } - /** - * @return array - */ public function permissionsDataProvider(): array { return [[[]], [[Permission::ACTION_SCHEDULE_UPDATE]]]; diff --git a/tests/Integration/Api/Client/Server/SettingsControllerTest.php b/tests/Integration/Api/Client/Server/SettingsControllerTest.php index 44a850a7..87ae1eb4 100644 --- a/tests/Integration/Api/Client/Server/SettingsControllerTest.php +++ b/tests/Integration/Api/Client/Server/SettingsControllerTest.php @@ -110,17 +110,11 @@ class SettingsControllerTest extends ClientApiIntegrationTestCase $this->assertSame(Server::STATUS_INSTALLED, $server->installed); } - /** - * @return array - */ public function renamePermissionsDataProvider(): array { return [[[]], [[Permission::ACTION_SETTINGS_RENAME]]]; } - /** - * @return array - */ public function reinstallPermissionsDataProvider(): array { return [[[]], [[Permission::ACTION_SETTINGS_REINSTALL]]]; diff --git a/tests/Integration/Api/Client/Server/Startup/UpdateStartupVariableTest.php b/tests/Integration/Api/Client/Server/Startup/UpdateStartupVariableTest.php index 7f40fb5b..0e5e421c 100644 --- a/tests/Integration/Api/Client/Server/Startup/UpdateStartupVariableTest.php +++ b/tests/Integration/Api/Client/Server/Startup/UpdateStartupVariableTest.php @@ -49,7 +49,6 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase * Test that variables that are either not user_viewable, or not user_editable, cannot be * updated via this endpoint. * - * @param array $permissions * @dataProvider permissionsDataProvider */ public function testStartupVariableCannotBeUpdatedIfNotUserViewableOrEditable(array $permissions) diff --git a/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php b/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php index d01bbd05..94c9b17e 100644 --- a/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php +++ b/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php @@ -156,9 +156,6 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase $response->assertJsonPath('errors.0.detail', 'A user with that email address is already assigned as a subuser for this server.'); } - /** - * @return array - */ public function permissionsDataProvider(): array { return [[[]], [[Permission::ACTION_USER_CREATE]]]; diff --git a/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php b/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php index 0e55cc80..f95e06f7 100644 --- a/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php +++ b/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php @@ -13,7 +13,6 @@ class SubuserAuthorizationTest extends ClientApiIntegrationTestCase /** * Test that mismatched subusers are not accessible to a server. * - * @param string $method * @dataProvider methodDataProvider */ public function testUserCannotAccessResourceBelongingToOtherServers(string $method) diff --git a/tests/Integration/Api/Client/Server/WebsocketControllerTest.php b/tests/Integration/Api/Client/Server/WebsocketControllerTest.php index aa01ae6d..d6c2119b 100644 --- a/tests/Integration/Api/Client/Server/WebsocketControllerTest.php +++ b/tests/Integration/Api/Client/Server/WebsocketControllerTest.php @@ -50,8 +50,8 @@ class WebsocketControllerTest extends ClientApiIntegrationTestCase $this->assertStringStartsWith('wss://', $connection, 'Failed asserting that websocket connection address has expected "wss://" prefix.'); $this->assertStringEndsWith("/api/servers/{$server->uuid}/ws", $connection, 'Failed asserting that websocket connection address uses expected Wings endpoint.'); - $config = Configuration::forSymmetricSigner(new Sha256, $key = InMemory::plainText($server->node->getDecryptedKey())); - $config->setValidationConstraints(new SignedWith(new Sha256, $key)); + $config = Configuration::forSymmetricSigner(new Sha256(), $key = InMemory::plainText($server->node->getDecryptedKey())); + $config->setValidationConstraints(new SignedWith(new Sha256(), $key)); /** @var \Lcobucci\JWT\Token\Plain $token */ $token = $config->parser()->parse($response->json('data.token')); @@ -95,8 +95,8 @@ class WebsocketControllerTest extends ClientApiIntegrationTestCase $response->assertOk(); $response->assertJsonStructure(['data' => ['token', 'socket']]); - $config = Configuration::forSymmetricSigner(new Sha256, $key = InMemory::plainText($server->node->getDecryptedKey())); - $config->setValidationConstraints(new SignedWith(new Sha256, $key)); + $config = Configuration::forSymmetricSigner(new Sha256(), $key = InMemory::plainText($server->node->getDecryptedKey())); + $config->setValidationConstraints(new SignedWith(new Sha256(), $key)); /** @var \Lcobucci\JWT\Token\Plain $token */ $token = $config->parser()->parse($response->json('data.token')); diff --git a/tests/Integration/Api/Client/TwoFactorControllerTest.php b/tests/Integration/Api/Client/TwoFactorControllerTest.php index fe62d6ff..8af7e31a 100644 --- a/tests/Integration/Api/Client/TwoFactorControllerTest.php +++ b/tests/Integration/Api/Client/TwoFactorControllerTest.php @@ -111,9 +111,7 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase } } - throw new ExpectationFailedException( - sprintf('Failed asserting that token [%s] exists as a hashed value in recovery_tokens table.', $raw) - ); + throw new ExpectationFailedException(sprintf('Failed asserting that token [%s] exists as a hashed value in recovery_tokens table.', $raw)); } } diff --git a/tests/Integration/IntegrationTestCase.php b/tests/Integration/IntegrationTestCase.php index cf3f33a9..f12eaaef 100644 --- a/tests/Integration/IntegrationTestCase.php +++ b/tests/Integration/IntegrationTestCase.php @@ -36,9 +36,6 @@ abstract class IntegrationTestCase extends TestCase /** * Return an ISO-8601 formatted timestamp to use in the API response. - * - * @param string $timestamp - * @return string */ protected function formatTimestamp(string $timestamp): string { diff --git a/tests/Integration/Services/Allocations/FindAssignableAllocationServiceTest.php b/tests/Integration/Services/Allocations/FindAssignableAllocationServiceTest.php index 84d91fa9..c3b88e2c 100644 --- a/tests/Integration/Services/Allocations/FindAssignableAllocationServiceTest.php +++ b/tests/Integration/Services/Allocations/FindAssignableAllocationServiceTest.php @@ -92,7 +92,7 @@ class FindAssignableAllocationServiceTest extends IntegrationTestCase config()->set('pterodactyl.client_features.allocations.range_start', 5000); config()->set('pterodactyl.client_features.allocations.range_end', 5005); - for ($i = 5000; $i <= 5005; $i++) { + for ($i = 5000; $i <= 5005; ++$i) { Allocation::factory()->create([ 'ip' => $server->allocation->ip, 'port' => $i, diff --git a/tests/Integration/Services/Databases/DatabaseManagementServiceTest.php b/tests/Integration/Services/Databases/DatabaseManagementServiceTest.php index 5759a116..e354e029 100644 --- a/tests/Integration/Services/Databases/DatabaseManagementServiceTest.php +++ b/tests/Integration/Services/Databases/DatabaseManagementServiceTest.php @@ -184,9 +184,9 @@ class DatabaseManagementServiceTest extends IntegrationTestCase $host = DatabaseHost::factory()->create(['node_id' => $server->node_id]); - $this->repository->expects('createDatabase')->with($name)->andThrows(new BadMethodCallException); + $this->repository->expects('createDatabase')->with($name)->andThrows(new BadMethodCallException()); $this->repository->expects('dropDatabase')->with($name); - $this->repository->expects('dropUser')->withAnyArgs()->andThrows(new InvalidArgumentException); + $this->repository->expects('dropUser')->withAnyArgs()->andThrows(new InvalidArgumentException()); $this->expectException(BadMethodCallException::class); @@ -199,9 +199,6 @@ class DatabaseManagementServiceTest extends IntegrationTestCase $this->assertDatabaseMissing('databases', ['server_id' => $server->id]); } - /** - * @return array - */ public function invalidDataDataProvider(): array { return [ diff --git a/tests/Integration/Services/Databases/DeployServerDatabaseServiceTest.php b/tests/Integration/Services/Databases/DeployServerDatabaseServiceTest.php index cc2aa662..2d471957 100644 --- a/tests/Integration/Services/Databases/DeployServerDatabaseServiceTest.php +++ b/tests/Integration/Services/Databases/DeployServerDatabaseServiceTest.php @@ -107,7 +107,7 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase 'database_host_id' => $host->id, 'database' => "s{$server->id}_something", 'remote' => '%', - ])->andReturns(new Database); + ])->andReturns(new Database()); $response = $this->getService()->handle($server, [ 'database' => 'something', @@ -133,7 +133,7 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase 'database_host_id' => $host->id, 'database' => "s{$server->id}_something", 'remote' => '%', - ])->andReturns(new Database); + ])->andReturns(new Database()); $response = $this->getService()->handle($server, [ 'database' => 'something', @@ -143,9 +143,6 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase $this->assertInstanceOf(Database::class, $response); } - /** - * @return array - */ public function invalidDataProvider(): array { return [ diff --git a/tests/Integration/Services/Schedules/ProcessScheduleServiceTest.php b/tests/Integration/Services/Schedules/ProcessScheduleServiceTest.php index d8cd6d1a..e5dd9e23 100644 --- a/tests/Integration/Services/Schedules/ProcessScheduleServiceTest.php +++ b/tests/Integration/Services/Schedules/ProcessScheduleServiceTest.php @@ -151,9 +151,6 @@ class ProcessScheduleServiceTest extends IntegrationTestCase $this->assertDatabaseHas('tasks', ['id' => $task->id, 'is_queued' => false]); } - /** - * @return array - */ public function dispatchNowDataProvider(): array { return [[true], [false]]; diff --git a/tests/Integration/Services/Servers/ServerDeletionServiceTest.php b/tests/Integration/Services/Servers/ServerDeletionServiceTest.php index 562e86f2..197e6b38 100644 --- a/tests/Integration/Services/Servers/ServerDeletionServiceTest.php +++ b/tests/Integration/Services/Servers/ServerDeletionServiceTest.php @@ -66,7 +66,7 @@ class ServerDeletionServiceTest extends IntegrationTestCase $this->expectException(DaemonConnectionException::class); $this->daemonServerRepository->expects('setServer->delete')->withNoArgs()->andThrows( - new DaemonConnectionException(new BadResponseException('Bad request', new Request('GET', '/test'), new Response)) + new DaemonConnectionException(new BadResponseException('Bad request', new Request('GET', '/test'), new Response())) ); $this->getService()->handle($server); @@ -124,7 +124,7 @@ class ServerDeletionServiceTest extends IntegrationTestCase $this->daemonServerRepository->expects('setServer->delete')->withNoArgs()->andReturnUndefined(); $this->databaseManagementService->expects('delete')->with(Mockery::on(function ($value) use ($db) { return $value instanceof Database && $value->id === $db->id; - }))->andThrows(new Exception); + }))->andThrows(new Exception()); $this->expectException(Exception::class); $this->getService()->handle($server); @@ -149,7 +149,7 @@ class ServerDeletionServiceTest extends IntegrationTestCase $this->daemonServerRepository->expects('setServer->delete')->withNoArgs()->andReturnUndefined(); $this->databaseManagementService->expects('delete')->with(Mockery::on(function ($value) use ($db) { return $value instanceof Database && $value->id === $db->id; - }))->andThrows(new Exception); + }))->andThrows(new Exception()); $this->getService()->withForce(true)->handle($server); diff --git a/tests/Integration/TestResponse.php b/tests/Integration/TestResponse.php index a812f37b..2185598c 100644 --- a/tests/Integration/TestResponse.php +++ b/tests/Integration/TestResponse.php @@ -15,6 +15,7 @@ class TestResponse extends IlluminateTestResponse * look for that status response. * * @param int $status + * * @return \Pterodactyl\Tests\Integration\TestResponse */ public function assertStatus($status) @@ -25,7 +26,7 @@ class TestResponse extends IlluminateTestResponse // to fail so that debugging isn't such a nightmare. if ($actual !== $status && $status !== 500) { $this->dump(); - if (! is_null($this->exception) && ! $this->exception instanceof DisplayException && ! $this->exception instanceof ValidationException) { + if (!is_null($this->exception) && !$this->exception instanceof DisplayException && !$this->exception instanceof ValidationException) { dump($this->exception); } } diff --git a/tests/Traits/Http/IntegrationJsonRequestAssertions.php b/tests/Traits/Http/IntegrationJsonRequestAssertions.php index f01b7716..e26235a9 100644 --- a/tests/Traits/Http/IntegrationJsonRequestAssertions.php +++ b/tests/Traits/Http/IntegrationJsonRequestAssertions.php @@ -9,8 +9,6 @@ trait IntegrationJsonRequestAssertions { /** * Make assertions about a 404 response on the API. - * - * @param \Illuminate\Testing\TestResponse $response */ public function assertNotFoundJson(TestResponse $response) { @@ -30,8 +28,6 @@ trait IntegrationJsonRequestAssertions /** * Make assertions about a 403 error returned by the API. - * - * @param \Illuminate\Testing\TestResponse $response */ public function assertAccessDeniedJson(TestResponse $response) { diff --git a/tests/Traits/Http/RequestMockHelpers.php b/tests/Traits/Http/RequestMockHelpers.php index 98ecdd39..668d809e 100644 --- a/tests/Traits/Http/RequestMockHelpers.php +++ b/tests/Traits/Http/RequestMockHelpers.php @@ -22,8 +22,6 @@ trait RequestMockHelpers /** * Set the class to mock for requests. - * - * @param string $class */ public function setRequestMockClass(string $class) { @@ -34,8 +32,6 @@ trait RequestMockHelpers /** * Configure the user model that the request mock should return with. - * - * @param \Pterodactyl\Models\User|null $user */ public function setRequestUserModel(User $user = null) { @@ -44,9 +40,6 @@ trait RequestMockHelpers /** * Generates a new request user model and also returns the generated model. - * - * @param array $args - * @return \Pterodactyl\Models\User */ public function generateRequestUserModel(array $args = []): User { @@ -59,8 +52,7 @@ trait RequestMockHelpers /** * Set a request attribute on the mock object. * - * @param string $attribute - * @param mixed $value + * @param mixed $value */ public function setRequestAttribute(string $attribute, $value) { @@ -69,8 +61,6 @@ trait RequestMockHelpers /** * Set the request route name. - * - * @param string $name */ public function setRequestRouteName(string $name) { @@ -83,7 +73,7 @@ trait RequestMockHelpers protected function buildRequestMock() { $this->request = m::mock($this->requestMockClass); - if (! $this->request instanceof Request) { + if (!$this->request instanceof Request) { throw new InvalidArgumentException('Request mock class must be an instance of ' . Request::class . ' when mocked.'); } @@ -94,8 +84,6 @@ trait RequestMockHelpers * Sets the mocked request user. If a user model is not provided, a factory model * will be created and returned. * - * @param \Pterodactyl\Models\User|null $user - * @return \Pterodactyl\Models\User * @deprecated */ protected function setRequestUser(User $user = null): User diff --git a/tests/Traits/Integration/CreatesTestModels.php b/tests/Traits/Integration/CreatesTestModels.php index 18326e50..bafa9baa 100644 --- a/tests/Traits/Integration/CreatesTestModels.php +++ b/tests/Traits/Integration/CreatesTestModels.php @@ -20,8 +20,6 @@ trait CreatesTestModels * * The returned server model will have all of the relationships loaded onto it. * - * @param array $attributes - * * @return \Pterodactyl\Models\Server */ public function createServerModel(array $attributes = []) @@ -30,14 +28,14 @@ trait CreatesTestModels $attributes['owner_id'] = $attributes['user_id']; } - if (! isset($attributes['owner_id'])) { + if (!isset($attributes['owner_id'])) { /** @var \Pterodactyl\Models\User $user */ $user = User::factory()->create(); $attributes['owner_id'] = $user->id; } - if (! isset($attributes['node_id'])) { - if (! isset($attributes['location_id'])) { + if (!isset($attributes['node_id'])) { + if (!isset($attributes['location_id'])) { /** @var \Pterodactyl\Models\Location $location */ $location = Location::factory()->create(); $attributes['location_id'] = $location->id; @@ -48,23 +46,23 @@ trait CreatesTestModels $attributes['node_id'] = $node->id; } - if (! isset($attributes['allocation_id'])) { + if (!isset($attributes['allocation_id'])) { /** @var \Pterodactyl\Models\Allocation $allocation */ $allocation = Allocation::factory()->create(['node_id' => $attributes['node_id']]); $attributes['allocation_id'] = $allocation->id; } - if (! isset($attributes['nest_id'])) { + if (!isset($attributes['nest_id'])) { /** @var \Pterodactyl\Models\Nest $nest */ $nest = Nest::with('eggs')->first(); $attributes['nest_id'] = $nest->id; - if (! isset($attributes['egg_id'])) { + if (!isset($attributes['egg_id'])) { $attributes['egg_id'] = $nest->getRelation('eggs')->first()->id; } } - if (! isset($attributes['egg_id'])) { + if (!isset($attributes['egg_id'])) { /** @var \Pterodactyl\Models\Egg $egg */ $egg = Egg::where('nest_id', $attributes['nest_id'])->first(); $attributes['egg_id'] = $egg->id; @@ -85,9 +83,6 @@ trait CreatesTestModels /** * Clones a given egg allowing us to make modifications that don't affect other * tests that rely on the egg existing in the correct state. - * - * @param \Pterodactyl\Models\Egg $egg - * @return \Pterodactyl\Models\Egg */ protected function cloneEggAndVariables(Egg $egg): Egg { diff --git a/tests/Traits/MocksPdoConnection.php b/tests/Traits/MocksPdoConnection.php index 2d3813a6..c7fe8cdd 100644 --- a/tests/Traits/MocksPdoConnection.php +++ b/tests/Traits/MocksPdoConnection.php @@ -41,7 +41,7 @@ trait MocksPdoConnection */ protected function tearDownPdoMock() { - if (! self::$initialResolver) { + if (!self::$initialResolver) { return; } diff --git a/tests/Traits/MocksRequestException.php b/tests/Traits/MocksRequestException.php index 5efffcde..69c04913 100644 --- a/tests/Traits/MocksRequestException.php +++ b/tests/Traits/MocksRequestException.php @@ -22,8 +22,7 @@ trait MocksRequestException * Configure the exception mock to work with the Panel's default exception * handler actions. * - * @param string $abstract - * @param null $response + * @param null $response */ protected function configureExceptionMock(string $abstract = RequestException::class, $response = null) { @@ -32,9 +31,6 @@ trait MocksRequestException /** * Return a mocked instance of the request exception. - * - * @param string $abstract - * @return \Mockery\MockInterface */ protected function getExceptionMock(string $abstract = RequestException::class): MockInterface { diff --git a/tests/Traits/MocksUuids.php b/tests/Traits/MocksUuids.php index ef0ed36d..0a84fce1 100644 --- a/tests/Traits/MocksUuids.php +++ b/tests/Traits/MocksUuids.php @@ -37,8 +37,6 @@ trait MocksUuids /** * Returns the known UUID for tests to use. - * - * @return string */ public function getKnownUuid(): string { diff --git a/tests/Unit/Http/Middleware/AdminAuthenticateTest.php b/tests/Unit/Http/Middleware/AdminAuthenticateTest.php index 8e63ff09..75fb2280 100644 --- a/tests/Unit/Http/Middleware/AdminAuthenticateTest.php +++ b/tests/Unit/Http/Middleware/AdminAuthenticateTest.php @@ -48,8 +48,6 @@ class AdminAuthenticateTest extends MiddlewareTestCase /** * Return an instance of the middleware using mocked dependencies. - * - * @return \Pterodactyl\Http\Middleware\AdminAuthenticate */ private function getMiddleware(): AdminAuthenticate { diff --git a/tests/Unit/Http/Middleware/Api/Application/AuthenticateUserTest.php b/tests/Unit/Http/Middleware/Api/Application/AuthenticateUserTest.php index fa2e7b01..8ba4c75f 100644 --- a/tests/Unit/Http/Middleware/Api/Application/AuthenticateUserTest.php +++ b/tests/Unit/Http/Middleware/Api/Application/AuthenticateUserTest.php @@ -44,11 +44,9 @@ class AuthenticateUserTest extends MiddlewareTestCase /** * Return an instance of the middleware for testing. - * - * @return \Pterodactyl\Http\Middleware\Api\Application\AuthenticateApplicationUser */ private function getMiddleware(): AuthenticateApplicationUser { - return new AuthenticateApplicationUser; + return new AuthenticateApplicationUser(); } } diff --git a/tests/Unit/Http/Middleware/Api/AuthenticateIPAccessTest.php b/tests/Unit/Http/Middleware/Api/AuthenticateIPAccessTest.php index 287c50f8..c362e9cc 100644 --- a/tests/Unit/Http/Middleware/Api/AuthenticateIPAccessTest.php +++ b/tests/Unit/Http/Middleware/Api/AuthenticateIPAccessTest.php @@ -65,8 +65,6 @@ class AuthenticateIPAccessTest extends MiddlewareTestCase /** * Return an instance of the middleware to be used when testing. - * - * @return \Pterodactyl\Http\Middleware\Api\AuthenticateIPAccess */ private function getMiddleware(): AuthenticateIPAccess { diff --git a/tests/Unit/Http/Middleware/Api/AuthenticateKeyTest.php b/tests/Unit/Http/Middleware/Api/AuthenticateKeyTest.php index 521bb7ea..211e810d 100644 --- a/tests/Unit/Http/Middleware/Api/AuthenticateKeyTest.php +++ b/tests/Unit/Http/Middleware/Api/AuthenticateKeyTest.php @@ -68,7 +68,7 @@ class AuthenticateKeyTest extends MiddlewareTestCase $this->expectException(AccessDeniedHttpException::class); $this->request->shouldReceive('bearerToken')->withNoArgs()->twice()->andReturn('abcd1234'); - $this->repository->shouldReceive('findFirstWhere')->andThrow(new RecordNotFoundException); + $this->repository->shouldReceive('findFirstWhere')->andThrow(new RecordNotFoundException()); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions(), ApiKey::TYPE_APPLICATION); } @@ -160,8 +160,6 @@ class AuthenticateKeyTest extends MiddlewareTestCase /** * Return an instance of the middleware with mocked dependencies for testing. - * - * @return \Pterodactyl\Http\Middleware\Api\AuthenticateKey */ private function getMiddleware(): AuthenticateKey { diff --git a/tests/Unit/Http/Middleware/Api/Daemon/DaemonAuthenticateTest.php b/tests/Unit/Http/Middleware/Api/Daemon/DaemonAuthenticateTest.php index d7364080..945e0870 100644 --- a/tests/Unit/Http/Middleware/Api/Daemon/DaemonAuthenticateTest.php +++ b/tests/Unit/Http/Middleware/Api/Daemon/DaemonAuthenticateTest.php @@ -70,7 +70,6 @@ class DaemonAuthenticateTest extends MiddlewareTestCase * Test that passing in an invalid node daemon secret will result in a bad request * exception being returned. * - * @param string $token * @dataProvider badTokenDataProvider */ public function testResponseShouldFailIfTokenFormatIsIncorrect(string $token) @@ -159,8 +158,6 @@ class DaemonAuthenticateTest extends MiddlewareTestCase /** * Return an instance of the middleware using mocked dependencies. - * - * @return \Pterodactyl\Http\Middleware\Api\Daemon\DaemonAuthenticate */ private function getMiddleware(): DaemonAuthenticate { diff --git a/tests/Unit/Http/Middleware/Api/SetSessionDriverTest.php b/tests/Unit/Http/Middleware/Api/SetSessionDriverTest.php index 6cbf810d..83fc2b7b 100644 --- a/tests/Unit/Http/Middleware/Api/SetSessionDriverTest.php +++ b/tests/Unit/Http/Middleware/Api/SetSessionDriverTest.php @@ -36,8 +36,6 @@ class SetSessionDriverTest extends MiddlewareTestCase /** * Return an instance of the middleware with mocked dependencies for testing. - * - * @return \Pterodactyl\Http\Middleware\Api\SetSessionDriver */ private function getMiddleware(): SetSessionDriver { diff --git a/tests/Unit/Http/Middleware/AuthenticateTest.php b/tests/Unit/Http/Middleware/AuthenticateTest.php index 34cda6e2..828afc12 100644 --- a/tests/Unit/Http/Middleware/AuthenticateTest.php +++ b/tests/Unit/Http/Middleware/AuthenticateTest.php @@ -31,8 +31,6 @@ class AuthenticateTest extends MiddlewareTestCase /** * Return an instance of the middleware using mocked dependencies. - * - * @return \Pterodactyl\Http\Middleware\Authenticate */ private function getMiddleware(): Authenticate { diff --git a/tests/Unit/Http/Middleware/LanguageMiddlewareTest.php b/tests/Unit/Http/Middleware/LanguageMiddlewareTest.php index ed25a699..569ef417 100644 --- a/tests/Unit/Http/Middleware/LanguageMiddlewareTest.php +++ b/tests/Unit/Http/Middleware/LanguageMiddlewareTest.php @@ -50,8 +50,6 @@ class LanguageMiddlewareTest extends MiddlewareTestCase /** * Return an instance of the middleware using mocked dependencies. - * - * @return \Pterodactyl\Http\Middleware\LanguageMiddleware */ private function getMiddleware(): LanguageMiddleware { diff --git a/tests/Unit/Http/Middleware/MaintenanceMiddlewareTest.php b/tests/Unit/Http/Middleware/MaintenanceMiddlewareTest.php index 38824b3a..a007dd34 100644 --- a/tests/Unit/Http/Middleware/MaintenanceMiddlewareTest.php +++ b/tests/Unit/Http/Middleware/MaintenanceMiddlewareTest.php @@ -54,15 +54,12 @@ class MaintenanceMiddlewareTest extends MiddlewareTestCase $this->response->shouldReceive('view') ->once() ->with('errors.maintenance') - ->andReturn(new Response); + ->andReturn(new Response()); $response = $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); $this->assertInstanceOf(Response::class, $response); } - /** - * @return \Pterodactyl\Http\Middleware\MaintenanceMiddleware - */ private function getMiddleware(): MaintenanceMiddleware { return new MaintenanceMiddleware($this->response); diff --git a/tests/Unit/Http/Middleware/MiddlewareTestCase.php b/tests/Unit/Http/Middleware/MiddlewareTestCase.php index b01ef05b..b716681d 100644 --- a/tests/Unit/Http/Middleware/MiddlewareTestCase.php +++ b/tests/Unit/Http/Middleware/MiddlewareTestCase.php @@ -9,7 +9,9 @@ use Pterodactyl\Tests\Assertions\MiddlewareAttributeAssertionsTrait; abstract class MiddlewareTestCase extends TestCase { - use MiddlewareAttributeAssertionsTrait, MocksMiddlewareClosure, RequestMockHelpers; + use MiddlewareAttributeAssertionsTrait; + use MocksMiddlewareClosure; + use RequestMockHelpers; /** * Setup tests with a mocked request object and normal attributes. diff --git a/tests/Unit/Http/Middleware/RedirectIfAuthenticatedTest.php b/tests/Unit/Http/Middleware/RedirectIfAuthenticatedTest.php index b1775b2c..ea4bc801 100644 --- a/tests/Unit/Http/Middleware/RedirectIfAuthenticatedTest.php +++ b/tests/Unit/Http/Middleware/RedirectIfAuthenticatedTest.php @@ -50,8 +50,6 @@ class RedirectIfAuthenticatedTest extends MiddlewareTestCase /** * Return an instance of the middleware using mocked dependencies. - * - * @return \Pterodactyl\Http\Middleware\RedirectIfAuthenticated */ private function getMiddleware(): RedirectIfAuthenticated { diff --git a/tests/Unit/Http/Middleware/Server/AccessingValidServerTest.php b/tests/Unit/Http/Middleware/Server/AccessingValidServerTest.php index de0259ff..e2cfca6c 100644 --- a/tests/Unit/Http/Middleware/Server/AccessingValidServerTest.php +++ b/tests/Unit/Http/Middleware/Server/AccessingValidServerTest.php @@ -117,8 +117,6 @@ class AccessingValidServerTest extends MiddlewareTestCase /** * Provide test data that checks that the correct view is returned for each model type. - * - * @return array */ public function viewDataProvider(): array { @@ -134,8 +132,6 @@ class AccessingValidServerTest extends MiddlewareTestCase /** * Return an instance of the middleware using mocked dependencies. - * - * @return \Pterodactyl\Http\Middleware\Server\AccessingValidServer */ private function getMiddleware(): AccessingValidServer { diff --git a/tests/Unit/Rules/UsernameTest.php b/tests/Unit/Rules/UsernameTest.php index 5684e6a5..829cab2c 100644 --- a/tests/Unit/Rules/UsernameTest.php +++ b/tests/Unit/Rules/UsernameTest.php @@ -12,7 +12,7 @@ class UsernameTest extends TestCase */ public function testRuleIsStringable() { - $this->assertSame('p_username', (string) new Username); + $this->assertSame('p_username', (string) new Username()); } /** @@ -22,7 +22,7 @@ class UsernameTest extends TestCase */ public function testValidUsernames(string $username) { - $this->assertTrue((new Username)->passes('test', $username), 'Assert username is valid.'); + $this->assertTrue((new Username())->passes('test', $username), 'Assert username is valid.'); } /** @@ -32,12 +32,11 @@ class UsernameTest extends TestCase */ public function testInvalidUsernames(string $username) { - $this->assertFalse((new Username)->passes('test', $username), 'Assert username is not valid.'); + $this->assertFalse((new Username())->passes('test', $username), 'Assert username is not valid.'); } /** * Provide valid usernames. - * @return array */ public function validUsernameDataProvider(): array { @@ -54,8 +53,6 @@ class UsernameTest extends TestCase /** * Provide invalid usernames. - * - * @return array */ public function invalidUsernameDataProvider(): array { diff --git a/tests/Unit/Services/Acl/Api/AdminAclTest.php b/tests/Unit/Services/Acl/Api/AdminAclTest.php index a1941b93..daaea838 100644 --- a/tests/Unit/Services/Acl/Api/AdminAclTest.php +++ b/tests/Unit/Services/Acl/Api/AdminAclTest.php @@ -30,8 +30,6 @@ class AdminAclTest extends TestCase /** * Provide valid and invalid permissions combos for testing. - * - * @return array */ public function permissionsDataProvider(): array { diff --git a/tests/Unit/Services/Api/KeyCreationServiceTest.php b/tests/Unit/Services/Api/KeyCreationServiceTest.php index e46033d8..5c847f14 100644 --- a/tests/Unit/Services/Api/KeyCreationServiceTest.php +++ b/tests/Unit/Services/Api/KeyCreationServiceTest.php @@ -149,8 +149,6 @@ class KeyCreationServiceTest extends TestCase /** * Provide key types that are not an application specific key. - * - * @return array */ public function keyTypeDataProvider(): array { @@ -161,8 +159,6 @@ class KeyCreationServiceTest extends TestCase /** * Return an instance of the service with mocked dependencies for testing. - * - * @return \Pterodactyl\Services\Api\KeyCreationService */ private function getService(): KeyCreationService {