@@ -31,8 +31,9 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | protected function parseRequestIncludeParameter($request) |
| 33 | 33 | { |
| 34 | - if (isset($request->include) && is_string($request->include)) |
|
| 35 | - return explode(',', $request->include); |
|
| 34 | + if (isset($request->include) && is_string($request->include)) { |
|
| 35 | + return explode(',', $request->include); |
|
| 36 | + } |
|
| 36 | 37 | |
| 37 | 38 | return []; |
| 38 | 39 | } |
@@ -53,10 +54,11 @@ discard block |
||
| 53 | 54 | $data = $this->$method($this->resource); |
| 54 | 55 | } |
| 55 | 56 | if ($data instanceof JsonResource) { |
| 56 | - if ($data->resource === null) |
|
| 57 | - $data = null; |
|
| 58 | - else |
|
| 59 | - $data->jsonSerialize(); |
|
| 57 | + if ($data->resource === null) { |
|
| 58 | + $data = null; |
|
| 59 | + } else { |
|
| 60 | + $data->jsonSerialize(); |
|
| 61 | + } |
|
| 60 | 62 | } |
| 61 | 63 | $relations[strtolower($relation)] = $data; |
| 62 | 64 | } else { |
@@ -72,8 +74,9 @@ discard block |
||
| 72 | 74 | */ |
| 73 | 75 | public function include($relations) |
| 74 | 76 | { |
| 75 | - if (is_string($relations)) |
|
| 76 | - $relations = [$relations]; |
|
| 77 | + if (is_string($relations)) { |
|
| 78 | + $relations = [$relations]; |
|
| 79 | + } |
|
| 77 | 80 | $this->include = array_unique(array_merge($this->include, $relations)); |
| 78 | 81 | return $this; |
| 79 | 82 | } |
@@ -83,8 +86,9 @@ discard block |
||
| 83 | 86 | */ |
| 84 | 87 | public function available($relations) |
| 85 | 88 | { |
| 86 | - if (is_string($relations)) |
|
| 87 | - $relations = [$relations]; |
|
| 89 | + if (is_string($relations)) { |
|
| 90 | + $relations = [$relations]; |
|
| 91 | + } |
|
| 88 | 92 | $this->available = array_unique(array_merge($this->available, $relations)); |
| 89 | 93 | return $this; |
| 90 | 94 | } |
@@ -83,10 +83,11 @@ discard block |
||
| 83 | 83 | $routePrefix = $fileNameArray[0]; |
| 84 | 84 | $version = $fileNameArray[1]; |
| 85 | 85 | |
| 86 | - if ($version === 'php') |
|
| 87 | - $prefix = $routePrefix; |
|
| 88 | - else |
|
| 89 | - $prefix = $version . '/' . $routePrefix; |
|
| 86 | + if ($version === 'php') { |
|
| 87 | + $prefix = $routePrefix; |
|
| 88 | + } else { |
|
| 89 | + $prefix = $version . '/' . $routePrefix; |
|
| 90 | + } |
|
| 90 | 91 | |
| 91 | 92 | Route::group([ |
| 92 | 93 | 'prefix' => $prefix, |
@@ -184,8 +185,9 @@ discard block |
||
| 184 | 185 | private function loadServiceProviders() |
| 185 | 186 | { |
| 186 | 187 | foreach ($this->bootstrapService->getProviders() as $provider) { |
| 187 | - if ($this->passedRegistrationCondition($provider)) |
|
| 188 | - $this->app->register($provider); |
|
| 188 | + if ($this->passedRegistrationCondition($provider)) { |
|
| 189 | + $this->app->register($provider); |
|
| 190 | + } |
|
| 189 | 191 | } |
| 190 | 192 | } |
| 191 | 193 | |
@@ -200,8 +202,9 @@ discard block |
||
| 200 | 202 | |
| 201 | 203 | private function passedRegistrationCondition($class) |
| 202 | 204 | { |
| 203 | - if (!class_implements_interface($class, ConditionalAutoRegistration::class)) |
|
| 204 | - return true; |
|
| 205 | + if (!class_implements_interface($class, ConditionalAutoRegistration::class)) { |
|
| 206 | + return true; |
|
| 207 | + } |
|
| 205 | 208 | return run_class_function($class, 'registrationCondition'); |
| 206 | 209 | } |
| 207 | 210 | } |
@@ -50,10 +50,11 @@ |
||
| 50 | 50 | public function toArray($request) |
| 51 | 51 | { |
| 52 | 52 | $collection = $this->collection->map(function ($item) { |
| 53 | - if ($item instanceof Transformer) |
|
| 54 | - return $item->include($this->relations); |
|
| 55 | - else |
|
| 56 | - return $item; |
|
| 53 | + if ($item instanceof Transformer) { |
|
| 54 | + return $item->include($this->relations); |
|
| 55 | + } else { |
|
| 56 | + return $item; |
|
| 57 | + } |
|
| 57 | 58 | }); |
| 58 | 59 | return $collection->map->resolve($request)->all(); |
| 59 | 60 | } |
@@ -34,8 +34,9 @@ |
||
| 34 | 34 | |
| 35 | 35 | $maxMachineCount = 20; |
| 36 | 36 | |
| 37 | - if($machineCount > $maxMachineCount) |
|
| 38 | - throw new Exception('You Cannot create more than 20 machines. Delete one first',401); |
|
| 37 | + if($machineCount > $maxMachineCount) { |
|
| 38 | + throw new Exception('You Cannot create more than 20 machines. Delete one first',401); |
|
| 39 | + } |
|
| 39 | 40 | } |
| 40 | 41 | |
| 41 | 42 | |
@@ -34,8 +34,9 @@ |
||
| 34 | 34 | |
| 35 | 35 | $maxAccountCount = 20; |
| 36 | 36 | |
| 37 | - if($AccountCount > $maxAccountCount) |
|
| 38 | - throw new Exception('You Cannot create more than 20 Accounts. Delete one first',401); |
|
| 37 | + if($AccountCount > $maxAccountCount) { |
|
| 38 | + throw new Exception('You Cannot create more than 20 Accounts. Delete one first',401); |
|
| 39 | + } |
|
| 39 | 40 | } |
| 40 | 41 | |
| 41 | 42 | |