Passed
Push — master ( 5c9089...a37889 )
by Georgi
05:25
created
src/CommonData/Database/Models/CommonData.php 1 patch
Braces   +31 added lines, -10 removed lines patch added patch discarded remove patch
@@ -19,7 +19,10 @@  discard block
 block discarded – undo
19 19
 
20 20
     	$parentId = null;
21 21
     	foreach(explode('/', trim($path,'/')) as $nodeKey) {
22
-    		if ($nodeKey === '') continue; //ignore empty paths
22
+    		if ($nodeKey === '') {
23
+    			continue;
24
+    		}
25
+    		//ignore empty paths
23 26
     		
24 27
     		if (empty($cache[$parentId][$nodeKey])) {
25 28
     			if (! $node = self::where('parent_id', $parentId)->where('key', $nodeKey)->first()) {
@@ -37,11 +40,15 @@  discard block
 block discarded – undo
37 40
    
38 41
     public static function newId($path, $readonly = false)
39 42
     {
40
-    	if (! $path = trim($path,'/')) return false;
43
+    	if (! $path = trim($path,'/')) {
44
+    		return false;
45
+    	}
41 46
 
42 47
     	$id = $parentId = null;
43 48
     	foreach(explode('/', $path) as $nodeKey) {
44
-    		if ($nodeKey === '') continue;
49
+    		if ($nodeKey === '') {
50
+    			continue;
51
+    		}
45 52
 
46 53
     		if (! $node = self::where('parent_id', $parentId)->where('key', $nodeKey)->first()) {
47 54
     			$node = self::create([
@@ -61,9 +68,13 @@  discard block
 block discarded – undo
61 68
     public static function setValue($path, $value, $overwrite = true, $readonly = false)
62 69
     {
63 70
     	if (! $id = self::getId($path)) {
64
-    		if (! $id = self::newId($path, $readonly)) return false;
71
+    		if (! $id = self::newId($path, $readonly)) {
72
+    			return false;
73
+    		}
65 74
     	} else {
66
-    		if (! $overwrite) return false;
75
+    		if (! $overwrite) {
76
+    			return false;
77
+    		}
67 78
     	}
68 79
     	
69 80
     	self::find($id)->update(compact('value', 'readonly'));
@@ -78,7 +89,9 @@  discard block
 block discarded – undo
78 89
     	$key = md5(serialize([$path, $translate]));
79 90
     	
80 91
     	if (! isset($cache[$key])) {
81
-    		if(! $id = self::getId($path)) return false;
92
+    		if(! $id = self::getId($path)) {
93
+    			return false;
94
+    		}
82 95
 
83 96
     		$ret = self::find($id)->value;
84 97
 
@@ -112,7 +125,9 @@  discard block
 block discarded – undo
112 125
     		self::find($id)->delete();
113 126
     	}
114 127
     			
115
-    	if(! $id = self::newId($path, $readonly)) return false;
128
+    	if(! $id = self::newId($path, $readonly)) {
129
+    		return false;
130
+    	}
116 131
     			
117 132
     	if ($overwrite) {
118 133
     		self::find($id)->update(compact('readonly'));
@@ -165,7 +180,9 @@  discard block
 block discarded – undo
165 180
      * @return true on success, false otherwise
166 181
      */
167 182
     public static function deleteArray($path){
168
-    	if (! $id = self::getId($path, true)) return false;
183
+    	if (! $id = self::getId($path, true)) {
184
+    		return false;
185
+    	}
169 186
     	
170 187
     	self::find($id)->delete();
171 188
     }
@@ -185,7 +202,9 @@  discard block
 block discarded – undo
185 202
     	}
186 203
     	
187 204
     	if (! $id = self::getId($path)) {
188
-    		if ($silent) return collection();
205
+    		if ($silent) {
206
+    			return collection();
207
+    		}
189 208
     		
190 209
     		new \Exception('Invalid CommonData::getArray() request: ' . $path);
191 210
     	}
@@ -196,7 +215,9 @@  discard block
 block discarded – undo
196 215
     protected static function validateArrayKeys($array)
197 216
     {
198 217
     	foreach($array as $key => $value) {
199
-    		if (strpos($key, '/') === false) continue;
218
+    		if (strpos($key, '/') === false) {
219
+    			continue;
220
+    		}
200 221
     		
201 222
     		\Exception('Invalid common data key: '. $key);
202 223
     	}
Please login to merge, or discard this patch.
src/CommonData/CommonDataSettings.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -112,7 +112,9 @@
 block discarded – undo
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) {
Please login to merge, or discard this patch.