@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | { |
62 | 62 | $this->bootstrapService = new BootstrapRegistrarService(); |
63 | 63 | |
64 | - if (! ($this->app->environment('production'))) { |
|
64 | + if (!($this->app->environment('production'))) { |
|
65 | 65 | $this->bootstrapService->recache(); |
66 | 66 | } |
67 | 67 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | private function loadCommands() |
70 | 70 | { |
71 | 71 | foreach ($this->bootstrapService->getCommands() as $command) { |
72 | - $this->commands($command['class']); |
|
72 | + $this->commands($command[ 'class' ]); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
@@ -78,17 +78,17 @@ discard block |
||
78 | 78 | $moduleModel = null; |
79 | 79 | foreach ($this->bootstrapService->getRoutes() as $route) { |
80 | 80 | Route::group([ |
81 | - 'prefix' => $route['prefix'], |
|
82 | - 'namespace' => $route['controller_namespace'], |
|
83 | - 'domain' => $route['domain'], |
|
84 | - 'middleware' => ['api'], |
|
85 | - ], function () use ($route) { |
|
86 | - require $route['path']; |
|
81 | + 'prefix' => $route[ 'prefix' ], |
|
82 | + 'namespace' => $route[ 'controller_namespace' ], |
|
83 | + 'domain' => $route[ 'domain' ], |
|
84 | + 'middleware' => [ 'api' ], |
|
85 | + ], function() use ($route) { |
|
86 | + require $route[ 'path' ]; |
|
87 | 87 | }); |
88 | - if ($moduleModel !== $route['module_model']) { |
|
89 | - Route::model(strtolower(get_short_class_name($route['module_model'])), $route['module_model']); |
|
88 | + if ($moduleModel !== $route[ 'module_model' ]) { |
|
89 | + Route::model(strtolower(get_short_class_name($route[ 'module_model' ])), $route[ 'module_model' ]); |
|
90 | 90 | } |
91 | - $moduleModel = $route['module_model']; |
|
91 | + $moduleModel = $route[ 'module_model' ]; |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | { |
102 | 102 | foreach ($this->bootstrapService->getConfigs() as $config) { |
103 | 103 | $this->mergeConfigFrom( |
104 | - $config['path'], |
|
105 | - $config['name'] |
|
104 | + $config[ 'path' ], |
|
105 | + $config[ 'name' ] |
|
106 | 106 | ); |
107 | 107 | } |
108 | 108 | } |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | public function loadFactories() |
116 | 116 | { |
117 | 117 | foreach ($this->bootstrapService->getFactories() as $factory) { |
118 | - if (! $this->app->environment('production')) { |
|
119 | - app(Factory::class)->load($factory['path']); |
|
118 | + if (!$this->app->environment('production')) { |
|
119 | + app(Factory::class)->load($factory[ 'path' ]); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | public function loadMigrations() |
130 | 130 | { |
131 | 131 | foreach ($this->bootstrapService->getMigrations() as $migration) { |
132 | - $this->loadMigrationsFrom($migration['path']); |
|
132 | + $this->loadMigrationsFrom($migration[ 'path' ]); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
@@ -137,16 +137,16 @@ discard block |
||
137 | 137 | { |
138 | 138 | $app = $this->app; |
139 | 139 | $service = $this->bootstrapService; |
140 | - $this->app->extend('command.seed', function () use ($app, $service) { |
|
141 | - return new SeedCommand($app['db'], $service); |
|
140 | + $this->app->extend('command.seed', function() use ($app, $service) { |
|
141 | + return new SeedCommand($app[ 'db' ], $service); |
|
142 | 142 | }); |
143 | 143 | } |
144 | 144 | |
145 | 145 | private function loadCacheObservers() |
146 | 146 | { |
147 | 147 | foreach ($this->bootstrapService->getModels() as $model) { |
148 | - if ($model['cacheable']) { |
|
149 | - $model['class']::observe(CacheObserver::class); |
|
148 | + if ($model[ 'cacheable' ]) { |
|
149 | + $model[ 'class' ]::observe(CacheObserver::class); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | } |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | private function loadModelPolicies() |
155 | 155 | { |
156 | 156 | foreach ($this->bootstrapService->getModels() as $model) { |
157 | - foreach ($model['policies'] as $policy) { |
|
158 | - Gate::policy($model['class'], $policy); |
|
159 | - if ($model['ownable']) { |
|
157 | + foreach ($model[ 'policies' ] as $policy) { |
|
158 | + Gate::policy($model[ 'class' ], $policy); |
|
159 | + if ($model[ 'ownable' ]) { |
|
160 | 160 | Gate::define('access', OwnershipPolicy::class.'@access'); |
161 | 161 | } |
162 | 162 | } |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | private function loadModelObservers() |
167 | 167 | { |
168 | 168 | foreach ($this->bootstrapService->getModels() as $model) { |
169 | - foreach ($model['observers'] as $observer) { |
|
170 | - $model['class']::observe($observer); |
|
169 | + foreach ($model[ 'observers' ] as $observer) { |
|
170 | + $model[ 'class' ]::observe($observer); |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | } |
@@ -175,15 +175,15 @@ discard block |
||
175 | 175 | private function loadServiceProviders() |
176 | 176 | { |
177 | 177 | foreach ($this->bootstrapService->getProviders() as $provider) { |
178 | - $this->app->register($provider['class']); |
|
178 | + $this->app->register($provider[ 'class' ]); |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
182 | 182 | private function loadListeners() |
183 | 183 | { |
184 | 184 | foreach ($this->bootstrapService->getEvents() as $event) { |
185 | - foreach ($event['listeners'] as $listener) { |
|
186 | - Event::listen($event['class'], $listener); |
|
185 | + foreach ($event[ 'listeners' ] as $listener) { |
|
186 | + Event::listen($event[ 'class' ], $listener); |
|
187 | 187 | } |
188 | 188 | } |
189 | 189 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * @var File[] |
35 | 35 | */ |
36 | - protected $files = []; |
|
36 | + protected $files = [ ]; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * LarapiModule constructor. |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | { |
58 | 58 | $files = $this->getAllPhpFileNamesWithoutExtension(); |
59 | 59 | foreach ($files as $file) { |
60 | - $this->files[] = new File($file, $this->getPath().'/'.$file.'.php', $this); |
|
60 | + $this->files[ ] = new File($file, $this->getPath().'/'.$file.'.php', $this); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function getClasses(): array |
108 | 108 | { |
109 | - $classes = []; |
|
109 | + $classes = [ ]; |
|
110 | 110 | foreach ($this->getAllPhpFileNames() as $file) { |
111 | 111 | $shortClassName = str_replace('.php', '', $file); |
112 | 112 | $class = $this->getNamespace().'\\'.$shortClassName; |
113 | 113 | |
114 | 114 | if ($this->baseClass === null || instance_without_constructor($class) instanceof $this->baseClass) { |
115 | - $classes[] = $class; |
|
115 | + $classes[ ] = $class; |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | public function getAllFileNames() |
131 | 131 | { |
132 | 132 | try { |
133 | - $fileNames = array_diff(scandir($this->getPath()), ['..', '.']); |
|
133 | + $fileNames = array_diff(scandir($this->getPath()), [ '..', '.' ]); |
|
134 | 134 | } catch (\ErrorException $e) { |
135 | - $fileNames = []; |
|
135 | + $fileNames = [ ]; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | return $fileNames; |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | |
141 | 141 | public function getAllPhpFileNames() |
142 | 142 | { |
143 | - $files = []; |
|
143 | + $files = [ ]; |
|
144 | 144 | foreach ($this->getAllFileNames() as $file) { |
145 | 145 | if ($this->hasPhpExtension($file)) { |
146 | - $files[] = $file; |
|
146 | + $files[ ] = $file; |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
@@ -152,10 +152,10 @@ discard block |
||
152 | 152 | |
153 | 153 | public function getAllPhpFileNamesWithoutExtension() |
154 | 154 | { |
155 | - $files = []; |
|
155 | + $files = [ ]; |
|
156 | 156 | foreach ($this->getAllFileNames() as $file) { |
157 | 157 | if ($this->hasPhpExtension($file)) { |
158 | - $files[] = str_replace('.php', '', $file); |
|
158 | + $files[ ] = str_replace('.php', '', $file); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | */ |
170 | 170 | private function hasPhpExtension(string $fileName): bool |
171 | 171 | { |
172 | - return strlen($fileName) > 4 && '.php' === ($fileName[-4].$fileName[-3].$fileName[-2].$fileName[-1]); |
|
172 | + return strlen($fileName) > 4 && '.php' === ($fileName[-4 ].$fileName[-3 ].$fileName[-2 ].$fileName[-1 ]); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public static function getModules(): array |
19 | 19 | { |
20 | - $modules = []; |
|
20 | + $modules = [ ]; |
|
21 | 21 | |
22 | 22 | foreach (self::getModuleNames() as $moduleName) { |
23 | - $modules[] = self::getModule($moduleName); |
|
23 | + $modules[ ] = self::getModule($moduleName); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | return $modules; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public static function getModuleNames(): array |
53 | 53 | { |
54 | - return array_diff(scandir(self::getModulesBasePath()), ['..', '.']); |
|
54 | + return array_diff(scandir(self::getModulesBasePath()), [ '..', '.' ]); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | 'exceptions' => $schedule->exceptions, |
37 | 37 | 'randomize' => $schedule->randomize, |
38 | 38 | 'times' => $schedule->times, //$this->buildTimes($schedule->week_days), |
39 | - 'accounts' => [], |
|
39 | + 'accounts' => [ ], |
|
40 | 40 | 'created_at' => $schedule->created_at, |
41 | 41 | 'updated_at' => $schedule->updated_at, |
42 | 42 | ]; |
@@ -44,6 +44,6 @@ discard block |
||
44 | 44 | |
45 | 45 | public function buildTimes($weekDays): array |
46 | 46 | { |
47 | - return []; |
|
47 | + return [ ]; |
|
48 | 48 | } |
49 | 49 | } |
@@ -4,11 +4,11 @@ discard block |
||
4 | 4 | use Modules\Schedule\Entities\Schedule; |
5 | 5 | use Modules\Schedule\Entities\WeekDay; |
6 | 6 | |
7 | -$factory->define(Schedule::class, function (Faker $faker) { |
|
8 | - $times = []; |
|
7 | +$factory->define(Schedule::class, function(Faker $faker) { |
|
8 | + $times = [ ]; |
|
9 | 9 | for ($d = 0; $d < 7; $d++) { |
10 | 10 | for ($h = 0; $h < 24; $h++) { |
11 | - $times[$d][$h] = $faker->boolean; |
|
11 | + $times[ $d ][ $h ] = $faker->boolean; |
|
12 | 12 | } |
13 | 13 | } |
14 | 14 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | Schedule::WEEK_DAYS => [ |
21 | 21 | WeekDay::MONDAY => WeekDay::fromFactory()->raw(), |
22 | 22 | ], |
23 | - Schedule::EXCEPTIONS => [], |
|
23 | + Schedule::EXCEPTIONS => [ ], |
|
24 | 24 | Schedule::RANDOMIZE => $faker->boolean, |
25 | 25 | ]; |
26 | 26 | }); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | { |
21 | 21 | private function getAuth0Service() : Auth0Service |
22 | 22 | { |
23 | - return once(function () { |
|
23 | + return once(function() { |
|
24 | 24 | return app()->make(Auth0ServiceContract::class); |
25 | 25 | }); |
26 | 26 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | private function getUserAuth0Token() |
37 | 37 | { |
38 | - return Cache::remember('testing:http_access_token', 60 * 60, function () { |
|
38 | + return Cache::remember('testing:http_access_token', 60 * 60, function() { |
|
39 | 39 | try { |
40 | 40 | $httpClient = new Client(); |
41 | 41 | $response = $httpClient->post(env('AUTH0_DOMAIN').'oauth/token', [ |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | { |
19 | 19 | use Auth0TestUser, UserTestRoles; |
20 | 20 | |
21 | - protected function http(string $method, string $route, array $payload = [], array $headers = []): TestResponse |
|
21 | + protected function http(string $method, string $route, array $payload = [ ], array $headers = [ ]): TestResponse |
|
22 | 22 | { |
23 | - $headers['Authorization'] = 'Bearer '.$this->getUserAuth0Token()->id_token; |
|
23 | + $headers[ 'Authorization' ] = 'Bearer '.$this->getUserAuth0Token()->id_token; |
|
24 | 24 | |
25 | 25 | return parent::http($method, $route, $payload, $headers); |
26 | 26 | } |
27 | 27 | |
28 | - protected function httpNoAuth(string $method, string $route, array $payload = [], array $headers = []): TestResponse |
|
28 | + protected function httpNoAuth(string $method, string $route, array $payload = [ ], array $headers = [ ]): TestResponse |
|
29 | 29 | { |
30 | 30 | return parent::http($method, $route, $payload, $headers); |
31 | 31 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | public function actingAs($user, $driver = null) |
39 | 39 | { |
40 | - if (! $user->is($this->getTestUser())) { |
|
40 | + if (!$user->is($this->getTestUser())) { |
|
41 | 41 | throw new \Foundation\Exceptions\Exception('cannot set another user for authorized http tests. Sync other roles/permissions instead.'); |
42 | 42 | } |
43 | 43 | parent::actingAs($user, $driver); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | public function read($id) |
45 | 45 | { |
46 | - if (! $this->service->find($id)->notifiable()->is(auth()->user())) { |
|
46 | + if (!$this->service->find($id)->notifiable()->is(auth()->user())) { |
|
47 | 47 | throw new NotFoundHttpException('notification not found'); |
48 | 48 | } |
49 | 49 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | public function unread($id) |
58 | 58 | { |
59 | - if (! $this->service->find($id)->notifiable()->is(auth()->user())) { |
|
59 | + if (!$this->service->find($id)->notifiable()->is(auth()->user())) { |
|
60 | 60 | throw new NotFoundHttpException('notification not found'); |
61 | 61 | } |
62 | 62 |
@@ -66,8 +66,8 @@ |
||
66 | 66 | |
67 | 67 | public function setRoles($id, array $roles): void |
68 | 68 | { |
69 | - if (! in_array(Role::MEMBER, $roles)) { |
|
70 | - $roles[] = Role::MEMBER; |
|
69 | + if (!in_array(Role::MEMBER, $roles)) { |
|
70 | + $roles[ ] = Role::MEMBER; |
|
71 | 71 | } |
72 | 72 | $this->find($id)->syncRoles($roles); |
73 | 73 | } |