Passed
Push — master ( 800a7c...2f3156 )
by dima
03:06
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/AbstractDataMapper.php 1 patch
Braces   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -110,8 +110,7 @@  discard block
 block discarded – undo
110 110
 			
111 111
 			if(method_exists($this, 'onUnBuild'.$propery )){
112 112
 				$value = $this->{'onUnBuild'.$propery}(  $Entity->{$method_get}() );
113
-			}
114
-			else{
113
+			} else{
115 114
 				$value = $Entity->{$method_get}();
116 115
 			}			
117 116
 			$row[$field] = $value;
@@ -146,13 +145,13 @@  discard block
 block discarded – undo
146 145
 			//событие onBuildField
147 146
 			if(method_exists($this, 'onBuild'.$propery )){
148 147
 				$value = $this->{'onBuild'.$propery}($field,$row);
149
-			}
150
-			elseif(is_string($field) && isset($row[strtolower($field)])){
148
+			} elseif(is_string($field) && isset($row[strtolower($field)])){
151 149
 				$value = $row[strtolower($field)];
152 150
 			}
153 151
 			
154
-			if($value!==false)
155
-				$Entity->{$method_set}($value);
152
+			if($value!==false) {
153
+							$Entity->{$method_set}($value);
154
+			}
156 155
 			
157 156
         }
158 157
 		
@@ -206,8 +205,7 @@  discard block
 block discarded – undo
206 205
 				$delete_key > '' && 
207 206
 				$Entity->getId() > 0){
208 207
 				$result = $this->db->update($this->getEntityTable(), [ $delete_key => 1 ], "{$this->getPrimaryKey()} = '{$Entity->getId()}'");
209
-		}
210
-		elseif($Entity->getId() > 0){
208
+		} elseif($Entity->getId() > 0){
211 209
 			
212 210
 			if($result = $this->db->delete($this->getEntityTable(), $this->getPrimaryKey()."  = ".$Entity->getId())){
213 211
 				if(method_exists($this, 'onDeleteSuccess' )){ $result = $this->onDeleteSuccess( $Entity );}
@@ -253,8 +251,9 @@  discard block
 block discarded – undo
253 251
 		if(
254 252
 				$this->setSoftDeleteKey()>'' 
255 253
 				&& !isset($specification->getWhere()[$this->setSoftDeleteKey()])
256
-				)
257
-		$specification->setWhere($this->setSoftDeleteKey(),0);
254
+				) {
255
+				$specification->setWhere($this->setSoftDeleteKey(),0);
256
+		}
258 257
 	}
259 258
 	
260 259
 	/**
Please login to merge, or discard this patch.
src/AbstractOptDataMapper.php 1 patch
Braces   +14 added lines, -18 removed lines patch added patch discarded remove patch
@@ -44,11 +44,9 @@  discard block
 block discarded – undo
44 44
 		
45 45
 		if(is_string($field)){
46 46
 			$field = ['field'	=>	$field];
47
-		}
48
-		elseif(empty($field)){
47
+		} elseif(empty($field)){
49 48
 			$field = ['field'	=>	$alias];
50
-		}
51
-		elseif(is_array($field) && !isset($field['field'])){
49
+		} elseif(is_array($field) && !isset($field['field'])){
52 50
 			$field['field']	= $alias;
53 51
 		}
54 52
 	
@@ -121,19 +119,18 @@  discard block
 block discarded – undo
121 119
 				
122 120
 				if($this->use_joins===true){
123 121
 					$value = $mapper->createEntity($row);
124
-				}
125
-				else{
122
+				} else{
126 123
 					$fkey = isset($cfg['on']) ? $cfg['on'] :$mapper->key;
127 124
 					$value = $mapper->findBySpecification((new Specification)->setWhere($fkey, $row[$field]));
128 125
 				}				
129 126
 				
130
-			}
131
-			elseif(is_string($field) && isset($row[strtolower($field)])){
127
+			} elseif(is_string($field) && isset($row[strtolower($field)])){
132 128
 				$value = $row[strtolower($field)];
133 129
 			}
134 130
 			
135
-			if($value!==false)
136
-				$Entity->{$method_set}($value);
131
+			if($value!==false) {
132
+							$Entity->{$method_set}($value);
133
+			}
137 134
 			
138 135
         }
139 136
 		
@@ -164,18 +161,17 @@  discard block
 block discarded – undo
164 161
 			//--------------------------------------------------------------------
165 162
 			if( isset($cfg['unbuild']) && is_object($cfg['unbuild']) ){
166 163
 				$value = call_user_func($cfg['unbuild'], $Entity->{$method_get}() );
167
-			}
168
-			elseif(isset($cfg['relation'])){
164
+			} elseif(isset($cfg['relation'])){
169 165
 				
170
-				if(isset($cfg['on']))
171
-					$fkey = $this->DI->get($cfg['relation'])->getFieldAlias($cfg['on']);
172
-				else
173
-					$fkey = 'id';
166
+				if(isset($cfg['on'])) {
167
+									$fkey = $this->DI->get($cfg['relation'])->getFieldAlias($cfg['on']);
168
+				} else {
169
+									$fkey = 'id';
170
+				}
174 171
 				
175 172
 				$value = $Entity->{$method_get}()->{'get'.$fkey}();
176 173
 				
177
-			}			
178
-			else{
174
+			} else{
179 175
 				$value = $Entity->{$method_get}();
180 176
 			}			
181 177
 						
Please login to merge, or discard this patch.