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

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

View file

@ -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 = [])

View file

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

View file

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

View file

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

View file

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