Completed
Push — master ( 3ffd7e...e292fe )
by Ron
02:37
created
src/Builder/Helpers/LazyRowGenerator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,14 +21,14 @@
 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(\PDO::FETCH_ASSOC)) {
25
-			if($this->preserveTypes) {
24
+		while ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
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
 				$row = call_user_func($callback);
31
-				if($row !== null) {
31
+				if ($row !== null) {
32 32
 					yield $row;
33 33
 				}
34 34
 			} else {
Please login to merge, or discard this patch.
src/Builder/Internal/DDLRunnable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 	public function run(array $params = array()) {
26 26
 		$this->query->execute($params);
27 27
 		$response = $this->query->getStatement()->rowCount();
28
-		if($this->callbackFn !== null) {
28
+		if ($this->callbackFn !== null) {
29 29
 			$response = call_user_func($this->callbackFn, $response);
30 30
 		}
31 31
 		return $response;
Please login to merge, or discard this patch.
src/Builder/Insert.php 1 patch
Spacing   +15 added lines, -15 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
 		}
Please login to merge, or discard this patch.
src/Builder/Traits/OrderByBuilder.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
 	 * @return $this
14 14
 	 */
15 15
 	public function orderBy($expression, $direction = 'asc') {
16
-		if(strtolower($direction) != 'desc') {
16
+		if (strtolower($direction) != 'desc') {
17 17
 			$direction = 'ASC';
18 18
 		}
19
-		if(is_array($expression)) {
20
-			if(!count($expression)) {
19
+		if (is_array($expression)) {
20
+			if (!count($expression)) {
21 21
 				return $this;
22 22
 			}
23 23
 			$arguments = array(
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function orderByValues($fieldName, array $values) {
36 36
 		$expr = [];
37
-		foreach(array_values($values) as $idx => $value) {
37
+		foreach (array_values($values) as $idx => $value) {
38 38
 			$expr[] = $this->db()->quoteExpression("WHEN ? THEN ?", array($value, $idx));
39 39
 		}
40 40
 		$this->orderBy[] = array(sprintf("CASE %s\n\t\t%s\n\tEND", $this->db()->quoteField($fieldName), join("\n\t\t", $expr)), 'ASC');
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
 	 * @return string
47 47
 	 */
48 48
 	protected function buildOrder($query) {
49
-		if(!count($this->orderBy)) {
49
+		if (!count($this->orderBy)) {
50 50
 			return $query;
51 51
 		}
52 52
 		$query .= "ORDER BY\n";
53 53
 		$arr = array();
54
-		foreach($this->orderBy as $order) {
54
+		foreach ($this->orderBy as $order) {
55 55
 			list($expression, $direction) = $order;
56 56
 			$arr[] = sprintf("\t%s %s", $expression, strtoupper($direction));
57 57
 		}
Please login to merge, or discard this patch.
src/Databases/MySQL/MySQLExceptionInterpreter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@
 block discarded – undo
16 16
 	public function throwMoreConcreteException(PDOException $exception) {
17 17
 		$code = $exception->errorInfo[1];
18 18
 		$message = (string) $exception->errorInfo[2];
19
-		switch($code) {
19
+		switch ($code) {
20 20
 			case 2006: throw new DatabaseHasGoneAwayException($message, $code, $exception);
21 21
 			case 1213: throw new SqlDeadLockException($message, $code, $exception);
22 22
 			case 1205: throw new LockWaitTimeoutExceededException($message, $code, $exception);
23 23
 			case 1062: throw new DuplicateUniqueKeyException($message, $code, $exception);
24 24
 		}
25 25
 		/** @link http://php.net/manual/en/class.exception.php#Hcom115813 (cHao's comment) */
26
-		if(!is_string($message) || !is_int($code)) {
26
+		if (!is_string($message) || !is_int($code)) {
27 27
 			throw new SqlException((string) $message, (int) $code, $exception);
28 28
 		}
29 29
 		throw $exception;
Please login to merge, or discard this patch.
src/Builder/RunnableSelect.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
 	 * @return array[]
57 57
 	 */
58 58
 	public function fetchRows(\Closure $callback = null) {
59
-		return $this->createTempStatement(function (QueryStatement $statement) use ($callback) {
59
+		return $this->createTempStatement(function(QueryStatement $statement) use ($callback) {
60 60
 			$data = $statement->fetchAll(\PDO::FETCH_ASSOC);
61
-			if($this->preserveTypes) {
61
+			if ($this->preserveTypes) {
62 62
 				$columnDefinitions = FieldTypeProvider::getFieldTypes($statement);
63
-				foreach($data as &$row) {
63
+				foreach ($data as &$row) {
64 64
 					$row = FieldValueConverter::convertValues($row, $columnDefinitions);
65 65
 				}
66 66
 			}
67
-			if($callback !== null) {
67
+			if ($callback !== null) {
68 68
 				$data = array_map($callback, $data);
69 69
 			}
70 70
 			return $data;
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 * @return array[]|\Generator
77 77
 	 */
78 78
 	public function fetchRowsLazy(\Closure $callback = null) {
79
-		if(version_compare(PHP_VERSION, '5.5', '<')) {
79
+		if (version_compare(PHP_VERSION, '5.5', '<')) {
80 80
 			return $this->fetchRows($callback);
81 81
 		}
82 82
 		$statement = $this->createStatement();
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
 	 * @return string[]
89 89
 	 */
90 90
 	public function fetchRow() {
91
-		return $this->createTempStatement(function (QueryStatement $statement) {
91
+		return $this->createTempStatement(function(QueryStatement $statement) {
92 92
 			$row = $statement->fetch(\PDO::FETCH_ASSOC);
93
-			if(!is_array($row)) {
93
+			if (!is_array($row)) {
94 94
 				return array();
95 95
 			}
96
-			if($this->preserveTypes) {
96
+			if ($this->preserveTypes) {
97 97
 				$columnDefinitions = FieldTypeProvider::getFieldTypes($statement);
98 98
 				$row = FieldValueConverter::convertValues($row, $columnDefinitions);
99 99
 			}
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
 	 * @return mixed[]
107 107
 	 */
108 108
 	public function fetchKeyValue($treatValueAsArray = false) {
109
-		return $this->createTempStatement(function (QueryStatement $statement) use ($treatValueAsArray) {
110
-			if($treatValueAsArray) {
109
+		return $this->createTempStatement(function(QueryStatement $statement) use ($treatValueAsArray) {
110
+			if ($treatValueAsArray) {
111 111
 				$rows = $statement->fetchAll(\PDO::FETCH_ASSOC);
112 112
 				$result = array();
113
-				foreach($rows as $row) {
113
+				foreach ($rows as $row) {
114 114
 					list($key) = array_values($row);
115 115
 					$result[$key] = $row;
116 116
 				}
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 	public function fetchGroups(array $fields) {
128 128
 		$rows = $this->fetchRows();
129 129
 		$result = array();
130
-		foreach($rows as $row) {
130
+		foreach ($rows as $row) {
131 131
 			$tmp = &$result;
132
-			foreach($fields as $field) {
132
+			foreach ($fields as $field) {
133 133
 				$value = $row[$field];
134
-				if(!array_key_exists($value, $tmp)) {
134
+				if (!array_key_exists($value, $tmp)) {
135 135
 					$tmp[$value] = [];
136 136
 				}
137 137
 				$tmp = &$tmp[$value];
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * @return string[]
146 146
 	 */
147 147
 	public function fetchArray() {
148
-		return $this->createTempStatement(function (QueryStatement $stmt) {
148
+		return $this->createTempStatement(function(QueryStatement $stmt) {
149 149
 			return $stmt->fetchAll(\PDO::FETCH_COLUMN);
150 150
 		});
151 151
 	}
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 	 * @return null|bool|string|int|float
156 156
 	 */
157 157
 	public function fetchValue($default = null) {
158
-		return $this->createTempStatement(function (QueryStatement $stmt) use ($default) {
158
+		return $this->createTempStatement(function(QueryStatement $stmt) use ($default) {
159 159
 			$result = $stmt->fetch(\PDO::FETCH_NUM);
160
-			if($result !== false) {
160
+			if ($result !== false) {
161 161
 				return $result[0];
162 162
 			}
163 163
 			return $default;
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		$query = $this->__toString();
198 198
 		$statement = $db->prepare($query);
199 199
 		$statement->execute($this->values);
200
-		if($this->getCalcFoundRows()) {
200
+		if ($this->getCalcFoundRows()) {
201 201
 			$this->foundRows = (int) $db->query('SELECT FOUND_ROWS()')->fetchColumn();
202 202
 		}
203 203
 		return $statement;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@
 block discarded – undo
169 169
 	}
170 170
 
171 171
 	/**
172
-	 * @return bool
172
+	 * @return integer
173 173
 	 */
174 174
 	public function getFoundRows() {
175 175
 		return $this->foundRows;
Please login to merge, or discard this patch.
src/Databases/MySQL.php 1 patch
Spacing   +29 added lines, -29 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
 	}
@@ -264,14 +264,14 @@  discard block
 block discarded – undo
264 264
 	 * @throws null
265 265
 	 */
266 266
 	public function transaction($tries = 1, $callback = null) {
267
-		if(is_callable($tries)) {
267
+		if (is_callable($tries)) {
268 268
 			$callback = $tries;
269 269
 			$tries = 1;
270
-		} elseif(!is_callable($callback)) {
270
+		} elseif (!is_callable($callback)) {
271 271
 			throw new \Exception('$callback must be a callable');
272 272
 		}
273 273
 		$e = null;
274
-		for(; $tries--;) {
274
+		for (; $tries--;) {
275 275
 			try {
276 276
 				$this->transactionStart();
277 277
 				$result = call_user_func($callback, $this);
@@ -291,11 +291,11 @@  discard block
 block discarded – undo
291 291
 	 */
292 292
 	private function transactionEnd($fn) {
293 293
 		$this->transactionLevel--;
294
-		if($this->transactionLevel < 0) {
294
+		if ($this->transactionLevel < 0) {
295 295
 			throw new \Exception("Transaction-Nesting-Problem: Trying to invoke commit on a already closed transaction");
296 296
 		}
297
-		if((int) $this->transactionLevel === 0) {
298
-			if($this->outerTransaction) {
297
+		if ((int) $this->transactionLevel === 0) {
298
+			if ($this->outerTransaction) {
299 299
 				$this->outerTransaction = false;
300 300
 			} else {
301 301
 				call_user_func($fn);
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 	 */
313 313
 	private function buildQueryStatement($query, $fn) {
314 314
 		$stmt = call_user_func($fn, $query);
315
-		if(!$stmt) {
315
+		if (!$stmt) {
316 316
 			throw new Exception("Could not execute statement:\n{$query}");
317 317
 		}
318 318
 		$stmtWrapper = new QueryStatement($stmt, $query, $this->exceptionInterpreter, $this->queryLoggers);
Please login to merge, or discard this patch.
src/Builder/QueryStatement.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 			$timer = microtime(true);
50 50
 			$response = $this->statement->execute($params);
51 51
 			$this->queryLoggers->log($this->query, microtime(true)-$timer);
52
-			if(!$response) {
52
+			if (!$response) {
53 53
 				throw new SqlException('Execution returned with "false".');
54 54
 			}
55 55
 		});
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	public function fetchAll($fetchStyle = PDO::FETCH_ASSOC, $fetchArgument = null, array $ctorArgs = []) {
66 66
 		return $this->exceptionHandler(function() use ($fetchStyle, $fetchArgument, $ctorArgs) {
67
-			if($fetchArgument !== null) {
67
+			if ($fetchArgument !== null) {
68 68
 				return $this->statement->fetchAll($fetchStyle, $fetchArgument, $ctorArgs);
69 69
 			}
70 70
 			return $this->statement->fetchAll($fetchStyle);
Please login to merge, or discard this patch.
src/Builder/Internal/ConditionBuilder.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,15 +12,15 @@
 block discarded – undo
12 12
 	 * @return string
13 13
 	 */
14 14
 	public static function build(Database $db, $query, array $conditions, $token) {
15
-		if(!count($conditions)) {
15
+		if (!count($conditions)) {
16 16
 			return $query;
17 17
 		}
18 18
 		$query .= "{$token}\n";
19 19
 		$arr = [];
20
-		foreach($conditions as $condition) {
20
+		foreach ($conditions as $condition) {
21 21
 			list($expression, $arguments) = $condition;
22
-			if(is_array($expression)) {
23
-				foreach($expression as $key => $value) {
22
+			if (is_array($expression)) {
23
+				foreach ($expression as $key => $value) {
24 24
 					$arr = self::buildCondition($arr, "`{$key}`=?", [$value], $db);
25 25
 				}
26 26
 			} else {
Please login to merge, or discard this patch.