@@ -37,15 +37,15 @@ |
||
37 | 37 | $tokenInfo = $auth0->decodeJWT($accessToken); |
38 | 38 | $user = $this->auth0Service->getUserByDecodedJWT($tokenInfo); |
39 | 39 | |
40 | - if (! $user) { |
|
41 | - return response()->json(['error' => 'Unauthorized user.'], 401); |
|
40 | + if (!$user) { |
|
41 | + return response()->json([ 'error' => 'Unauthorized user.' ], 401); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | \Auth::login($user); |
45 | 45 | } catch (InvalidTokenException $e) { |
46 | - return response()->json(['error' => 'Invalid or no token set.'], 401); |
|
46 | + return response()->json([ 'error' => 'Invalid or no token set.' ], 401); |
|
47 | 47 | } catch (CoreException $e) { |
48 | - return response()->json(['error' => $e->getMessage()], 401); |
|
48 | + return response()->json([ 'error' => $e->getMessage() ], 401); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $next($request); |
@@ -49,17 +49,17 @@ discard block |
||
49 | 49 | |
50 | 50 | public function getUserByUserInfo($userInfo) |
51 | 51 | { |
52 | - return $this->upsertUser($userInfo['profile']); |
|
52 | + return $this->upsertUser($userInfo[ 'profile' ]); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | protected function upsertUser($profile) |
56 | 56 | { |
57 | - if (! isset($profile->user_id)) { |
|
57 | + if (!isset($profile->user_id)) { |
|
58 | 58 | throw new BadRequestHttpException('Missing token information: Auth0 user id is not set'); |
59 | 59 | } |
60 | 60 | $identifier = explode('|', $profile->user_id); |
61 | - $identityProvider = $identifier[0]; |
|
62 | - $id = $identifier[1]; |
|
61 | + $identityProvider = $identifier[ 0 ]; |
|
62 | + $id = $identifier[ 1 ]; |
|
63 | 63 | |
64 | 64 | $user = $this->service->findByIdentityId($id); |
65 | 65 | if ($user === null) { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | public function getTestUserToken() |
97 | 97 | { |
98 | - return Cache::remember('testing:http_access_token', 60, function () { |
|
98 | + return Cache::remember('testing:http_access_token', 60, function() { |
|
99 | 99 | try { |
100 | 100 | $httpClient = new Client(); |
101 | 101 | $response = $httpClient->post(env('AUTH0_DOMAIN').'oauth/token', [ |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | $this->loadServices(); |
78 | 78 | |
79 | - if (! $this->validator->validate($this->profile)) { |
|
79 | + if (!$this->validator->validate($this->profile)) { |
|
80 | 80 | throw new UnauthorizedException('Invalid profile data found in the access token'); |
81 | 81 | } |
82 | 82 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $profile = $this->transformer->transformProfile($this->profile); |
112 | 112 | |
113 | 113 | if ($this->profileHasChanged()) { |
114 | - $profile['provider'] = $this->identityProvider; |
|
114 | + $profile[ 'provider' ] = $this->identityProvider; |
|
115 | 115 | $this->user->fill($profile); |
116 | 116 | $this->user->save(); |
117 | 117 | } |
@@ -124,6 +124,6 @@ discard block |
||
124 | 124 | $user = $this->user->toArray(); |
125 | 125 | $profile = (array) $this->profile; |
126 | 126 | |
127 | - return ! array_is_subset_of($profile, $user); |
|
127 | + return !array_is_subset_of($profile, $user); |
|
128 | 128 | } |
129 | 129 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() |
29 | 29 | { |
30 | - if (! isset($this->collection) || $this->collection === '') { |
|
30 | + if (!isset($this->collection) || $this->collection === '') { |
|
31 | 31 | throw new InternalErrorException('Collection name must be specified on migration: '.get_called_class()); |
32 | 32 | } |
33 | 33 | } |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | */ |
40 | 40 | final public function up() |
41 | 41 | { |
42 | - if (! Schema::connection($this->connection)->hasTable($this->collection)) { |
|
43 | - Schema::connection($this->connection)->create($this->collection, function (Blueprint $collection) { |
|
42 | + if (!Schema::connection($this->connection)->hasTable($this->collection)) { |
|
43 | + Schema::connection($this->connection)->create($this->collection, function(Blueprint $collection) { |
|
44 | 44 | if (method_exists($this, 'migrate')) { |
45 | 45 | $this->migrate($collection); |
46 | 46 | } |
@@ -64,8 +64,8 @@ |
||
64 | 64 | |
65 | 65 | public function setRoles($id, array $roles): void |
66 | 66 | { |
67 | - if (! in_array(Role::USER, $roles)) { |
|
68 | - $roles[] = Role::USER; |
|
67 | + if (!in_array(Role::USER, $roles)) { |
|
68 | + $roles[ ] = Role::USER; |
|
69 | 69 | } |
70 | 70 | $this->find($id)->syncRoles($roles); |
71 | 71 | } |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | |
24 | 24 | public static function cache(): ModelCache |
25 | 25 | { |
26 | - if (! isset(static::$caching)) { |
|
26 | + if (!isset(static::$caching)) { |
|
27 | 27 | static::$caching = new ModelCache(static::class, get_class_property(static::class, 'secondaryCacheIndexes'), get_class_property(static::class, 'cacheTime')); |
28 | 28 | } |
29 | 29 | |
30 | 30 | return static::$caching; |
31 | 31 | } |
32 | 32 | |
33 | - public static function find($id, $columns = ['*']) |
|
33 | + public static function find($id, $columns = [ '*' ]) |
|
34 | 34 | { |
35 | 35 | if (static::cache()->enabled()) { |
36 | 36 | $model = static::cache()->find($id) ?? static::recache($id); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | return $model; |
50 | 50 | } |
51 | 51 | |
52 | - public static function findWithoutCache($id, $columns = ['*']) |
|
52 | + public static function findWithoutCache($id, $columns = [ '*' ]) |
|
53 | 53 | { |
54 | 54 | $model = new static(); |
55 | 55 | if (is_array($id) || $id instanceof Arrayable) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | return; |
66 | 66 | } |
67 | 67 | |
68 | - if ($columns !== ['*']) { |
|
68 | + if ($columns !== [ '*' ]) { |
|
69 | 69 | return collect($model)->first($columns); |
70 | 70 | } |
71 | 71 |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | */ |
89 | 89 | private function buildEmptyBootstrapArray() |
90 | 90 | { |
91 | - $bootstrapArray = []; |
|
91 | + $bootstrapArray = [ ]; |
|
92 | 92 | foreach ($this->moduleEntityDirectories as $key => $directory) { |
93 | - $bootstrapArray[$key] = []; |
|
93 | + $bootstrapArray[ $key ] = [ ]; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | return $bootstrapArray; |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | private function getModules(): array |
103 | 103 | { |
104 | 104 | $path = base_path('src/Modules'); |
105 | - $moduleNames = array_diff(scandir($path), ['..', '.']); |
|
106 | - $modules = []; |
|
105 | + $moduleNames = array_diff(scandir($path), [ '..', '.' ]); |
|
106 | + $modules = [ ]; |
|
107 | 107 | foreach ($moduleNames as $moduleName) { |
108 | - $modules[$moduleName] = $path.'/'.$moduleName; |
|
108 | + $modules[ $moduleName ] = $path.'/'.$moduleName; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | return $modules; |
@@ -135,38 +135,38 @@ discard block |
||
135 | 135 | try { |
136 | 136 | $command = new $class(); |
137 | 137 | if ($command instanceof Command) { |
138 | - $bootstrap[$key][] = $class; |
|
138 | + $bootstrap[ $key ][ ] = $class; |
|
139 | 139 | } |
140 | 140 | } catch (\Exception $e) { |
141 | 141 | break; |
142 | 142 | } |
143 | 143 | break; |
144 | 144 | case 'routes': |
145 | - $bootstrap[$key][] = $this->buildRouteArray($directoryPath.'/'.$fileName, $namespace, $fileName); |
|
145 | + $bootstrap[ $key ][ ] = $this->buildRouteArray($directoryPath.'/'.$fileName, $namespace, $fileName); |
|
146 | 146 | break; |
147 | 147 | case 'configs': |
148 | - $bootstrap[$key][] = $this->buildConfigArray($directoryPath.'/'.$fileName, $moduleName, $fileName); |
|
148 | + $bootstrap[ $key ][ ] = $this->buildConfigArray($directoryPath.'/'.$fileName, $moduleName, $fileName); |
|
149 | 149 | break; |
150 | 150 | case 'factories': |
151 | - $bootstrap[$key][] = $this->buildDirectoryPathArray($directoryPath); |
|
151 | + $bootstrap[ $key ][ ] = $this->buildDirectoryPathArray($directoryPath); |
|
152 | 152 | break; |
153 | 153 | case 'migrations': |
154 | - $bootstrap[$key][] = $this->buildDirectoryPathArray($directoryPath); |
|
154 | + $bootstrap[ $key ][ ] = $this->buildDirectoryPathArray($directoryPath); |
|
155 | 155 | break; |
156 | 156 | case 'seeders': |
157 | - $bootstrap[$key][] = $class; |
|
157 | + $bootstrap[ $key ][ ] = $class; |
|
158 | 158 | break; |
159 | 159 | case 'models': |
160 | - $bootstrap[$key][] = $class; |
|
160 | + $bootstrap[ $key ][ ] = $class; |
|
161 | 161 | break; |
162 | 162 | case 'policies': |
163 | - $bootstrap[$key][] = $this->buildPolicyArray($class, $namespace); |
|
163 | + $bootstrap[ $key ][ ] = $this->buildPolicyArray($class, $namespace); |
|
164 | 164 | break; |
165 | 165 | case 'providers': |
166 | - $bootstrap[$key][] = $class; |
|
166 | + $bootstrap[ $key ][ ] = $class; |
|
167 | 167 | break; |
168 | 168 | case 'events': |
169 | - $bootstrap[$key][] = $this->buildEventsArray($class); |
|
169 | + $bootstrap[ $key ][ ] = $this->buildEventsArray($class); |
|
170 | 170 | break; |
171 | 171 | default: |
172 | 172 | break; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | */ |
189 | 189 | private function hasPhpExtension(string $fileName): bool |
190 | 190 | { |
191 | - return strlen($fileName) > 4 && '.php' === ($fileName[-4].$fileName[-3].$fileName[-2].$fileName[-1]); |
|
191 | + return strlen($fileName) > 4 && '.php' === ($fileName[-4 ].$fileName[-3 ].$fileName[-2 ].$fileName[-1 ]); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function loadBootstrapFromCache() |
198 | 198 | { |
199 | - if (! isset($this->bootstrap)) { |
|
199 | + if (!isset($this->bootstrap)) { |
|
200 | 200 | if ($this->cacheExists()) { |
201 | 201 | $this->bootstrap = $this->readFromCache(); |
202 | 202 | } else { |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $apiDomain = str_replace('http://', '', $apiDomain); |
220 | 220 | $apiDomain = str_replace('https://', '', $apiDomain); |
221 | 221 | $moduleNamespace = $namespace; |
222 | - $moduleName = explode('\\', $moduleNamespace)[1]; |
|
222 | + $moduleName = explode('\\', $moduleNamespace)[ 1 ]; |
|
223 | 223 | $controllerNamespace = $moduleNamespace.'\\'.'Http\\Controllers'; |
224 | 224 | $modelNameSpace = $moduleNamespace.'\\'.'Entities\\'.$moduleName; |
225 | 225 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | private function buildPolicyArray($class, $namespace) |
244 | 244 | { |
245 | 245 | $moduleNamespace = $namespace; |
246 | - $moduleName = explode('\\', $moduleNamespace)[1]; |
|
246 | + $moduleName = explode('\\', $moduleNamespace)[ 1 ]; |
|
247 | 247 | $modelNameSpace = $moduleNamespace.'\\'.'Entities\\'.$moduleName; |
248 | 248 | |
249 | 249 | return [ |
@@ -281,11 +281,11 @@ discard block |
||
281 | 281 | |
282 | 282 | private function buildEventsArray($class) |
283 | 283 | { |
284 | - $listenerProperties = get_class_property($class, 'listeners') ?? []; |
|
285 | - $listeners = []; |
|
284 | + $listenerProperties = get_class_property($class, 'listeners') ?? [ ]; |
|
285 | + $listeners = [ ]; |
|
286 | 286 | foreach ($listenerProperties as $listener) { |
287 | 287 | if (class_implements_interface($listener, ListenerContract::class)) { |
288 | - $listeners[] = $listener; |
|
288 | + $listeners[ ] = $listener; |
|
289 | 289 | } |
290 | 290 | } |
291 | 291 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | */ |
301 | 301 | public function getCommands(): array |
302 | 302 | { |
303 | - return $this->loadBootstrapFromCache()['commands'] ?? []; |
|
303 | + return $this->loadBootstrapFromCache()[ 'commands' ] ?? [ ]; |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | */ |
309 | 309 | public function getRoutes(): array |
310 | 310 | { |
311 | - return $this->loadBootstrapFromCache()['routes'] ?? []; |
|
311 | + return $this->loadBootstrapFromCache()[ 'routes' ] ?? [ ]; |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | /** |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | */ |
317 | 317 | public function getConfigs(): array |
318 | 318 | { |
319 | - return $this->loadBootstrapFromCache()['configs'] ?? []; |
|
319 | + return $this->loadBootstrapFromCache()[ 'configs' ] ?? [ ]; |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | /** |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | */ |
325 | 325 | public function getFactories(): array |
326 | 326 | { |
327 | - return $this->loadBootstrapFromCache()['factories'] ?? []; |
|
327 | + return $this->loadBootstrapFromCache()[ 'factories' ] ?? [ ]; |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | /** |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | */ |
333 | 333 | public function getMigrations(): array |
334 | 334 | { |
335 | - return $this->loadBootstrapFromCache()['migrations'] ?? []; |
|
335 | + return $this->loadBootstrapFromCache()[ 'migrations' ] ?? [ ]; |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | */ |
341 | 341 | public function getSeeders(): array |
342 | 342 | { |
343 | - return $this->loadBootstrapFromCache()['seeders'] ?? []; |
|
343 | + return $this->loadBootstrapFromCache()[ 'seeders' ] ?? [ ]; |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | */ |
349 | 349 | public function getModels(): array |
350 | 350 | { |
351 | - return $this->loadBootstrapFromCache()['models'] ?? []; |
|
351 | + return $this->loadBootstrapFromCache()[ 'models' ] ?? [ ]; |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | /** |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | */ |
357 | 357 | public function getPolicies(): array |
358 | 358 | { |
359 | - return $this->loadBootstrapFromCache()['policies'] ?? []; |
|
359 | + return $this->loadBootstrapFromCache()[ 'policies' ] ?? [ ]; |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | /** |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | */ |
365 | 365 | public function getProviders(): array |
366 | 366 | { |
367 | - return $this->loadBootstrapFromCache()['providers'] ?? []; |
|
367 | + return $this->loadBootstrapFromCache()[ 'providers' ] ?? [ ]; |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
@@ -372,6 +372,6 @@ discard block |
||
372 | 372 | */ |
373 | 373 | public function getEvents(): array |
374 | 374 | { |
375 | - return $this->loadBootstrapFromCache()['events'] ?? []; |
|
375 | + return $this->loadBootstrapFromCache()[ 'events' ] ?? [ ]; |
|
376 | 376 | } |
377 | 377 | } |
@@ -28,16 +28,16 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function handle() |
30 | 30 | { |
31 | - if (! $this->confirmToProceed()) { |
|
31 | + if (!$this->confirmToProceed()) { |
|
32 | 32 | return; |
33 | 33 | } |
34 | 34 | |
35 | 35 | $this->resolver->setDefaultConnection($this->getDatabase()); |
36 | 36 | |
37 | - Model::unguarded(function () { |
|
37 | + Model::unguarded(function() { |
|
38 | 38 | foreach ($this->getSeeders() as $seeder) { |
39 | 39 | $seeder = $this->laravel->make($seeder); |
40 | - if (! isset($seeder->enabled) || $seeder->enabled) { |
|
40 | + if (!isset($seeder->enabled) || $seeder->enabled) { |
|
41 | 41 | $seeder->__invoke(); |
42 | 42 | } |
43 | 43 | } |
@@ -50,6 +50,6 @@ discard block |
||
50 | 50 | { |
51 | 51 | $this->service = $this->laravel->make(BootstrapRegistrarService::class); |
52 | 52 | |
53 | - return $this->service->getSeeders() ?? []; |
|
53 | + return $this->service->getSeeders() ?? [ ]; |
|
54 | 54 | } |
55 | 55 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function __construct() |
25 | 25 | { |
26 | - if (! isset($this->collection) || $this->collection === '') { |
|
26 | + if (!isset($this->collection) || $this->collection === '') { |
|
27 | 27 | throw new InternalErrorException('Collection name must be specified on migration: '.get_called_class()); |
28 | 28 | } |
29 | 29 | } |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | */ |
38 | 38 | final public function up() |
39 | 39 | { |
40 | - if (! Schema::connection($this->connection)->hasTable($this->collection)) { |
|
41 | - Schema::connection($this->connection)->create($this->collection, function (Blueprint $collection) { |
|
40 | + if (!Schema::connection($this->connection)->hasTable($this->collection)) { |
|
41 | + Schema::connection($this->connection)->create($this->collection, function(Blueprint $collection) { |
|
42 | 42 | $this->migrate($collection); |
43 | 43 | }); |
44 | 44 | } |