@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | { |
21 | 21 | $paths = $this->migrations(); |
22 | 22 | |
23 | - foreach (is_array($paths)? $paths: [$paths] as $path) { |
|
23 | + foreach (is_array($paths) ? $paths : [$paths] as $path) { |
|
24 | 24 | \Illuminate\Support\Facades\Artisan::call('migrate', ['--path' => $path, '--force' => true]); |
25 | 25 | } |
26 | 26 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | { |
32 | 32 | $paths = $this->migrations(); |
33 | 33 | |
34 | - foreach (is_array($paths)? $paths: [$paths] as $path) { |
|
34 | + foreach (is_array($paths) ? $paths : [$paths] as $path) { |
|
35 | 35 | \Illuminate\Support\Facades\Artisan::call('migrate:rollback', ['--path' => $path]); |
36 | 36 | } |
37 | 37 |
@@ -62,11 +62,11 @@ |
||
62 | 62 | { |
63 | 63 | $templatesDir = static::path() . DIRECTORY_SEPARATOR . 'Templates'; |
64 | 64 | |
65 | - if (! is_dir($templatesDir)) return; |
|
65 | + if (!is_dir($templatesDir)) return; |
|
66 | 66 | |
67 | 67 | $skinDir = $templatesDir . DIRECTORY_SEPARATOR . $skin; |
68 | 68 | |
69 | - return is_dir($skinDir)? $skinDir: $templatesDir; |
|
69 | + return is_dir($skinDir) ? $skinDir : $templatesDir; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | public static function translations() |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | public static function isInstalled($classOrAlias) |
21 | 21 | { |
22 | - return self::getClass($classOrAlias, true)? 1: 0; |
|
22 | + return self::getClass($classOrAlias, true) ? 1 : 0; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public static function isAvalable($classOrAlias) |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @return string; |
35 | 35 | */ |
36 | 36 | public static function getClass($classOrAlias, $installedOnly = false) { |
37 | - $modules = $installedOnly? self::getInstalled(): self::getAll(); |
|
37 | + $modules = $installedOnly ? self::getInstalled() : self::getAll(); |
|
38 | 38 | |
39 | 39 | if (collect($modules)->contains($classOrAlias)) return $classOrAlias; |
40 | 40 | |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public static function getAll() |
72 | 72 | { |
73 | - return self::getCached('epesi-modules-available', function () { |
|
73 | + return self::getCached('epesi-modules-available', function() { |
|
74 | 74 | $modules = collect(); |
75 | - foreach (array_merge(config('epesi.modules', []), self::packageManifest()->modules()?: []) as $moduleClass) { |
|
75 | + foreach (array_merge(config('epesi.modules', []), self::packageManifest()->modules() ?: []) as $moduleClass) { |
|
76 | 76 | $modules->add(['alias' => $moduleClass::alias(), 'class' => $moduleClass]); |
77 | 77 | } |
78 | 78 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | protected static function getCached($key, \Closure $default) |
91 | 91 | { |
92 | - if (! Cache::has($key)) { |
|
92 | + if (!Cache::has($key)) { |
|
93 | 93 | Cache::forever($key, $default()); |
94 | 94 | } |
95 | 95 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public static function collect($method, $args = []) |
127 | 127 | { |
128 | - $args = is_array($args)? $args: [$args]; |
|
128 | + $args = is_array($args) ? $args : [$args]; |
|
129 | 129 | |
130 | 130 | $installedModules = self::getInstalled(); |
131 | 131 | |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | |
139 | 139 | $ret = []; |
140 | 140 | foreach ($installedModules as $module) { |
141 | - if (! $list = $module::$method(...$args)) continue; |
|
141 | + if (!$list = $module::$method(...$args)) continue; |
|
142 | 142 | |
143 | - $ret = array_merge($ret, is_array($list)? $list: [$list]); |
|
143 | + $ret = array_merge($ret, is_array($list) ? $list : [$list]); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | return $ret; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | return true; |
160 | 160 | } |
161 | 161 | |
162 | - if (! $moduleClass = self::getClass($classOrAlias)) { |
|
162 | + if (!$moduleClass = self::getClass($classOrAlias)) { |
|
163 | 163 | throw new \Exception('Module "' . $classOrAlias . '" could not be identified'); |
164 | 164 | } |
165 | 165 | |
@@ -210,10 +210,10 @@ discard block |
||
210 | 210 | $parentModule = array_shift($unsatisfiedDependencies); |
211 | 211 | |
212 | 212 | if (self::$processing[$parentModule]?? false) { |
213 | - throw new Exception('Cross dependency: '. $parentModule); |
|
213 | + throw new Exception('Cross dependency: ' . $parentModule); |
|
214 | 214 | } |
215 | 215 | |
216 | - if (! self::isAvalable($parentModule)) { |
|
216 | + if (!self::isAvalable($parentModule)) { |
|
217 | 217 | throw new Exception('Module not found: "' . $parentModule . '"'); |
218 | 218 | } |
219 | 219 |
@@ -36,7 +36,9 @@ discard block |
||
36 | 36 | public static function getClass($classOrAlias, $installedOnly = false) { |
37 | 37 | $modules = $installedOnly? self::getInstalled(): self::getAll(); |
38 | 38 | |
39 | - if (collect($modules)->contains($classOrAlias)) return $classOrAlias; |
|
39 | + if (collect($modules)->contains($classOrAlias)) { |
|
40 | + return $classOrAlias; |
|
41 | + } |
|
40 | 42 | |
41 | 43 | return $modules[$classOrAlias]?? null; |
42 | 44 | } |
@@ -138,7 +140,9 @@ discard block |
||
138 | 140 | |
139 | 141 | $ret = []; |
140 | 142 | foreach ($installedModules as $module) { |
141 | - if (! $list = $module::$method(...$args)) continue; |
|
143 | + if (! $list = $module::$method(...$args)) { |
|
144 | + continue; |
|
145 | + } |
|
142 | 146 | |
143 | 147 | $ret = array_merge($ret, is_array($list)? $list: [$list]); |
144 | 148 | } |
@@ -9,61 +9,61 @@ |
||
9 | 9 | |
10 | 10 | class EpesiServiceProvider extends ServiceProvider |
11 | 11 | { |
12 | - /** |
|
13 | - * Booting the package. |
|
14 | - */ |
|
15 | - public function boot() |
|
16 | - { |
|
17 | - $this->ensureHttps(); |
|
12 | + /** |
|
13 | + * Booting the package. |
|
14 | + */ |
|
15 | + public function boot() |
|
16 | + { |
|
17 | + $this->ensureHttps(); |
|
18 | 18 | |
19 | - Route::group(['namespace' => 'Epesi\Core\Controllers', 'middleware' => ['web']], function() { |
|
20 | - header("Cache-Control: no-cache, no-store, must-revalidate"); //HTTP 1.1 |
|
21 | - header("Pragma: no-cache"); //HTTP 1.0 |
|
22 | - header("Expires: 0"); |
|
19 | + Route::group(['namespace' => 'Epesi\Core\Controllers', 'middleware' => ['web']], function() { |
|
20 | + header("Cache-Control: no-cache, no-store, must-revalidate"); //HTTP 1.1 |
|
21 | + header("Pragma: no-cache"); //HTTP 1.0 |
|
22 | + header("Expires: 0"); |
|
23 | 23 | |
24 | - Route::any('view/{alias}/{method?}/{args?}', 'ModuleController@view')->middleware('auth'); |
|
24 | + Route::any('view/{alias}/{method?}/{args?}', 'ModuleController@view')->middleware('auth'); |
|
25 | 25 | |
26 | - Route::any('install', 'InstallController@index'); |
|
27 | - }); |
|
26 | + Route::any('install', 'InstallController@index'); |
|
27 | + }); |
|
28 | 28 | |
29 | - // call boot methods on all modules |
|
30 | - ModuleManager::call('boot'); |
|
29 | + // call boot methods on all modules |
|
30 | + ModuleManager::call('boot'); |
|
31 | 31 | |
32 | 32 | foreach (ModuleManager::collect('translations') as $path) { |
33 | 33 | $this->loadJsonTranslationsFrom($path); |
34 | 34 | } |
35 | 35 | |
36 | - // Register admin service provider if in admin mode or in console |
|
37 | - // TODO: apply access restriction to admin mode |
|
36 | + // Register admin service provider if in admin mode or in console |
|
37 | + // TODO: apply access restriction to admin mode |
|
38 | 38 | // if ($this->app->runningInConsole() || (request('admin', false) && Auth::user()->can('modify system'))) { |
39 | - if ($this->app->runningInConsole() || request('admin', false)) { |
|
40 | - $this->app->register(AdminServiceProvider::class); |
|
41 | - } |
|
42 | - } |
|
39 | + if ($this->app->runningInConsole() || request('admin', false)) { |
|
40 | + $this->app->register(AdminServiceProvider::class); |
|
41 | + } |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * Register the provider. |
|
46 | - */ |
|
47 | - public function register() |
|
48 | - { |
|
49 | - $this->app->singleton(App::class); |
|
50 | - } |
|
44 | + /** |
|
45 | + * Register the provider. |
|
46 | + */ |
|
47 | + public function register() |
|
48 | + { |
|
49 | + $this->app->singleton(App::class); |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Force to set https scheme if https enabled. |
|
54 | - * |
|
55 | - * @return void |
|
56 | - */ |
|
57 | - protected function ensureHttps() |
|
58 | - { |
|
59 | - if (config('epesi.https') || config('epesi.secure')) { |
|
60 | - url()->forceScheme('https'); |
|
61 | - $this->app['request']->server->set('HTTPS', true); |
|
62 | - } |
|
63 | - } |
|
52 | + /** |
|
53 | + * Force to set https scheme if https enabled. |
|
54 | + * |
|
55 | + * @return void |
|
56 | + */ |
|
57 | + protected function ensureHttps() |
|
58 | + { |
|
59 | + if (config('epesi.https') || config('epesi.secure')) { |
|
60 | + url()->forceScheme('https'); |
|
61 | + $this->app['request']->server->set('HTTPS', true); |
|
62 | + } |
|
63 | + } |
|
64 | 64 | |
65 | - protected function registerStorageDisk() |
|
66 | - { |
|
67 | - $this->app['config']['filesystems.disks.epesi'] = config('epesi.disk'); |
|
68 | - } |
|
65 | + protected function registerStorageDisk() |
|
66 | + { |
|
67 | + $this->app['config']['filesystems.disks.epesi'] = config('epesi.disk'); |
|
68 | + } |
|
69 | 69 | } |