Use more standardized phpcs

This commit is contained in:
Dane Everitt 2021-01-23 12:33:34 -08:00
parent a043071e3c
commit c449ca5155
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
493 changed files with 1116 additions and 3903 deletions

View file

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

View file

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