@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | return [['Template', $availablePages[$row[$column]]?? '[' . __('missing: :path', ['path' => $row[$column]]) . ']']]; |
54 | 54 | }]); |
55 | 55 | |
56 | - $this->grid->addDragHandler()->onReorder(function ($order) { |
|
56 | + $this->grid->addDragHandler()->onReorder(function($order) { |
|
57 | 57 | $result = true; |
58 | 58 | foreach ($this->getHomepages() as $homepage) { |
59 | 59 | $homepage->priority = array_search($homepage->id, $order); |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | $result &= $homepage->save(); |
62 | 62 | } |
63 | 63 | |
64 | - return $result? $this->notify(__('Homepages reordered!')): $this->notifyError(__('Error saving order!')); |
|
64 | + return $result ? $this->notify(__('Homepages reordered!')) : $this->notifyError(__('Error saving order!')); |
|
65 | 65 | }); |
66 | 66 | |
67 | - $this->grid->addAction(['icon' => 'red trash'], function ($jschain, $id) { |
|
67 | + $this->grid->addAction(['icon' => 'red trash'], function($jschain, $id) { |
|
68 | 68 | HomePage::find($id)->delete(); |
69 | 69 | |
70 | 70 | return $jschain->closest('tr')->transition('fade left'); |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | |
88 | 88 | $rowsEmpty = []; |
89 | 89 | |
90 | - $model = new \atk4\data\Model($rows? new \atk4\data\Persistence_Static($rows): new \atk4\data\Persistence_Array($rowsEmpty)); |
|
90 | + $model = new \atk4\data\Model($rows ? new \atk4\data\Persistence_Static($rows) : new \atk4\data\Persistence_Array($rowsEmpty)); |
|
91 | 91 | |
92 | - $pathField = $rows? $model->hasField('path'): $model->addField('path'); |
|
92 | + $pathField = $rows ? $model->hasField('path') : $model->addField('path'); |
|
93 | 93 | |
94 | - $roleField = $rows? $model->hasField('role'): $model->addField('role'); |
|
94 | + $roleField = $rows ? $model->hasField('role') : $model->addField('role'); |
|
95 | 95 | |
96 | 96 | $pathField->setDefaults(['caption' => __('Page'), 'values' => $availablePages]); |
97 | 97 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | public function getHomepageForm() |
109 | 109 | { |
110 | - if (! $this->form) { |
|
110 | + if (!$this->form) { |
|
111 | 111 | $this->form = new Form(['buttonSave' => ['Button', __('Save'), 'primary']]); |
112 | 112 | |
113 | 113 | $this->form->addHook('submit', function($form) { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | { |
140 | 140 | static $cache; |
141 | 141 | |
142 | - if (! isset($cache)) { |
|
142 | + if (!isset($cache)) { |
|
143 | 143 | $cache = []; |
144 | 144 | foreach (HomePageJoint::collect() as $joint) { |
145 | 145 | $cache[$joint->link()] = $joint->caption(); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public static function getUserHomePage() |
158 | 158 | { |
159 | - if (! $user = Auth::user()) return; |
|
159 | + if (!$user = Auth::user()) return; |
|
160 | 160 | |
161 | 161 | return HomePage::whereIn('role', $user->roles()->pluck('name'))->orderBy('priority')->first(); |
162 | 162 | } |
@@ -170,6 +170,6 @@ discard block |
||
170 | 170 | { |
171 | 171 | $homepage = self::getUserHomePage(); |
172 | 172 | |
173 | - return $homepage? $homepage->path: self::$defaultPath; |
|
173 | + return $homepage ? $homepage->path : self::$defaultPath; |
|
174 | 174 | } |
175 | 175 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | //TODO: set the skin from admin / user selection |
34 | 34 | $this->skin = config('epesi.app.skin', $this->skin); |
35 | 35 | |
36 | - $this->template_dir = array_merge(ModuleManager::collect('templates', $this->skin), $this->template_dir?: []); |
|
36 | + $this->template_dir = array_merge(ModuleManager::collect('templates', $this->skin), $this->template_dir ?: []); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | final public static function module() |
@@ -83,31 +83,31 @@ discard block |
||
83 | 83 | //TODO: include below in app.js and app.css |
84 | 84 | // jQuery |
85 | 85 | $urlJs = $this->cdn['jquery']?? 'storage/system/js'; |
86 | - $this->requireJS($urlJs.'/jquery.min.js'); |
|
86 | + $this->requireJS($urlJs . '/jquery.min.js'); |
|
87 | 87 | |
88 | 88 | // Semantic UI |
89 | 89 | $urlJs = $this->cdn['semantic-ui']?? 'storage/system/js'; |
90 | 90 | $urlCss = $this->cdn['semantic-ui']?? 'storage/system/css'; |
91 | - $this->requireJS($urlJs.'/semantic.min.js'); |
|
92 | - $this->requireCSS($urlCss.'/semantic.min.css'); |
|
91 | + $this->requireJS($urlJs . '/semantic.min.js'); |
|
92 | + $this->requireCSS($urlCss . '/semantic.min.css'); |
|
93 | 93 | |
94 | 94 | // Serialize Object |
95 | 95 | $urlJs = $this->cdn['serialize-object']?? 'storage/system/js'; |
96 | - $this->requireJS($urlJs.'/jquery.serialize-object.min.js'); |
|
96 | + $this->requireJS($urlJs . '/jquery.serialize-object.min.js'); |
|
97 | 97 | |
98 | 98 | // Agile UI |
99 | 99 | $urlJs = $this->cdn['atk']?? 'storage/system/js'; |
100 | 100 | $urlCss = $this->cdn['atk']?? 'storage/system/css'; |
101 | - $this->requireJS($urlJs.'/atkjs-ui.min.js'); |
|
102 | - $this->requireCSS($urlCss.'/agileui.css'); |
|
101 | + $this->requireJS($urlJs . '/atkjs-ui.min.js'); |
|
102 | + $this->requireCSS($urlCss . '/agileui.css'); |
|
103 | 103 | |
104 | 104 | // Draggable |
105 | 105 | $urlJs = $this->cdn['draggable']?? 'storage/system/js'; |
106 | - $this->requireJS($urlJs.'/draggable.bundle.js'); |
|
106 | + $this->requireJS($urlJs . '/draggable.bundle.js'); |
|
107 | 107 | |
108 | 108 | // jQuery niceScroll |
109 | 109 | $urlJs = $this->cdn['jquery-nicescroll']?? 'storage/system/js'; |
110 | - $this->requireJS($urlJs.'/jquery.nicescroll.js'); |
|
110 | + $this->requireJS($urlJs . '/jquery.nicescroll.js'); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | public function addCsrfToken() |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | |
185 | 185 | $key = md5(serialize(func_get_args())); |
186 | 186 | |
187 | - if (! isset($cache[$key])) { |
|
187 | + if (!isset($cache[$key])) { |
|
188 | 188 | $cache[$key] = true; |
189 | 189 | |
190 | 190 | parent::requireJS($url, $isAsync, $isDefer); |
@@ -10,60 +10,60 @@ |
||
10 | 10 | |
11 | 11 | class EpesiServiceProvider extends ServiceProvider |
12 | 12 | { |
13 | - /** |
|
14 | - * Booting the package. |
|
15 | - */ |
|
16 | - public function boot() |
|
17 | - { |
|
18 | - $this->ensureHttps(); |
|
13 | + /** |
|
14 | + * Booting the package. |
|
15 | + */ |
|
16 | + public function boot() |
|
17 | + { |
|
18 | + $this->ensureHttps(); |
|
19 | 19 | |
20 | - if (env('APP_DEBUG', false)) ModuleManager::clearCache(); |
|
20 | + if (env('APP_DEBUG', false)) ModuleManager::clearCache(); |
|
21 | 21 | |
22 | - Route::group(['namespace' => 'Epesi\Core\Controllers', 'middleware' => 'web'], function() { |
|
23 | - Route::any('/', 'SystemController@index'); |
|
24 | - Route::get('logo', 'SystemController@logo'); |
|
25 | - Route::any('install', 'SystemController@install'); |
|
22 | + Route::group(['namespace' => 'Epesi\Core\Controllers', 'middleware' => 'web'], function() { |
|
23 | + Route::any('/', 'SystemController@index'); |
|
24 | + Route::get('logo', 'SystemController@logo'); |
|
25 | + Route::any('install', 'SystemController@install'); |
|
26 | 26 | |
27 | - Route::group(['middleware' => ['auth', NoCacheHeaders::class]], function() { |
|
28 | - Route::any('home', 'SystemController@home')->name('home'); |
|
27 | + Route::group(['middleware' => ['auth', NoCacheHeaders::class]], function() { |
|
28 | + Route::any('home', 'SystemController@home')->name('home'); |
|
29 | 29 | |
30 | - Route::any('view/{alias}/{method?}/{args?}', 'SystemController@view'); |
|
31 | - }); |
|
32 | - }); |
|
30 | + Route::any('view/{alias}/{method?}/{args?}', 'SystemController@view'); |
|
31 | + }); |
|
32 | + }); |
|
33 | 33 | |
34 | - // call boot methods on all modules |
|
35 | - ModuleManager::call('boot'); |
|
34 | + // call boot methods on all modules |
|
35 | + ModuleManager::call('boot'); |
|
36 | 36 | |
37 | 37 | foreach (ModuleManager::collect('translations') as $path) { |
38 | 38 | $this->loadJsonTranslationsFrom($path); |
39 | 39 | } |
40 | 40 | |
41 | - // Register admin service provider if in admin mode or in console |
|
42 | - // TODO: apply access restriction to admin mode |
|
41 | + // Register admin service provider if in admin mode or in console |
|
42 | + // TODO: apply access restriction to admin mode |
|
43 | 43 | // if ($this->app->runningInConsole() || (request('admin', false) && Auth::user()->can('modify system'))) { |
44 | - if ($this->app->runningInConsole() || request('admin', false)) { |
|
45 | - $this->app->register(AdminServiceProvider::class); |
|
46 | - } |
|
47 | - } |
|
44 | + if ($this->app->runningInConsole() || request('admin', false)) { |
|
45 | + $this->app->register(AdminServiceProvider::class); |
|
46 | + } |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Register the provider. |
|
51 | - */ |
|
52 | - public function register() |
|
53 | - { |
|
54 | - $this->app->singleton(App::class); |
|
55 | - } |
|
49 | + /** |
|
50 | + * Register the provider. |
|
51 | + */ |
|
52 | + public function register() |
|
53 | + { |
|
54 | + $this->app->singleton(App::class); |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * Force to set https scheme if https enabled. |
|
59 | - * |
|
60 | - * @return void |
|
61 | - */ |
|
62 | - protected function ensureHttps() |
|
63 | - { |
|
64 | - if (config('epesi.https') || config('epesi.secure')) { |
|
65 | - url()->forceScheme('https'); |
|
66 | - $this->app['request']->server->set('HTTPS', true); |
|
67 | - } |
|
68 | - } |
|
57 | + /** |
|
58 | + * Force to set https scheme if https enabled. |
|
59 | + * |
|
60 | + * @return void |
|
61 | + */ |
|
62 | + protected function ensureHttps() |
|
63 | + { |
|
64 | + if (config('epesi.https') || config('epesi.secure')) { |
|
65 | + url()->forceScheme('https'); |
|
66 | + $this->app['request']->server->set('HTTPS', true); |
|
67 | + } |
|
68 | + } |
|
69 | 69 | } |
@@ -17,7 +17,9 @@ |
||
17 | 17 | { |
18 | 18 | $this->ensureHttps(); |
19 | 19 | |
20 | - if (env('APP_DEBUG', false)) ModuleManager::clearCache(); |
|
20 | + if (env('APP_DEBUG', false)) { |
|
21 | + ModuleManager::clearCache(); |
|
22 | + } |
|
21 | 23 | |
22 | 24 | Route::group(['namespace' => 'Epesi\Core\Controllers', 'middleware' => 'web'], function() { |
23 | 25 | Route::any('/', 'SystemController@index'); |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | { |
30 | 30 | $modules = ModuleManager::getAll(); |
31 | 31 | |
32 | - return $modules->filter(function ($subModuleClass) use ($modules) { |
|
33 | - return ! $modules->map(function($moduleClass){ |
|
32 | + return $modules->filter(function($subModuleClass) use ($modules) { |
|
33 | + return !$modules->map(function($moduleClass) { |
|
34 | 34 | return $moduleClass::namespace(); |
35 | 35 | })->contains($subModuleClass::parentNamespace()); |
36 | 36 | })->sort(); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | $section->add($label, 'title')->setStyle('float', 'right'); |
63 | 63 | |
64 | - $submodules = ModuleManager::getAll()->filter(function ($subModuleClass) use ($moduleClass) { |
|
64 | + $submodules = ModuleManager::getAll()->filter(function($subModuleClass) use ($moduleClass) { |
|
65 | 65 | return $subModuleClass::isSubModuleOf($moduleClass); |
66 | 66 | }); |
67 | 67 | |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | |
74 | 74 | public function formatModuleInfo($moduleClass) |
75 | 75 | { |
76 | - $moduleInfo = (array) ($moduleClass::info()?: __(' No details provided by author')); |
|
76 | + $moduleInfo = (array) ($moduleClass::info() ?: __(' No details provided by author')); |
|
77 | 77 | |
78 | 78 | $ret = []; |
79 | 79 | foreach ($moduleInfo as $label => $text) { |
80 | - $ret[] = (is_string($label)? "<strong>$label</strong>: ": '') . $text; |
|
80 | + $ret[] = (is_string($label) ? "<strong>$label</strong>: " : '') . $text; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | return implode('<br>', $ret); |
@@ -52,8 +52,7 @@ discard block |
||
52 | 52 | $this->addUninstallButton($section, $moduleClass); |
53 | 53 | |
54 | 54 | $this->addReinstallButton($section, $moduleClass); |
55 | - } |
|
56 | - else { |
|
55 | + } else { |
|
57 | 56 | $label = ['Label', __('Available'), 'yellow']; |
58 | 57 | |
59 | 58 | $this->addInstallButton($section, $moduleClass); |
@@ -65,7 +64,9 @@ discard block |
||
65 | 64 | return $subModuleClass::isSubModuleOf($moduleClass); |
66 | 65 | }); |
67 | 66 | |
68 | - if ($submodules->isEmpty()) continue; |
|
67 | + if ($submodules->isEmpty()) { |
|
68 | + continue; |
|
69 | + } |
|
69 | 70 | |
70 | 71 | $this->addAccordion($section, $submodules); |
71 | 72 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | Storage::delete(self::alias() . '/tmp/' . $token); |
42 | 42 | }); |
43 | 43 | |
44 | - $logo->onUpload(function ($files) use ($form, $logo) { |
|
44 | + $logo->onUpload(function($files) use ($form, $logo) { |
|
45 | 45 | if ($files === 'error') return $form->error('logo', __('Error uploading image')); |
46 | 46 | |
47 | 47 | $tmpPath = self::alias() . '/tmp/' . $files['name']; |
@@ -42,7 +42,9 @@ |
||
42 | 42 | }); |
43 | 43 | |
44 | 44 | $logo->onUpload(function ($files) use ($form, $logo) { |
45 | - if ($files === 'error') return $form->error('logo', __('Error uploading image')); |
|
45 | + if ($files === 'error') { |
|
46 | + return $form->error('logo', __('Error uploading image')); |
|
47 | + } |
|
46 | 48 | |
47 | 49 | $tmpPath = self::alias() . '/tmp/' . $files['name']; |
48 | 50 |
@@ -8,79 +8,79 @@ |
||
8 | 8 | |
9 | 9 | class ActionButton extends View |
10 | 10 | { |
11 | - public $defaultTemplate = 'action_button.html'; |
|
11 | + public $defaultTemplate = 'action_button.html'; |
|
12 | 12 | |
13 | - public $ui = 'basic inverted action button'; |
|
13 | + public $ui = 'basic inverted action button'; |
|
14 | 14 | |
15 | - /** |
|
16 | - * Icon that will appear on the button (top). |
|
17 | - * |
|
18 | - * @var string|array|Icon |
|
19 | - */ |
|
20 | - public $icon; |
|
15 | + /** |
|
16 | + * Icon that will appear on the button (top). |
|
17 | + * |
|
18 | + * @var string|array|Icon |
|
19 | + */ |
|
20 | + public $icon; |
|
21 | 21 | |
22 | - public $label; |
|
22 | + public $label; |
|
23 | 23 | |
24 | - public $element = 'a'; |
|
24 | + public $element = 'a'; |
|
25 | 25 | |
26 | - public $weight = 10; |
|
26 | + public $weight = 10; |
|
27 | 27 | |
28 | - public $callback; |
|
28 | + public $callback; |
|
29 | 29 | |
30 | - public function renderView() |
|
31 | - { |
|
32 | - $this->addIcon(); |
|
30 | + public function renderView() |
|
31 | + { |
|
32 | + $this->addIcon(); |
|
33 | 33 | |
34 | - $this->addLabel(); |
|
34 | + $this->addLabel(); |
|
35 | 35 | |
36 | - $this->addCallback(); |
|
36 | + $this->addCallback(); |
|
37 | 37 | |
38 | - parent::renderView(); |
|
39 | - } |
|
38 | + parent::renderView(); |
|
39 | + } |
|
40 | 40 | |
41 | - protected function addIcon() |
|
42 | - { |
|
43 | - if (! $icon = $this->getIcon()) return; |
|
41 | + protected function addIcon() |
|
42 | + { |
|
43 | + if (! $icon = $this->getIcon()) return; |
|
44 | 44 | |
45 | - $this->add($icon, 'Icon')->id = null; |
|
45 | + $this->add($icon, 'Icon')->id = null; |
|
46 | 46 | |
47 | - $this->addClass('icon'); |
|
47 | + $this->addClass('icon'); |
|
48 | 48 | |
49 | - return $this; |
|
50 | - } |
|
49 | + return $this; |
|
50 | + } |
|
51 | 51 | |
52 | - protected function addLabel() |
|
53 | - { |
|
54 | - $this->content = $this->label?: $this->content; |
|
52 | + protected function addLabel() |
|
53 | + { |
|
54 | + $this->content = $this->label?: $this->content; |
|
55 | 55 | |
56 | - return $this; |
|
57 | - } |
|
56 | + return $this; |
|
57 | + } |
|
58 | 58 | |
59 | - public function getIcon() |
|
60 | - { |
|
61 | - return is_object($this->icon)? $this->icon: new Icon($this->icon); |
|
62 | - } |
|
59 | + public function getIcon() |
|
60 | + { |
|
61 | + return is_object($this->icon)? $this->icon: new Icon($this->icon); |
|
62 | + } |
|
63 | 63 | |
64 | - public function callback($callable) |
|
65 | - { |
|
66 | - $this->callback = $callable; |
|
64 | + public function callback($callable) |
|
65 | + { |
|
66 | + $this->callback = $callable; |
|
67 | 67 | |
68 | - return $this; |
|
69 | - } |
|
68 | + return $this; |
|
69 | + } |
|
70 | 70 | |
71 | - public function addCallback() |
|
72 | - { |
|
73 | - if (!$callable = $this->callback) return; |
|
71 | + public function addCallback() |
|
72 | + { |
|
73 | + if (!$callable = $this->callback) return; |
|
74 | 74 | |
75 | - if (is_callable($callable)) { |
|
76 | - $callable = $this->add('jsCallback')->set($callable); |
|
77 | - } |
|
75 | + if (is_callable($callable)) { |
|
76 | + $callable = $this->add('jsCallback')->set($callable); |
|
77 | + } |
|
78 | 78 | |
79 | - if ($callable instanceof jsCallback) { |
|
80 | - $this->on('click', $callable); |
|
81 | - } |
|
79 | + if ($callable instanceof jsCallback) { |
|
80 | + $this->on('click', $callable); |
|
81 | + } |
|
82 | 82 | |
83 | - return $this; |
|
84 | - } |
|
83 | + return $this; |
|
84 | + } |
|
85 | 85 | |
86 | 86 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | protected function addIcon() |
42 | 42 | { |
43 | - if (! $icon = $this->getIcon()) return; |
|
43 | + if (!$icon = $this->getIcon()) return; |
|
44 | 44 | |
45 | 45 | $this->add($icon, 'Icon')->id = null; |
46 | 46 | |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | |
52 | 52 | protected function addLabel() |
53 | 53 | { |
54 | - $this->content = $this->label?: $this->content; |
|
54 | + $this->content = $this->label ?: $this->content; |
|
55 | 55 | |
56 | 56 | return $this; |
57 | 57 | } |
58 | 58 | |
59 | 59 | public function getIcon() |
60 | 60 | { |
61 | - return is_object($this->icon)? $this->icon: new Icon($this->icon); |
|
61 | + return is_object($this->icon) ? $this->icon : new Icon($this->icon); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | public function callback($callable) |
@@ -40,7 +40,9 @@ discard block |
||
40 | 40 | |
41 | 41 | protected function addIcon() |
42 | 42 | { |
43 | - if (! $icon = $this->getIcon()) return; |
|
43 | + if (! $icon = $this->getIcon()) { |
|
44 | + return; |
|
45 | + } |
|
44 | 46 | |
45 | 47 | $this->add($icon, 'Icon')->id = null; |
46 | 48 | |
@@ -70,7 +72,9 @@ discard block |
||
70 | 72 | |
71 | 73 | public function addCallback() |
72 | 74 | { |
73 | - if (!$callable = $this->callback) return; |
|
75 | + if (!$callable = $this->callback) { |
|
76 | + return; |
|
77 | + } |
|
74 | 78 | |
75 | 79 | if (is_callable($callable)) { |
76 | 80 | $callable = $this->add('jsCallback')->set($callable); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | private static $variables; |
18 | 18 | |
19 | 19 | private static function cache() { |
20 | - if(isset(self::$variables)) return; |
|
20 | + if (isset(self::$variables)) return; |
|
21 | 21 | |
22 | 22 | self::$variables = self::pluck('value', 'name'); |
23 | 23 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | public static function get($name, $default = null) { |
26 | 26 | self::cache(); |
27 | 27 | |
28 | - if (! self::$variables->has($name)) return $default; |
|
28 | + if (!self::$variables->has($name)) return $default; |
|
29 | 29 | |
30 | 30 | return self::$variables->get($name, $default); |
31 | 31 | } |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | return self::updateOrCreate(compact('name'), compact('value')); |
45 | 45 | } |
46 | 46 | |
47 | - public static function forget($name, $throwError=true) { |
|
47 | + public static function forget($name, $throwError = true) { |
|
48 | 48 | self::cache(); |
49 | 49 | |
50 | - if (! self::$variables->has($name) && $throwError) { |
|
50 | + if (!self::$variables->has($name) && $throwError) { |
|
51 | 51 | throw new \Exception('No such variable in database: ' . $name); |
52 | 52 | } |
53 | 53 |
@@ -17,7 +17,9 @@ discard block |
||
17 | 17 | private static $variables; |
18 | 18 | |
19 | 19 | private static function cache() { |
20 | - if(isset(self::$variables)) return; |
|
20 | + if(isset(self::$variables)) { |
|
21 | + return; |
|
22 | + } |
|
21 | 23 | |
22 | 24 | self::$variables = self::pluck('value', 'name'); |
23 | 25 | } |
@@ -25,7 +27,9 @@ discard block |
||
25 | 27 | public static function get($name, $default = null) { |
26 | 28 | self::cache(); |
27 | 29 | |
28 | - if (! self::$variables->has($name)) return $default; |
|
30 | + if (! self::$variables->has($name)) { |
|
31 | + return $default; |
|
32 | + } |
|
29 | 33 | |
30 | 34 | return self::$variables->get($name, $default); |
31 | 35 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * Label of the module |
65 | 65 | */ |
66 | 66 | public static function label() { |
67 | - return static::$label?: ucwords(str_ireplace('.', ' ', static::alias())); |
|
67 | + return static::$label ?: ucwords(str_ireplace('.', ' ', static::alias())); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | { |
77 | 77 | $templatesDir = static::path() . DIRECTORY_SEPARATOR . 'Templates'; |
78 | 78 | |
79 | - if (! is_dir($templatesDir)) return; |
|
79 | + if (!is_dir($templatesDir)) return; |
|
80 | 80 | |
81 | 81 | $skinDir = $templatesDir . DIRECTORY_SEPARATOR . $skin; |
82 | 82 | |
83 | - return is_dir($skinDir)? $skinDir: $templatesDir; |
|
83 | + return is_dir($skinDir) ? $skinDir : $templatesDir; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | public static function translations() |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | public static function isInstalled($classOrAlias) |
22 | 22 | { |
23 | - return self::getClass($classOrAlias, true)? 1: 0; |
|
23 | + return self::getClass($classOrAlias, true) ? 1 : 0; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | public static function isAvailable($classOrAlias) |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @return string; |
36 | 36 | */ |
37 | 37 | public static function getClass($classOrAlias, $installedOnly = false) { |
38 | - $modules = $installedOnly? self::getInstalled(): self::getAll(); |
|
38 | + $modules = $installedOnly ? self::getInstalled() : self::getAll(); |
|
39 | 39 | |
40 | 40 | if (collect($modules)->contains($classOrAlias)) return $classOrAlias; |
41 | 41 | |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public static function getAll() |
69 | 69 | { |
70 | - return self::getCached('epesi-modules-available', function () { |
|
70 | + return self::getCached('epesi-modules-available', function() { |
|
71 | 71 | $modules = collect(); |
72 | - foreach (array_merge(config('epesi.modules', []), self::packageManifest()->modules()?: []) as $namespace => $path) { |
|
72 | + foreach (array_merge(config('epesi.modules', []), self::packageManifest()->modules() ?: []) as $namespace => $path) { |
|
73 | 73 | foreach (self::discoverModuleClasses($namespace, $path) as $moduleClass) { |
74 | 74 | $modules->add(['alias' => $moduleClass::alias(), 'class' => $moduleClass]); |
75 | 75 | } |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | protected static function discoverModuleClasses($namespace, $basePath) |
83 | 83 | { |
84 | 84 | $ret = collect(); |
85 | - foreach (glob($basePath . '/*', GLOB_ONLYDIR|GLOB_NOSORT) as $path) { |
|
85 | + foreach (glob($basePath . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $path) { |
|
86 | 86 | $moduleNamespace = trim($namespace, '\\') . '\\' . basename($path); |
87 | 87 | |
88 | 88 | $ret = $ret->merge(self::discoverModuleClasses($moduleNamespace, $path)); |
89 | 89 | |
90 | 90 | $moduleClass = $moduleNamespace . '\\' . basename($path) . 'Core'; |
91 | 91 | |
92 | - if (! is_a($moduleClass, ModuleCore::class, true)) continue; |
|
92 | + if (!is_a($moduleClass, ModuleCore::class, true)) continue; |
|
93 | 93 | |
94 | 94 | $ret->add($moduleClass); |
95 | 95 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | protected static function getCached($key, \Closure $default) |
108 | 108 | { |
109 | - if (! Cache::has($key)) { |
|
109 | + if (!Cache::has($key)) { |
|
110 | 110 | Cache::forever($key, $default()); |
111 | 111 | } |
112 | 112 | |
@@ -144,12 +144,12 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public static function collect($method, $args = []) |
146 | 146 | { |
147 | - $args = is_array($args)? $args: [$args]; |
|
147 | + $args = is_array($args) ? $args : [$args]; |
|
148 | 148 | |
149 | 149 | $installedModules = self::getInstalled(); |
150 | 150 | |
151 | 151 | // if epesi is not installed fake having the system module to enable its functionality |
152 | - if (! $installedModules->contains(\Epesi\Core\System\SystemCore::class)) { |
|
152 | + if (!$installedModules->contains(\Epesi\Core\System\SystemCore::class)) { |
|
153 | 153 | $installedModules = collect([ |
154 | 154 | 'system' => \Epesi\Core\System\SystemCore::class |
155 | 155 | ]); |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | |
158 | 158 | $ret = []; |
159 | 159 | foreach ($installedModules as $module) { |
160 | - if (! $list = $module::$method(...$args)) continue; |
|
160 | + if (!$list = $module::$method(...$args)) continue; |
|
161 | 161 | |
162 | - $ret = array_merge($ret, is_array($list)? $list: [$list]); |
|
162 | + $ret = array_merge($ret, is_array($list) ? $list : [$list]); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | return $ret; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | return true; |
179 | 179 | } |
180 | 180 | |
181 | - if (! $moduleClass = self::getClass($classOrAlias)) { |
|
181 | + if (!$moduleClass = self::getClass($classOrAlias)) { |
|
182 | 182 | throw new \Exception('Module "' . $classOrAlias . '" could not be identified'); |
183 | 183 | } |
184 | 184 | |
@@ -237,10 +237,10 @@ discard block |
||
237 | 237 | $parentModule = array_shift($unsatisfiedDependencies); |
238 | 238 | |
239 | 239 | if (self::$processing[$parentModule]?? false) { |
240 | - throw new Exception('Cross dependency: '. $parentModule); |
|
240 | + throw new Exception('Cross dependency: ' . $parentModule); |
|
241 | 241 | } |
242 | 242 | |
243 | - if (! self::isAvailable($parentModule)) { |
|
243 | + if (!self::isAvailable($parentModule)) { |
|
244 | 244 | throw new Exception('Module not found: "' . $parentModule . '"'); |
245 | 245 | } |
246 | 246 | |
@@ -261,13 +261,13 @@ discard block |
||
261 | 261 | |
262 | 262 | public static function uninstall($classOrAlias) |
263 | 263 | { |
264 | - if (! self::isInstalled($classOrAlias)) { |
|
264 | + if (!self::isInstalled($classOrAlias)) { |
|
265 | 265 | print ('Module "' . $classOrAlias . '" is not installed!'); |
266 | 266 | |
267 | 267 | return true; |
268 | 268 | } |
269 | 269 | |
270 | - if (! $moduleClass = self::getClass($classOrAlias)) { |
|
270 | + if (!$moduleClass = self::getClass($classOrAlias)) { |
|
271 | 271 | throw new \Exception('Module "' . $classOrAlias . '" could not be identified'); |
272 | 272 | } |
273 | 273 |