@@ -142,7 +142,9 @@ discard block |
||
142 | 142 | |
143 | 143 | public function addMenu() |
144 | 144 | { |
145 | - if ($this->isLocked()) return; |
|
145 | + if ($this->isLocked()) { |
|
146 | + return; |
|
147 | + } |
|
146 | 148 | |
147 | 149 | $dashboardId = $this->dashboard()->id; |
148 | 150 | |
@@ -165,14 +167,18 @@ discard block |
||
165 | 167 | $dashboardMenu->addItem([__('Rename dashboard'), 'icon' => 'i cursor'])->on('click', $modal->show()); |
166 | 168 | |
167 | 169 | // there is only one admin default dashboard |
168 | - if ($this->admin) return; |
|
170 | + if ($this->admin) { |
|
171 | + return; |
|
172 | + } |
|
169 | 173 | |
170 | 174 | // ***** add ***** // |
171 | 175 | $modal = $this->add(['Modal', 'title' => __('Add Dashboard')])->set(\Closure::fromCallable([$this, 'addDashboard'])); |
172 | 176 | |
173 | 177 | $dashboardMenu->addItem([__('Add dashboard'), 'icon' => 'add'])->on('click', $modal->show()); |
174 | 178 | |
175 | - if ($this->isSingleDashboard()) return; |
|
179 | + if ($this->isSingleDashboard()) { |
|
180 | + return; |
|
181 | + } |
|
176 | 182 | |
177 | 183 | // ***** reorder ***** // |
178 | 184 | $modal = $this->add(['Modal', 'title' => __('Reorder Dashboards')])->set(\Closure::fromCallable([$this, 'reorderDashboards'])); |
@@ -50,12 +50,17 @@ discard block |
||
50 | 50 | foreach(explode('/', trim($path,'/')) as $nodeKey) { |
51 | 51 | $parentId = $id; |
52 | 52 | |
53 | - if ($nodeKey === '') continue; //ignore empty paths |
|
53 | + if ($nodeKey === '') { |
|
54 | + continue; |
|
55 | + } |
|
56 | + //ignore empty paths |
|
54 | 57 | |
55 | 58 | if ($clearCache || empty(self::$cache['id'][$parentId][$nodeKey])) { |
56 | 59 | $node = self::siblings($parentId)->addCondition('key', $nodeKey)->tryLoadAny(); |
57 | 60 | |
58 | - if (! $node->loaded()) return false; |
|
61 | + if (! $node->loaded()) { |
|
62 | + return false; |
|
63 | + } |
|
59 | 64 | |
60 | 65 | self::$cache['id'][$parentId][$nodeKey] = $node->id; |
61 | 66 | } |
@@ -68,11 +73,15 @@ discard block |
||
68 | 73 | |
69 | 74 | public static function newId($path, $readonly = false) |
70 | 75 | { |
71 | - if (! $path = trim($path,'/')) return false; |
|
76 | + if (! $path = trim($path,'/')) { |
|
77 | + return false; |
|
78 | + } |
|
72 | 79 | |
73 | 80 | $id = null; |
74 | 81 | foreach(explode('/', $path) as $nodeKey) { |
75 | - if ($nodeKey === '') continue; |
|
82 | + if ($nodeKey === '') { |
|
83 | + continue; |
|
84 | + } |
|
76 | 85 | |
77 | 86 | $parentId = $id; |
78 | 87 | |
@@ -80,8 +89,7 @@ discard block |
||
80 | 89 | |
81 | 90 | if ($node->loaded()) { |
82 | 91 | $id = $node->id; |
83 | - } |
|
84 | - else { |
|
92 | + } else { |
|
85 | 93 | $id = $node->insert([ |
86 | 94 | 'parent' => $parentId, |
87 | 95 | 'key' => $nodeKey, |
@@ -96,9 +104,13 @@ discard block |
||
96 | 104 | public static function setValue($path, $value, $overwrite = true, $readonly = false) |
97 | 105 | { |
98 | 106 | if (! $id = self::getId($path)) { |
99 | - if (! $id = self::newId($path, $readonly)) return false; |
|
107 | + if (! $id = self::newId($path, $readonly)) { |
|
108 | + return false; |
|
109 | + } |
|
100 | 110 | } else { |
101 | - if (! $overwrite) return false; |
|
111 | + if (! $overwrite) { |
|
112 | + return false; |
|
113 | + } |
|
102 | 114 | } |
103 | 115 | |
104 | 116 | self::create()->tryLoad($id)->save(compact('value', 'readonly')); |
@@ -118,7 +130,9 @@ discard block |
||
118 | 130 | $key = md5(serialize($path)); |
119 | 131 | |
120 | 132 | if (! isset(self::$cache['value'][$key])) { |
121 | - if(! $id = self::getId($path)) return false; |
|
133 | + if(! $id = self::getId($path)) { |
|
134 | + return false; |
|
135 | + } |
|
122 | 136 | |
123 | 137 | self::$cache['value'][$key] = self::create()->tryLoad($id)->get('value'); |
124 | 138 | } |
@@ -149,7 +163,9 @@ discard block |
||
149 | 163 | self::create()->delete($id); |
150 | 164 | } |
151 | 165 | |
152 | - if(! $id = self::newId($path, $readonly)) return false; |
|
166 | + if(! $id = self::newId($path, $readonly)) { |
|
167 | + return false; |
|
168 | + } |
|
153 | 169 | |
154 | 170 | if ($overwrite) { |
155 | 171 | self::create()->tryLoad($id)->save(compact('readonly')); |
@@ -202,7 +218,9 @@ discard block |
||
202 | 218 | * @return true on success, false otherwise |
203 | 219 | */ |
204 | 220 | public static function deleteArray($path){ |
205 | - if (! $id = self::getId($path, true)) return false; |
|
221 | + if (! $id = self::getId($path, true)) { |
|
222 | + return false; |
|
223 | + } |
|
206 | 224 | |
207 | 225 | self::create()->delete($id); |
208 | 226 | |
@@ -223,7 +241,9 @@ discard block |
||
223 | 241 | { |
224 | 242 | $node = is_numeric($node)? self::create()->tryLoad($node): $node; |
225 | 243 | |
226 | - if (! $node['parent']) return []; |
|
244 | + if (! $node['parent']) { |
|
245 | + return []; |
|
246 | + } |
|
227 | 247 | |
228 | 248 | return array_filter(array_merge([$node['parent']], self::ancestors($node['parent']))); |
229 | 249 | } |
@@ -248,7 +268,9 @@ discard block |
||
248 | 268 | } |
249 | 269 | |
250 | 270 | if (! $id = self::getId($path)) { |
251 | - if ($silent) return collect(); |
|
271 | + if ($silent) { |
|
272 | + return collect(); |
|
273 | + } |
|
252 | 274 | |
253 | 275 | throw new CommonDataNotFound('Invalid CommonData::getArray() request: ' . $path); |
254 | 276 | } |
@@ -259,7 +281,9 @@ discard block |
||
259 | 281 | protected static function validateArrayKeys($array) |
260 | 282 | { |
261 | 283 | foreach($array as $key => $value) { |
262 | - if (strpos($key, '/') === false) continue; |
|
284 | + if (strpos($key, '/') === false) { |
|
285 | + continue; |
|
286 | + } |
|
263 | 287 | |
264 | 288 | \Exception('Invalid common data key: '. $key); |
265 | 289 | } |
@@ -68,7 +68,9 @@ |
||
68 | 68 | |
69 | 69 | public function getDependencyPath($data) |
70 | 70 | { |
71 | - if (! $dependency = $this->getDependency()) return false; |
|
71 | + if (! $dependency = $this->getDependency()) { |
|
72 | + return false; |
|
73 | + } |
|
72 | 74 | |
73 | 75 | return implode('/', array_merge([$dependency['path']], array_intersect_key($data, array_flip($dependency['fields'])))); |
74 | 76 | } |
@@ -51,7 +51,9 @@ |
||
51 | 51 | { |
52 | 52 | // create user default dashboard as copy of the system default |
53 | 53 | User::created(function(User $user) { |
54 | - if (! $defaultDashboard = Models\Dashboard::create()->addCondition('user_id', 0)->tryLoadAny()) return; |
|
54 | + if (! $defaultDashboard = Models\Dashboard::create()->addCondition('user_id', 0)->tryLoadAny()) { |
|
55 | + return; |
|
56 | + } |
|
55 | 57 | $userDefaultDashboard = (clone $defaultDashboard)->duplicate()->save([ |
56 | 58 | 'name' => __('Default'), |
57 | 59 | 'user_id' => $user->id |
@@ -26,8 +26,7 @@ |
||
26 | 26 | |
27 | 27 | if ($this->admin) { |
28 | 28 | $this->set($joint->info())->setAttr('searchkey', strtolower($joint->caption() . ';' . $joint->info())); |
29 | - } |
|
30 | - else { |
|
29 | + } else { |
|
31 | 30 | if (! $this->locked) { |
32 | 31 | $this->addControl('close', 'applet-close')->setAttr('title', __('Close applet')); |
33 | 32 | } |