Apply php-cs-fixer changes

This commit is contained in:
Dane Everitt 2021-08-07 16:10:24 -07:00
parent cec96062e3
commit 436e686037
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
72 changed files with 91 additions and 196 deletions

View file

@ -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;

View file

@ -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();
}

View file

@ -9,8 +9,6 @@ class BaseController extends Controller
{
/**
* Return the admin index view.
*
* @return \Illuminate\View\View
*/
public function index(): View
{

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -26,7 +26,6 @@ class SSHKeyController extends ClientApiController
/**
* ?
*
* @return JsonResponse
* @throws \Illuminate\Contracts\Container\BindingResolutionException
* @throws \Pterodactyl\Exceptions\DisplayException
*/

View file

@ -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;

View file

@ -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;

View file

@ -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
{

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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;
}

View file

@ -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,
]);
}

View file

@ -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);

View file

@ -20,8 +20,6 @@ class SubstituteApplicationApiBindings
/**
* Mappings to automatically assign route parameters to a model.
*
* @var array
*/
protected static array $mappings = [
'allocation' => Allocation::class,

View file

@ -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()) {

View file

@ -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()));
}
}

View file

@ -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;
/**

View file

@ -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
{

View file

@ -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',
];
}

View file

@ -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',

View file

@ -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',

View file

@ -61,9 +61,6 @@ class AuditLog extends Model
*/
protected $table = 'audit_logs';
/**
* @var bool
*/
protected bool $immutableDates = true;
/**

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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
{

View file

@ -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)

View file

@ -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',

View file

@ -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
{

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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)) {

View file

@ -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;

View file

@ -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);
}
}

View file

@ -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
{

View file

@ -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

View file

@ -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,

View file

@ -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
{

View file

@ -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)

View file

@ -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;

View file

@ -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
{

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration

View file

@ -118,7 +118,7 @@ return [
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'),
],
'default' => [

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Stateful Domains
@ -16,7 +15,7 @@ return [
'stateful' => 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,
],
];

View file

@ -16,7 +16,7 @@ return [
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
'endpoint' => env('MAILGUN_ENDPOINT')
'endpoint' => env('MAILGUN_ENDPOINT'),
],
'mandrill' => [

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| LaravelWebauthn Master Switch
@ -208,7 +207,6 @@ return [
*/
'authenticator_selection_criteria' => [
/*
| See https://www.w3.org/TR/webauthn/#attachment
*/
@ -221,5 +219,4 @@ return [
*/
'user_verification' => \Webauthn\AuthenticatorSelectionCriteria::USER_VERIFICATION_REQUIREMENT_PREFERRED,
],
];

View file

@ -1,8 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddWebauthn extends Migration
{

View file

@ -1,8 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePersonalAccessTokensTable extends Migration
{

View file

@ -1,8 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAdminRolesTable extends Migration
{

View file

@ -1,8 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddIndexForServerAndAction extends Migration
{

View file

@ -1,8 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class MakeSftpPortUnsignedInt extends Migration
{

View file

@ -1,9 +1,9 @@
<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ForceCronMonthFieldToHaveValueIfMissing extends Migration
{

View file

@ -1,8 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddContinueOnFailureOptionToTasks extends Migration
{

View file

@ -1,8 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddOnlyRunWhenServerOnlineOptionToSchedules extends Migration
{

View file

@ -1,8 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddSupportForLockingABackup extends Migration
{

View file

@ -7,6 +7,7 @@ class RemoveUserInteraction extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()

View file

@ -1,8 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUserSshKeysTable extends Migration
{

View file

@ -1,8 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class YeetNamesFromUsersTable extends Migration
{

View file

@ -132,7 +132,6 @@ Route::group(['prefix' => '/nodes'], function () {
});
});
/*
|--------------------------------------------------------------------------
| Role Controller Routes
@ -152,7 +151,6 @@ Route::group(['prefix' => '/roles'], function () {
Route::delete('/{role}', 'Roles\RoleController@delete');
});
/*
|--------------------------------------------------------------------------
| Server Controller Routes

View file

@ -41,9 +41,6 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase
$this->createNewAccessToken();
}
/**
* @return \Pterodactyl\Models\User
*/
public function getApiUser(): User
{
return $this->user;

View file

@ -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()
{

View file

@ -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;

View file

@ -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;

View file

@ -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);