From 436e6860371a0e08232a1e12ac1335fbd04f6e5d Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 7 Aug 2021 16:10:24 -0700 Subject: [PATCH] Apply php-cs-fixer changes --- app/Exceptions/Handler.php | 2 +- .../Spatie/Fractalistic/Fractal.php | 2 +- app/Http/Controllers/Admin/BaseController.php | 2 -- .../Application/Mounts/MountController.php | 2 +- .../Api/Application/Roles/RoleController.php | 2 +- .../Api/Client/ApiKeyController.php | 1 - .../Api/Client/SSHKeyController.php | 1 - .../Api/Client/Servers/BackupController.php | 2 +- .../Api/Client/Servers/ScheduleController.php | 1 - .../Client/Servers/ScheduleTaskController.php | 2 +- .../Client/Servers/WebsocketController.php | 2 -- .../Api/Client/TwoFactorController.php | 2 -- .../Api/Client/WebauthnController.php | 2 +- .../Auth/LoginCheckpointController.php | 3 +- app/Http/Controllers/Auth/LoginController.php | 11 ++++--- .../Controllers/Auth/WebauthnController.php | 4 ++- .../SubstituteApplicationApiBindings.php | 2 -- .../Client/SubstituteClientApiBindings.php | 4 +-- .../Middleware/Api/PreventUnboundModels.php | 6 ++-- app/Http/Requests/Api/ApiRequest.php | 1 - .../Api/Application/ApplicationApiRequest.php | 2 -- .../Remote/SftpAuthenticationFormRequest.php | 2 +- app/Models/AdminRole.php | 3 -- app/Models/Allocation.php | 3 -- app/Models/AuditLog.php | 3 -- app/Models/Backup.php | 8 +---- app/Models/Database.php | 3 -- app/Models/DatabaseHost.php | 5 --- app/Models/Egg.php | 3 -- app/Models/EggVariable.php | 6 ---- app/Models/Location.php | 2 -- app/Models/Model.php | 7 ---- app/Models/Node.php | 3 ++ app/Models/Permission.php | 3 -- app/Models/PersonalAccessToken.php | 9 +++--- app/Models/ServerTransfer.php | 3 -- app/Models/Setting.php | 3 -- app/Models/Subuser.php | 3 -- app/Models/Task.php | 3 -- app/Models/User.php | 12 ++----- app/Models/UserSSHKey.php | 2 +- app/Providers/AppServiceProvider.php | 6 ++-- .../Eloquent/BackupRepository.php | 2 -- app/Repositories/Eloquent/NestRepository.php | 2 -- .../Backups/InitiateBackupService.php | 4 --- .../Helpers/SoftwareVersionService.php | 12 ------- .../Api/Application/AllocationTransformer.php | 4 --- .../Application/ServerDatabaseTransformer.php | 1 - app/Transformers/Api/Transformer.php | 12 ++++--- config/cors.php | 1 - config/database.php | 2 +- config/sanctum.php | 4 +-- config/services.php | 2 +- config/webauthn.php | 3 -- .../2019_03_29_163611_add_webauthn.php | 4 +-- ...01_create_personal_access_tokens_table.php | 4 +-- ..._09_25_021109_create_admin_roles_table.php | 4 +-- ...205021_add_index_for_server_and_action.php | 4 +-- ..._23_212657_make_sftp_port_unsigned_int.php | 4 +-- ...n_month_field_to_have_value_if_missing.php | 4 +-- ...dd_continue_on_failure_option_to_tasks.php | 4 +-- ...when_server_online_option_to_schedules.php | 4 +-- ...01016_add_support_for_locking_a_backup.php | 4 +-- ...21_07_12_013420_remove_userinteraction.php | 1 + ...7_17_211512_create_user_ssh_keys_table.php | 4 +-- ..._29_032255_yeet_names_from_users_table.php | 4 +-- routes/api-application.php | 2 -- .../ApplicationApiIntegrationTestCase.php | 3 -- .../CreateServerScheduleTaskTest.php | 2 +- .../Jobs/Schedule/RunTaskJobTest.php | 5 ++- .../Servers/BuildModificationServiceTest.php | 1 - .../RequireTwoFactorAuthenticationTest.php | 32 +++++++++---------- 72 files changed, 91 insertions(+), 196 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 38ac2eb27..c22198f98 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -7,8 +7,8 @@ use Throwable; use PDOException; use Illuminate\Support\Arr; use Illuminate\Support\Str; -use Swift_TransportException; use Illuminate\Http\Response; +use Swift_TransportException; use Illuminate\Http\JsonResponse; use Illuminate\Support\Collection; use Illuminate\Container\Container; diff --git a/app/Extensions/Spatie/Fractalistic/Fractal.php b/app/Extensions/Spatie/Fractalistic/Fractal.php index 3a708b734..adb3c96a9 100644 --- a/app/Extensions/Spatie/Fractalistic/Fractal.php +++ b/app/Extensions/Spatie/Fractalistic/Fractal.php @@ -33,7 +33,7 @@ class Fractal extends SpatieFractal // If the resource name is not set attempt to pull it off the transformer // itself and set it automatically. - $class = is_string($this->transformer) ? new $this->transformer : $this->transformer; + $class = is_string($this->transformer) ? new $this->transformer() : $this->transformer; if (is_null($this->resourceName) && $class instanceof Transformer) { $this->resourceName = $class->getResourceName(); } diff --git a/app/Http/Controllers/Admin/BaseController.php b/app/Http/Controllers/Admin/BaseController.php index 317228f08..0452fa148 100644 --- a/app/Http/Controllers/Admin/BaseController.php +++ b/app/Http/Controllers/Admin/BaseController.php @@ -9,8 +9,6 @@ class BaseController extends Controller { /** * Return the admin index view. - * - * @return \Illuminate\View\View */ public function index(): View { diff --git a/app/Http/Controllers/Api/Application/Mounts/MountController.php b/app/Http/Controllers/Api/Application/Mounts/MountController.php index 22635354f..9a5ddfc1b 100644 --- a/app/Http/Controllers/Api/Application/Mounts/MountController.php +++ b/app/Http/Controllers/Api/Application/Mounts/MountController.php @@ -2,8 +2,8 @@ namespace Pterodactyl\Http\Controllers\Api\Application\Mounts; -use Pterodactyl\Models\Mount; use Illuminate\Http\Response; +use Pterodactyl\Models\Mount; use Illuminate\Http\JsonResponse; use Spatie\QueryBuilder\QueryBuilder; use Pterodactyl\Transformers\Api\Application\MountTransformer; diff --git a/app/Http/Controllers/Api/Application/Roles/RoleController.php b/app/Http/Controllers/Api/Application/Roles/RoleController.php index 904d389e8..aab08f276 100644 --- a/app/Http/Controllers/Api/Application/Roles/RoleController.php +++ b/app/Http/Controllers/Api/Application/Roles/RoleController.php @@ -6,8 +6,8 @@ use Illuminate\Http\Response; use Illuminate\Http\JsonResponse; use Pterodactyl\Models\AdminRole; use Spatie\QueryBuilder\QueryBuilder; -use Pterodactyl\Transformers\Api\Application\AdminRoleTransformer; use Pterodactyl\Exceptions\Http\QueryValueOutOfRangeHttpException; +use Pterodactyl\Transformers\Api\Application\AdminRoleTransformer; use Pterodactyl\Http\Requests\Api\Application\Roles\GetRoleRequest; use Pterodactyl\Http\Requests\Api\Application\Roles\GetRolesRequest; use Pterodactyl\Http\Requests\Api\Application\Roles\StoreRoleRequest; diff --git a/app/Http/Controllers/Api/Client/ApiKeyController.php b/app/Http/Controllers/Api/Client/ApiKeyController.php index 631752f1e..dc4fc59c7 100644 --- a/app/Http/Controllers/Api/Client/ApiKeyController.php +++ b/app/Http/Controllers/Api/Client/ApiKeyController.php @@ -4,7 +4,6 @@ namespace Pterodactyl\Http\Controllers\Api\Client; use Illuminate\Http\Response; use Pterodactyl\Exceptions\DisplayException; -use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; use Pterodactyl\Http\Requests\Api\Client\AccountApiRequest; use Pterodactyl\Http\Requests\Api\Client\Account\StoreApiKeyRequest; use Pterodactyl\Transformers\Api\Client\PersonalAccessTokenTransformer; diff --git a/app/Http/Controllers/Api/Client/SSHKeyController.php b/app/Http/Controllers/Api/Client/SSHKeyController.php index dc87b4cf7..d8e3cea32 100644 --- a/app/Http/Controllers/Api/Client/SSHKeyController.php +++ b/app/Http/Controllers/Api/Client/SSHKeyController.php @@ -26,7 +26,6 @@ class SSHKeyController extends ClientApiController /** * ? * - * @return JsonResponse * @throws \Illuminate\Contracts\Container\BindingResolutionException * @throws \Pterodactyl\Exceptions\DisplayException */ diff --git a/app/Http/Controllers/Api/Client/Servers/BackupController.php b/app/Http/Controllers/Api/Client/Servers/BackupController.php index f2dd8d40b..0bbe0d396 100644 --- a/app/Http/Controllers/Api/Client/Servers/BackupController.php +++ b/app/Http/Controllers/Api/Client/Servers/BackupController.php @@ -12,8 +12,8 @@ use Pterodactyl\Models\Permission; use Illuminate\Auth\Access\AuthorizationException; use Pterodactyl\Services\Backups\DeleteBackupService; use Pterodactyl\Services\Backups\DownloadLinkService; -use Pterodactyl\Services\Backups\InitiateBackupService; use Pterodactyl\Repositories\Eloquent\BackupRepository; +use Pterodactyl\Services\Backups\InitiateBackupService; use Pterodactyl\Repositories\Wings\DaemonBackupRepository; use Pterodactyl\Transformers\Api\Client\BackupTransformer; use Pterodactyl\Http\Controllers\Api\Client\ClientApiController; diff --git a/app/Http/Controllers/Api/Client/Servers/ScheduleController.php b/app/Http/Controllers/Api/Client/Servers/ScheduleController.php index 28f3c791c..ade67ca5d 100644 --- a/app/Http/Controllers/Api/Client/Servers/ScheduleController.php +++ b/app/Http/Controllers/Api/Client/Servers/ScheduleController.php @@ -14,7 +14,6 @@ use Pterodactyl\Repositories\Eloquent\ScheduleRepository; use Pterodactyl\Services\Schedules\ProcessScheduleService; use Pterodactyl\Transformers\Api\Client\ScheduleTransformer; use Pterodactyl\Http\Controllers\Api\Client\ClientApiController; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\ViewScheduleRequest; use Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\StoreScheduleRequest; diff --git a/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php b/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php index 14437afaa..6448aa581 100644 --- a/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php +++ b/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php @@ -13,8 +13,8 @@ use Pterodactyl\Http\Controllers\Api\Client\ClientApiController; use Pterodactyl\Exceptions\Service\ServiceLimitExceededException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\StoreTaskRequest; -use Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\UpdateScheduleRequest; use Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\DeleteScheduleRequest; +use Pterodactyl\Http\Requests\Api\Client\Servers\Schedules\UpdateScheduleRequest; class ScheduleTaskController extends ClientApiController { diff --git a/app/Http/Controllers/Api/Client/Servers/WebsocketController.php b/app/Http/Controllers/Api/Client/Servers/WebsocketController.php index 72219c0a7..d13600872 100644 --- a/app/Http/Controllers/Api/Client/Servers/WebsocketController.php +++ b/app/Http/Controllers/Api/Client/Servers/WebsocketController.php @@ -5,10 +5,8 @@ namespace Pterodactyl\Http\Controllers\Api\Client\Servers; use Carbon\CarbonImmutable; use Pterodactyl\Models\Server; use Illuminate\Http\JsonResponse; -use Pterodactyl\Models\Permission; use Pterodactyl\Services\Nodes\NodeJWTService; use Pterodactyl\Exceptions\Http\HttpForbiddenException; -use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; use Pterodactyl\Services\Servers\GetUserPermissionsService; use Pterodactyl\Http\Requests\Api\Client\WebsocketTokenRequest; use Pterodactyl\Http\Controllers\Api\Client\ClientApiController; diff --git a/app/Http/Controllers/Api/Client/TwoFactorController.php b/app/Http/Controllers/Api/Client/TwoFactorController.php index 396f889be..3abc2522b 100644 --- a/app/Http/Controllers/Api/Client/TwoFactorController.php +++ b/app/Http/Controllers/Api/Client/TwoFactorController.php @@ -55,8 +55,6 @@ class TwoFactorController extends ClientApiController /** * Updates a user's account to have two-factor enabled. * - * @return \Illuminate\Http\JsonResponse - * * @throws \Throwable * @throws \Illuminate\Validation\ValidationException * @throws \PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException diff --git a/app/Http/Controllers/Api/Client/WebauthnController.php b/app/Http/Controllers/Api/Client/WebauthnController.php index 6d042fa43..3e3aad679 100644 --- a/app/Http/Controllers/Api/Client/WebauthnController.php +++ b/app/Http/Controllers/Api/Client/WebauthnController.php @@ -5,8 +5,8 @@ namespace Pterodactyl\Http\Controllers\Api\Client; use Exception; use Illuminate\Http\Request; use Illuminate\Http\JsonResponse; -use LaravelWebauthn\Facades\Webauthn; use Pterodactyl\Models\WebauthnKey; +use LaravelWebauthn\Facades\Webauthn; use Webauthn\PublicKeyCredentialCreationOptions; use Illuminate\Database\Eloquent\ModelNotFoundException; use Pterodactyl\Transformers\Api\Client\WebauthnKeyTransformer; diff --git a/app/Http/Controllers/Auth/LoginCheckpointController.php b/app/Http/Controllers/Auth/LoginCheckpointController.php index dffa79998..d38f31230 100644 --- a/app/Http/Controllers/Auth/LoginCheckpointController.php +++ b/app/Http/Controllers/Auth/LoginCheckpointController.php @@ -17,7 +17,6 @@ class LoginCheckpointController extends AbstractLoginController private Encrypter $encrypter; private Google2FA $google2FA; - /** * LoginCheckpointController constructor. */ @@ -51,6 +50,7 @@ class LoginCheckpointController extends AbstractLoginController { if ($this->hasTooManyLoginAttempts($request)) { $this->sendLockoutResponse($request); + return; } @@ -66,6 +66,7 @@ class LoginCheckpointController extends AbstractLoginController null, 'The authentication token provided has expired, please refresh the page and try again.' ); + return; } diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index f0ef09292..bf12ceb82 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -69,6 +69,7 @@ class LoginController extends AbstractLoginController if ($this->hasTooManyLoginAttempts($request)) { $this->fireLockoutEvent($request); $this->sendLockoutResponse($request); + return; } @@ -77,6 +78,7 @@ class LoginController extends AbstractLoginController $user = $this->repository->findFirstWhere([[$useColumn, '=', $username]]); } catch (RecordNotFoundException $exception) { $this->sendFailedLoginResponse($request); + return; } @@ -86,12 +88,13 @@ class LoginController extends AbstractLoginController // can proceed to the next step in the login process. if (!password_verify($request->input('password'), $user->password)) { $this->sendFailedLoginResponse($request, $user); + return; } $webauthnKeys = $user->webauthnKeys()->get(); - if (sizeof($webauthnKeys) > 0) { + if (count($webauthnKeys) > 0) { $token = Str::random(64); $this->cache->put($token, $user->id, CarbonImmutable::now()->addMinutes(5)); @@ -99,7 +102,7 @@ class LoginController extends AbstractLoginController $request->session()->put(self::SESSION_PUBLICKEY_REQUEST, $publicKey); $request->session()->save(); - $methods = [ self::METHOD_WEBAUTHN ]; + $methods = [self::METHOD_WEBAUTHN]; if ($user->use_totp) { $methods[] = self::METHOD_TOTP; } @@ -112,13 +115,13 @@ class LoginController extends AbstractLoginController 'public_key' => $publicKey, ], ]); - } else if ($user->use_totp) { + } elseif ($user->use_totp) { $token = Str::random(64); $this->cache->put($token, $user->id, CarbonImmutable::now()->addMinutes(5)); return new JsonResponse([ 'complete' => false, - 'methods' => [ self::METHOD_TOTP ], + 'methods' => [self::METHOD_TOTP], 'confirmation_token' => $token, ]); } diff --git a/app/Http/Controllers/Auth/WebauthnController.php b/app/Http/Controllers/Auth/WebauthnController.php index 438c3b342..7a85b9e19 100644 --- a/app/Http/Controllers/Auth/WebauthnController.php +++ b/app/Http/Controllers/Auth/WebauthnController.php @@ -3,8 +3,8 @@ namespace Pterodactyl\Http\Controllers\Auth; use Exception; -use Pterodactyl\Models\User; use Illuminate\Http\Request; +use Pterodactyl\Models\User; use Illuminate\Auth\AuthManager; use Illuminate\Http\JsonResponse; use LaravelWebauthn\Facades\Webauthn; @@ -36,6 +36,7 @@ class WebauthnController extends AbstractLoginController { if ($this->hasTooManyLoginAttempts($request)) { $this->sendLockoutResponse($request); + return; } @@ -51,6 +52,7 @@ class WebauthnController extends AbstractLoginController null, 'The authentication token provided has expired, please refresh the page and try again.' ); + return; } $this->auth->guard()->onceUsingId($user->id); diff --git a/app/Http/Middleware/Api/Application/SubstituteApplicationApiBindings.php b/app/Http/Middleware/Api/Application/SubstituteApplicationApiBindings.php index bb6bc5ece..4ae63ff4a 100644 --- a/app/Http/Middleware/Api/Application/SubstituteApplicationApiBindings.php +++ b/app/Http/Middleware/Api/Application/SubstituteApplicationApiBindings.php @@ -20,8 +20,6 @@ class SubstituteApplicationApiBindings /** * Mappings to automatically assign route parameters to a model. - * - * @var array */ protected static array $mappings = [ 'allocation' => Allocation::class, diff --git a/app/Http/Middleware/Api/Client/SubstituteClientApiBindings.php b/app/Http/Middleware/Api/Client/SubstituteClientApiBindings.php index 7ab63948f..3a1a80f49 100644 --- a/app/Http/Middleware/Api/Client/SubstituteClientApiBindings.php +++ b/app/Http/Middleware/Api/Client/SubstituteClientApiBindings.php @@ -26,7 +26,7 @@ class SubstituteClientApiBindings * Perform substitution of route parameters for the Client API. * * @param \Illuminate\Http\Request - * @param \Closure $next + * * @return mixed */ public function handle($request, Closure $next) @@ -73,7 +73,7 @@ class SubstituteClientApiBindings }); try { - /** @var \Illuminate\Routing\Route $route */ + /* @var \Illuminate\Routing\Route $route */ $this->router->substituteBindings($route = $request->route()); } catch (ModelNotFoundException $exception) { if (isset($route) && $route->getMissing()) { diff --git a/app/Http/Middleware/Api/PreventUnboundModels.php b/app/Http/Middleware/Api/PreventUnboundModels.php index 3fc2322eb..1b1a959a7 100644 --- a/app/Http/Middleware/Api/PreventUnboundModels.php +++ b/app/Http/Middleware/Api/PreventUnboundModels.php @@ -17,7 +17,7 @@ class PreventUnboundModels * added but not properly defined in the substitution middleware. * * @param \Illuminate\Http\Request $request - * @param \Closure $next + * * @return mixed * * @throws \Exception @@ -36,9 +36,7 @@ class PreventUnboundModels } if (!$parameters[$signature->getName()] instanceof Model) { - throw new Exception( - sprintf('No parameter binding has been defined for model [%s] using route parameter key "%s".', $class, $signature->getName()) - ); + throw new Exception(sprintf('No parameter binding has been defined for model [%s] using route parameter key "%s".', $class, $signature->getName())); } } diff --git a/app/Http/Requests/Api/ApiRequest.php b/app/Http/Requests/Api/ApiRequest.php index c76b434dd..253a61691 100644 --- a/app/Http/Requests/Api/ApiRequest.php +++ b/app/Http/Requests/Api/ApiRequest.php @@ -3,7 +3,6 @@ namespace Pterodactyl\Http\Requests\Api; use Illuminate\Foundation\Http\FormRequest; -use Illuminate\Auth\Access\AuthorizationException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Http/Requests/Api/Application/ApplicationApiRequest.php b/app/Http/Requests/Api/Application/ApplicationApiRequest.php index 6a6dc48b3..70f6cb219 100644 --- a/app/Http/Requests/Api/Application/ApplicationApiRequest.php +++ b/app/Http/Requests/Api/Application/ApplicationApiRequest.php @@ -9,8 +9,6 @@ abstract class ApplicationApiRequest extends ApiRequest /** * This will eventually be replaced with per-request permissions checking * on the API key and for the user. - * - * @return bool */ public function authorize(): bool { diff --git a/app/Http/Requests/Api/Remote/SftpAuthenticationFormRequest.php b/app/Http/Requests/Api/Remote/SftpAuthenticationFormRequest.php index 8454075d5..383f20505 100644 --- a/app/Http/Requests/Api/Remote/SftpAuthenticationFormRequest.php +++ b/app/Http/Requests/Api/Remote/SftpAuthenticationFormRequest.php @@ -26,7 +26,7 @@ class SftpAuthenticationFormRequest extends FormRequest return [ 'username' => 'required|string', 'password' => 'required|string', - 'type' => 'required|in:password,publicKey' + 'type' => 'required|in:password,publicKey', ]; } diff --git a/app/Models/AdminRole.php b/app/Models/AdminRole.php index 3f4b44ea2..51b485495 100644 --- a/app/Models/AdminRole.php +++ b/app/Models/AdminRole.php @@ -45,9 +45,6 @@ class AdminRole extends Model 'permissions' => 'array', ]; - /** - * @var array - */ public static array $validationRules = [ 'name' => 'required|string|max:64', 'description' => 'nullable|string|max:255', diff --git a/app/Models/Allocation.php b/app/Models/Allocation.php index c01444951..564822abe 100644 --- a/app/Models/Allocation.php +++ b/app/Models/Allocation.php @@ -50,9 +50,6 @@ class Allocation extends Model 'server_id' => 'integer', ]; - /** - * @var array - */ public static array $validationRules = [ 'node_id' => 'required|exists:nodes,id', 'ip' => 'required|ip', diff --git a/app/Models/AuditLog.php b/app/Models/AuditLog.php index 18b466a22..a1ae4ea9d 100644 --- a/app/Models/AuditLog.php +++ b/app/Models/AuditLog.php @@ -61,9 +61,6 @@ class AuditLog extends Model */ protected $table = 'audit_logs'; - /** - * @var bool - */ protected bool $immutableDates = true; /** diff --git a/app/Models/Backup.php b/app/Models/Backup.php index 8b3413147..9b0abde6a 100644 --- a/app/Models/Backup.php +++ b/app/Models/Backup.php @@ -37,9 +37,6 @@ class Backup extends Model */ protected $table = 'backups'; - /** - * @var bool - */ protected bool $immutableDates = true; /** @@ -76,9 +73,6 @@ class Backup extends Model */ protected $guarded = ['id', 'created_at', 'updated_at', 'deleted_at']; - /** - * @var array - */ public static array $validationRules = [ 'server_id' => 'bail|required|numeric|exists:servers,id', 'uuid' => 'required|uuid', @@ -107,6 +101,6 @@ class Backup extends Model { return $this->hasMany(AuditLog::class, 'metadata->backup_uuid', 'uuid') ->where('action', 'LIKE', 'server:backup.%'); - // ->where('metadata->backup_uuid', $this->uuid); + // ->where('metadata->backup_uuid', $this->uuid); } } diff --git a/app/Models/Database.php b/app/Models/Database.php index 291604632..b2be8a7d2 100644 --- a/app/Models/Database.php +++ b/app/Models/Database.php @@ -58,9 +58,6 @@ class Database extends Model 'max_connections' => 'integer', ]; - /** - * @var array - */ public static array $validationRules = [ 'server_id' => 'required|numeric|exists:servers,id', 'database_host_id' => 'required|exists:database_hosts,id', diff --git a/app/Models/DatabaseHost.php b/app/Models/DatabaseHost.php index f184f313b..31dad3865 100644 --- a/app/Models/DatabaseHost.php +++ b/app/Models/DatabaseHost.php @@ -21,9 +21,6 @@ class DatabaseHost extends Model */ public const RESOURCE_NAME = 'database_host'; - /** - * @var bool - */ protected bool $immutableDates = true; /** @@ -61,8 +58,6 @@ class DatabaseHost extends Model /** * Validation rules to assign to this model. - * - * @var array */ public static array $validationRules = [ 'name' => 'required|string|max:191', diff --git a/app/Models/Egg.php b/app/Models/Egg.php index c8698e05a..992a54f91 100644 --- a/app/Models/Egg.php +++ b/app/Models/Egg.php @@ -108,9 +108,6 @@ class Egg extends Model 'file_denylist' => 'array', ]; - /** - * @var array - */ public static array $validationRules = [ 'nest_id' => 'required|bail|numeric|exists:nests,id', 'uuid' => 'required|string|size:36', diff --git a/app/Models/EggVariable.php b/app/Models/EggVariable.php index 0a48132d7..98e3da2c9 100644 --- a/app/Models/EggVariable.php +++ b/app/Models/EggVariable.php @@ -37,9 +37,6 @@ class EggVariable extends Model */ public const RESERVED_ENV_NAMES = 'SERVER_MEMORY,SERVER_IP,SERVER_PORT,ENV,HOME,USER,STARTUP,SERVER_UUID,UUID'; - /** - * @var bool - */ protected bool $immutableDates = true; /** @@ -67,9 +64,6 @@ class EggVariable extends Model 'user_editable' => 'bool', ]; - /** - * @var array - */ public static array $validationRules = [ 'egg_id' => 'exists:eggs,id', 'name' => 'required|string|between:1,191', diff --git a/app/Models/Location.php b/app/Models/Location.php index df04eb417..ad9ae2a21 100644 --- a/app/Models/Location.php +++ b/app/Models/Location.php @@ -35,8 +35,6 @@ class Location extends Model /** * Rules ensuring that the raw data stored in the database meets expectations. - * - * @var array */ public static array $validationRules = [ 'short' => 'required|string|between:1,60|unique:locations,short', diff --git a/app/Models/Model.php b/app/Models/Model.php index 184b3d1c1..8e762801a 100644 --- a/app/Models/Model.php +++ b/app/Models/Model.php @@ -17,8 +17,6 @@ abstract class Model extends IlluminateModel /** * Set to true to return immutable Carbon date instances from the model. - * - * @var bool */ protected bool $immutableDates = false; @@ -42,9 +40,6 @@ abstract class Model extends IlluminateModel */ protected static $validatorFactory; - /** - * @var array - */ public static array $validationRules = []; /** @@ -82,8 +77,6 @@ abstract class Model extends IlluminateModel /** * Returns the validator instance used by this model. - * - * @return \Illuminate\Validation\Validator */ public function getValidator(): Validator { diff --git a/app/Models/Node.php b/app/Models/Node.php index 052b352a2..f0bee4d67 100644 --- a/app/Models/Node.php +++ b/app/Models/Node.php @@ -152,6 +152,7 @@ class Node extends Model * Returns the configuration as an array. * * @return array + * * @throws \Illuminate\Contracts\Container\BindingResolutionException */ public function getConfiguration() @@ -186,6 +187,7 @@ class Node extends Model * Returns the configuration in Yaml format. * * @return string + * * @throws \Illuminate\Contracts\Container\BindingResolutionException */ public function getYamlConfiguration() @@ -197,6 +199,7 @@ class Node extends Model * Returns the configuration in JSON format. * * @return string + * * @throws \Illuminate\Contracts\Container\BindingResolutionException */ public function getJsonConfiguration(bool $pretty = false) diff --git a/app/Models/Permission.php b/app/Models/Permission.php index aa505398b..b3b127486 100644 --- a/app/Models/Permission.php +++ b/app/Models/Permission.php @@ -93,9 +93,6 @@ class Permission extends Model 'subuser_id' => 'integer', ]; - /** - * @var array - */ public static array $validationRules = [ 'subuser_id' => 'required|numeric|min:1', 'permission' => 'required|string', diff --git a/app/Models/PersonalAccessToken.php b/app/Models/PersonalAccessToken.php index 5cc7c3b30..56ca18cea 100644 --- a/app/Models/PersonalAccessToken.php +++ b/app/Models/PersonalAccessToken.php @@ -36,9 +36,6 @@ class PersonalAccessToken extends Model implements HasAbilities 'abilities', ]; - /** - * @var array - */ public static array $validationRules = [ 'token' => 'required|string', 'token_id' => 'required|string|size:16', @@ -58,6 +55,7 @@ class PersonalAccessToken extends Model implements HasAbilities * Required for support with Laravel Sanctum. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + * * @see \Laravel\Sanctum\Guard::supportsTokens() */ public function tokenable() @@ -69,6 +67,7 @@ class PersonalAccessToken extends Model implements HasAbilities * Determine if the token has a given ability. * * @param string $ability + * * @return bool */ public function can($ability) @@ -81,6 +80,7 @@ class PersonalAccessToken extends Model implements HasAbilities * Determine if the token is missing a given ability. * * @param string $ability + * * @return bool */ public function cant($ability) @@ -92,6 +92,7 @@ class PersonalAccessToken extends Model implements HasAbilities * Find the token instance matching the given token. * * @param string $token + * * @return \Pterodactyl\Models\PersonalAccessToken|null */ public static function findToken($token) @@ -108,8 +109,6 @@ class PersonalAccessToken extends Model implements HasAbilities /** * Generates a new identifier for a personal access token. - * - * @return string */ public static function generateTokenIdentifier(): string { diff --git a/app/Models/ServerTransfer.php b/app/Models/ServerTransfer.php index 0b6a372f4..1645111ed 100644 --- a/app/Models/ServerTransfer.php +++ b/app/Models/ServerTransfer.php @@ -58,9 +58,6 @@ class ServerTransfer extends Model 'archived' => 'bool', ]; - /** - * @var array - */ public static array $validationRules = [ 'server_id' => 'required|numeric|exists:servers,id', 'old_node' => 'required|numeric', diff --git a/app/Models/Setting.php b/app/Models/Setting.php index 9f4396bb1..b620ec8d2 100644 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -21,9 +21,6 @@ class Setting extends Model */ protected $fillable = ['key', 'value']; - /** - * @var array - */ public static array $validationRules = [ 'key' => 'required|string|between:1,191', 'value' => 'string', diff --git a/app/Models/Subuser.php b/app/Models/Subuser.php index 5312a7151..eaa3de06c 100644 --- a/app/Models/Subuser.php +++ b/app/Models/Subuser.php @@ -39,9 +39,6 @@ class Subuser extends Model 'permissions' => 'array', ]; - /** - * @var array - */ public static array $validationRules = [ 'user_id' => 'required|numeric|exists:users,id', 'server_id' => 'required|numeric|exists:servers,id', diff --git a/app/Models/Task.php b/app/Models/Task.php index 348a9098f..a6de1f3ec 100644 --- a/app/Models/Task.php +++ b/app/Models/Task.php @@ -92,9 +92,6 @@ class Task extends Model 'continue_on_failure' => false, ]; - /** - * @var array - */ public static array $validationRules = [ 'schedule_id' => 'required|numeric|exists:schedules,id', 'sequence_id' => 'required|numeric|min:1', diff --git a/app/Models/User.php b/app/Models/User.php index fb6cdb79c..3e3ae71d9 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -9,10 +9,10 @@ use Illuminate\Notifications\Notifiable; use Illuminate\Database\Eloquent\Builder; use Pterodactyl\Models\Traits\HasAccessTokens; use Illuminate\Auth\Passwords\CanResetPassword; -use Pterodactyl\Traits\Helpers\AvailableLanguages; use Illuminate\Database\Eloquent\Relations\HasOne; -use Illuminate\Foundation\Auth\Access\Authorizable; +use Pterodactyl\Traits\Helpers\AvailableLanguages; use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Foundation\Auth\Access\Authorizable; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; @@ -111,8 +111,6 @@ class User extends Model implements /** * Rules verifying that the data being stored matches the expectations of the database. - * - * @var array */ public static array $validationRules = [ 'uuid' => 'required|string|size:36|unique:users,uuid', @@ -173,8 +171,6 @@ class User extends Model implements /** * Gets the avatar url for the user. - * - * @return string */ public function avatarURL(): string { @@ -183,10 +179,8 @@ class User extends Model implements /** * Gets the name of the role assigned to a user. - * - * @return string|null */ - public function adminRoleName():? string + public function adminRoleName(): ?string { $role = $this->adminRole; if (is_null($role)) { diff --git a/app/Models/UserSSHKey.php b/app/Models/UserSSHKey.php index 29ce29bbc..c61500164 100644 --- a/app/Models/UserSSHKey.php +++ b/app/Models/UserSSHKey.php @@ -20,7 +20,7 @@ class UserSSHKey extends Model */ public const RESOURCE_NAME = 'user_ssh_key'; - const UPDATED_AT = null; + public const UPDATED_AT = null; protected $table = 'user_ssh_keys'; protected bool $immutableDates = true; diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 02455c5a5..f7a18ac5c 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,8 +2,8 @@ namespace Pterodactyl\Providers; -use Pterodactyl\Models\User; use Laravel\Sanctum\Sanctum; +use Pterodactyl\Models\User; use Pterodactyl\Models\Server; use Pterodactyl\Models\Subuser; use Illuminate\Support\Facades\Schema; @@ -26,7 +26,7 @@ class AppServiceProvider extends ServiceProvider Server::observe(ServerObserver::class); Subuser::observe(SubuserObserver::class); - /** + /* * @see https://laravel.com/docs/8.x/sanctum#overriding-default-models */ Sanctum::usePersonalAccessTokenModel(PersonalAccessToken::class); @@ -41,7 +41,7 @@ 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); } } diff --git a/app/Repositories/Eloquent/BackupRepository.php b/app/Repositories/Eloquent/BackupRepository.php index 7efdace06..051d0ce42 100644 --- a/app/Repositories/Eloquent/BackupRepository.php +++ b/app/Repositories/Eloquent/BackupRepository.php @@ -38,8 +38,6 @@ class BackupRepository extends EloquentRepository /** * Returns a query filtering only non-failed backups for a specific server. - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function getNonFailedBackups(Server $server): HasMany { diff --git a/app/Repositories/Eloquent/NestRepository.php b/app/Repositories/Eloquent/NestRepository.php index 89b9c9800..7e4884255 100644 --- a/app/Repositories/Eloquent/NestRepository.php +++ b/app/Repositories/Eloquent/NestRepository.php @@ -28,8 +28,6 @@ class NestRepository extends EloquentRepository implements NestRepositoryInterfa /** * Return a nest or all nests with their associated eggs and variables. * - * @param int|null $id - * * @return \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Nest * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException diff --git a/app/Services/Backups/InitiateBackupService.php b/app/Services/Backups/InitiateBackupService.php index 718328cfb..634f17cfe 100644 --- a/app/Services/Backups/InitiateBackupService.php +++ b/app/Services/Backups/InitiateBackupService.php @@ -55,11 +55,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, diff --git a/app/Services/Helpers/SoftwareVersionService.php b/app/Services/Helpers/SoftwareVersionService.php index e6c768d19..f601e6f20 100644 --- a/app/Services/Helpers/SoftwareVersionService.php +++ b/app/Services/Helpers/SoftwareVersionService.php @@ -43,8 +43,6 @@ class SoftwareVersionService /** * Gets the current version of the panel that is being used. - * - * @return string */ public function getVersion(): string { @@ -53,8 +51,6 @@ class SoftwareVersionService /** * Get the latest version of the panel from the CDN servers. - * - * @return string */ public function getLatestPanel(): string { @@ -63,8 +59,6 @@ class SoftwareVersionService /** * Get the latest version of wings from the CDN servers. - * - * @return string */ public function getLatestWings(): string { @@ -89,8 +83,6 @@ class SoftwareVersionService /** * Determine if a passed wings version is the latest. * - * @param string $version - * * @return bool */ public function isLatestWings(string $version) @@ -127,8 +119,6 @@ class SoftwareVersionService /** * Return version information for the footer. - * - * @return array */ protected function versionData(): array { @@ -159,8 +149,6 @@ class SoftwareVersionService /** * ? - * - * @return array */ public function getVersionData(): array { diff --git a/app/Transformers/Api/Application/AllocationTransformer.php b/app/Transformers/Api/Application/AllocationTransformer.php index ea63013cd..6a1734185 100644 --- a/app/Transformers/Api/Application/AllocationTransformer.php +++ b/app/Transformers/Api/Application/AllocationTransformer.php @@ -35,8 +35,6 @@ class AllocationTransformer extends Transformer /** * Load the node relationship onto a given transformation. * - * @param \Pterodactyl\Models\Allocation $allocation - * * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource */ public function includeNode(Allocation $allocation) @@ -51,8 +49,6 @@ class AllocationTransformer extends Transformer /** * Load the server relationship onto a given transformation. * - * @param \Pterodactyl\Models\Allocation $allocation - * * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource */ public function includeServer(Allocation $allocation) diff --git a/app/Transformers/Api/Application/ServerDatabaseTransformer.php b/app/Transformers/Api/Application/ServerDatabaseTransformer.php index 392b33bf9..66b9bd522 100644 --- a/app/Transformers/Api/Application/ServerDatabaseTransformer.php +++ b/app/Transformers/Api/Application/ServerDatabaseTransformer.php @@ -3,7 +3,6 @@ namespace Pterodactyl\Transformers\Api\Application; use Pterodactyl\Models\Database; -use Pterodactyl\Models\DatabaseHost; use Pterodactyl\Services\Acl\Api\AdminAcl; use Pterodactyl\Transformers\Api\Transformer; use Illuminate\Contracts\Encryption\Encrypter; diff --git a/app/Transformers/Api/Transformer.php b/app/Transformers/Api/Transformer.php index f35609339..91fdc0a3e 100644 --- a/app/Transformers/Api/Transformer.php +++ b/app/Transformers/Api/Transformer.php @@ -41,8 +41,6 @@ abstract class Transformer extends TransformerAbstract /** * Returns the authorized user for the request. - * - * @return \Pterodactyl\Models\User */ protected function user(): User { @@ -62,10 +60,12 @@ abstract class Transformer extends TransformerAbstract } /** - * @inheritDoc + * {@inheritDoc} + * * @param mixed $data * @param callable|\League\Fractal\TransformerAbstract $transformer * @param null $resourceKey + * * @return \League\Fractal\Resource\Item */ protected function item($data, $transformer, $resourceKey = null) @@ -84,10 +84,12 @@ abstract class Transformer extends TransformerAbstract } /** - * @inheritDoc + * {@inheritDoc} + * * @param mixed $data * @param callable|\League\Fractal\TransformerAbstract $transformer * @param null $resourceKey + * * @return \League\Fractal\Resource\Collection */ protected function collection($data, $transformer, $resourceKey = null) @@ -138,7 +140,7 @@ abstract class Transformer extends TransformerAbstract * * If no time is provided a null value is returned. * - * @param null|string|\DateTimeInterface $timestamp + * @param string|\DateTimeInterface|null $timestamp */ protected static function formatTimestamp($timestamp, string $tz = null): ?string { diff --git a/config/cors.php b/config/cors.php index b56881c10..abf1a9322 100644 --- a/config/cors.php +++ b/config/cors.php @@ -1,7 +1,6 @@ [ 'cluster' => env('REDIS_CLUSTER', 'redis'), - 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), + 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'), ], 'default' => [ diff --git a/config/sanctum.php b/config/sanctum.php index 2e6826ded..a2febb243 100644 --- a/config/sanctum.php +++ b/config/sanctum.php @@ -1,7 +1,6 @@ explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( '%s%s', 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1,pterodactyl.test', - env('APP_URL') ? ','.parse_url(env('APP_URL'), PHP_URL_HOST) : '' + env('APP_URL') ? ',' . parse_url(env('APP_URL'), PHP_URL_HOST) : '' ))), /* @@ -47,5 +46,4 @@ return [ 'verify_csrf_token' => Pterodactyl\Http\Middleware\VerifyCsrfToken::class, 'encrypt_cookies' => Pterodactyl\Http\Middleware\EncryptCookies::class, ], - ]; diff --git a/config/services.php b/config/services.php index b15f7bf02..39b8116c7 100644 --- a/config/services.php +++ b/config/services.php @@ -16,7 +16,7 @@ return [ 'mailgun' => [ 'domain' => env('MAILGUN_DOMAIN'), 'secret' => env('MAILGUN_SECRET'), - 'endpoint' => env('MAILGUN_ENDPOINT') + 'endpoint' => env('MAILGUN_ENDPOINT'), ], 'mandrill' => [ diff --git a/config/webauthn.php b/config/webauthn.php index 623eb4b14..4d94f7f07 100644 --- a/config/webauthn.php +++ b/config/webauthn.php @@ -1,7 +1,6 @@ [ - /* | See https://www.w3.org/TR/webauthn/#attachment */ @@ -221,5 +219,4 @@ return [ */ 'user_verification' => \Webauthn\AuthenticatorSelectionCriteria::USER_VERIFICATION_REQUIREMENT_PREFERRED, ], - ]; diff --git a/database/migrations/2019_03_29_163611_add_webauthn.php b/database/migrations/2019_03_29_163611_add_webauthn.php index 5e9718a4d..80406d4c5 100644 --- a/database/migrations/2019_03_29_163611_add_webauthn.php +++ b/database/migrations/2019_03_29_163611_add_webauthn.php @@ -1,8 +1,8 @@ '/nodes'], function () { }); }); - /* |-------------------------------------------------------------------------- | Role Controller Routes @@ -152,7 +151,6 @@ Route::group(['prefix' => '/roles'], function () { Route::delete('/{role}', 'Roles\RoleController@delete'); }); - /* |-------------------------------------------------------------------------- | Server Controller Routes diff --git a/tests/Integration/Api/Application/ApplicationApiIntegrationTestCase.php b/tests/Integration/Api/Application/ApplicationApiIntegrationTestCase.php index a15f88002..ab977dba4 100644 --- a/tests/Integration/Api/Application/ApplicationApiIntegrationTestCase.php +++ b/tests/Integration/Api/Application/ApplicationApiIntegrationTestCase.php @@ -41,9 +41,6 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase $this->createNewAccessToken(); } - /** - * @return \Pterodactyl\Models\User - */ public function getApiUser(): User { return $this->user; diff --git a/tests/Integration/Api/Client/Server/ScheduleTask/CreateServerScheduleTaskTest.php b/tests/Integration/Api/Client/Server/ScheduleTask/CreateServerScheduleTaskTest.php index d79173fb8..b031b4fb2 100644 --- a/tests/Integration/Api/Client/Server/ScheduleTask/CreateServerScheduleTaskTest.php +++ b/tests/Integration/Api/Client/Server/ScheduleTask/CreateServerScheduleTaskTest.php @@ -89,7 +89,7 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase } /** - * Test that backups can not be tasked when the backup limit is 0 + * Test that backups can not be tasked when the backup limit is 0. */ public function testBackupsCanNotBeTaskedIfLimit0() { diff --git a/tests/Integration/Jobs/Schedule/RunTaskJobTest.php b/tests/Integration/Jobs/Schedule/RunTaskJobTest.php index bd943cbc9..68249dc43 100644 --- a/tests/Integration/Jobs/Schedule/RunTaskJobTest.php +++ b/tests/Integration/Jobs/Schedule/RunTaskJobTest.php @@ -3,12 +3,11 @@ namespace Pterodactyl\Tests\Integration\Jobs\Schedule; use Mockery; -use Exception; use Carbon\CarbonImmutable; -use Pterodactyl\Models\Task; use GuzzleHttp\Psr7\Request; -use InvalidArgumentException; +use Pterodactyl\Models\Task; use GuzzleHttp\Psr7\Response; +use InvalidArgumentException; use Pterodactyl\Models\Server; use Pterodactyl\Models\Schedule; use Illuminate\Support\Facades\Bus; diff --git a/tests/Integration/Services/Servers/BuildModificationServiceTest.php b/tests/Integration/Services/Servers/BuildModificationServiceTest.php index 9a61caa34..88be5d8fc 100644 --- a/tests/Integration/Services/Servers/BuildModificationServiceTest.php +++ b/tests/Integration/Services/Servers/BuildModificationServiceTest.php @@ -8,7 +8,6 @@ use GuzzleHttp\Psr7\Response; use Pterodactyl\Models\Server; use Pterodactyl\Models\Allocation; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Exception\TransferException; use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Tests\Integration\IntegrationTestCase; use Pterodactyl\Repositories\Wings\DaemonServerRepository; diff --git a/tests/Unit/Http/Middleware/RequireTwoFactorAuthenticationTest.php b/tests/Unit/Http/Middleware/RequireTwoFactorAuthenticationTest.php index 9b4633f2f..2f984e2b9 100644 --- a/tests/Unit/Http/Middleware/RequireTwoFactorAuthenticationTest.php +++ b/tests/Unit/Http/Middleware/RequireTwoFactorAuthenticationTest.php @@ -6,8 +6,8 @@ use Mockery as m; use Pterodactyl\Models\User; use Pterodactyl\Models\WebauthnKey; use Prologue\Alerts\AlertsMessageBag; -use Pterodactyl\Http\Middleware\RequireTwoFactorAuthentication; use Pterodactyl\Exceptions\Http\TwoFactorAuthRequiredException; +use Pterodactyl\Http\Middleware\RequireTwoFactorAuthentication; class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase { @@ -23,7 +23,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase $this->alerts = m::mock(AlertsMessageBag::class); } - public function testNoRequirement__userWithout_2fa() + public function testNoRequirementUserWithout2fa() { // Disable the 2FA requirement config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_NONE); @@ -41,7 +41,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); } - public function testNoRequirement__userWithTotp_2fa() + public function testNoRequirementUserWithTotp2fa() { // Disable the 2FA requirement config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_NONE); @@ -59,7 +59,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); } - public function testNoRequirement__userWithWebauthn_2fa() + public function testNoRequirementUserWithWebauthn2fa() { // Disable the 2FA requirement config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_NONE); @@ -82,7 +82,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); } - public function testNoRequirement__guestUser() + public function testNoRequirementGuestUser() { // Disable the 2FA requirement config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_NONE); @@ -96,7 +96,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); } - public function testAllRequirement__userWithout_2fa() + public function testAllRequirementUserWithout2fa() { $this->expectException(TwoFactorAuthRequiredException::class); @@ -116,7 +116,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); } - public function testAllRequirement__userWithTotp_2fa() + public function testAllRequirementUserWithTotp2fa() { // Disable the 2FA requirement config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ALL); @@ -134,7 +134,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); } - public function testAllRequirement__ruserWithWebauthn_2fa() + public function testAllRequirementRuserWithWebauthn2fa() { // Disable the 2FA requirement config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ALL); @@ -157,7 +157,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); } - public function testAllRequirement__guestUser() + public function testAllRequirementGuestUser() { // Disable the 2FA requirement config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ALL); @@ -171,7 +171,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); } - public function testAdminRequirement__userWithout_2fa() + public function testAdminRequirementUserWithout2fa() { // Disable the 2FA requirement config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ADMIN); @@ -190,7 +190,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); } - public function testAdminRequirement__adminUserWithout_2fa() + public function testAdminRequirementAdminUserWithout2fa() { $this->expectException(TwoFactorAuthRequiredException::class); @@ -211,7 +211,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); } - public function testAdminRequirement__userWithTotp_2fa() + public function testAdminRequirementUserWithTotp2fa() { // Disable the 2FA requirement config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ADMIN); @@ -230,7 +230,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); } - public function testAdminRequirement__adminUserWithTotp_2fa() + public function testAdminRequirementAdminUserWithTotp2fa() { // Disable the 2FA requirement config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ADMIN); @@ -249,7 +249,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); } - public function testAdminRequirement__userWithWebauthn_2fa() + public function testAdminRequirementUserWithWebauthn2fa() { // Disable the 2FA requirement config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ADMIN); @@ -271,7 +271,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); } - public function testAdminRequirement__adminUserWithWebauthn_2fa() + public function testAdminRequirementAdminUserWithWebauthn2fa() { // Disable the 2FA requirement config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ADMIN); @@ -295,7 +295,7 @@ class RequireTwoFactorAuthenticationTest extends MiddlewareTestCase $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); } - public function testAdminRequirement__guestUser() + public function testAdminRequirementGuestUser() { // Disable the 2FA requirement config()->set('pterodactyl.auth.2fa_required', RequireTwoFactorAuthentication::LEVEL_ADMIN);