@@ -49,17 +49,17 @@ |
||
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) { |
@@ -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 | - $seeder = $this->laravel->make($seeder['class']); |
|
40 | - if (! isset($seeder->enabled) || $seeder->enabled) { |
|
39 | + $seeder = $this->laravel->make($seeder[ 'class' ]); |
|
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 | } |
@@ -161,7 +161,7 @@ |
||
161 | 161 | |
162 | 162 | public function getNamespace(): string |
163 | 163 | { |
164 | - return 'Modules' . '\\' . $this->getName(); |
|
164 | + return 'Modules'.'\\'.$this->getName(); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | public function getMainModel() |
@@ -16,71 +16,71 @@ discard block |
||
16 | 16 | $tableNames = config('permission.table_names'); |
17 | 17 | $columnNames = config('permission.column_names'); |
18 | 18 | |
19 | - Schema::create($tableNames['permissions'], function (Blueprint $table) { |
|
19 | + Schema::create($tableNames[ 'permissions' ], function(Blueprint $table) { |
|
20 | 20 | $table->increments('id'); |
21 | 21 | $table->string('name'); |
22 | 22 | $table->string('guard_name'); |
23 | 23 | $table->timestamps(); |
24 | 24 | }); |
25 | 25 | |
26 | - Schema::create($tableNames['roles'], function (Blueprint $table) { |
|
26 | + Schema::create($tableNames[ 'roles' ], function(Blueprint $table) { |
|
27 | 27 | $table->increments('id'); |
28 | 28 | $table->string('name'); |
29 | 29 | $table->string('guard_name'); |
30 | 30 | $table->timestamps(); |
31 | 31 | }); |
32 | 32 | |
33 | - Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) { |
|
33 | + Schema::create($tableNames[ 'model_has_permissions' ], function(Blueprint $table) use ($tableNames, $columnNames) { |
|
34 | 34 | $table->unsignedInteger('permission_id'); |
35 | 35 | |
36 | 36 | $table->string('model_type'); |
37 | - $table->unsignedBigInteger($columnNames['model_morph_key']); |
|
38 | - $table->index([$columnNames['model_morph_key'], 'model_type']); |
|
37 | + $table->unsignedBigInteger($columnNames[ 'model_morph_key' ]); |
|
38 | + $table->index([ $columnNames[ 'model_morph_key' ], 'model_type' ]); |
|
39 | 39 | |
40 | 40 | $table->foreign('permission_id') |
41 | 41 | ->references('id') |
42 | - ->on($tableNames['permissions']) |
|
42 | + ->on($tableNames[ 'permissions' ]) |
|
43 | 43 | ->onDelete('cascade'); |
44 | 44 | |
45 | 45 | $table->primary( |
46 | - ['permission_id', $columnNames['model_morph_key'], 'model_type'], |
|
46 | + [ 'permission_id', $columnNames[ 'model_morph_key' ], 'model_type' ], |
|
47 | 47 | 'model_has_permissions_permission_model_type_primary' |
48 | 48 | ); |
49 | 49 | }); |
50 | 50 | |
51 | - Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) { |
|
51 | + Schema::create($tableNames[ 'model_has_roles' ], function(Blueprint $table) use ($tableNames, $columnNames) { |
|
52 | 52 | $table->unsignedInteger('role_id'); |
53 | 53 | |
54 | 54 | $table->string('model_type'); |
55 | - $table->unsignedBigInteger($columnNames['model_morph_key']); |
|
56 | - $table->index([$columnNames['model_morph_key'], 'model_type']); |
|
55 | + $table->unsignedBigInteger($columnNames[ 'model_morph_key' ]); |
|
56 | + $table->index([ $columnNames[ 'model_morph_key' ], 'model_type' ]); |
|
57 | 57 | |
58 | 58 | $table->foreign('role_id') |
59 | 59 | ->references('id') |
60 | - ->on($tableNames['roles']) |
|
60 | + ->on($tableNames[ 'roles' ]) |
|
61 | 61 | ->onDelete('cascade'); |
62 | 62 | |
63 | 63 | $table->primary( |
64 | - ['role_id', $columnNames['model_morph_key'], 'model_type'], |
|
64 | + [ 'role_id', $columnNames[ 'model_morph_key' ], 'model_type' ], |
|
65 | 65 | 'model_has_roles_role_model_type_primary' |
66 | 66 | ); |
67 | 67 | }); |
68 | 68 | |
69 | - Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) { |
|
69 | + Schema::create($tableNames[ 'role_has_permissions' ], function(Blueprint $table) use ($tableNames) { |
|
70 | 70 | $table->unsignedInteger('permission_id'); |
71 | 71 | $table->unsignedInteger('role_id'); |
72 | 72 | |
73 | 73 | $table->foreign('permission_id') |
74 | 74 | ->references('id') |
75 | - ->on($tableNames['permissions']) |
|
75 | + ->on($tableNames[ 'permissions' ]) |
|
76 | 76 | ->onDelete('cascade'); |
77 | 77 | |
78 | 78 | $table->foreign('role_id') |
79 | 79 | ->references('id') |
80 | - ->on($tableNames['roles']) |
|
80 | + ->on($tableNames[ 'roles' ]) |
|
81 | 81 | ->onDelete('cascade'); |
82 | 82 | |
83 | - $table->primary(['permission_id', 'role_id']); |
|
83 | + $table->primary([ 'permission_id', 'role_id' ]); |
|
84 | 84 | |
85 | 85 | app('cache')->forget('spatie.permission.cache'); |
86 | 86 | }); |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | { |
96 | 96 | $tableNames = config('permission.table_names'); |
97 | 97 | |
98 | - Schema::drop($tableNames['role_has_permissions']); |
|
99 | - Schema::drop($tableNames['model_has_roles']); |
|
100 | - Schema::drop($tableNames['model_has_permissions']); |
|
101 | - Schema::drop($tableNames['roles']); |
|
102 | - Schema::drop($tableNames['permissions']); |
|
98 | + Schema::drop($tableNames[ 'role_has_permissions' ]); |
|
99 | + Schema::drop($tableNames[ 'model_has_roles' ]); |
|
100 | + Schema::drop($tableNames[ 'model_has_permissions' ]); |
|
101 | + Schema::drop($tableNames[ 'roles' ]); |
|
102 | + Schema::drop($tableNames[ 'permissions' ]); |
|
103 | 103 | } |
104 | 104 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | /** |
38 | 38 | * @var array |
39 | 39 | */ |
40 | - protected $guarded = []; |
|
40 | + protected $guarded = [ ]; |
|
41 | 41 | |
42 | 42 | protected $casts = [ |
43 | 43 | 'monitor' => 'boolean', |
@@ -3,16 +3,16 @@ |
||
3 | 3 | use Faker\Generator as Faker; |
4 | 4 | use Modules\Schedule\Entities\WeekDay; |
5 | 5 | |
6 | -$factory->define(WeekDay::class, function (Faker $faker) { |
|
6 | +$factory->define(WeekDay::class, function(Faker $faker) { |
|
7 | 7 | for ($h = 0; $h < 24; $h++) { |
8 | - $times[$h] = $faker->boolean; |
|
8 | + $times[ $h ] = $faker->boolean; |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | $inInterval = false; |
12 | - $interval = []; |
|
13 | - $intervals = []; |
|
12 | + $interval = [ ]; |
|
13 | + $intervals = [ ]; |
|
14 | 14 | for ($h = 0; $h < 24; $h++) { |
15 | 15 | // if(sizeof($interval) |
16 | 16 | } |
17 | - return []; |
|
17 | + return [ ]; |
|
18 | 18 | }); |
@@ -26,6 +26,6 @@ |
||
26 | 26 | |
27 | 27 | public function decode() |
28 | 28 | { |
29 | - return json_decode($this->getContent(), true)['data'] ?? json_decode($this->getContent(), true); |
|
29 | + return json_decode($this->getContent(), true)[ 'data' ] ?? json_decode($this->getContent(), true); |
|
30 | 30 | } |
31 | 31 | } |
@@ -19,15 +19,15 @@ |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | if ($unwrap) { |
22 | - return json_decode($content, true)['data'] ?? json_decode($content, true); |
|
22 | + return json_decode($content, true)[ 'data' ] ?? json_decode($content, true); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | return json_decode($content, true); |
26 | 26 | } |
27 | 27 | |
28 | - protected function http(string $method, string $route, array $payload = [], array $headers = []) : \Foundation\Abstracts\Tests\TestResponse |
|
28 | + protected function http(string $method, string $route, array $payload = [ ], array $headers = [ ]) : \Foundation\Abstracts\Tests\TestResponse |
|
29 | 29 | { |
30 | - if (! in_array($method, ['GET', 'POST', 'PATCH', 'DELETE', 'PUT'])) { |
|
30 | + if (!in_array($method, [ 'GET', 'POST', 'PATCH', 'DELETE', 'PUT' ])) { |
|
31 | 31 | throw new \Exception('Invalid Http Method'); |
32 | 32 | } |
33 | 33 |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | private function bootstrapCommands(\Foundation\Core\Module $module) |
91 | 91 | { |
92 | 92 | foreach ($module->getCommands()->getClasses() as $commandClass) { |
93 | - $this->bootstrap['commands'][] = [ |
|
93 | + $this->bootstrap[ 'commands' ][ ] = [ |
|
94 | 94 | 'class' => $commandClass, |
95 | 95 | ]; |
96 | 96 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | private function bootstrapRoutes(\Foundation\Core\Module $module) |
100 | 100 | { |
101 | 101 | foreach ($module->getRoutes()->getFiles() as $file) { |
102 | - $this->bootstrap['routes'][] = [ |
|
102 | + $this->bootstrap[ 'routes' ][ ] = [ |
|
103 | 103 | 'prefix' => $this->generateRoutePrefixFromFileName($file->getFileName()), |
104 | 104 | 'controller_namespace' => $module->getControllers()->getNamespace(), |
105 | 105 | 'domain' => Larapi::getApiDomainName(), |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | private function generateRoutePrefixFromFileName(string $fileName) |
113 | 113 | { |
114 | 114 | $prefixArray = explode('.', $fileName); |
115 | - $prefixVersion = $prefixArray[1]; |
|
116 | - $prefixRoute = $prefixArray[0]; |
|
115 | + $prefixVersion = $prefixArray[ 1 ]; |
|
116 | + $prefixRoute = $prefixArray[ 0 ]; |
|
117 | 117 | |
118 | 118 | return $prefixVersion.'/'.$prefixRoute; |
119 | 119 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | private function bootstrapConfigs(\Foundation\Core\Module $module) |
122 | 122 | { |
123 | 123 | foreach ($module->getConfigs()->getFiles() as $file) { |
124 | - $this->bootstrap['configs'][] = [ |
|
124 | + $this->bootstrap[ 'configs' ][ ] = [ |
|
125 | 125 | 'name' => $file->getName(), |
126 | 126 | 'path' => $file->getPath(), |
127 | 127 | ]; |
@@ -130,14 +130,14 @@ discard block |
||
130 | 130 | |
131 | 131 | private function bootstrapFactories(\Foundation\Core\Module $module) |
132 | 132 | { |
133 | - $this->bootstrap['factories'][] = [ |
|
133 | + $this->bootstrap[ 'factories' ][ ] = [ |
|
134 | 134 | 'path' => $module->getFactories()->getPath(), |
135 | 135 | ]; |
136 | 136 | } |
137 | 137 | |
138 | 138 | private function bootstrapMigrations(\Foundation\Core\Module $module) |
139 | 139 | { |
140 | - $this->bootstrap['migrations'][] = [ |
|
140 | + $this->bootstrap[ 'migrations' ][ ] = [ |
|
141 | 141 | 'path' => $module->getMigrations()->getPath(), |
142 | 142 | ]; |
143 | 143 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | private function bootstrapSeeders(\Foundation\Core\Module $module) |
146 | 146 | { |
147 | 147 | foreach ($module->getSeeders()->getClasses() as $seederClass) { |
148 | - $this->bootstrap['seeders'][] = [ |
|
148 | + $this->bootstrap[ 'seeders' ][ ] = [ |
|
149 | 149 | 'class' => $seederClass, |
150 | 150 | ]; |
151 | 151 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | private function bootstrapModels(\Foundation\Core\Module $module) |
155 | 155 | { |
156 | 156 | foreach ($module->getModels()->getClasses() as $modelClass) { |
157 | - $this->bootstrap['models'][] = [ |
|
157 | + $this->bootstrap[ 'models' ][ ] = [ |
|
158 | 158 | 'class' => $modelClass, |
159 | 159 | 'observers' => $this->extractObserversFromModel($modelClass), |
160 | 160 | 'policies' => $this->extractPoliciesFromModel($modelClass), |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | |
167 | 167 | private function extractObserversFromModel(string $modelClass) |
168 | 168 | { |
169 | - $observers = []; |
|
170 | - foreach (get_class_property($modelClass, 'observers') ?? [] as $observerClass) { |
|
169 | + $observers = [ ]; |
|
170 | + foreach (get_class_property($modelClass, 'observers') ?? [ ] as $observerClass) { |
|
171 | 171 | if (instance_without_constructor($observerClass) instanceof Observer) { |
172 | - $observers[] = $observerClass; |
|
172 | + $observers[ ] = $observerClass; |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
@@ -178,10 +178,10 @@ discard block |
||
178 | 178 | |
179 | 179 | private function extractPoliciesFromModel(string $modelClass) |
180 | 180 | { |
181 | - $policies = []; |
|
182 | - foreach (get_class_property($modelClass, 'policies') ?? [] as $policyClass) { |
|
181 | + $policies = [ ]; |
|
182 | + foreach (get_class_property($modelClass, 'policies') ?? [ ] as $policyClass) { |
|
183 | 183 | if (instance_without_constructor($policyClass) instanceof Policy) { |
184 | - $policies[] = $policyClass; |
|
184 | + $policies[ ] = $policyClass; |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | { |
193 | 193 | foreach ($module->getServiceProviders()->getClasses() as $serviceProviderClass) { |
194 | 194 | if ($this->passedRegistrationCondition($serviceProviderClass)) { |
195 | - $this->bootstrap['providers'][] = [ |
|
195 | + $this->bootstrap[ 'providers' ][ ] = [ |
|
196 | 196 | 'class' => $serviceProviderClass, |
197 | 197 | ]; |
198 | 198 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | |
202 | 202 | private function passedRegistrationCondition($class) |
203 | 203 | { |
204 | - if (! class_implements_interface($class, ConditionalAutoRegistration::class)) { |
|
204 | + if (!class_implements_interface($class, ConditionalAutoRegistration::class)) { |
|
205 | 205 | return true; |
206 | 206 | } |
207 | 207 | |
@@ -211,13 +211,13 @@ discard block |
||
211 | 211 | private function bootstrapEvents(\Foundation\Core\Module $module) |
212 | 212 | { |
213 | 213 | foreach ($module->getEvents()->getClasses() as $eventClass) { |
214 | - $listeners = []; |
|
215 | - foreach (get_class_property($eventClass, 'listeners') ?? [] as $listenerClass) { |
|
214 | + $listeners = [ ]; |
|
215 | + foreach (get_class_property($eventClass, 'listeners') ?? [ ] as $listenerClass) { |
|
216 | 216 | if (instance_without_constructor($listenerClass) instanceof Listener) { |
217 | - $listeners[] = $listenerClass; |
|
217 | + $listeners[ ] = $listenerClass; |
|
218 | 218 | } |
219 | 219 | } |
220 | - $this->bootstrap['events'][] = [ |
|
220 | + $this->bootstrap[ 'events' ][ ] = [ |
|
221 | 221 | 'class' => $eventClass, |
222 | 222 | 'listeners' => $listeners, |
223 | 223 | ]; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | */ |
230 | 230 | public function loadBootstrapFromCache() |
231 | 231 | { |
232 | - if (! isset($this->bootstrap)) { |
|
232 | + if (!isset($this->bootstrap)) { |
|
233 | 233 | if ($this->cacheExists()) { |
234 | 234 | $this->bootstrap = $this->readFromCache(); |
235 | 235 | } else { |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | */ |
253 | 253 | public function getCommands(): array |
254 | 254 | { |
255 | - return $this->loadBootstrapFromCache()['commands'] ?? []; |
|
255 | + return $this->loadBootstrapFromCache()[ 'commands' ] ?? [ ]; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | */ |
261 | 261 | public function getRoutes(): array |
262 | 262 | { |
263 | - return $this->loadBootstrapFromCache()['routes'] ?? []; |
|
263 | + return $this->loadBootstrapFromCache()[ 'routes' ] ?? [ ]; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | */ |
269 | 269 | public function getConfigs(): array |
270 | 270 | { |
271 | - return $this->loadBootstrapFromCache()['configs'] ?? []; |
|
271 | + return $this->loadBootstrapFromCache()[ 'configs' ] ?? [ ]; |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | /** |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public function getFactories(): array |
278 | 278 | { |
279 | - return $this->loadBootstrapFromCache()['factories'] ?? []; |
|
279 | + return $this->loadBootstrapFromCache()[ 'factories' ] ?? [ ]; |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public function getMigrations(): array |
286 | 286 | { |
287 | - return $this->loadBootstrapFromCache()['migrations'] ?? []; |
|
287 | + return $this->loadBootstrapFromCache()[ 'migrations' ] ?? [ ]; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | /** |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | */ |
293 | 293 | public function getSeeders(): array |
294 | 294 | { |
295 | - return $this->loadBootstrapFromCache()['seeders'] ?? []; |
|
295 | + return $this->loadBootstrapFromCache()[ 'seeders' ] ?? [ ]; |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | /** |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | */ |
301 | 301 | public function getModels(): array |
302 | 302 | { |
303 | - return $this->loadBootstrapFromCache()['models'] ?? []; |
|
303 | + return $this->loadBootstrapFromCache()[ 'models' ] ?? [ ]; |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | */ |
309 | 309 | public function getPolicies(): array |
310 | 310 | { |
311 | - return $this->loadBootstrapFromCache()['policies'] ?? []; |
|
311 | + return $this->loadBootstrapFromCache()[ 'policies' ] ?? [ ]; |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | /** |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | */ |
317 | 317 | public function getProviders(): array |
318 | 318 | { |
319 | - return $this->loadBootstrapFromCache()['providers'] ?? []; |
|
319 | + return $this->loadBootstrapFromCache()[ 'providers' ] ?? [ ]; |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | /** |
@@ -324,6 +324,6 @@ discard block |
||
324 | 324 | */ |
325 | 325 | public function getEvents(): array |
326 | 326 | { |
327 | - return $this->loadBootstrapFromCache()['events'] ?? []; |
|
327 | + return $this->loadBootstrapFromCache()[ 'events' ] ?? [ ]; |
|
328 | 328 | } |
329 | 329 | } |