@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | public function toArray($request) |
24 | 24 | { |
25 | - $notification = (object)$this->data; |
|
25 | + $notification = (object) $this->data; |
|
26 | 26 | $resource = [ |
27 | 27 | 'id' => $this->getKey(), |
28 | 28 | 'title' => $notification->title, |
@@ -15,7 +15,7 @@ |
||
15 | 15 | public function boot() |
16 | 16 | { |
17 | 17 | Broadcast::routes([ |
18 | - 'middleware' => ['api'], |
|
18 | + 'middleware' => [ 'api' ], |
|
19 | 19 | 'domain' => env('API_URL'), |
20 | 20 | ]); |
21 | 21 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | } |
43 | 43 | $randomIndex = random_int(0, count($array) - 1); |
44 | 44 | |
45 | - return $array[$randomIndex]; |
|
45 | + return $array[ $randomIndex ]; |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | if (!function_exists('create_multiple_from_factory')) { |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $traits = array_flip(class_uses_recursive($class)); |
93 | 93 | |
94 | - return isset($traits[$trait]); |
|
94 | + return isset($traits[ $trait ]); |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | if (!function_exists('array_keys_exists')) { |
@@ -123,8 +123,9 @@ discard block |
||
123 | 123 | |
124 | 124 | $result = array_intersect($subset, $array); |
125 | 125 | |
126 | - if ($strict) |
|
127 | - return $result === $subset; |
|
126 | + if ($strict) { |
|
127 | + return $result === $subset; |
|
128 | + } |
|
128 | 129 | |
129 | 130 | return $result == $subset; |
130 | 131 | } |
@@ -133,7 +134,9 @@ discard block |
||
133 | 134 | if (!function_exists('is_associative_array')) { |
134 | 135 | function is_associative_array(array $arr) |
135 | 136 | { |
136 | - if (array() === $arr) return false; |
|
137 | + if (array() === $arr) { |
|
138 | + return false; |
|
139 | + } |
|
137 | 140 | return array_keys($arr) !== range(0, count($arr) - 1); |
138 | 141 | } |
139 | 142 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | $this->artisan('cache:clear'); |
24 | 24 | $this->artisan('db:seed'); |
25 | 25 | |
26 | - $this->beforeApplicationDestroyed(function () { |
|
26 | + $this->beforeApplicationDestroyed(function() { |
|
27 | 27 | $this->artisan('cache:clear'); |
28 | 28 | $this->artisan('migrate:rollback'); |
29 | 29 | RefreshDatabaseState::$migrated = false; |
@@ -28,6 +28,6 @@ |
||
28 | 28 | |
29 | 29 | public function receivesBroadcastNotificationsOn() |
30 | 30 | { |
31 | - return strtolower(get_short_class_name($this)) . '.' . $this->getKey(); |
|
31 | + return strtolower(get_short_class_name($this)).'.'.$this->getKey(); |
|
32 | 32 | } |
33 | 33 | } |
@@ -65,8 +65,9 @@ |
||
65 | 65 | |
66 | 66 | protected function decodeHttpContent($content, $unwrap = true) |
67 | 67 | { |
68 | - if ($unwrap) |
|
69 | - return json_decode($content, true)['data']; |
|
68 | + if ($unwrap) { |
|
69 | + return json_decode($content, true)['data']; |
|
70 | + } |
|
70 | 71 | return json_decode($content, true); |
71 | 72 | } |
72 | 73 |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | |
45 | 45 | private function getUserTokenData(): \stdClass |
46 | 46 | { |
47 | - return Cache::remember('testing:http_access_token', 60, function () { |
|
47 | + return Cache::remember('testing:http_access_token', 60, function() { |
|
48 | 48 | try { |
49 | 49 | $httpClient = new Client(); |
50 | - $response = $httpClient->post(env('AUTH0_DOMAIN') . 'oauth/token', [ |
|
50 | + $response = $httpClient->post(env('AUTH0_DOMAIN').'oauth/token', [ |
|
51 | 51 | 'form_params' => [ |
52 | 52 | 'grant_type' => 'password', |
53 | 53 | 'client_id' => env('AUTH0_CLIENT_ID'), |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | ]); |
59 | 59 | return json_decode($response->getBody()->getContents()); |
60 | 60 | } catch (ClientException $exception) { |
61 | - throw new Exception("Could not obtain token from Auth0 at " . env('AUTH0_DOMAIN') . " for testing."); |
|
61 | + throw new Exception("Could not obtain token from Auth0 at ".env('AUTH0_DOMAIN')." for testing."); |
|
62 | 62 | } |
63 | 63 | }); |
64 | 64 | } |
@@ -66,30 +66,30 @@ discard block |
||
66 | 66 | protected function decodeHttpContent($content, $unwrap = true) |
67 | 67 | { |
68 | 68 | if ($unwrap) |
69 | - return json_decode($content, true)['data']; |
|
69 | + return json_decode($content, true)[ 'data' ]; |
|
70 | 70 | return json_decode($content, true); |
71 | 71 | } |
72 | 72 | |
73 | - protected function http(string $method, string $route, array $payload = []) |
|
73 | + protected function http(string $method, string $route, array $payload = [ ]) |
|
74 | 74 | { |
75 | 75 | return $this->sendRequest($method, $route, $payload, true); |
76 | 76 | } |
77 | 77 | |
78 | - private function sendRequest(string $method, string $route, array $payload = [], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
78 | + private function sendRequest(string $method, string $route, array $payload = [ ], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
79 | 79 | { |
80 | - return $this->json($method, env('API_URL') . '/' . $route, $payload, $authenticated ? [ |
|
81 | - 'Authorization' => 'Bearer ' . $this->getUserTokenData()->id_token, |
|
82 | - ] : []); |
|
80 | + return $this->json($method, env('API_URL').'/'.$route, $payload, $authenticated ? [ |
|
81 | + 'Authorization' => 'Bearer '.$this->getUserTokenData()->id_token, |
|
82 | + ] : [ ]); |
|
83 | 83 | } |
84 | 84 | |
85 | - protected function sendRequestWithToken($token, string $method, string $route, array $payload = [], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
85 | + protected function sendRequestWithToken($token, string $method, string $route, array $payload = [ ], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
86 | 86 | { |
87 | - return $this->json($method, env('API_URL') . '/' . $route, $payload, $authenticated ? [ |
|
88 | - 'Authorization' => 'Bearer ' . $token, |
|
89 | - ] : []); |
|
87 | + return $this->json($method, env('API_URL').'/'.$route, $payload, $authenticated ? [ |
|
88 | + 'Authorization' => 'Bearer '.$token, |
|
89 | + ] : [ ]); |
|
90 | 90 | } |
91 | 91 | |
92 | - protected function httpNoAuth(string $method, string $route, array $payload = []) |
|
92 | + protected function httpNoAuth(string $method, string $route, array $payload = [ ]) |
|
93 | 93 | { |
94 | 94 | return $this->sendRequest($method, $route, $payload, false); |
95 | 95 | } |
@@ -14,23 +14,23 @@ |
||
14 | 14 | { |
15 | 15 | protected $connection = 'mysql'; |
16 | 16 | |
17 | - public static function find($id, $columns = ['*']) |
|
17 | + public static function find($id, $columns = [ '*' ]) |
|
18 | 18 | { |
19 | - if ((bool)config('model.caching')) { |
|
19 | + if ((bool) config('model.caching')) { |
|
20 | 20 | $model = ModelCache::findOrRequery($id, get_called_class()); |
21 | 21 | return self::filterFromColumns($model, $columns); |
22 | 22 | } |
23 | 23 | return self::findWithoutCache($id, $columns); |
24 | 24 | } |
25 | 25 | |
26 | - public static function findWithoutCache($id, $columns = ['*']) |
|
26 | + public static function findWithoutCache($id, $columns = [ '*' ]) |
|
27 | 27 | { |
28 | 28 | return parent::find($id, $columns); |
29 | 29 | } |
30 | 30 | |
31 | 31 | private static function filterFromColumns($model, $columns) |
32 | 32 | { |
33 | - if ($columns !== ['*']) { |
|
33 | + if ($columns !== [ '*' ]) { |
|
34 | 34 | return collect($model)->first($columns); |
35 | 35 | } |
36 | 36 | return $model; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $id = $user->getKey(); |
21 | 21 | $response = $this->http('POST', '/broadcasting/auth', [ |
22 | 22 | 'socket_id' => '125200.2991064', |
23 | - 'channel_name' => 'private-user.' . $id |
|
23 | + 'channel_name' => 'private-user.'.$id |
|
24 | 24 | ]); |
25 | 25 | $response->assertStatus(200); |
26 | 26 | $this->assertArrayHasKey('auth', $this->decodeHttpContent($response->content(), false)); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | { |
31 | 31 | $response = $this->http('POST', '/broadcasting/auth', [ |
32 | 32 | 'socket_id' => '125200.2991064', |
33 | - 'channel_name' => 'private-user.' . new ObjectId() |
|
33 | + 'channel_name' => 'private-user.'.new ObjectId() |
|
34 | 34 | ]); |
35 | 35 | $response->assertStatus(403); |
36 | 36 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | private function storeInCache($data) |
56 | 56 | { |
57 | - file_put_contents($this->getCachePath(), '<?php return ' . var_export($data, true) . ';'); |
|
57 | + file_put_contents($this->getCachePath(), '<?php return '.var_export($data, true).';'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | private function getCachePath(): string |
85 | 85 | { |
86 | - return app()->bootstrapPath() . '/cache/' . $this->cacheFile; |
|
86 | + return app()->bootstrapPath().'/cache/'.$this->cacheFile; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | */ |
92 | 92 | private function buildEmptyBootstrapArray() |
93 | 93 | { |
94 | - $bootstrapArray = []; |
|
94 | + $bootstrapArray = [ ]; |
|
95 | 95 | foreach ($this->moduleEntityDirectories as $key => $directory) { |
96 | - $bootstrapArray[$key] = []; |
|
96 | + $bootstrapArray[ $key ] = [ ]; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | return $bootstrapArray; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $moduleNames = array_diff(scandir($path), array('..', '.')); |
109 | 109 | $modules = array(); |
110 | 110 | foreach ($moduleNames as $moduleName) { |
111 | - $modules[$moduleName] = $path . '/' . $moduleName; |
|
111 | + $modules[ $moduleName ] = $path.'/'.$moduleName; |
|
112 | 112 | } |
113 | 113 | return $modules; |
114 | 114 | } |
@@ -124,51 +124,51 @@ discard block |
||
124 | 124 | if (is_dir($modulePath)) { |
125 | 125 | foreach ($this->moduleEntityDirectories as $key => $directory) { |
126 | 126 | $directory = ucfirst($directory); |
127 | - $directoryPath = $modulePath . '/' . $directory; |
|
128 | - $namespace = 'Modules' . '\\' . $moduleName; |
|
127 | + $directoryPath = $modulePath.'/'.$directory; |
|
128 | + $namespace = 'Modules'.'\\'.$moduleName; |
|
129 | 129 | if (is_dir($directoryPath)) { |
130 | 130 | $files = scandir($directoryPath); |
131 | 131 | foreach ($files as $fileName) { |
132 | 132 | if ($this->hasPhpExtension($fileName)) { |
133 | 133 | $className = basename($fileName, '.php'); |
134 | - $class = $namespace . '\\' . str_replace('/', '\\', $directory) . '\\' . $className; |
|
134 | + $class = $namespace.'\\'.str_replace('/', '\\', $directory).'\\'.$className; |
|
135 | 135 | switch ($key) { |
136 | 136 | case 'commands': |
137 | 137 | try { |
138 | 138 | $command = new $class(); |
139 | 139 | if ($command instanceof Command) { |
140 | - $bootstrap[$key][] = $class; |
|
140 | + $bootstrap[ $key ][ ] = $class; |
|
141 | 141 | } |
142 | 142 | } catch (\Exception $e) { |
143 | 143 | break; |
144 | 144 | } |
145 | 145 | break; |
146 | 146 | case 'routes': |
147 | - $bootstrap[$key][] = $this->buildRouteArray($directoryPath . '/' . $fileName, $namespace); |
|
147 | + $bootstrap[ $key ][ ] = $this->buildRouteArray($directoryPath.'/'.$fileName, $namespace); |
|
148 | 148 | break; |
149 | 149 | case 'configs': |
150 | - $bootstrap[$key][] = $this->buildConfigArray($directoryPath . '/' . $fileName, $moduleName, $fileName); |
|
150 | + $bootstrap[ $key ][ ] = $this->buildConfigArray($directoryPath.'/'.$fileName, $moduleName, $fileName); |
|
151 | 151 | break; |
152 | 152 | case 'factories': |
153 | - $bootstrap[$key][] = $this->buildDirectoryPathArray($directoryPath); |
|
153 | + $bootstrap[ $key ][ ] = $this->buildDirectoryPathArray($directoryPath); |
|
154 | 154 | break; |
155 | 155 | case 'migrations': |
156 | - $bootstrap[$key][] = $this->buildDirectoryPathArray($directoryPath); |
|
156 | + $bootstrap[ $key ][ ] = $this->buildDirectoryPathArray($directoryPath); |
|
157 | 157 | break; |
158 | 158 | case 'seeders': |
159 | - $bootstrap[$key][] = $class; |
|
159 | + $bootstrap[ $key ][ ] = $class; |
|
160 | 160 | break; |
161 | 161 | case 'models': |
162 | - $bootstrap[$key][] = $class; |
|
162 | + $bootstrap[ $key ][ ] = $class; |
|
163 | 163 | break; |
164 | 164 | case 'policies': |
165 | - $bootstrap[$key][] = $this->buildPolicyArray($class, $namespace); |
|
165 | + $bootstrap[ $key ][ ] = $this->buildPolicyArray($class, $namespace); |
|
166 | 166 | break; |
167 | 167 | case 'providers': |
168 | - $bootstrap[$key][] = $class; |
|
168 | + $bootstrap[ $key ][ ] = $class; |
|
169 | 169 | break; |
170 | 170 | case 'events': |
171 | - $bootstrap[$key][] = $this->buildEventsArray($class); |
|
171 | + $bootstrap[ $key ][ ] = $this->buildEventsArray($class); |
|
172 | 172 | break; |
173 | 173 | default: |
174 | 174 | break; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | private function hasPhpExtension(string $fileName): bool |
192 | 192 | { |
193 | - return strlen($fileName) > 4 && '.php' === ($fileName[-4] . $fileName[-3] . $fileName[-2] . $fileName[-1]); |
|
193 | + return strlen($fileName) > 4 && '.php' === ($fileName[-4 ].$fileName[-3 ].$fileName[-2 ].$fileName[-1 ]); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | $apiDomain = str_replace('http://', '', $apiDomain); |
222 | 222 | $apiDomain = str_replace('https://', '', $apiDomain); |
223 | 223 | $moduleNamespace = $namespace; |
224 | - $moduleName = explode('\\', $moduleNamespace)[1]; |
|
225 | - $controllerNamespace = $moduleNamespace . '\\' . 'Http\\Controllers'; |
|
226 | - $modelNameSpace = $moduleNamespace . '\\' . 'Entities\\' . $moduleName; |
|
224 | + $moduleName = explode('\\', $moduleNamespace)[ 1 ]; |
|
225 | + $controllerNamespace = $moduleNamespace.'\\'.'Http\\Controllers'; |
|
226 | + $modelNameSpace = $moduleNamespace.'\\'.'Entities\\'.$moduleName; |
|
227 | 227 | |
228 | 228 | return [ |
229 | 229 | 'path' => $path, |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | private function buildPolicyArray($class, $namespace) |
245 | 245 | { |
246 | 246 | $moduleNamespace = $namespace; |
247 | - $moduleName = explode('\\', $moduleNamespace)[1]; |
|
248 | - $modelNameSpace = $moduleNamespace . '\\' . 'Entities\\' . $moduleName; |
|
247 | + $moduleName = explode('\\', $moduleNamespace)[ 1 ]; |
|
248 | + $modelNameSpace = $moduleNamespace.'\\'.'Entities\\'.$moduleName; |
|
249 | 249 | |
250 | 250 | return [ |
251 | 251 | 'class' => $class, |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $listeners = array(); |
287 | 287 | foreach ($listenerProperties as $listener) { |
288 | 288 | if (class_implements_interface($listener, ListenerContract::class)) { |
289 | - $listeners[] = $listener; |
|
289 | + $listeners[ ] = $listener; |
|
290 | 290 | } |
291 | 291 | } |
292 | 292 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | */ |
302 | 302 | public function getCommands(): array |
303 | 303 | { |
304 | - return $this->loadBootstrapFromCache()['commands'] ?? []; |
|
304 | + return $this->loadBootstrapFromCache()[ 'commands' ] ?? [ ]; |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | /** |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | */ |
310 | 310 | public function getRoutes(): array |
311 | 311 | { |
312 | - return $this->loadBootstrapFromCache()['routes'] ?? []; |
|
312 | + return $this->loadBootstrapFromCache()[ 'routes' ] ?? [ ]; |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | /** |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | */ |
318 | 318 | public function getConfigs(): array |
319 | 319 | { |
320 | - return $this->loadBootstrapFromCache()['configs'] ?? []; |
|
320 | + return $this->loadBootstrapFromCache()[ 'configs' ] ?? [ ]; |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | /** |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | */ |
326 | 326 | public function getFactories(): array |
327 | 327 | { |
328 | - return $this->loadBootstrapFromCache()['factories'] ?? []; |
|
328 | + return $this->loadBootstrapFromCache()[ 'factories' ] ?? [ ]; |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | */ |
334 | 334 | public function getMigrations(): array |
335 | 335 | { |
336 | - return $this->loadBootstrapFromCache()['migrations'] ?? []; |
|
336 | + return $this->loadBootstrapFromCache()[ 'migrations' ] ?? [ ]; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | */ |
342 | 342 | public function getSeeders(): array |
343 | 343 | { |
344 | - return $this->loadBootstrapFromCache()['seeders'] ?? []; |
|
344 | + return $this->loadBootstrapFromCache()[ 'seeders' ] ?? [ ]; |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | */ |
350 | 350 | public function getModels(): array |
351 | 351 | { |
352 | - return $this->loadBootstrapFromCache()['models'] ?? []; |
|
352 | + return $this->loadBootstrapFromCache()[ 'models' ] ?? [ ]; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | /** |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | */ |
358 | 358 | public function getPolicies(): array |
359 | 359 | { |
360 | - return $this->loadBootstrapFromCache()['policies'] ?? []; |
|
360 | + return $this->loadBootstrapFromCache()[ 'policies' ] ?? [ ]; |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | */ |
366 | 366 | public function getProviders(): array |
367 | 367 | { |
368 | - return $this->loadBootstrapFromCache()['providers'] ?? []; |
|
368 | + return $this->loadBootstrapFromCache()[ 'providers' ] ?? [ ]; |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
@@ -373,6 +373,6 @@ discard block |
||
373 | 373 | */ |
374 | 374 | public function getEvents(): array |
375 | 375 | { |
376 | - return $this->loadBootstrapFromCache()['events'] ?? []; |
|
376 | + return $this->loadBootstrapFromCache()[ 'events' ] ?? [ ]; |
|
377 | 377 | } |
378 | 378 | } |