Use more standardized phpcs
This commit is contained in:
parent
a043071e3c
commit
c449ca5155
493 changed files with 1116 additions and 3903 deletions
|
@ -11,10 +11,10 @@ use Prologue\Alerts\AlertsMessageBag;
|
|||
|
||||
class DisplayException extends PterodactylException
|
||||
{
|
||||
const LEVEL_DEBUG = 'debug';
|
||||
const LEVEL_INFO = 'info';
|
||||
const LEVEL_WARNING = 'warning';
|
||||
const LEVEL_ERROR = 'error';
|
||||
public const LEVEL_DEBUG = 'debug';
|
||||
public const LEVEL_INFO = 'info';
|
||||
public const LEVEL_WARNING = 'warning';
|
||||
public const LEVEL_ERROR = 'error';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
|
@ -25,9 +25,8 @@ class DisplayException extends PterodactylException
|
|||
* Exception constructor.
|
||||
*
|
||||
* @param string $message
|
||||
* @param Throwable|null $previous
|
||||
* @param string $level
|
||||
* @param int $code
|
||||
* @param int $code
|
||||
*/
|
||||
public function __construct($message, Throwable $previous = null, $level = self::LEVEL_ERROR, $code = 0)
|
||||
{
|
||||
|
@ -58,6 +57,7 @@ class DisplayException extends PterodactylException
|
|||
* request originated from an API hit, return the error in JSONAPI spec format.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function render($request)
|
||||
|
@ -83,7 +83,7 @@ class DisplayException extends PterodactylException
|
|||
*/
|
||||
public function report()
|
||||
{
|
||||
if (! $this->getPrevious() instanceof Exception || ! Handler::isReportable($this->getPrevious())) {
|
||||
if (!$this->getPrevious() instanceof Exception || !Handler::isReportable($this->getPrevious())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ class Handler extends ExceptionHandler
|
|||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Throwable $exception
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*
|
||||
* @throws \Throwable
|
||||
|
@ -142,7 +142,7 @@ class Handler extends ExceptionHandler
|
|||
* calls to the API.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Validation\ValidationException $exception
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function invalidJson($request, ValidationException $exception)
|
||||
|
@ -162,7 +162,8 @@ class Handler extends ExceptionHandler
|
|||
$meta = [
|
||||
'source_field' => $field,
|
||||
'rule' => str_replace(self::PTERODACTYL_RULE_STRING, 'p_', Arr::get(
|
||||
$codes, str_replace('.', '_', $field) . '.' . $key
|
||||
$codes,
|
||||
str_replace('.', '_', $field) . '.' . $key
|
||||
)),
|
||||
];
|
||||
|
||||
|
@ -183,10 +184,6 @@ class Handler extends ExceptionHandler
|
|||
|
||||
/**
|
||||
* Return the exception as a JSONAPI representation for use on API requests.
|
||||
*
|
||||
* @param \Throwable $exception
|
||||
* @param array $override
|
||||
* @return array
|
||||
*/
|
||||
public static function convertToArray(Throwable $exception, array $override = []): array
|
||||
{
|
||||
|
@ -225,9 +222,6 @@ class Handler extends ExceptionHandler
|
|||
|
||||
/**
|
||||
* Return an array of exceptions that should not be reported.
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @return bool
|
||||
*/
|
||||
public static function isReportable(Exception $exception): bool
|
||||
{
|
||||
|
@ -238,7 +232,7 @@ class Handler extends ExceptionHandler
|
|||
* Convert an authentication exception into an unauthenticated response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Auth\AuthenticationException $exception
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
protected function unauthenticated($request, AuthenticationException $exception)
|
||||
|
@ -254,7 +248,6 @@ class Handler extends ExceptionHandler
|
|||
* Converts an exception into an array to render in the response. Overrides
|
||||
* Laravel's built-in converter to output as a JSONAPI spec compliant object.
|
||||
*
|
||||
* @param \Throwable $exception
|
||||
* @return array
|
||||
*/
|
||||
protected function convertExceptionToArray(Throwable $exception)
|
||||
|
|
|
@ -19,9 +19,6 @@ class DaemonConnectionException extends DisplayException
|
|||
|
||||
/**
|
||||
* Throw a displayable exception caused by a daemon connection error.
|
||||
*
|
||||
* @param \GuzzleHttp\Exception\GuzzleException $previous
|
||||
* @param bool $useStatusCode
|
||||
*/
|
||||
public function __construct(GuzzleException $previous, bool $useStatusCode = true)
|
||||
{
|
||||
|
@ -38,7 +35,7 @@ class DaemonConnectionException extends DisplayException
|
|||
|
||||
// Attempt to pull the actual error message off the response and return that if it is not
|
||||
// a 500 level error.
|
||||
if ($this->statusCode < 500 && ! is_null($response)) {
|
||||
if ($this->statusCode < 500 && !is_null($response)) {
|
||||
$body = $response->getBody();
|
||||
if (is_string($body) || (is_object($body) && method_exists($body, '__toString'))) {
|
||||
$body = json_decode(is_string($body) ? $body : $body->__toString(), true);
|
||||
|
|
|
@ -9,9 +9,6 @@ class HttpForbiddenException extends HttpException
|
|||
{
|
||||
/**
|
||||
* HttpForbiddenException constructor.
|
||||
*
|
||||
* @param string|null $message
|
||||
* @param \Throwable|null $previous
|
||||
*/
|
||||
public function __construct(string $message = null, \Throwable $previous = null)
|
||||
{
|
||||
|
|
|
@ -11,8 +11,6 @@ class TwoFactorAuthRequiredException extends HttpException implements HttpExcept
|
|||
{
|
||||
/**
|
||||
* TwoFactorAuthRequiredException constructor.
|
||||
*
|
||||
* @param \Throwable|null $previous
|
||||
*/
|
||||
public function __construct(Throwable $previous = null)
|
||||
{
|
||||
|
|
|
@ -18,8 +18,6 @@ class DataValidationException extends PterodactylException implements HttpExcept
|
|||
|
||||
/**
|
||||
* DataValidationException constructor.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Validation\Validator $validator
|
||||
*/
|
||||
public function __construct(Validator $validator)
|
||||
{
|
||||
|
|
|
@ -8,8 +8,6 @@ class TooManyBackupsException extends DisplayException
|
|||
{
|
||||
/**
|
||||
* TooManyBackupsException constructor.
|
||||
*
|
||||
* @param int $backupLimit
|
||||
*/
|
||||
public function __construct(int $backupLimit)
|
||||
{
|
||||
|
|
|
@ -10,9 +10,6 @@ class ServiceLimitExceededException extends DisplayException
|
|||
/**
|
||||
* Exception thrown when something goes over a defined limit, such as allocated
|
||||
* ports, tasks, databases, etc.
|
||||
*
|
||||
* @param string $message
|
||||
* @param \Throwable|null $previous
|
||||
*/
|
||||
public function __construct(string $message, Throwable $previous = null)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue