Passed
Push — master ( c62a09...4c7916 )
by Georgi
06:55
created
src/CommonData/CommonDataSettings.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -112,8 +112,7 @@
 block discarded – undo
112 112
 	    //@TODO: remove below when adding null condition fixed
113 113
 	    if ($parent = $this->parent()) {
114 114
 	        $nodes->addCondition('parent', $parent);
115
-	    }
116
-	    else {
115
+	    } else {
117 116
 	        $nodes->addCondition($nodes->expr('parent is NULL'));
118 117
 	    }
119 118
 
Please login to merge, or discard this patch.
src/CommonData/Models/CommonData.php 1 patch
Braces   +38 added lines, -14 removed lines patch added patch discarded remove patch
@@ -50,12 +50,17 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     	}
Please login to merge, or discard this patch.
src/CommonData/Fields/CommonData.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,9 @@
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
src/Dashboard/DashboardCore.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,9 @@
 block discarded – undo
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
Please login to merge, or discard this patch.