Completed
Push — master ( 792038...9ff9da )
by Ron
02:22
created
src/Databases/MySQL.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @param PDO $pdo
36 36
 	 */
37 37
 	public function __construct(PDO $pdo) {
38
-		if($pdo->getAttribute(PDO::ATTR_ERRMODE) === PDO::ERRMODE_SILENT) {
38
+		if ($pdo->getAttribute(PDO::ATTR_ERRMODE) === PDO::ERRMODE_SILENT) {
39 39
 			$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
40 40
 		}
41 41
 		$this->pdo = $pdo;
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * @return QueryStatement
65 65
 	 */
66 66
 	public function query($query) {
67
-		return $this->buildQueryStatement($query, function ($query) {
67
+		return $this->buildQueryStatement($query, function($query) {
68 68
 			$stmt = $this->pdo->query($query);
69 69
 			return $stmt;
70 70
 		});
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 * @return QueryStatement
77 77
 	 */
78 78
 	public function prepare($query) {
79
-		return $this->buildQueryStatement((string) $query, function ($query) {
79
+		return $this->buildQueryStatement((string) $query, function($query) {
80 80
 			$stmt = $this->pdo->prepare($query);
81 81
 			return $stmt;
82 82
 		});
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 	 * @return int
89 89
 	 */
90 90
 	public function exec($query, array $params = array()) {
91
-		return $this->exceptionHandler(function () use ($query, $params) {
91
+		return $this->exceptionHandler(function() use ($query, $params) {
92 92
 			$stmt = $this->pdo->prepare($query);
93 93
 			$timer = microtime(true);
94 94
 			$stmt->execute($params);
95
-			$this->queryLoggers->log($query, microtime(true) - $timer);
95
+			$this->queryLoggers->log($query, microtime(true)-$timer);
96 96
 			$result = $stmt->rowCount();
97 97
 			$stmt->closeCursor();
98 98
 			return $result;
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function getTableFields($table) {
114 114
 		$table = $this->select()->aliasReplacer()->replace($table);
115
-		if(array_key_exists($table, self::$tableFields)) {
115
+		if (array_key_exists($table, self::$tableFields)) {
116 116
 			return self::$tableFields[$table];
117 117
 		}
118 118
 		$stmt = $this->pdo->query("DESCRIBE {$table}");
119 119
 		$rows = $stmt->fetchAll(\PDO::FETCH_ASSOC);
120
-		self::$tableFields[$table] = array_map(function ($row) { return $row['Field']; }, $rows);
120
+		self::$tableFields[$table] = array_map(function($row) { return $row['Field']; }, $rows);
121 121
 		$stmt->closeCursor();
122 122
 		return self::$tableFields[$table];
123 123
 	}
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 	 * @return string
129 129
 	 */
130 130
 	public function quoteExpression($expression, array $arguments = array()) {
131
-		$func = function () use ($arguments) {
131
+		$func = function() use ($arguments) {
132 132
 			static $idx = -1;
133 133
 			$idx++;
134 134
 			$index = $idx;
135
-			if(array_key_exists($index, $arguments)) {
135
+			if (array_key_exists($index, $arguments)) {
136 136
 				$argument = $arguments[$index];
137 137
 				$value = $this->quote($argument);
138 138
 			} else {
@@ -149,14 +149,14 @@  discard block
 block discarded – undo
149 149
 	 * @return string
150 150
 	 */
151 151
 	public function quote($value) {
152
-		if(is_null($value)) {
152
+		if (is_null($value)) {
153 153
 			$result = 'NULL';
154
-		} elseif($value instanceof Builder\DBExpr) {
154
+		} elseif ($value instanceof Builder\DBExpr) {
155 155
 			$result = $value->getExpression();
156
-		} elseif($value instanceof Builder\Select) {
156
+		} elseif ($value instanceof Builder\Select) {
157 157
 			$result = sprintf('(%s)', (string) $value);
158
-		} elseif(is_array($value)) {
159
-			$result = join(', ', array_map(function ($value) { return $this->quote($value); }, $value));
158
+		} elseif (is_array($value)) {
159
+			$result = join(', ', array_map(function($value) { return $this->quote($value); }, $value));
160 160
 		} else {
161 161
 			$result = $this->pdo->quote($value);
162 162
 		}
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 		if (is_numeric($field) || !is_string($field)) {
172 172
 			throw new UnexpectedValueException('Field name is invalid');
173 173
 		}
174
-		if(strpos($field, '`') !== false) {
174
+		if (strpos($field, '`') !== false) {
175 175
 			return (string) $field;
176 176
 		}
177 177
 		$parts = explode('.', $field);
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	public function select(array $fields = null) {
186 186
 		$select = new RunnableSelect($this);
187
-		if($fields !== null) {
187
+		if ($fields !== null) {
188 188
 			$select->fields($fields);
189 189
 		}
190 190
 		return $select;
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 */
197 197
 	public function insert(array $fields = null) {
198 198
 		$insert = new Builder\RunnableInsert($this);
199
-		if($fields !== null) {
199
+		if ($fields !== null) {
200 200
 			$insert->addAll($fields);
201 201
 		}
202 202
 		return $insert;
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	 */
209 209
 	public function update(array $fields = null) {
210 210
 		$update = new Builder\RunnableUpdate($this);
211
-		if($fields !== null) {
211
+		if ($fields !== null) {
212 212
 			$update->setAll($fields);
213 213
 		}
214 214
 		return $update;
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
 	 * @return $this
226 226
 	 */
227 227
 	public function transactionStart() {
228
-		if((int) $this->transactionLevel === 0) {
229
-			if($this->pdo->inTransaction()) {
228
+		if ((int) $this->transactionLevel === 0) {
229
+			if ($this->pdo->inTransaction()) {
230 230
 				$this->outerTransaction = true;
231 231
 			} else {
232 232
 				$this->pdo->beginTransaction();
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 	 * @throws \Exception
242 242
 	 */
243 243
 	public function transactionCommit() {
244
-		return $this->transactionEnd(function () {
244
+		return $this->transactionEnd(function() {
245 245
 			$this->pdo->commit();
246 246
 		});
247 247
 	}
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 * @throws \Exception
252 252
 	 */
253 253
 	public function transactionRollback() {
254
-		return $this->transactionEnd(function () {
254
+		return $this->transactionEnd(function() {
255 255
 			$this->pdo->rollBack();
256 256
 		});
257 257
 	}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	public function dryRun($callback = null) {
266 266
 		$result = null;
267 267
 		$exception = null;
268
-		if(!$this->pdo->inTransaction()) {
268
+		if (!$this->pdo->inTransaction()) {
269 269
 			$this->transactionStart();
270 270
 			try {
271 271
 				$result = call_user_func($callback, $this);
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 				$exception = $e;
274 274
 			}
275 275
 			$this->transactionRollback();
276
-			if($exception !== null) {
276
+			if ($exception !== null) {
277 277
 				throw $exception;
278 278
 			}
279 279
 		} else {
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 				$exception = $e;
286 286
 			}
287 287
 			$this->exec("ROLLBACK TO {$uniqueId}");
288
-			if($exception !== null) {
288
+			if ($exception !== null) {
289 289
 				throw $exception;
290 290
 			}
291 291
 		}
@@ -300,15 +300,15 @@  discard block
 block discarded – undo
300 300
 	 * @throws null
301 301
 	 */
302 302
 	public function transaction($tries = 1, $callback = null) {
303
-		if(is_callable($tries)) {
303
+		if (is_callable($tries)) {
304 304
 			$callback = $tries;
305 305
 			$tries = 1;
306
-		} elseif(!is_callable($callback)) {
306
+		} elseif (!is_callable($callback)) {
307 307
 			throw new \Exception('$callback must be a callable');
308 308
 		}
309 309
 		$e = null;
310
-		if(!$this->pdo->inTransaction()) {
311
-			for(; $tries--;) {
310
+		if (!$this->pdo->inTransaction()) {
311
+			for (; $tries--;) {
312 312
 				try {
313 313
 					$this->transactionStart();
314 314
 					$result = call_user_func($callback, $this);
@@ -339,11 +339,11 @@  discard block
 block discarded – undo
339 339
 	 */
340 340
 	private function transactionEnd($fn) {
341 341
 		$this->transactionLevel--;
342
-		if($this->transactionLevel < 0) {
342
+		if ($this->transactionLevel < 0) {
343 343
 			throw new \Exception("Transaction-Nesting-Problem: Trying to invoke commit on a already closed transaction");
344 344
 		}
345
-		if((int) $this->transactionLevel === 0) {
346
-			if($this->outerTransaction) {
345
+		if ((int) $this->transactionLevel === 0) {
346
+			if ($this->outerTransaction) {
347 347
 				$this->outerTransaction = false;
348 348
 			} else {
349 349
 				call_user_func($fn);
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 	 */
361 361
 	private function buildQueryStatement($query, $fn) {
362 362
 		$stmt = call_user_func($fn, $query);
363
-		if(!$stmt) {
363
+		if (!$stmt) {
364 364
 			throw new Exception("Could not execute statement:\n{$query}");
365 365
 		}
366 366
 		$stmtWrapper = new QueryStatement($stmt, $query, $this->exceptionInterpreter, $this->queryLoggers);
Please login to merge, or discard this patch.
src/Builder/Helpers/FieldTypeProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 	 */
11 11
 	public static function getFieldTypes(QueryStatement $statement) {
12 12
 		$fieldTypes = array();
13
-		for($i = 0; $column = $statement->getColumnMeta($i); $i++) {
13
+		for ($i = 0; $column = $statement->getColumnMeta($i); $i++) {
14 14
 			$fieldTypes[$column['name']] = self::getTypeFromNativeType($column['native_type']);
15 15
 		}
16 16
 		return $fieldTypes;
Please login to merge, or discard this patch.
src/Builder/Expr/RequiredDBFilterMap.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@
 block discarded – undo
27 27
 	 * @return DBExprFilter
28 28
 	 */
29 29
 	public function __invoke($expression, $keyPath, $validator = null) {
30
-		return new DBExprFilter($expression, $this->map, $keyPath, $validator, function ($result, array $data) {
31
-			if(!$result) {
30
+		return new DBExprFilter($expression, $this->map, $keyPath, $validator, function($result, array $data) {
31
+			if (!$result) {
32 32
 				throw new RequiredValueNotFoundException(sprintf("Required value %s not found", $data['key']));
33 33
 			}
34 34
 		});
Please login to merge, or discard this patch.
src/Builder/Expr/DBExprFilter.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -28,16 +28,16 @@  discard block
 block discarded – undo
28 28
 		$this->value = $data;
29 29
 		$this->keyPath = $this->buildKey($keyPath);
30 30
 		$this->value = $this->recursiveGet($data, $this->keyPath, null);
31
-		if($validator === null) {
32
-			$validator = function ($data) {
33
-				if(is_array($data)) {
31
+		if ($validator === null) {
32
+			$validator = function($data) {
33
+				if (is_array($data)) {
34 34
 					return $this->isValidArray($data);
35 35
 				}
36 36
 				return (string) $data !== '';
37 37
 			};
38 38
 		}
39
-		if($validationResultHandler === null) {
40
-			$validationResultHandler = function () {};
39
+		if ($validationResultHandler === null) {
40
+			$validationResultHandler = function() {};
41 41
 		}
42 42
 		$this->validator = $validator;
43 43
 		$this->validationResultHandler = $validationResultHandler;
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
 	 * @throws Exception
76 76
 	 */
77 77
 	private function buildKey($keyPath) {
78
-		if(is_string($keyPath)) {
78
+		if (is_string($keyPath)) {
79 79
 			$keyPath = explode('.', $keyPath);
80 80
 		}
81
-		if(!is_array($keyPath)) {
81
+		if (!is_array($keyPath)) {
82 82
 			throw new Exception('Invalid key');
83 83
 		}
84 84
 		return $keyPath;
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 	 * @return bool
90 90
 	 */
91 91
 	private function isValidArray(array $array) {
92
-		$data = array_filter($array, function ($value) {
93
-			if(is_array($value)) {
92
+		$data = array_filter($array, function($value) {
93
+			if (is_array($value)) {
94 94
 				return $this->isValidArray($value);
95 95
 			}
96 96
 			return (string) $value !== '';
@@ -109,9 +109,9 @@  discard block
 block discarded – undo
109 109
 		if (!$count) {
110 110
 			return $default;
111 111
 		}
112
-		for($idx = 0; $idx < $count; $idx++) {
112
+		for ($idx = 0; $idx < $count; $idx++) {
113 113
 			$part = $path[$idx];
114
-			if(!array_key_exists($part, $array)) {
114
+			if (!array_key_exists($part, $array)) {
115 115
 				return $default;
116 116
 			}
117 117
 			$array = $array[$part];
Please login to merge, or discard this patch.
src/Builder/Helpers/YieldPolyfillIterator.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -47,16 +47,16 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function current() {
49 49
 		$row = $this->currentItem;
50
-		if($this->preserveTypes) {
50
+		if ($this->preserveTypes) {
51 51
 			$columnDefinitions = FieldTypeProvider::getFieldTypes($this->getStmt());
52 52
 			$row = FieldValueConverter::convertValues($row, $columnDefinitions);
53 53
 		}
54 54
 		$callback = $this->callback;
55
-		if($callback !== null) {
55
+		if ($callback !== null) {
56 56
 			$result = $callback($row);
57
-			if($result instanceof DBIgnoreRow) {
57
+			if ($result instanceof DBIgnoreRow) {
58 58
 				// Do nothing in this case
59
-			} elseif($result !== null) {
59
+			} elseif ($result !== null) {
60 60
 				return $result;
61 61
 			} else {
62 62
 				return $row;
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function valid() {
87 87
 		$result = !!$this->currentItem;
88
-		if(!$result) {
88
+		if (!$result) {
89 89
 			$this->closeCursor();
90 90
 		}
91 91
 		return $result;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	/**
95 95
 	 */
96 96
 	public function rewind() {
97
-		if($this->stmt !== null) {
97
+		if ($this->stmt !== null) {
98 98
 			throw new \Exception("It's not possible to rewind this iterator");
99 99
 		}
100 100
 		$this->stmt = call_user_func($this->statementFactory);
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 * @return QueryStatement
107 107
 	 */
108 108
 	private function getStmt() {
109
-		if($this->stmt === null) {
109
+		if ($this->stmt === null) {
110 110
 			$this->rewind();
111 111
 		}
112 112
 		return $this->stmt;
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	/**
116 116
 	 */
117 117
 	private function closeCursor() {
118
-		if($this->stmt instanceof QueryStatement) {
118
+		if ($this->stmt instanceof QueryStatement) {
119 119
 			$this->stmt->closeCursor();
120 120
 		}
121 121
 		$this->stmt = null;
Please login to merge, or discard this patch.
src/Builder/Traits/LimitBuilder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@
 block discarded – undo
28 28
 	 */
29 29
 	protected function buildLimit($query, $offset = null) {
30 30
 		$limit = $this->limit;
31
-		if($limit === null && $offset !== null) {
31
+		if ($limit === null && $offset !== null) {
32 32
 			$limit = '18446744073709551615';
33 33
 		}
34
-		if($limit !== null) {
34
+		if ($limit !== null) {
35 35
 			$query .= "LIMIT\n\t{$limit}\n";
36 36
 		}
37 37
 		return $query;
Please login to merge, or discard this patch.
src/Builder/Helpers/LazyRowGenerator.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,16 +21,16 @@
 block discarded – undo
21 21
 	 * @return array[]|\Generator
22 22
 	 */
23 23
 	public function generate(QueryStatement $statement, Closure $callback = null) {
24
-		while($row = $statement->fetch()) {
25
-			if($this->preserveTypes) {
24
+		while ($row = $statement->fetch()) {
25
+			if ($this->preserveTypes) {
26 26
 				$columnDefinitions = FieldTypeProvider::getFieldTypes($statement);
27 27
 				$row = FieldValueConverter::convertValues($row, $columnDefinitions);
28 28
 			}
29
-			if($callback !== null) {
29
+			if ($callback !== null) {
30 30
 				$result = $callback($row);
31
-				if($result instanceof DBIgnoreRow) {
31
+				if ($result instanceof DBIgnoreRow) {
32 32
 					// Do nothing in this case
33
-				} elseif($result !== null) {
33
+				} elseif ($result !== null) {
34 34
 					yield $result;
35 35
 				} else {
36 36
 					yield $row;
Please login to merge, or discard this patch.
src/Builder/QueryStatement.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
 	 * @return $this
47 47
 	 */
48 48
 	public function setFetchMode($mode, $arg0 = null, array $arg1 = null) {
49
-		if($arg1 !== null) {
49
+		if ($arg1 !== null) {
50 50
 			/** @noinspection PhpMethodParametersCountMismatchInspection */
51 51
 			$this->statement->setFetchMode($mode, $arg0, $arg1);
52 52
 			return $this;
53 53
 		}
54
-		if($arg0 !== null) {
54
+		if ($arg0 !== null) {
55 55
 			/** @noinspection PhpMethodParametersCountMismatchInspection */
56 56
 			$this->statement->setFetchMode($mode, $arg0);
57 57
 			return $this;
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 			$timer = microtime(true);
71 71
 			$response = $this->statement->execute($params);
72 72
 			$this->queryLoggers->log($this->query, microtime(true)-$timer);
73
-			if(!$response) {
73
+			if (!$response) {
74 74
 				throw new SqlException('Execution returned with "false".');
75 75
 			}
76 76
 		});
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function fetchAll($fetchStyle = null, $fetchArgument = null, array $ctorArgs = []) {
87 87
 		return $this->exceptionHandler(function() use ($fetchStyle, $fetchArgument, $ctorArgs) {
88
-			if($fetchArgument !== null) {
88
+			if ($fetchArgument !== null) {
89 89
 				return $this->statement->fetchAll($fetchStyle, $fetchArgument, $ctorArgs);
90 90
 			}
91 91
 			return $this->statement->fetchAll($fetchStyle);
Please login to merge, or discard this patch.
src/Builder/RunnableSelect.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @throws \Exception
81 81
 	 */
82 82
 	public function fetchRow(Closure $callback = null) {
83
-		return $this->fetch($callback, PDO::FETCH_ASSOC, null, function ($row) {
83
+		return $this->fetch($callback, PDO::FETCH_ASSOC, null, function($row) {
84 84
 			return ['valid' => is_array($row), 'default' => []];
85 85
 		});
86 86
 	}
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @throws \Exception
112 112
 	 */
113 113
 	public function fetchObject($className, Closure $callback = null) {
114
-		return $this->fetch($callback, PDO::FETCH_CLASS, $className, function ($row) {
114
+		return $this->fetch($callback, PDO::FETCH_CLASS, $className, function($row) {
115 115
 			return ['valid' => is_object($row), 'default' => null];
116 116
 		});
117 117
 	}
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
 	 * @return mixed[]
122 122
 	 */
123 123
 	public function fetchKeyValue($treatValueAsArray = false) {
124
-		return $this->createTempStatement(function (QueryStatement $statement) use ($treatValueAsArray) {
125
-			if($treatValueAsArray) {
124
+		return $this->createTempStatement(function(QueryStatement $statement) use ($treatValueAsArray) {
125
+			if ($treatValueAsArray) {
126 126
 				$rows = $statement->fetchAll(\PDO::FETCH_ASSOC);
127 127
 				$result = array();
128
-				foreach($rows as $row) {
128
+				foreach ($rows as $row) {
129 129
 					list($key) = array_values($row);
130 130
 					$result[$key] = $row;
131 131
 				}
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 	public function fetchGroups(array $fields) {
143 143
 		$rows = $this->fetchRows();
144 144
 		$result = array();
145
-		foreach($rows as $row) {
145
+		foreach ($rows as $row) {
146 146
 			$tmp = &$result;
147
-			foreach($fields as $field) {
147
+			foreach ($fields as $field) {
148 148
 				$value = $row[$field];
149
-				if(!array_key_exists($value, $tmp)) {
149
+				if (!array_key_exists($value, $tmp)) {
150 150
 					$tmp[$value] = [];
151 151
 				}
152 152
 				$tmp = &$tmp[$value];
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 * @return string[]
161 161
 	 */
162 162
 	public function fetchArray() {
163
-		return $this->createTempStatement(function (QueryStatement $stmt) {
163
+		return $this->createTempStatement(function(QueryStatement $stmt) {
164 164
 			return $stmt->fetchAll(\PDO::FETCH_COLUMN);
165 165
 		});
166 166
 	}
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 	 * @return null|bool|string|int|float
171 171
 	 */
172 172
 	public function fetchValue($default = null) {
173
-		return $this->createTempStatement(function (QueryStatement $stmt) use ($default) {
173
+		return $this->createTempStatement(function(QueryStatement $stmt) use ($default) {
174 174
 			$result = $stmt->fetch(\PDO::FETCH_NUM);
175
-			if($result !== false) {
175
+			if ($result !== false) {
176 176
 				return $result[0];
177 177
 			}
178 178
 			return $default;
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 		$query = $this->__toString();
213 213
 		$statement = $db->prepare($query);
214 214
 		$statement->execute($this->values);
215
-		if($this->getCalcFoundRows()) {
215
+		if ($this->getCalcFoundRows()) {
216 216
 			$this->foundRows = (int) $db->query('SELECT FOUND_ROWS()')->fetchColumn();
217 217
 		}
218 218
 		return $statement;
@@ -233,20 +233,20 @@  discard block
 block discarded – undo
233 233
 	 * @throws \Exception
234 234
 	 */
235 235
 	private function fetchAll(Closure $callback = null, $mode, $arg0 = null) {
236
-		return $this->createTempStatement(function (QueryStatement $statement) use ($callback, $mode, $arg0) {
236
+		return $this->createTempStatement(function(QueryStatement $statement) use ($callback, $mode, $arg0) {
237 237
 			$statement->setFetchMode($mode, $arg0);
238 238
 			$data = $statement->fetchAll();
239
-			if($this->preserveTypes) {
239
+			if ($this->preserveTypes) {
240 240
 				$columnDefinitions = FieldTypeProvider::getFieldTypes($statement);
241
-				foreach($data as &$row) {
241
+				foreach ($data as &$row) {
242 242
 					$row = FieldValueConverter::convertValues($row, $columnDefinitions);
243 243
 				}
244 244
 			}
245
-			if($callback !== null) {
246
-				return call_user_func(function ($resultData = []) use ($data, $callback) {
247
-					foreach($data as $row) {
245
+			if ($callback !== null) {
246
+				return call_user_func(function($resultData = []) use ($data, $callback) {
247
+					foreach ($data as $row) {
248 248
 						$result = $callback($row);
249
-						if($result !== null && !($result instanceof DBIgnoreRow)) {
249
+						if ($result !== null && !($result instanceof DBIgnoreRow)) {
250 250
 							$resultData[] = $result;
251 251
 						} else {
252 252
 							$resultData[] = $row;
@@ -266,8 +266,8 @@  discard block
 block discarded – undo
266 266
 	 * @return Generator|YieldPolyfillIterator|mixed[]
267 267
 	 */
268 268
 	private function fetchLazy(Closure $callback = null, $mode, $arg0 = null) {
269
-		if(version_compare(PHP_VERSION, '5.5', '<')) {
270
-			return new YieldPolyfillIterator($callback, $this->preserveTypes, function () use ($mode, $arg0) {
269
+		if (version_compare(PHP_VERSION, '5.5', '<')) {
270
+			return new YieldPolyfillIterator($callback, $this->preserveTypes, function() use ($mode, $arg0) {
271 271
 				$statement = $this->createStatement();
272 272
 				$statement->setFetchMode($mode, $arg0);
273 273
 				return $statement;
@@ -288,20 +288,20 @@  discard block
 block discarded – undo
288 288
 	 * @throws \Exception
289 289
 	 */
290 290
 	private function fetch(Closure $callback = null, $mode, $arg0 = null, Closure $resultValidator = null) {
291
-		return $this->createTempStatement(function (QueryStatement $statement) use ($callback, $mode, $arg0, $resultValidator) {
291
+		return $this->createTempStatement(function(QueryStatement $statement) use ($callback, $mode, $arg0, $resultValidator) {
292 292
 			$statement->setFetchMode($mode, $arg0);
293 293
 			$row = $statement->fetch();
294 294
 			$result = $resultValidator($row);
295
-			if(!$result['valid']) {
295
+			if (!$result['valid']) {
296 296
 				return $result['default'];
297 297
 			}
298
-			if($this->preserveTypes) {
298
+			if ($this->preserveTypes) {
299 299
 				$columnDefinitions = FieldTypeProvider::getFieldTypes($statement);
300 300
 				$row = FieldValueConverter::convertValues($row, $columnDefinitions);
301 301
 			}
302
-			if($callback !== null) {
302
+			if ($callback !== null) {
303 303
 				$result = $callback($row);
304
-				if($result !== null) {
304
+				if ($result !== null) {
305 305
 					$row = $result;
306 306
 				}
307 307
 			}
Please login to merge, or discard this patch.