@@ -23,7 +23,7 @@ |
||
| 23 | 23 | * @param int $unionCloudCode |
| 24 | 24 | * @param string $unionCloudMessage |
| 25 | 25 | */ |
| 26 | - public function __construct($message='Page of results not found', $code=404, Throwable $previous = null, $unionCloudCode = 0, $unionCloudMessage='') |
|
| 26 | + public function __construct($message = 'Page of results not found', $code = 404, Throwable $previous = null, $unionCloudCode = 0, $unionCloudMessage = '') |
|
| 27 | 27 | { |
| 28 | 28 | parent::__construct($message, $code, $previous, $unionCloudCode, $unionCloudMessage); |
| 29 | 29 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | * @param int $unionCloudCode |
| 27 | 27 | * @param string $unionCloudMessage |
| 28 | 28 | */ |
| 29 | - public function __construct($message='Pagination Failed', $code=500, Throwable $previous = null, $unionCloudCode = 0, $unionCloudMessage='') |
|
| 29 | + public function __construct($message = 'Pagination Failed', $code = 500, Throwable $previous = null, $unionCloudCode = 0, $unionCloudMessage = '') |
|
| 30 | 30 | { |
| 31 | 31 | parent::__construct($message, $code, $previous, $unionCloudCode, $unionCloudMessage); |
| 32 | 32 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | * @param int $unionCloudCode |
| 25 | 25 | * @param string $unionCloudMessage |
| 26 | 26 | */ |
| 27 | - public function __construct($message='You don\'t have the permission to do that', $code=403, Throwable $previous = null, $unionCloudCode = 0, $unionCloudMessage='') |
|
| 27 | + public function __construct($message = 'You don\'t have the permission to do that', $code = 403, Throwable $previous = null, $unionCloudCode = 0, $unionCloudMessage = '') |
|
| 28 | 28 | {
|
| 29 | 29 | parent::__construct($message, $code, $previous, $unionCloudCode, $unionCloudMessage); |
| 30 | 30 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | * @param int $unionCloudCode |
| 26 | 26 | * @param string $unionCloudMessage |
| 27 | 27 | */ |
| 28 | - public function __construct($message='A problem occured creating your resource', $code=500, Throwable $previous = null, $unionCloudCode = 0, $unionCloudMessage='') |
|
| 28 | + public function __construct($message = 'A problem occured creating your resource', $code = 500, Throwable $previous = null, $unionCloudCode = 0, $unionCloudMessage = '') |
|
| 29 | 29 | { |
| 30 | 30 | parent::__construct($message, $code, $previous, $unionCloudCode, $unionCloudMessage); |
| 31 | 31 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | * @param int $unionCloudCode |
| 25 | 25 | * @param string $unionCloudMessage |
| 26 | 26 | */ |
| 27 | - public function __construct($message='Your resource wasn\'t found', $code=400, Throwable $previous = null, $unionCloudCode = 0, $unionCloudMessage='') |
|
| 27 | + public function __construct($message = 'Your resource wasn\'t found', $code = 400, Throwable $previous = null, $unionCloudCode = 0, $unionCloudMessage = '') |
|
| 28 | 28 | { |
| 29 | 29 | parent::__construct($message, $code, $previous, $unionCloudCode, $unionCloudMessage); |
| 30 | 30 | } |
@@ -366,38 +366,38 @@ discard block |
||
| 366 | 366 | {
|
| 367 | 367 | |
| 368 | 368 | // If no data was returned, no resource was found |
| 369 | - if($this->getRawData() === null) |
|
| 369 | + if ($this->getRawData() === null) |
|
| 370 | 370 | {
|
| 371 | 371 | throw new ResourceNotFoundException('The resource wasn\'t found', 404);
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - $responseBody = (array_key_exists(0, $this->getRawData())?$this->getRawData()[0]:$this->getRawData()); |
|
| 374 | + $responseBody = (array_key_exists(0, $this->getRawData()) ? $this->getRawData()[0] : $this->getRawData()); |
|
| 375 | 375 | |
| 376 | 376 | // Process the standard error code response. |
| 377 | 377 | |
| 378 | - if(array_key_exists('errors', $responseBody) || array_key_exists('error', $responseBody))
|
|
| 378 | + if (array_key_exists('errors', $responseBody) || array_key_exists('error', $responseBody))
|
|
| 379 | 379 | {
|
| 380 | 380 | $errors = []; |
| 381 | 381 | // Get the errors |
| 382 | - if(array_key_exists('errors', $responseBody))
|
|
| 382 | + if (array_key_exists('errors', $responseBody))
|
|
| 383 | 383 | {
|
| 384 | 384 | $errors = $responseBody['errors']; |
| 385 | - } elseif(array_key_exists('error', $responseBody))
|
|
| 385 | + } elseif (array_key_exists('error', $responseBody))
|
|
| 386 | 386 | {
|
| 387 | 387 | $errors = $responseBody['error']; |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | // Standardize the errors. If the errors aren't in an enclosing array, put them in one so we can iterate through them |
| 391 | - if(! array_key_exists(0, $errors)) |
|
| 391 | + if (!array_key_exists(0, $errors)) |
|
| 392 | 392 | {
|
| 393 | 393 | $errors = [$errors]; |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | // Throw the error |
| 397 | 397 | // TODO allow all errors to be seen by the user |
| 398 | - foreach($errors as $error) |
|
| 398 | + foreach ($errors as $error) |
|
| 399 | 399 | {
|
| 400 | - if(array_key_exists('error_code', $error) && array_key_exists('error_message', $error))
|
|
| 400 | + if (array_key_exists('error_code', $error) && array_key_exists('error_message', $error))
|
|
| 401 | 401 | {
|
| 402 | 402 | $this->throwCustomUnionCloudError($error); |
| 403 | 403 | } |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | {
|
| 425 | 425 | $errorCode = $error['error_code']; |
| 426 | 426 | $errorMessage = $error['error_message']; |
| 427 | - if(($errorDetails = $this->getUnionCloudErrorDetails($errorCode)) !== false) |
|
| 427 | + if (($errorDetails = $this->getUnionCloudErrorDetails($errorCode)) !== false) |
|
| 428 | 428 | {
|
| 429 | 429 | throw new $errorDetails['errorClass']($errorDetails['message'], $errorDetails['code'], null, $errorCode, $errorMessage); |
| 430 | 430 | } |
@@ -761,7 +761,7 @@ discard block |
||
| 761 | 761 | ], |
| 762 | 762 | ]; |
| 763 | 763 | |
| 764 | - if(array_key_exists($errorCode, $errors)) |
|
| 764 | + if (array_key_exists($errorCode, $errors)) |
|
| 765 | 765 | {
|
| 766 | 766 | $error = $errors[$errorCode]; |
| 767 | 767 | return [ |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | $parsedResource = $this->parseResource($resource); |
| 791 | 791 | $resources->addResource($parsedResource); |
| 792 | 792 | } |
| 793 | - } catch(\Exception $e) {
|
|
| 793 | + } catch (\Exception $e) {
|
|
| 794 | 794 | // See the above TODO |
| 795 | 795 | } |
| 796 | 796 | return $resources; |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | public function register() |
| 46 | 46 | { |
| 47 | 47 | |
| 48 | - $this->app->singleton('Twigger\UnionCloud\API\UnionCloud', function($app){ |
|
| 48 | + $this->app->singleton('Twigger\UnionCloud\API\UnionCloud', function($app) { |
|
| 49 | 49 | $unionCloud = new UnionCloud([ |
| 50 | 50 | 'email' => config('unioncloud.v0auth.email', 'email'), |
| 51 | 51 | 'password' => config('unioncloud.v0auth.password', 'password'), |