Completed
Push — master ( 0079ad...7daa74 )
by Ron
23:44
created
src/Builder/Insert.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 * @return $this
89 89
 	 */
90 90
 	public function addExpr($str) {
91
-		if(count(func_get_args()) > 1) {
91
+		if (count(func_get_args()) > 1) {
92 92
 			$this->fields[] = func_get_args();
93 93
 		} else {
94 94
 			$this->fields[] = $str;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 * @return $this
103 103
 	 */
104 104
 	public function updateExpr($str) {
105
-		if(count(func_get_args()) > 1) {
105
+		if (count(func_get_args()) > 1) {
106 106
 			$this->update[] = func_get_args();
107 107
 		} else {
108 108
 			$this->update[] = $str;
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 * @return $this
116 116
 	 */
117 117
 	public function addOrUpdateExpr($str) {
118
-		if(count(func_get_args()) > 1) {
118
+		if (count(func_get_args()) > 1) {
119 119
 			$this->fields[] = func_get_args();
120 120
 			$this->update[] = func_get_args();
121 121
 		} else {
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 * @return $this
133 133
 	 */
134 134
 	public function addAll(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
 			$this->add($field, $value);
137 137
 		});
138 138
 		return $this;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * @return $this
146 146
 	 */
147 147
 	public function updateAll(array $data, array $mask = null, array $excludeFields = null) {
148
-		$this->addAllTo($data, $mask, $excludeFields, function ($field, $value) {
148
+		$this->addAllTo($data, $mask, $excludeFields, function($field, $value) {
149 149
 			if ($field !== $this->keyField) {
150 150
 				$this->update($field, $value);
151 151
 			}
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 		$ignoreStr = $this->ignore ? ' IGNORE' : '';
190 190
 		$queryArr[] = "INSERT{$ignoreStr} INTO\n\t{$tableName}\n";
191 191
 
192
-		if($this->from !== null) {
192
+		if ($this->from !== null) {
193 193
 			$fields = $this->from->getFields();
194 194
 			$queryArr[] = sprintf("\t(%s)\n", join(', ', array_keys($fields)));
195 195
 			$queryArr[] = $this->from;
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 		}
204 204
 
205 205
 		$updateData = $this->buildUpdate();
206
-		if($updateData) {
206
+		if ($updateData) {
207 207
 			$queryArr[] = "{$updateData}\n";
208 208
 		}
209 209
 
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
 	 * @return $this
237 237
 	 */
238 238
 	private function addAllTo(array $data, array $mask = null, array $excludeFields = null, $fn) {
239
-		if($mask !== null) {
239
+		if ($mask !== null) {
240 240
 			$data = array_intersect_key($data, array_combine($mask, $mask));
241 241
 		}
242
-		if($excludeFields !== null) {
243
-			foreach($excludeFields as $excludeField) {
244
-				if(array_key_exists($excludeField, $data)) {
242
+		if ($excludeFields !== null) {
243
+			foreach ($excludeFields as $excludeField) {
244
+				if (array_key_exists($excludeField, $data)) {
245 245
 					unset($data[$excludeField]);
246 246
 				}
247 247
 			}
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 	 */
258 258
 	private function buildUpdate() {
259 259
 		$queryArr = array();
260
-		if(!empty($this->update)) {
260
+		if (!empty($this->update)) {
261 261
 			$queryArr[] = "ON DUPLICATE KEY UPDATE\n";
262 262
 			$updateArr = array();
263
-			if($this->keyField !== null) {
263
+			if ($this->keyField !== null) {
264 264
 				$updateArr[] = "\t`{$this->keyField}` = LAST_INSERT_ID({$this->keyField})";
265 265
 			}
266 266
 			$updateArr = $this->buildFieldList($this->update, $updateArr);
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	 * @throws Exception
285 285
 	 */
286 286
 	private function clearValues(array $values) {
287
-		if(!count($values)) {
287
+		if (!count($values)) {
288 288
 			return [];
289 289
 		}
290 290
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 		$result = array();
294 294
 
295 295
 		foreach ($values as $fieldName => $fieldValue) {
296
-			if(in_array($fieldName, $fields)) {
296
+			if (in_array($fieldName, $fields)) {
297 297
 				$result[$fieldName] = $fieldValue;
298 298
 			}
299 299
 		}
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 * @return string
308 308
 	 */
309 309
 	private function formatExtraArgs($expression, $args) {
310
-		if(count($args) > 1) {
310
+		if (count($args) > 1) {
311 311
 			$args = array_slice($args, 1);
312 312
 			$expression = $this->db()->quoteExpression($expression, $args);
313 313
 		}
Please login to merge, or discard this patch.