@@ -36,13 +36,13 @@ |
||
36 | 36 | return $this; |
37 | 37 | } |
38 | 38 | |
39 | - $this->label = is_array($this->label)? $this->label: [$this->label]; |
|
39 | + $this->label = is_array($this->label) ? $this->label : [$this->label]; |
|
40 | 40 | |
41 | 41 | $this->label = array_map('trans', $this->label); |
42 | 42 | |
43 | - $this->location = is_array($this->location)? $this->location: [$this->location]; |
|
43 | + $this->location = is_array($this->location) ? $this->location : [$this->location]; |
|
44 | 44 | |
45 | - return array_merge($this->label, $this->location?: []); |
|
45 | + return array_merge($this->label, $this->location ?: []); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | public function label($label) |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | $defaultView = self::module()::view(); |
21 | 21 | |
22 | - $viewClass = is_a(static::class, ModuleView::class, true)? static::class: $defaultView; |
|
22 | + $viewClass = is_a(static::class, ModuleView::class, true) ? static::class : $defaultView; |
|
23 | 23 | |
24 | 24 | if ($viewClass == $defaultView) $viewClass = null; |
25 | 25 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | final public static function moduleLink($module, $method = 'body', $args = []) |
40 | 40 | { |
41 | - $alias = class_exists($module)? $module::alias(): $module; |
|
41 | + $alias = class_exists($module) ? $module::alias() : $module; |
|
42 | 42 | |
43 | 43 | return url(implode('/', ['view', $alias, $method, self::encodeArgs($args)])); |
44 | 44 | } |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | * @throws \Illuminate\Http\Exceptions\HttpResponseException |
53 | 53 | */ |
54 | 54 | final public static function decodeArgs($hash) { |
55 | - if (! $hash) return []; |
|
55 | + if (!$hash) return []; |
|
56 | 56 | |
57 | 57 | $args = session($hash); |
58 | 58 | |
59 | 59 | if (is_null($args)) abort(419); |
60 | 60 | |
61 | - return is_array($args)? $args: [$args]; |
|
61 | + return is_array($args) ? $args : [$args]; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | * @return string |
69 | 69 | */ |
70 | 70 | final public static function encodeArgs($args) { |
71 | - $args = is_array($args)? $args: [$args]; |
|
71 | + $args = is_array($args) ? $args : [$args]; |
|
72 | 72 | |
73 | - if (! $args) return; |
|
73 | + if (!$args) return; |
|
74 | 74 | |
75 | 75 | $hash = md5(serialize($args)); |
76 | 76 |
@@ -21,7 +21,9 @@ discard block |
||
21 | 21 | |
22 | 22 | $viewClass = is_a(static::class, ModuleView::class, true)? static::class: $defaultView; |
23 | 23 | |
24 | - if ($viewClass == $defaultView) $viewClass = null; |
|
24 | + if ($viewClass == $defaultView) { |
|
25 | + $viewClass = null; |
|
26 | + } |
|
25 | 27 | |
26 | 28 | return url(implode('/', ['view', implode('_', array_filter([self::alias(), $viewClass])), $method, self::encodeArgs($args)])); |
27 | 29 | } |
@@ -52,11 +54,15 @@ discard block |
||
52 | 54 | * @throws \Illuminate\Http\Exceptions\HttpResponseException |
53 | 55 | */ |
54 | 56 | final public static function decodeArgs($hash) { |
55 | - if (! $hash) return []; |
|
57 | + if (! $hash) { |
|
58 | + return []; |
|
59 | + } |
|
56 | 60 | |
57 | 61 | $args = session($hash); |
58 | 62 | |
59 | - if (is_null($args)) abort(419); |
|
63 | + if (is_null($args)) { |
|
64 | + abort(419); |
|
65 | + } |
|
60 | 66 | |
61 | 67 | return is_array($args)? $args: [$args]; |
62 | 68 | } |
@@ -70,7 +76,9 @@ discard block |
||
70 | 76 | final public static function encodeArgs($args) { |
71 | 77 | $args = is_array($args)? $args: [$args]; |
72 | 78 | |
73 | - if (! $args) return; |
|
79 | + if (! $args) { |
|
80 | + return; |
|
81 | + } |
|
74 | 82 | |
75 | 83 | $hash = md5(serialize($args)); |
76 | 84 |
@@ -6,16 +6,16 @@ |
||
6 | 6 | { |
7 | 7 | public function notify($options, $attachTo = null) |
8 | 8 | { |
9 | - $options = array_merge(['duration'=> 1500], is_array($options)? $options: ['content' => $options]); |
|
9 | + $options = array_merge(['duration'=> 1500], is_array($options) ? $options : ['content' => $options]); |
|
10 | 10 | |
11 | - $attachTo = $attachTo?: $this; |
|
11 | + $attachTo = $attachTo ?: $this; |
|
12 | 12 | |
13 | 13 | return (new \atk4\ui\jsNotify($options, $attachTo)); |
14 | 14 | } |
15 | 15 | |
16 | 16 | public function notifyError($options, $attachTo = null) |
17 | 17 | { |
18 | - $options = array_merge(['color' => 'red'], is_array($options)? $options: ['content' => $options]); |
|
18 | + $options = array_merge(['color' => 'red'], is_array($options) ? $options : ['content' => $options]); |
|
19 | 19 | |
20 | 20 | return $this->notify($options, $attachTo); |
21 | 21 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | final public static function packageManifest() |
13 | 13 | { |
14 | - return self::$packageManifest = self::$packageManifest?: new PackageManifest(new Filesystem(), app()->basePath(), self::getCachedManifestPath()); |
|
14 | + return self::$packageManifest = self::$packageManifest ?: new PackageManifest(new Filesystem(), app()->basePath(), self::getCachedManifestPath()); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | final public static function getCachedManifestPath() |
@@ -12,11 +12,11 @@ |
||
12 | 12 | } |
13 | 13 | |
14 | 14 | final public static function requireJS($file = 'default.js', $isAsync = false, $isDefer = false) { |
15 | - return epesi()->requireJS(self::assetUrl('js/'. $file), $isAsync, $isDefer); |
|
15 | + return epesi()->requireJS(self::assetUrl('js/' . $file), $isAsync, $isDefer); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | final public static function requireCSS($file = 'default.css') { |
19 | - return epesi()->requireCSS(self::assetUrl('css/'. $file)); |
|
19 | + return epesi()->requireCSS(self::assetUrl('css/' . $file)); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -33,7 +33,7 @@ |
||
33 | 33 | { |
34 | 34 | $link = $this->link(); |
35 | 35 | |
36 | - $link = is_array($link)? ModuleView::moduleLink(...$link): $link; |
|
36 | + $link = is_array($link) ? ModuleView::moduleLink(...$link) : $link; |
|
37 | 37 | |
38 | 38 | return (new LaunchButton([ |
39 | 39 | 'label' => $this->label(), |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | protected $validationRules = []; |
18 | 18 | |
19 | 19 | public function addElements($elements, $parent = null) { |
20 | - $parent = $parent?: $this; |
|
20 | + $parent = $parent ?: $this; |
|
21 | 21 | |
22 | 22 | foreach ($elements as $name => $desc) { |
23 | 23 | $name = $desc['name']?? $name; |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | |
27 | 27 | switch ($desc['type']?? 'field') { |
28 | 28 | case 'field': |
29 | - $desc = is_string($desc)? [ |
|
29 | + $desc = is_string($desc) ? [ |
|
30 | 30 | 'decorator' => [$desc] |
31 | - ]: $desc; |
|
31 | + ] : $desc; |
|
32 | 32 | |
33 | 33 | $field = $parent->addField($name, $desc['decorator']?? [], $desc['options']?? []); |
34 | 34 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | public function addFieldsDisplayRules($fieldsDisplayRules) { |
80 | - $this->setFieldsDisplayRules(array_merge($this->fieldsDisplayRules?: [], $fieldsDisplayRules)); |
|
80 | + $this->setFieldsDisplayRules(array_merge($this->fieldsDisplayRules ?: [], $fieldsDisplayRules)); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | public function addGroupDisplayRules($groupDisplayRules) { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | public function addFieldRules($field, $rules = []) { |
92 | - if (! $rules) return; |
|
92 | + if (!$rules) return; |
|
93 | 93 | |
94 | 94 | $this->fieldRules[$field] = $rules['rules']?? [ |
95 | 95 | 'identifier' => $field, |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | |
102 | 102 | public function setValues($values) |
103 | 103 | { |
104 | - foreach ($values?: [] as $name => $value) { |
|
105 | - if (! $field = $this->fields[$name]?? null) continue; |
|
104 | + foreach ($values ?: [] as $name => $value) { |
|
105 | + if (!$field = $this->fields[$name]?? null) continue; |
|
106 | 106 | |
107 | 107 | $field->set($value); |
108 | 108 | } |
@@ -125,17 +125,17 @@ discard block |
||
125 | 125 | 'fields' => $this->fieldRules |
126 | 126 | ]); |
127 | 127 | |
128 | - $this->onSubmit(function ($form) use ($callback) { |
|
128 | + $this->onSubmit(function($form) use ($callback) { |
|
129 | 129 | $errors = []; |
130 | - foreach ($this->validationRules?: [] as $ruleCallback) { |
|
131 | - if (! is_callable($ruleCallback)) continue; |
|
130 | + foreach ($this->validationRules ?: [] as $ruleCallback) { |
|
131 | + if (!is_callable($ruleCallback)) continue; |
|
132 | 132 | |
133 | 133 | $ruleErrors = $ruleCallback($form); |
134 | 134 | |
135 | - $errors = array_merge($errors, $ruleErrors?: []); |
|
135 | + $errors = array_merge($errors, $ruleErrors ?: []); |
|
136 | 136 | } |
137 | 137 | |
138 | - return $errors?: $callback($this); |
|
138 | + return $errors ?: $callback($this); |
|
139 | 139 | }); |
140 | 140 | |
141 | 141 | return $this; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | public function confirmLeave($confirm = true) |
150 | 150 | { |
151 | - $this->canLeave = ! $confirm; |
|
151 | + $this->canLeave = !$confirm; |
|
152 | 152 | |
153 | 153 | return $this; |
154 | 154 | } |
@@ -89,7 +89,9 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | public function addFieldRules($field, $rules = []) { |
92 | - if (! $rules) return; |
|
92 | + if (! $rules) { |
|
93 | + return; |
|
94 | + } |
|
93 | 95 | |
94 | 96 | $this->fieldRules[$field] = $rules['rules']?? [ |
95 | 97 | 'identifier' => $field, |
@@ -102,7 +104,9 @@ discard block |
||
102 | 104 | public function setValues($values) |
103 | 105 | { |
104 | 106 | foreach ($values?: [] as $name => $value) { |
105 | - if (! $field = $this->fields[$name]?? null) continue; |
|
107 | + if (! $field = $this->fields[$name]?? null) { |
|
108 | + continue; |
|
109 | + } |
|
106 | 110 | |
107 | 111 | $field->set($value); |
108 | 112 | } |
@@ -128,7 +132,9 @@ discard block |
||
128 | 132 | $this->onSubmit(function ($form) use ($callback) { |
129 | 133 | $errors = []; |
130 | 134 | foreach ($this->validationRules?: [] as $ruleCallback) { |
131 | - if (! is_callable($ruleCallback)) continue; |
|
135 | + if (! is_callable($ruleCallback)) { |
|
136 | + continue; |
|
137 | + } |
|
132 | 138 | |
133 | 139 | $ruleErrors = $ruleCallback($form); |
134 | 140 |
@@ -29,7 +29,7 @@ |
||
29 | 29 | $this->loadMigrationsFrom(ModuleManager::collect('migrations')); |
30 | 30 | |
31 | 31 | // Publish epesi configuration files |
32 | - $this->publishes([__DIR__.'/../../config' => config_path()], 'epesi.config'); |
|
32 | + $this->publishes([__DIR__ . '/../../config' => config_path()], 'epesi.config'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -20,25 +20,25 @@ |
||
20 | 20 | ModuleInstallCommand::class |
21 | 21 | ]; |
22 | 22 | |
23 | - /** |
|
24 | - * Booting the package. |
|
25 | - */ |
|
26 | - public function boot() |
|
27 | - { |
|
28 | - $this->app->register(\JoeDixon\Translation\TranslationServiceProvider::class); |
|
23 | + /** |
|
24 | + * Booting the package. |
|
25 | + */ |
|
26 | + public function boot() |
|
27 | + { |
|
28 | + $this->app->register(\JoeDixon\Translation\TranslationServiceProvider::class); |
|
29 | 29 | |
30 | - // Register migrations from installed modules |
|
31 | - $this->loadMigrationsFrom(ModuleManager::collect('migrations')); |
|
30 | + // Register migrations from installed modules |
|
31 | + $this->loadMigrationsFrom(ModuleManager::collect('migrations')); |
|
32 | 32 | |
33 | - // Publish epesi configuration files |
|
34 | - $this->publishes([__DIR__.'/../../config' => config_path()], 'epesi.config'); |
|
35 | - } |
|
33 | + // Publish epesi configuration files |
|
34 | + $this->publishes([__DIR__.'/../../config' => config_path()], 'epesi.config'); |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Register the provider. |
|
39 | - */ |
|
40 | - public function register() |
|
41 | - { |
|
42 | - $this->commands($this->commands); |
|
43 | - } |
|
37 | + /** |
|
38 | + * Register the provider. |
|
39 | + */ |
|
40 | + public function register() |
|
41 | + { |
|
42 | + $this->commands($this->commands); |
|
43 | + } |
|
44 | 44 | } |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | 'title' => __('Launchpad'), |
39 | 39 | ]); |
40 | 40 | |
41 | - foreach(UserMenuJoint::collect() as $joint) { |
|
42 | - foreach ($joint->tools()?: [] as $tool) { |
|
41 | + foreach (UserMenuJoint::collect() as $joint) { |
|
42 | + foreach ($joint->tools() ?: [] as $tool) { |
|
43 | 43 | $this->addTool($tool); |
44 | 44 | } |
45 | 45 | |
46 | - foreach ($joint->entries()?: [] as $entry) { |
|
46 | + foreach ($joint->entries() ?: [] as $entry) { |
|
47 | 47 | $this->addEntry($entry); |
48 | 48 | } |
49 | 49 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | 'item' => ['Logout', 'icon' => 'sign out', 'attr' => ['onclick' => "event.preventDefault();$('#logout-form').submit();"]], |
62 | 62 | 'action' => url('logout'), |
63 | 63 | 'group' => '10000:user', |
64 | - 'callback' => function ($item){ |
|
64 | + 'callback' => function($item) { |
|
65 | 65 | $logoutForm = $item->add(['View', 'attr' => ['method' => 'POST', 'action' => URL::to('logout')]])->setElement('form')->addStyle(['display' => 'none']); |
66 | 66 | $logoutForm->id = 'logout-form'; |
67 | 67 | $logoutForm->add(['View', 'attr' => ['type' => 'hidden', 'name' => '_token', 'value' => csrf_token()]])->setElement('input'); |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | |
79 | 79 | public function getUserMenuLabel() |
80 | 80 | { |
81 | - return $this->userMenuLabel?: Auth::user()->name; |
|
81 | + return $this->userMenuLabel ?: Auth::user()->name; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | public function addEntry($entry) |
85 | 85 | { |
86 | 86 | $entry = collect(array_merge(['item' => $entry, 'group' => '00500:general', 'weight' => 10], $entry)); |
87 | 87 | |
88 | - if (! $entry->get('item')) return; |
|
88 | + if (!$entry->get('item')) return; |
|
89 | 89 | |
90 | 90 | $this->entries->add($entry); |
91 | 91 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $item = $this->userMenu->addItem($entry['item'], $entry->get('action')); |
115 | 115 | |
116 | - if (! $callback = $entry->get('callback')) continue; |
|
116 | + if (!$callback = $entry->get('callback')) continue; |
|
117 | 117 | |
118 | 118 | $callback($item); |
119 | 119 | } |
@@ -73,7 +73,9 @@ discard block |
||
73 | 73 | { |
74 | 74 | $entry = collect(array_merge(['item' => $entry, 'group' => '00500:general', 'weight' => 10], $entry)); |
75 | 75 | |
76 | - if (! $entry->get('item')) return; |
|
76 | + if (! $entry->get('item')) { |
|
77 | + return; |
|
78 | + } |
|
77 | 79 | |
78 | 80 | $this->entries->add($entry); |
79 | 81 | } |
@@ -94,14 +96,18 @@ discard block |
||
94 | 96 | { |
95 | 97 | $empty = true; |
96 | 98 | foreach ($this->entries->groupBy('group')->sortKeys() as $group) { |
97 | - if (!$empty) $this->userMenu->addDivider(); |
|
99 | + if (!$empty) { |
|
100 | + $this->userMenu->addDivider(); |
|
101 | + } |
|
98 | 102 | |
99 | 103 | foreach ($group->sortBy('weight') as $entry) { |
100 | 104 | $empty = false; |
101 | 105 | |
102 | 106 | $item = $this->userMenu->addItem($entry['item'], $entry->get('action')); |
103 | 107 | |
104 | - if (! $callback = $entry->get('callback')) continue; |
|
108 | + if (! $callback = $entry->get('callback')) { |
|
109 | + continue; |
|
110 | + } |
|
105 | 111 | |
106 | 112 | $callback($item); |
107 | 113 | } |