@@ -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'])); |
@@ -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 | } |
@@ -31,7 +31,9 @@ |
||
31 | 31 | { |
32 | 32 | // create user default dashboard as copy of the system default |
33 | 33 | User::created(function(User $user) { |
34 | - if (! $defaultDashboard = Dashboard::where('user_id', 0)->first()) return; |
|
34 | + if (! $defaultDashboard = Dashboard::where('user_id', 0)->first()) { |
|
35 | + return; |
|
36 | + } |
|
35 | 37 | |
36 | 38 | $userDefaultDashboard = $defaultDashboard->replicate(); |
37 | 39 |
@@ -112,7 +112,9 @@ |
||
112 | 112 | |
113 | 113 | public function getControlButtonsHtml($row) |
114 | 114 | { |
115 | - if ($row['readonly']) return ''; |
|
115 | + if ($row['readonly']) { |
|
116 | + return ''; |
|
117 | + } |
|
116 | 118 | |
117 | 119 | $ret = ''; |
118 | 120 | foreach ($this->buttons as $button) { |
@@ -25,7 +25,10 @@ discard block |
||
25 | 25 | { |
26 | 26 | $parentId = null; |
27 | 27 | foreach(explode('/', trim($path,'/')) as $nodeKey) { |
28 | - if ($nodeKey === '') continue; //ignore empty paths |
|
28 | + if ($nodeKey === '') { |
|
29 | + continue; |
|
30 | + } |
|
31 | + //ignore empty paths |
|
29 | 32 | |
30 | 33 | if ($clearCache || empty(self::$cache['id'][$parentId][$nodeKey])) { |
31 | 34 | if (! $node = self::where('parent_id', $parentId)->where('key', $nodeKey)->first()) { |
@@ -43,11 +46,15 @@ discard block |
||
43 | 46 | |
44 | 47 | public static function newId($path, $readonly = false) |
45 | 48 | { |
46 | - if (! $path = trim($path,'/')) return false; |
|
49 | + if (! $path = trim($path,'/')) { |
|
50 | + return false; |
|
51 | + } |
|
47 | 52 | |
48 | 53 | $id = $parentId = null; |
49 | 54 | foreach(explode('/', $path) as $nodeKey) { |
50 | - if ($nodeKey === '') continue; |
|
55 | + if ($nodeKey === '') { |
|
56 | + continue; |
|
57 | + } |
|
51 | 58 | |
52 | 59 | if (! $node = self::where('parent_id', $parentId)->where('key', $nodeKey)->first()) { |
53 | 60 | $node = self::create([ |
@@ -67,9 +74,13 @@ discard block |
||
67 | 74 | public static function setValue($path, $value, $overwrite = true, $readonly = false) |
68 | 75 | { |
69 | 76 | if (! $id = self::getId($path)) { |
70 | - if (! $id = self::newId($path, $readonly)) return false; |
|
77 | + if (! $id = self::newId($path, $readonly)) { |
|
78 | + return false; |
|
79 | + } |
|
71 | 80 | } else { |
72 | - if (! $overwrite) return false; |
|
81 | + if (! $overwrite) { |
|
82 | + return false; |
|
83 | + } |
|
73 | 84 | } |
74 | 85 | |
75 | 86 | self::findOrFail($id)->update(compact('value', 'readonly')); |
@@ -89,7 +100,9 @@ discard block |
||
89 | 100 | $key = md5(serialize($path)); |
90 | 101 | |
91 | 102 | if (! isset(self::$cache['value'][$key])) { |
92 | - if(! $id = self::getId($path)) return false; |
|
103 | + if(! $id = self::getId($path)) { |
|
104 | + return false; |
|
105 | + } |
|
93 | 106 | |
94 | 107 | self::$cache['value'][$key] = self::find($id)->value; |
95 | 108 | } |
@@ -120,7 +133,9 @@ discard block |
||
120 | 133 | self::find($id)->delete(); |
121 | 134 | } |
122 | 135 | |
123 | - if(! $id = self::newId($path, $readonly)) return false; |
|
136 | + if(! $id = self::newId($path, $readonly)) { |
|
137 | + return false; |
|
138 | + } |
|
124 | 139 | |
125 | 140 | if ($overwrite) { |
126 | 141 | self::find($id)->update(compact('readonly')); |
@@ -173,7 +188,9 @@ discard block |
||
173 | 188 | * @return true on success, false otherwise |
174 | 189 | */ |
175 | 190 | public static function deleteArray($path){ |
176 | - if (! $id = self::getId($path, true)) return false; |
|
191 | + if (! $id = self::getId($path, true)) { |
|
192 | + return false; |
|
193 | + } |
|
177 | 194 | |
178 | 195 | self::find($id)->delete(); |
179 | 196 | |
@@ -193,7 +210,9 @@ discard block |
||
193 | 210 | } |
194 | 211 | |
195 | 212 | if (! $id = self::getId($path)) { |
196 | - if ($silent) return collect(); |
|
213 | + if ($silent) { |
|
214 | + return collect(); |
|
215 | + } |
|
197 | 216 | |
198 | 217 | throw new CommonDataNotFound('Invalid CommonData::getArray() request: ' . $path); |
199 | 218 | } |
@@ -204,7 +223,9 @@ discard block |
||
204 | 223 | protected static function validateArrayKeys($array) |
205 | 224 | { |
206 | 225 | foreach($array as $key => $value) { |
207 | - if (strpos($key, '/') === false) continue; |
|
226 | + if (strpos($key, '/') === false) { |
|
227 | + continue; |
|
228 | + } |
|
208 | 229 | |
209 | 230 | \Exception('Invalid common data key: '. $key); |
210 | 231 | } |