@@ -7,7 +7,7 @@ |
||
7 | 7 | |
8 | 8 | class User extends Model |
9 | 9 | { |
10 | - use HasEpesiConnection; |
|
10 | + use HasEpesiConnection; |
|
11 | 11 | |
12 | 12 | public $table = 'users'; |
13 | 13 |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | public $table = 'users'; |
13 | 13 | |
14 | - function init(){ |
|
14 | + function init() { |
|
15 | 15 | parent::init(); |
16 | 16 | |
17 | 17 | $this->addFields(['name']); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | $form->addField('language', ['DropDown', 'values' => $values, 'caption' => __('Select Language'), 'iconLeft' => 'globe'], ['required'=>true])->set($wizard->recall('language', 'en')); |
81 | 81 | |
82 | - $form->onSubmit(function ($form) use ($wizard) { |
|
82 | + $form->onSubmit(function($form) use ($wizard) { |
|
83 | 83 | $wizard->memorize('language', $form->model['language']); |
84 | 84 | |
85 | 85 | App::setLocale($form->model['language']); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $form->addField('support', ['CheckBox', 'caption' => __('I will not remove "Support -> About" credit page from the application menu.')], ['required'=>true]); |
112 | 112 | $form->addField('store', ['CheckBox', 'caption' => __('I will not remove or rename ":epesi Store" links from the application.', ['epesi' => config('epesi.app.title')])], ['required'=>true]); |
113 | 113 | |
114 | - $form->onSubmit(function ($form) use ($wizard) { |
|
114 | + $form->onSubmit(function($form) use ($wizard) { |
|
115 | 115 | return $wizard->jsNext(); |
116 | 116 | }); |
117 | 117 | |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | $form->addField('create', ['CheckBox', 'caption' => __('Create New Database')])->on('change', new jsExpression('if ($(event.target).is(":checked")) alert([])', [__('WARNING: Make sure you have CREATE access level to do this!')])); |
140 | 140 | |
141 | 141 | foreach ($wizard->recall('connection', []) as $name => $value) { |
142 | - if (! $field = $form->fields[$name]?? null) continue; |
|
142 | + if (!$field = $form->fields[$name]?? null) continue; |
|
143 | 143 | |
144 | 144 | $field->set($value); |
145 | 145 | } |
146 | 146 | |
147 | - $form->onSubmit(function ($form) use ($wizard) { |
|
147 | + $form->onSubmit(function($form) use ($wizard) { |
|
148 | 148 | $connection = $form->model->get(); |
149 | 149 | |
150 | 150 | $wizard->memorize('connection', $connection); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | $form->model->set($wizard->recall('user')); |
194 | 194 | |
195 | - $form->validate(function ($form) use ($wizard) { |
|
195 | + $form->validate(function($form) use ($wizard) { |
|
196 | 196 | $wizard->memorize('user', $form->model->get()); |
197 | 197 | |
198 | 198 | return $wizard->jsNext(); |
@@ -24,11 +24,11 @@ |
||
24 | 24 | |
25 | 25 | public function migrate() |
26 | 26 | { |
27 | - Models\Module::migrate(); |
|
27 | + Models\Module::migrate(); |
|
28 | 28 | |
29 | - Models\Variable::migrate(); |
|
29 | + Models\Variable::migrate(); |
|
30 | 30 | |
31 | - return parent::migrate(); |
|
31 | + return parent::migrate(); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $accordion = $container->add(['Accordion', 'type' => ['styled', 'fluid'], 'settings' => ['animateChildren' => false]])->setStyle(['max-width' => '800px', 'margin-left' => 'auto', 'margin-right' => 'auto']); |
44 | 44 | |
45 | 45 | if ($container == $this) { |
46 | - $this->accordion = $accordion; |
|
46 | + $this->accordion = $accordion; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | foreach ($modules as $moduleClass) { |
@@ -92,17 +92,17 @@ discard block |
||
92 | 92 | |
93 | 93 | public function addInstallButton($container, $moduleClass) |
94 | 94 | { |
95 | - $button = $container->add(['Button', __('Install'), 'class' => ['green']]); |
|
95 | + $button = $container->add(['Button', __('Install'), 'class' => ['green']]); |
|
96 | 96 | |
97 | - $callback = $installCallback = $this->add('jsCallback')->set(function() use ($moduleClass, $container) { |
|
97 | + $callback = $installCallback = $this->add('jsCallback')->set(function() use ($moduleClass, $container) { |
|
98 | 98 | ob_start(); |
99 | 99 | ModuleManager::install($moduleClass); |
100 | 100 | |
101 | 101 | $message = ob_get_clean(); |
102 | 102 | |
103 | 103 | return [ |
104 | - $this->notifySuccess($message), |
|
105 | - new jsReload($this->accordion), |
|
104 | + $this->notifySuccess($message), |
|
105 | + new jsReload($this->accordion), |
|
106 | 106 | ]; |
107 | 107 | }); |
108 | 108 | |
@@ -150,17 +150,17 @@ discard block |
||
150 | 150 | |
151 | 151 | public function addUninstallButton($container, $moduleClass) |
152 | 152 | { |
153 | - $button = $container->add(['Button', __('Uninstall'), 'class' => ['red']]); |
|
153 | + $button = $container->add(['Button', __('Uninstall'), 'class' => ['red']]); |
|
154 | 154 | |
155 | - $callback = $uninstallCallback = $button->add(['jsCallback', 'confirm' => __('Are you sure you want to uninstall :module', ['module' => $moduleClass::label()])])->set(function() use ($moduleClass) { |
|
156 | - ob_start(); |
|
155 | + $callback = $uninstallCallback = $button->add(['jsCallback', 'confirm' => __('Are you sure you want to uninstall :module', ['module' => $moduleClass::label()])])->set(function() use ($moduleClass) { |
|
156 | + ob_start(); |
|
157 | 157 | ModuleManager::uninstall($moduleClass); |
158 | 158 | |
159 | 159 | $message = ob_get_clean(); |
160 | 160 | |
161 | 161 | return [ |
162 | - $this->notifySuccess($message), |
|
163 | - new jsReload($this->accordion), |
|
162 | + $this->notifySuccess($message), |
|
163 | + new jsReload($this->accordion), |
|
164 | 164 | ]; |
165 | 165 | }); |
166 | 166 | |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | ModuleManager::clearCache(); |
200 | 200 | |
201 | 201 | return [ |
202 | - new jsReload($this->accordion), |
|
203 | - $this->notifySuccess(__('Cache cleared!')) |
|
202 | + new jsReload($this->accordion), |
|
203 | + $this->notifySuccess(__('Cache cleared!')) |
|
204 | 204 | ]; |
205 | 205 | }); |
206 | 206 | } |
@@ -7,18 +7,18 @@ |
||
7 | 7 | |
8 | 8 | class Module extends Model |
9 | 9 | { |
10 | - use HasEpesiConnection; |
|
10 | + use HasEpesiConnection; |
|
11 | 11 | |
12 | - public $table = 'modules'; |
|
12 | + public $table = 'modules'; |
|
13 | 13 | |
14 | - function init() { |
|
15 | - parent::init(); |
|
14 | + function init() { |
|
15 | + parent::init(); |
|
16 | 16 | |
17 | - $this->addFields([ |
|
18 | - 'class', |
|
19 | - 'alias', |
|
20 | - 'priority' => ['default' => 0], |
|
21 | - 'state' => ['default' => 1] |
|
22 | - ]); |
|
23 | - } |
|
17 | + $this->addFields([ |
|
18 | + 'class', |
|
19 | + 'alias', |
|
20 | + 'priority' => ['default' => 0], |
|
21 | + 'state' => ['default' => 1] |
|
22 | + ]); |
|
23 | + } |
|
24 | 24 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | class Variable extends Model |
10 | 10 | { |
11 | - use HasEpesiConnection; |
|
11 | + use HasEpesiConnection; |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @var Collection |
@@ -26,20 +26,20 @@ discard block |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | public function init() { |
29 | - parent::init(); |
|
29 | + parent::init(); |
|
30 | 30 | |
31 | - $this->addFields([ |
|
32 | - 'name', |
|
33 | - 'value' => ['type' => 'text'] |
|
34 | - ]); |
|
31 | + $this->addFields([ |
|
32 | + 'name', |
|
33 | + 'value' => ['type' => 'text'] |
|
34 | + ]); |
|
35 | 35 | |
36 | - $this->addHook('beforeSave', function(Variable $variable) { |
|
37 | - $variable['value'] = json_encode($variable['value']); |
|
38 | - }); |
|
36 | + $this->addHook('beforeSave', function(Variable $variable) { |
|
37 | + $variable['value'] = json_encode($variable['value']); |
|
38 | + }); |
|
39 | 39 | |
40 | - $this->addHook('beforeLoad', function(Variable $variable) { |
|
41 | - $variable['value'] = $variable['value']? json_decode($variable['value']): ''; |
|
42 | - }); |
|
40 | + $this->addHook('beforeLoad', function(Variable $variable) { |
|
41 | + $variable['value'] = $variable['value']? json_decode($variable['value']): ''; |
|
42 | + }); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | public static function recall($name, $default = null) { |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | $variable = self::create()->addCondition('name', $name)->tryLoadAny(); |
65 | 65 | |
66 | 66 | if ($variable->loaded()) { |
67 | - $variable->save(compact('value')); |
|
67 | + $variable->save(compact('value')); |
|
68 | 68 | } |
69 | 69 | else { |
70 | - $variable->insert(compact('name', 'value')); |
|
70 | + $variable->insert(compact('name', 'value')); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | public $strict_types = false; |
21 | 21 | |
22 | 22 | private static function cache() { |
23 | - if(isset(self::$variables)) return; |
|
23 | + if (isset(self::$variables)) return; |
|
24 | 24 | |
25 | 25 | self::$variables = self::pluck('value', 'name'); |
26 | 26 | } |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | }); |
39 | 39 | |
40 | 40 | $this->addHook('beforeLoad', function(Variable $variable) { |
41 | - $variable['value'] = $variable['value']? json_decode($variable['value']): ''; |
|
41 | + $variable['value'] = $variable['value'] ? json_decode($variable['value']) : ''; |
|
42 | 42 | }); |
43 | 43 | } |
44 | 44 | |
45 | 45 | public static function recall($name, $default = null) { |
46 | 46 | self::cache(); |
47 | 47 | |
48 | - if (! self::$variables->has($name)) return $default; |
|
48 | + if (!self::$variables->has($name)) return $default; |
|
49 | 49 | |
50 | 50 | return self::$variables->get($name, $default)?? $default; |
51 | 51 | } |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
74 | - public static function forget($name, $throwError=true) { |
|
74 | + public static function forget($name, $throwError = true) { |
|
75 | 75 | self::cache(); |
76 | 76 | |
77 | - if (! self::$variables->has($name) && $throwError) { |
|
77 | + if (!self::$variables->has($name) && $throwError) { |
|
78 | 78 | throw new \Exception('No such variable in database: ' . $name); |
79 | 79 | } |
80 | 80 |
@@ -20,7 +20,9 @@ discard block |
||
20 | 20 | public $strict_types = false; |
21 | 21 | |
22 | 22 | private static function cache() { |
23 | - if(isset(self::$variables)) return; |
|
23 | + if(isset(self::$variables)) { |
|
24 | + return; |
|
25 | + } |
|
24 | 26 | |
25 | 27 | self::$variables = self::pluck('value', 'name'); |
26 | 28 | } |
@@ -45,7 +47,9 @@ discard block |
||
45 | 47 | public static function recall($name, $default = null) { |
46 | 48 | self::cache(); |
47 | 49 | |
48 | - if (! self::$variables->has($name)) return $default; |
|
50 | + if (! self::$variables->has($name)) { |
|
51 | + return $default; |
|
52 | + } |
|
49 | 53 | |
50 | 54 | return self::$variables->get($name, $default)?? $default; |
51 | 55 | } |
@@ -65,8 +69,7 @@ discard block |
||
65 | 69 | |
66 | 70 | if ($variable->loaded()) { |
67 | 71 | $variable->save(compact('value')); |
68 | - } |
|
69 | - else { |
|
72 | + } else { |
|
70 | 73 | $variable->insert(compact('name', 'value')); |
71 | 74 | } |
72 | 75 | } |
@@ -4,24 +4,24 @@ |
||
4 | 4 | |
5 | 5 | trait Notifies |
6 | 6 | { |
7 | - public function notify($options) |
|
8 | - { |
|
9 | - $options = array_merge(['duration'=> 1500], is_array($options)? $options: ['message' => $options]); |
|
7 | + public function notify($options) |
|
8 | + { |
|
9 | + $options = array_merge(['duration'=> 1500], is_array($options)? $options: ['message' => $options]); |
|
10 | 10 | |
11 | - return new \atk4\ui\jsToast($options); |
|
12 | - } |
|
11 | + return new \atk4\ui\jsToast($options); |
|
12 | + } |
|
13 | 13 | |
14 | - public function notifySuccess($options) |
|
15 | - { |
|
16 | - $options = array_merge(['class' => 'success'], is_array($options)? $options: ['message' => $options]); |
|
14 | + public function notifySuccess($options) |
|
15 | + { |
|
16 | + $options = array_merge(['class' => 'success'], is_array($options)? $options: ['message' => $options]); |
|
17 | 17 | |
18 | - return $this->notify($options); |
|
19 | - } |
|
18 | + return $this->notify($options); |
|
19 | + } |
|
20 | 20 | |
21 | - public function notifyError($options) |
|
22 | - { |
|
23 | - $options = array_merge(['class' => 'error'], is_array($options)? $options: ['message' => $options]); |
|
21 | + public function notifyError($options) |
|
22 | + { |
|
23 | + $options = array_merge(['class' => 'error'], is_array($options)? $options: ['message' => $options]); |
|
24 | 24 | |
25 | - return $this->notify($options); |
|
26 | - } |
|
25 | + return $this->notify($options); |
|
26 | + } |
|
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -6,21 +6,21 @@ |
||
6 | 6 | { |
7 | 7 | public function notify($options) |
8 | 8 | { |
9 | - $options = array_merge(['duration'=> 1500], is_array($options)? $options: ['message' => $options]); |
|
9 | + $options = array_merge(['duration'=> 1500], is_array($options) ? $options : ['message' => $options]); |
|
10 | 10 | |
11 | 11 | return new \atk4\ui\jsToast($options); |
12 | 12 | } |
13 | 13 | |
14 | 14 | public function notifySuccess($options) |
15 | 15 | { |
16 | - $options = array_merge(['class' => 'success'], is_array($options)? $options: ['message' => $options]); |
|
16 | + $options = array_merge(['class' => 'success'], is_array($options) ? $options : ['message' => $options]); |
|
17 | 17 | |
18 | 18 | return $this->notify($options); |
19 | 19 | } |
20 | 20 | |
21 | 21 | public function notifyError($options) |
22 | 22 | { |
23 | - $options = array_merge(['class' => 'error'], is_array($options)? $options: ['message' => $options]); |
|
23 | + $options = array_merge(['class' => 'error'], is_array($options) ? $options : ['message' => $options]); |
|
24 | 24 | |
25 | 25 | return $this->notify($options); |
26 | 26 | } |
@@ -48,8 +48,8 @@ |
||
48 | 48 | $alias = class_exists($module)? $module::alias(): $module; |
49 | 49 | |
50 | 50 | if (is_array($method) && !$args) { |
51 | - $args = $method; |
|
52 | - $method = 'body'; |
|
51 | + $args = $method; |
|
52 | + $method = 'body'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | return url(implode('/', ['view', $alias, $method, self::encodeArgs($args)])); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | { |
22 | 22 | $defaultView = self::module()::view(); |
23 | 23 | |
24 | - $viewClass = is_a(static::class, ModuleView::class, true)? static::class: $defaultView; |
|
24 | + $viewClass = is_a(static::class, ModuleView::class, true) ? static::class : $defaultView; |
|
25 | 25 | |
26 | 26 | $viewAlias = null; |
27 | 27 | if ($viewClass !== $defaultView) { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | final public static function moduleLink($module, $method = 'body', $args = []) |
47 | 47 | { |
48 | - $alias = class_exists($module)? $module::alias(): $module; |
|
48 | + $alias = class_exists($module) ? $module::alias() : $module; |
|
49 | 49 | |
50 | 50 | if (is_array($method) && !$args) { |
51 | 51 | $args = $method; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @throws \Illuminate\Http\Exceptions\HttpResponseException |
65 | 65 | */ |
66 | 66 | final public static function decodeArgs($hash) { |
67 | - if (! $hash) return []; |
|
67 | + if (!$hash) return []; |
|
68 | 68 | |
69 | 69 | $args = session($hash); |
70 | 70 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | final public static function encodeArgs($args) { |
83 | 83 | $args = (array) $args; |
84 | 84 | |
85 | - if (! $args) return; |
|
85 | + if (!$args) return; |
|
86 | 86 | |
87 | 87 | $hash = md5(serialize($args)); |
88 | 88 |
@@ -64,11 +64,15 @@ discard block |
||
64 | 64 | * @throws \Illuminate\Http\Exceptions\HttpResponseException |
65 | 65 | */ |
66 | 66 | final public static function decodeArgs($hash) { |
67 | - if (! $hash) return []; |
|
67 | + if (! $hash) { |
|
68 | + return []; |
|
69 | + } |
|
68 | 70 | |
69 | 71 | $args = session($hash); |
70 | 72 | |
71 | - if (is_null($args)) abort(419); |
|
73 | + if (is_null($args)) { |
|
74 | + abort(419); |
|
75 | + } |
|
72 | 76 | |
73 | 77 | return (array) $args; |
74 | 78 | } |
@@ -82,7 +86,9 @@ discard block |
||
82 | 86 | final public static function encodeArgs($args) { |
83 | 87 | $args = (array) $args; |
84 | 88 | |
85 | - if (! $args) return; |
|
89 | + if (! $args) { |
|
90 | + return; |
|
91 | + } |
|
86 | 92 | |
87 | 93 | $hash = md5(serialize($args)); |
88 | 94 |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | { |
65 | 65 | return self::$installed = self::$installed?? self::getCached('epesi-modules-installed', function() { |
66 | 66 | try { |
67 | - $installedModules = Module::pluck('class', 'alias'); |
|
67 | + $installedModules = Module::pluck('class', 'alias'); |
|
68 | 68 | } catch (\Exception $e) { |
69 | 69 | $installedModules = collect(); |
70 | 70 | } |
@@ -104,27 +104,27 @@ discard block |
||
104 | 104 | */ |
105 | 105 | protected static function discoverModuleClasses($namespace, $basePath) |
106 | 106 | { |
107 | - $ret = collect(); |
|
107 | + $ret = collect(); |
|
108 | 108 | |
109 | - $moduleNamespace = trim($namespace, '\\'); |
|
109 | + $moduleNamespace = trim($namespace, '\\'); |
|
110 | 110 | |
111 | - $names = array_slice(explode('\\', $moduleNamespace), - 1); |
|
111 | + $names = array_slice(explode('\\', $moduleNamespace), - 1); |
|
112 | 112 | |
113 | - if ($name = $names? reset($names): '') { |
|
114 | - $moduleClass = $moduleNamespace . '\\' . $name . 'Core'; |
|
113 | + if ($name = $names? reset($names): '') { |
|
114 | + $moduleClass = $moduleNamespace . '\\' . $name . 'Core'; |
|
115 | 115 | |
116 | - if (is_subclass_of($moduleClass, ModuleCore::class)) { |
|
117 | - $ret->add($moduleClass); |
|
118 | - } |
|
119 | - } |
|
116 | + if (is_subclass_of($moduleClass, ModuleCore::class)) { |
|
117 | + $ret->add($moduleClass); |
|
118 | + } |
|
119 | + } |
|
120 | 120 | |
121 | - foreach (glob($basePath . '/*', GLOB_ONLYDIR|GLOB_NOSORT) as $path) { |
|
122 | - $subModuleNamespace = $moduleNamespace . '\\' . basename($path); |
|
121 | + foreach (glob($basePath . '/*', GLOB_ONLYDIR|GLOB_NOSORT) as $path) { |
|
122 | + $subModuleNamespace = $moduleNamespace . '\\' . basename($path); |
|
123 | 123 | |
124 | - $ret = $ret->merge(self::discoverModuleClasses($subModuleNamespace, $path)); |
|
125 | - } |
|
124 | + $ret = $ret->merge(self::discoverModuleClasses($subModuleNamespace, $path)); |
|
125 | + } |
|
126 | 126 | |
127 | - return $ret; |
|
127 | + return $ret; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -356,7 +356,6 @@ discard block |
||
356 | 356 | * |
357 | 357 | * @param string $classOrAlias |
358 | 358 | * @throws \Exception |
359 | - |
|
360 | 359 | * @return boolean |
361 | 360 | */ |
362 | 361 | public static function uninstall($classOrAlias) |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public static function isInstalled($classOrAlias) |
28 | 28 | { |
29 | - return self::getClass($classOrAlias, true)? 1: 0; |
|
29 | + return self::getClass($classOrAlias, true) ? 1 : 0; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @return string; |
49 | 49 | */ |
50 | 50 | public static function getClass($classOrAlias, $installedOnly = false) { |
51 | - $modules = $installedOnly? self::getInstalled(): self::getAll(); |
|
51 | + $modules = $installedOnly ? self::getInstalled() : self::getAll(); |
|
52 | 52 | |
53 | 53 | if (collect($modules)->contains($classOrAlias)) return $classOrAlias; |
54 | 54 | |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public static function getAll() |
82 | 82 | { |
83 | - return self::getCached('epesi-modules-available', function () { |
|
83 | + return self::getCached('epesi-modules-available', function() { |
|
84 | 84 | $modules = collect(); |
85 | - foreach (array_merge(config('epesi.modules', []), self::packageManifest()->modules()?: []) as $namespace => $path) { |
|
85 | + foreach (array_merge(config('epesi.modules', []), self::packageManifest()->modules() ?: []) as $namespace => $path) { |
|
86 | 86 | foreach (self::discoverModuleClasses($namespace, $path) as $moduleClass) { |
87 | 87 | $modules->add(['alias' => $moduleClass::alias(), 'class' => $moduleClass]); |
88 | 88 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | $names = array_slice(explode('\\', $moduleNamespace), - 1); |
112 | 112 | |
113 | - if ($name = $names? reset($names): '') { |
|
113 | + if ($name = $names ? reset($names) : '') { |
|
114 | 114 | $moduleClass = $moduleNamespace . '\\' . $name . 'Core'; |
115 | 115 | |
116 | 116 | if (is_subclass_of($moduleClass, ModuleCore::class)) { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | - foreach (glob($basePath . '/*', GLOB_ONLYDIR|GLOB_NOSORT) as $path) { |
|
121 | + foreach (glob($basePath . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $path) { |
|
122 | 122 | $subModuleNamespace = $moduleNamespace . '\\' . basename($path); |
123 | 123 | |
124 | 124 | $ret = $ret->merge(self::discoverModuleClasses($subModuleNamespace, $path)); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | protected static function getCached($key, \Closure $default) |
138 | 138 | { |
139 | - if (! Cache::has($key)) { |
|
139 | + if (!Cache::has($key)) { |
|
140 | 140 | Cache::forever($key, $default()); |
141 | 141 | } |
142 | 142 | |
@@ -174,12 +174,12 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public static function collect($method, $args = []) |
176 | 176 | { |
177 | - $args = is_array($args)? $args: [$args]; |
|
177 | + $args = is_array($args) ? $args : [$args]; |
|
178 | 178 | |
179 | 179 | $installedModules = self::getInstalled(); |
180 | 180 | |
181 | 181 | // if epesi is not installed fake having the system module to enable its functionality |
182 | - if (! $installedModules->contains(\Epesi\Core\System\SystemCore::class)) { |
|
182 | + if (!$installedModules->contains(\Epesi\Core\System\SystemCore::class)) { |
|
183 | 183 | $installedModules = collect([ |
184 | 184 | 'system' => \Epesi\Core\System\SystemCore::class |
185 | 185 | ]); |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | |
188 | 188 | $ret = []; |
189 | 189 | foreach ($installedModules as $module) { |
190 | - if (! $list = $module::$method(...$args)) continue; |
|
190 | + if (!$list = $module::$method(...$args)) continue; |
|
191 | 191 | |
192 | - $ret = array_merge($ret, is_array($list)? $list: [$list]); |
|
192 | + $ret = array_merge($ret, is_array($list) ? $list : [$list]); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | return $ret; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | return true; |
209 | 209 | } |
210 | 210 | |
211 | - if (! $moduleClass = self::getClass($classOrAlias)) { |
|
211 | + if (!$moduleClass = self::getClass($classOrAlias)) { |
|
212 | 212 | throw new \Exception('Module "' . $classOrAlias . '" could not be identified'); |
213 | 213 | } |
214 | 214 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | ]); |
239 | 239 | |
240 | 240 | if ($installRecommended) { |
241 | - $installRecommended = is_array($installRecommended)? $installRecommended: $module->recommended(); |
|
241 | + $installRecommended = is_array($installRecommended) ? $installRecommended : $module->recommended(); |
|
242 | 242 | |
243 | 243 | foreach ($installRecommended as $recommendedModule) { |
244 | 244 | try { |
@@ -271,10 +271,10 @@ discard block |
||
271 | 271 | $parentModule = array_shift($unsatisfiedDependencies); |
272 | 272 | |
273 | 273 | if (self::$processing[$parentModule]?? false) { |
274 | - throw new \Exception('Cross dependency: '. $parentModule); |
|
274 | + throw new \Exception('Cross dependency: ' . $parentModule); |
|
275 | 275 | } |
276 | 276 | |
277 | - if (! self::isAvailable($parentModule)) { |
|
277 | + if (!self::isAvailable($parentModule)) { |
|
278 | 278 | throw new \Exception('Module not found: "' . $parentModule . '"'); |
279 | 279 | } |
280 | 280 | |
@@ -361,13 +361,13 @@ discard block |
||
361 | 361 | */ |
362 | 362 | public static function uninstall($classOrAlias) |
363 | 363 | { |
364 | - if (! self::isInstalled($classOrAlias)) { |
|
364 | + if (!self::isInstalled($classOrAlias)) { |
|
365 | 365 | print ('Module "' . $classOrAlias . '" is not installed!'); |
366 | 366 | |
367 | 367 | return true; |
368 | 368 | } |
369 | 369 | |
370 | - if (! $moduleClass = self::getClass($classOrAlias)) { |
|
370 | + if (!$moduleClass = self::getClass($classOrAlias)) { |
|
371 | 371 | throw new \Exception('Module "' . $classOrAlias . '" could not be identified'); |
372 | 372 | } |
373 | 373 |
@@ -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 | } |