Passed
Push — master ( 5a733a...de3595 )
by dima
06:55
created
src/Specification.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,8 +77,7 @@
 block discarded – undo
77 77
     {
78 78
         if($value!==false){
79 79
             $this->where[$field] = $value;
80
-        }
81
-        else{
80
+        } else{
82 81
             $this->where = $where;
83 82
         }
84 83
         
Please login to merge, or discard this patch.
src/Adapter/CodeigniterQueryBuilder.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,8 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
 		if(!$like){
73 73
 			return $this->adapter->escape_str($str);
74
-		}
75
-		else{
74
+		} else{
76 75
 			return $this->adapter->escape_like_str($str);
77 76
 		}	
78 77
 		
@@ -145,8 +144,7 @@  discard block
 block discarded – undo
145 144
 		if(preg_match('~(.*?)\.(.*?)$~is',$table,$m)){
146 145
 			$this->database = $m[1];
147 146
 			$this->TableName = $m[2];
148
-		}
149
-		else{
147
+		} else{
150 148
 			$this->TableName = $table;
151 149
 		}		
152 150
 	}	
Please login to merge, or discard this patch.
src/AbstractDataMapper.php 1 patch
Braces   +23 added lines, -22 removed lines patch added patch discarded remove patch
@@ -126,7 +126,9 @@  discard block
 block discarded – undo
126 126
 		$data = $this->unbuildEntity($Entity);
127 127
 		
128 128
 		//protected function onAfterSave(\SimpleORM\EntityInterface $Entity, &$data)
129
-		if(method_exists($this, 'onAfterSave' )) $this->onAfterSave( $Entity, $data );
129
+		if(method_exists($this, 'onAfterSave' )) {
130
+			$this->onAfterSave( $Entity, $data );
131
+		}
130 132
 		
131 133
 		$id = $data[$this->getPrimaryKey()];
132 134
 		unset($data[$this->getPrimaryKey()]);		
@@ -153,7 +155,9 @@  discard block
 block discarded – undo
153 155
 
154 156
 		}		
155 157
 		
156
-		if(method_exists($this, 'onBeforeSave' )) $this->onBeforeSave( $Entity );
158
+		if(method_exists($this, 'onBeforeSave' )) {
159
+			$this->onBeforeSave( $Entity );
160
+		}
157 161
 
158 162
 		
159 163
 		return true;
@@ -233,19 +237,18 @@  discard block
 block discarded – undo
233 237
 				
234 238
 				if($this->use_joins===true){
235 239
 					$value = $mapper->createEntity($row);
236
-				}
237
-				else{
240
+				} else{
238 241
 					$fkey = isset($cfg['on']) ? $cfg['on'] :$mapper->key;
239 242
 					$value = $mapper->findBySpecification((new Specification)->setWhere($fkey, $row[$field]));
240 243
 				}				
241 244
 				
242
-			}
243
-			elseif(is_string($field) && isset($row[strtolower($field)])){
245
+			} elseif(is_string($field) && isset($row[strtolower($field)])){
244 246
 				$value = $row[strtolower($field)];
245 247
 			}
246 248
 			
247
-			if($value!==false)
248
-				$Entity->{$method_set}($value);
249
+			if($value!==false) {
250
+							$Entity->{$method_set}($value);
251
+			}
249 252
 			
250 253
         }
251 254
 		
@@ -276,18 +279,17 @@  discard block
 block discarded – undo
276 279
 			//--------------------------------------------------------------------
277 280
 			if( isset($cfg['unbuild']) && is_object($cfg['unbuild']) ){
278 281
 				$value = call_user_func($cfg['unbuild'], $Entity->{$method_get}() );
279
-			}
280
-			elseif(isset($cfg['relation'])){
282
+			} elseif(isset($cfg['relation'])){
281 283
 				
282
-				if(isset($cfg['on']))
283
-					$fkey = $this->DI->get($cfg['relation'])->getFieldAlias($cfg['on']);
284
-				else
285
-					$fkey = 'id';
284
+				if(isset($cfg['on'])) {
285
+									$fkey = $this->DI->get($cfg['relation'])->getFieldAlias($cfg['on']);
286
+				} else {
287
+									$fkey = 'id';
288
+				}
286 289
 				
287 290
 				$value = $Entity->{$method_get}()->{'get'.$fkey}();
288 291
 				
289
-			}			
290
-			else{
292
+			} else{
291 293
 				$value = $Entity->{$method_get}();
292 294
 			}			
293 295
 						
@@ -305,8 +307,7 @@  discard block
 block discarded – undo
305 307
 		
306 308
 		if(is_string($field)){
307 309
 			$field = ['field'	=>	$field];
308
-		}
309
-		elseif( (is_array($field) && !isset($field['field'])) || empty($field)){
310
+		} elseif( (is_array($field) && !isset($field['field'])) || empty($field)){
310 311
 			$field['field']	= $alias;
311 312
 		}
312 313
 	
@@ -388,8 +389,7 @@  discard block
 block discarded – undo
388 389
 				$delete_key > '' && 
389 390
 				$Entity->getId() > 0){
390 391
 				$result = $this->getAdapter()->update($this->getEntityTable(), [ $delete_key => 1 ], "{$this->getPrimaryKey()} = '{$Entity->getId()}'");
391
-		}
392
-		elseif($Entity->getId() > 0){
392
+		} elseif($Entity->getId() > 0){
393 393
 			
394 394
 			if($result = $this->getAdapter()->delete($this->getEntityTable(), $this->getPrimaryKey()."  = ".$Entity->getId())){
395 395
 				if(method_exists($this, 'onBeforeDelete' )){ $result = $this->onBeforeDelete( $Entity );}
@@ -436,8 +436,9 @@  discard block
 block discarded – undo
436 436
 				$this->use_delete === false &&
437 437
 				$this->setSoftDeleteKey()>'' 
438 438
 				&& !isset($specification->getWhere()[$this->setSoftDeleteKey()])
439
-				)
440
-		$specification->setWhere($this->setSoftDeleteKey(),0);
439
+				) {
440
+				$specification->setWhere($this->setSoftDeleteKey(),0);
441
+		}
441 442
 	}
442 443
 	
443 444
 	/**
Please login to merge, or discard this patch.