@@ -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, |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $listeners = array(); |
289 | 289 | foreach ($listenerProperties as $listener) { |
290 | 290 | if (class_implements_interface($listener, ListenerContract::class)) { |
291 | - $listeners[] = $listener; |
|
291 | + $listeners[ ] = $listener; |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | } catch (\ReflectionException $e) { |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | */ |
306 | 306 | public function getCommands(): array |
307 | 307 | { |
308 | - return $this->loadBootstrapFromCache()['commands'] ?? []; |
|
308 | + return $this->loadBootstrapFromCache()[ 'commands' ] ?? [ ]; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | /** |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | */ |
314 | 314 | public function getRoutes(): array |
315 | 315 | { |
316 | - return $this->loadBootstrapFromCache()['routes'] ?? []; |
|
316 | + return $this->loadBootstrapFromCache()[ 'routes' ] ?? [ ]; |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | /** |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | */ |
322 | 322 | public function getConfigs(): array |
323 | 323 | { |
324 | - return $this->loadBootstrapFromCache()['configs'] ?? []; |
|
324 | + return $this->loadBootstrapFromCache()[ 'configs' ] ?? [ ]; |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | /** |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | */ |
330 | 330 | public function getFactories(): array |
331 | 331 | { |
332 | - return $this->loadBootstrapFromCache()['factories'] ?? []; |
|
332 | + return $this->loadBootstrapFromCache()[ 'factories' ] ?? [ ]; |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | /** |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | */ |
338 | 338 | public function getMigrations(): array |
339 | 339 | { |
340 | - return $this->loadBootstrapFromCache()['migrations'] ?? []; |
|
340 | + return $this->loadBootstrapFromCache()[ 'migrations' ] ?? [ ]; |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | */ |
346 | 346 | public function getSeeders(): array |
347 | 347 | { |
348 | - return $this->loadBootstrapFromCache()['seeders'] ?? []; |
|
348 | + return $this->loadBootstrapFromCache()[ 'seeders' ] ?? [ ]; |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | /** |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | */ |
354 | 354 | public function getModels(): array |
355 | 355 | { |
356 | - return $this->loadBootstrapFromCache()['models'] ?? []; |
|
356 | + return $this->loadBootstrapFromCache()[ 'models' ] ?? [ ]; |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | /** |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | */ |
362 | 362 | public function getPolicies(): array |
363 | 363 | { |
364 | - return $this->loadBootstrapFromCache()['policies'] ?? []; |
|
364 | + return $this->loadBootstrapFromCache()[ 'policies' ] ?? [ ]; |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | /** |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | */ |
370 | 370 | public function getProviders(): array |
371 | 371 | { |
372 | - return $this->loadBootstrapFromCache()['providers'] ?? []; |
|
372 | + return $this->loadBootstrapFromCache()[ 'providers' ] ?? [ ]; |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | /** |
@@ -377,6 +377,6 @@ discard block |
||
377 | 377 | */ |
378 | 378 | public function getEvents(): array |
379 | 379 | { |
380 | - return $this->loadBootstrapFromCache()['events'] ?? []; |
|
380 | + return $this->loadBootstrapFromCache()[ 'events' ] ?? [ ]; |
|
381 | 381 | } |
382 | 382 | } |
@@ -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, |
@@ -70,16 +70,16 @@ discard block |
||
70 | 70 | private function loadRoutes() |
71 | 71 | { |
72 | 72 | foreach ($this->bootstrapService->getRoutes() as $route) { |
73 | - $path = $route['path']; |
|
73 | + $path = $route[ 'path' ]; |
|
74 | 74 | Route::group([ |
75 | - 'prefix' => 'v1/' . $route['module'], |
|
76 | - 'namespace' => $route['controller'], |
|
77 | - 'domain' => $route['domain'], |
|
78 | - 'middleware' => ['api'], |
|
79 | - ], function () use ($path) { |
|
75 | + 'prefix' => 'v1/'.$route[ 'module' ], |
|
76 | + 'namespace' => $route[ 'controller' ], |
|
77 | + 'domain' => $route[ 'domain' ], |
|
78 | + 'middleware' => [ 'api' ], |
|
79 | + ], function() use ($path) { |
|
80 | 80 | require $path; |
81 | 81 | }); |
82 | - Route::model($route['module'], $route['model']); |
|
82 | + Route::model($route[ 'module' ], $route[ 'model' ]); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | protected function loadConfigs() |
92 | 92 | { |
93 | 93 | foreach ($this->bootstrapService->getConfigs() as $config) { |
94 | - if ($config['filename'] === 'config.php') { |
|
94 | + if ($config[ 'filename' ] === 'config.php') { |
|
95 | 95 | $this->publishes([ |
96 | - $config['path'] => config_path($config['module']), |
|
96 | + $config[ 'path' ] => config_path($config[ 'module' ]), |
|
97 | 97 | ], 'config'); |
98 | 98 | $this->mergeConfigFrom( |
99 | - $config['path'], basename($config['module'], '.php') |
|
99 | + $config[ 'path' ], basename($config[ 'module' ], '.php') |
|
100 | 100 | ); |
101 | 101 | } |
102 | 102 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | { |
112 | 112 | foreach ($this->bootstrapService->getFactories() as $factory) { |
113 | 113 | if (!$this->app->environment('production')) { |
114 | - app(Factory::class)->load($factory['path']); |
|
114 | + app(Factory::class)->load($factory[ 'path' ]); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | } |
@@ -124,15 +124,15 @@ discard block |
||
124 | 124 | public function loadMigrations() |
125 | 125 | { |
126 | 126 | foreach ($this->bootstrapService->getMigrations() as $migration) { |
127 | - $this->loadMigrationsFrom($migration['path']); |
|
127 | + $this->loadMigrationsFrom($migration[ 'path' ]); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
131 | 131 | private function loadPolicies() |
132 | 132 | { |
133 | 133 | foreach ($this->bootstrapService->getPolicies() as $policy) { |
134 | - if (class_implements_interface($policy['class'], ModelPolicyContract::class)) { |
|
135 | - Gate::policy($policy['model'], $policy['class']); |
|
134 | + if (class_implements_interface($policy[ 'class' ], ModelPolicyContract::class)) { |
|
135 | + Gate::policy($policy[ 'model' ], $policy[ 'class' ]); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | } |
@@ -141,14 +141,14 @@ discard block |
||
141 | 141 | { |
142 | 142 | $app = $this->app; |
143 | 143 | $service = $this->bootstrapService; |
144 | - $this->app->extend('command.seed', function () use ($app, $service) { |
|
145 | - return new SeedCommand($app['db'], $service); |
|
144 | + $this->app->extend('command.seed', function() use ($app, $service) { |
|
145 | + return new SeedCommand($app[ 'db' ], $service); |
|
146 | 146 | }); |
147 | 147 | } |
148 | 148 | |
149 | 149 | private function loadCacheObservers() |
150 | 150 | { |
151 | - if ((bool)config('model.caching')) { |
|
151 | + if ((bool) config('model.caching')) { |
|
152 | 152 | foreach ($this->bootstrapService->getModels() as $model) { |
153 | 153 | if (class_uses_trait($model, Cacheable::class)) { |
154 | 154 | $model::observe(CacheObserver::class); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | foreach ($this->bootstrapService->getModels() as $model) { |
163 | 163 | if (class_implements_interface($model, Ownable::class)) { |
164 | 164 | Gate::policy($model, OwnershipPolicy::class); |
165 | - Gate::define('access', OwnershipPolicy::class . '@access'); |
|
165 | + Gate::define('access', OwnershipPolicy::class.'@access'); |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | } |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | private function loadListeners() |
178 | 178 | { |
179 | 179 | foreach ($this->bootstrapService->getEvents() as $event) { |
180 | - foreach ($event['listeners'] as $listener) { |
|
181 | - Event::listen($event['class'], $listener); |
|
180 | + foreach ($event[ 'listeners' ] as $listener) { |
|
181 | + Event::listen($event[ 'class' ], $listener); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | } |
@@ -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 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @var array |
33 | 33 | */ |
34 | - protected $guarded = []; |
|
34 | + protected $guarded = [ ]; |
|
35 | 35 | /** |
36 | 36 | * The attributes that should be cast to native types. |
37 | 37 | * |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | public function markAsRead() |
57 | 57 | { |
58 | 58 | if (is_null($this->read_at)) { |
59 | - $this->forceFill(['read_at' => $this->freshTimestamp()])->save(); |
|
59 | + $this->forceFill([ 'read_at' => $this->freshTimestamp() ])->save(); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | /** |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param array $models |
84 | 84 | * @return \Illuminate\Notifications\DatabaseNotificationCollection |
85 | 85 | */ |
86 | - public function newCollection(array $models = []) |
|
86 | + public function newCollection(array $models = [ ]) |
|
87 | 87 | { |
88 | 88 | return new DatabaseNotificationCollection($models); |
89 | 89 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | |
14 | 14 | class WebNotificationCreatedEvent extends BroadcastNotificationCreated |
15 | 15 | { |
16 | - public function broadcastAs(){ |
|
16 | + public function broadcastAs() { |
|
17 | 17 | return 'notification.created'; |
18 | 18 | } |
19 | 19 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | public function testCache() |
12 | 12 | { |
13 | 13 | $user = $this->createUser(); |
14 | - $this->assertArraySubset($user->toArray(),ModelCache::find($user->getKey(), User::class)->toArray()); |
|
14 | + $this->assertArraySubset($user->toArray(), ModelCache::find($user->getKey(), User::class)->toArray()); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | public function testClearModelsCache() |
@@ -18,7 +18,7 @@ |
||
18 | 18 | $user = $this->getHttpUser(); |
19 | 19 | $response = $this->http('POST', '/broadcasting/auth', [ |
20 | 20 | 'socket_id' => '125191.2709135', |
21 | - 'channel_name' => 'private-user.' . $user->getKey() |
|
21 | + 'channel_name' => 'private-user.'.$user->getKey() |
|
22 | 22 | ]); |
23 | 23 | |
24 | 24 | $response->assertStatus(200); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $this->assertCount(2, $notifications); |
26 | 26 | $notification = $user->unreadNotifications()->first(); |
27 | 27 | $notificationId = $notification->getKey(); |
28 | - $response = $this->http('POST', 'v1/notifications/' . $notificationId); |
|
28 | + $response = $this->http('POST', 'v1/notifications/'.$notificationId); |
|
29 | 29 | $response->assertStatus(200); |
30 | 30 | $unreadnotifications = User::find($user->getKey())->unreadNotifications; |
31 | 31 | $this->assertCount(1, $unreadnotifications); |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | $user->notifyNow(new UserRegisteredNotification($user)); |
52 | 52 | $notification = $user->unreadNotifications()->first(); |
53 | 53 | $notificationId = $notification->getKey(); |
54 | - $response = $this->http('POST', 'v1/notifications/' . $notificationId); |
|
54 | + $response = $this->http('POST', 'v1/notifications/'.$notificationId); |
|
55 | 55 | $response->assertStatus(200); |
56 | 56 | $response = $this->http('GET', 'v1/notifications/unread'); |
57 | 57 | $response->assertStatus(200); |
58 | - $notifications = (array)User::find($user->getKey())->unreadNotifications->toArray(); |
|
58 | + $notifications = (array) User::find($user->getKey())->unreadNotifications->toArray(); |
|
59 | 59 | //$this->assertEquals($notifications, $this->decodeHttpContent($response->getContent())); |
60 | 60 | } |
61 | 61 |