Passed
Push — master ( 252c51...fbb2a0 )
by dima
06:40
created
src/AbstractDataMapper.php 1 patch
Braces   +17 added lines, -20 removed lines patch added patch discarded remove patch
@@ -222,19 +222,18 @@  discard block
 block discarded – undo
222 222
 				
223 223
 				if($this->use_joins===true){
224 224
 					$value = $mapper->createEntity($row);
225
-				}
226
-				else{
225
+				} else{
227 226
 					$fkey = isset($cfg['on']) ? $cfg['on'] :$mapper->key;
228 227
 					$value = $mapper->findBySpecification((new Specification)->setWhere($fkey, $row[$field]));
229 228
 				}				
230 229
 				
231
-			}
232
-			elseif(is_string($field) && isset($row[strtolower($field)])){
230
+			} elseif(is_string($field) && isset($row[strtolower($field)])){
233 231
 				$value = $row[strtolower($field)];
234 232
 			}
235 233
 			
236
-			if($value!==false)
237
-				$Entity->{$method_set}($value);
234
+			if($value!==false) {
235
+							$Entity->{$method_set}($value);
236
+			}
238 237
 			
239 238
         }
240 239
 		
@@ -265,18 +264,17 @@  discard block
 block discarded – undo
265 264
 			//--------------------------------------------------------------------
266 265
 			if( isset($cfg['unbuild']) && is_object($cfg['unbuild']) ){
267 266
 				$value = call_user_func($cfg['unbuild'], $Entity->{$method_get}() );
268
-			}
269
-			elseif(isset($cfg['relation'])){
267
+			} elseif(isset($cfg['relation'])){
270 268
 				
271
-				if(isset($cfg['on']))
272
-					$fkey = $this->DI->get($cfg['relation'])->getFieldAlias($cfg['on']);
273
-				else
274
-					$fkey = 'id';
269
+				if(isset($cfg['on'])) {
270
+									$fkey = $this->DI->get($cfg['relation'])->getFieldAlias($cfg['on']);
271
+				} else {
272
+									$fkey = 'id';
273
+				}
275 274
 				
276 275
 				$value = $Entity->{$method_get}()->{'get'.$fkey}();
277 276
 				
278
-			}			
279
-			else{
277
+			} else{
280 278
 				$value = $Entity->{$method_get}();
281 279
 			}			
282 280
 						
@@ -294,8 +292,7 @@  discard block
 block discarded – undo
294 292
 		
295 293
 		if(is_string($field)){
296 294
 			$field = ['field'	=>	$field];
297
-		}
298
-		elseif( (is_array($field) && !isset($field['field'])) || empty($field)){
295
+		} elseif( (is_array($field) && !isset($field['field'])) || empty($field)){
299 296
 			$field['field']	= $alias;
300 297
 		}
301 298
 	
@@ -377,8 +374,7 @@  discard block
 block discarded – undo
377 374
 				$delete_key > '' && 
378 375
 				$Entity->getId() > 0){
379 376
 				$result = $this->db->update($this->getEntityTable(), [ $delete_key => 1 ], "{$this->getPrimaryKey()} = '{$Entity->getId()}'");
380
-		}
381
-		elseif($Entity->getId() > 0){
377
+		} elseif($Entity->getId() > 0){
382 378
 			
383 379
 			if($result = $this->db->delete($this->getEntityTable(), $this->getPrimaryKey()."  = ".$Entity->getId())){
384 380
 				if(method_exists($this, 'onDeleteSuccess' )){ $result = $this->onDeleteSuccess( $Entity );}
@@ -425,8 +421,9 @@  discard block
 block discarded – undo
425 421
 				$this->use_delete === false &&
426 422
 				$this->setSoftDeleteKey()>'' 
427 423
 				&& !isset($specification->getWhere()[$this->setSoftDeleteKey()])
428
-				)
429
-		$specification->setWhere($this->setSoftDeleteKey(),0);
424
+				) {
425
+				$specification->setWhere($this->setSoftDeleteKey(),0);
426
+		}
430 427
 	}
431 428
 	
432 429
 		/**
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.