Completed
Push — master ( c04073...0079ad )
by Ron
16:11
created
src/Builder/Insert.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * @return $this
120 120
 	 */
121 121
 	public function addAll(array $data, array $mask = null, array $excludeFields = null) {
122
-		$this->addAllTo($data, $mask, $excludeFields, function ($field, $value) {
122
+		$this->addAllTo($data, $mask, $excludeFields, function($field, $value) {
123 123
 			$this->add($field, $value);
124 124
 		});
125 125
 		return $this;
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 * @return $this
133 133
 	 */
134 134
 	public function updateAll(array $data, array $mask = null, array $excludeFields = null) {
135
-		$this->addAllTo($data, $mask, $excludeFields, function ($field, $value) {
135
+		$this->addAllTo($data, $mask, $excludeFields, function($field, $value) {
136 136
 			if ($field !== $this->keyField) {
137 137
 				$this->update($field, $value);
138 138
 			}
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		$ignoreStr = $this->ignore ? ' IGNORE' : '';
177 177
 		$queryArr[] = "INSERT{$ignoreStr} INTO\n\t{$tableName}\n";
178 178
 
179
-		if($this->from !== null) {
179
+		if ($this->from !== null) {
180 180
 			$fields = $this->from->getFields();
181 181
 			$queryArr[] = sprintf("\t(%s)\n", join(', ', array_keys($fields)));
182 182
 			$queryArr[] = $this->from;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 		}
191 191
 
192 192
 		$updateData = $this->buildUpdate();
193
-		if($updateData) {
193
+		if ($updateData) {
194 194
 			$queryArr[] = "{$updateData}\n";
195 195
 		}
196 196
 
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
 	 * @return $this
224 224
 	 */
225 225
 	private function addAllTo(array $data, array $mask = null, array $excludeFields = null, $fn) {
226
-		if($mask !== null) {
226
+		if ($mask !== null) {
227 227
 			$data = array_intersect_key($data, array_combine($mask, $mask));
228 228
 		}
229
-		if($excludeFields !== null) {
230
-			foreach($excludeFields as $excludeField) {
231
-				if(array_key_exists($excludeField, $data)) {
229
+		if ($excludeFields !== null) {
230
+			foreach ($excludeFields as $excludeField) {
231
+				if (array_key_exists($excludeField, $data)) {
232 232
 					unset($data[$excludeField]);
233 233
 				}
234 234
 			}
@@ -244,10 +244,10 @@  discard block
 block discarded – undo
244 244
 	 */
245 245
 	private function buildUpdate() {
246 246
 		$queryArr = array();
247
-		if(!empty($this->update)) {
247
+		if (!empty($this->update)) {
248 248
 			$queryArr[] = "ON DUPLICATE KEY UPDATE\n";
249 249
 			$updateArr = array();
250
-			if($this->keyField !== null) {
250
+			if ($this->keyField !== null) {
251 251
 				$updateArr[] = "\t`{$this->keyField}` = LAST_INSERT_ID({$this->keyField})";
252 252
 			}
253 253
 			$updateArr = $this->buildFieldList($this->update, $updateArr);
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 * @throws Exception
272 272
 	 */
273 273
 	private function clearValues(array $values) {
274
-		if(!count($values)) {
274
+		if (!count($values)) {
275 275
 			return [];
276 276
 		}
277 277
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 		$result = array();
281 281
 
282 282
 		foreach ($values as $fieldName => $fieldValue) {
283
-			if(in_array($fieldName, $fields)) {
283
+			if (in_array($fieldName, $fields)) {
284 284
 				$result[$fieldName] = $fieldValue;
285 285
 			}
286 286
 		}
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 	 * @return string
295 295
 	 */
296 296
 	private function formatExtraArgs($expression, $args) {
297
-		if(count($args) > 1) {
297
+		if (count($args) > 1) {
298 298
 			$args = array_slice($args, 1);
299 299
 			$expression = $this->db()->quoteExpression($expression, $args);
300 300
 		}
Please login to merge, or discard this patch.