Completed
Push — master ( 3e0fd7...23f593 )
by Ron
03:11
created
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/RunnableSelect.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -60,19 +60,19 @@  discard block
 block discarded – undo
60 60
 	 * @return array[]
61 61
 	 */
62 62
 	public function fetchRows(Closure $callback = null) {
63
-		return $this->createTempStatement(function (QueryStatement $statement) use ($callback) {
63
+		return $this->createTempStatement(function(QueryStatement $statement) use ($callback) {
64 64
 			$data = $statement->fetchAll(\PDO::FETCH_ASSOC);
65
-			if($this->preserveTypes) {
65
+			if ($this->preserveTypes) {
66 66
 				$columnDefinitions = FieldTypeProvider::getFieldTypes($statement);
67
-				foreach($data as &$row) {
67
+				foreach ($data as &$row) {
68 68
 					$row = FieldValueConverter::convertValues($row, $columnDefinitions);
69 69
 				}
70 70
 			}
71
-			if($callback !== null) {
71
+			if ($callback !== null) {
72 72
 				$resultData = [];
73
-				foreach($data as $row) {
73
+				foreach ($data as $row) {
74 74
 					$result = $callback($row);
75
-					if($result !== null && !($result instanceof DBIgnoreRow)) {
75
+					if ($result !== null && !($result instanceof DBIgnoreRow)) {
76 76
 						$resultData[] = $result;
77 77
 					} else {
78 78
 						$resultData[] = $row;
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @return array[]|\Generator
90 90
 	 */
91 91
 	public function fetchRowsLazy(Closure $callback = null) {
92
-		if(version_compare(PHP_VERSION, '5.5', '<')) {
92
+		if (version_compare(PHP_VERSION, '5.5', '<')) {
93 93
 			return $this->fetchRows($callback);
94 94
 		}
95 95
 		$statement = $this->createStatement();
@@ -103,18 +103,18 @@  discard block
 block discarded – undo
103 103
 	 * @throws \Exception
104 104
 	 */
105 105
 	public function fetchRow(Closure $callback = null) {
106
-		return $this->createTempStatement(function (QueryStatement $statement) use ($callback) {
106
+		return $this->createTempStatement(function(QueryStatement $statement) use ($callback) {
107 107
 			$row = $statement->fetch(\PDO::FETCH_ASSOC);
108
-			if(!is_array($row)) {
108
+			if (!is_array($row)) {
109 109
 				return [];
110 110
 			}
111
-			if($this->preserveTypes) {
111
+			if ($this->preserveTypes) {
112 112
 				$columnDefinitions = FieldTypeProvider::getFieldTypes($statement);
113 113
 				$row = FieldValueConverter::convertValues($row, $columnDefinitions);
114 114
 			}
115
-			if($callback !== null) {
115
+			if ($callback !== null) {
116 116
 				$result = $callback($row);
117
-				if($result !== null) {
117
+				if ($result !== null) {
118 118
 					$row = $result;
119 119
 				}
120 120
 			}
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 	 * @return mixed[]
128 128
 	 */
129 129
 	public function fetchKeyValue($treatValueAsArray = false) {
130
-		return $this->createTempStatement(function (QueryStatement $statement) use ($treatValueAsArray) {
131
-			if($treatValueAsArray) {
130
+		return $this->createTempStatement(function(QueryStatement $statement) use ($treatValueAsArray) {
131
+			if ($treatValueAsArray) {
132 132
 				$rows = $statement->fetchAll(\PDO::FETCH_ASSOC);
133 133
 				$result = array();
134
-				foreach($rows as $row) {
134
+				foreach ($rows as $row) {
135 135
 					list($key) = array_values($row);
136 136
 					$result[$key] = $row;
137 137
 				}
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
 	public function fetchGroups(array $fields) {
149 149
 		$rows = $this->fetchRows();
150 150
 		$result = array();
151
-		foreach($rows as $row) {
151
+		foreach ($rows as $row) {
152 152
 			$tmp = &$result;
153
-			foreach($fields as $field) {
153
+			foreach ($fields as $field) {
154 154
 				$value = $row[$field];
155
-				if(!array_key_exists($value, $tmp)) {
155
+				if (!array_key_exists($value, $tmp)) {
156 156
 					$tmp[$value] = [];
157 157
 				}
158 158
 				$tmp = &$tmp[$value];
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 * @return string[]
167 167
 	 */
168 168
 	public function fetchArray() {
169
-		return $this->createTempStatement(function (QueryStatement $stmt) {
169
+		return $this->createTempStatement(function(QueryStatement $stmt) {
170 170
 			return $stmt->fetchAll(\PDO::FETCH_COLUMN);
171 171
 		});
172 172
 	}
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 	 * @return null|bool|string|int|float
177 177
 	 */
178 178
 	public function fetchValue($default = null) {
179
-		return $this->createTempStatement(function (QueryStatement $stmt) use ($default) {
179
+		return $this->createTempStatement(function(QueryStatement $stmt) use ($default) {
180 180
 			$result = $stmt->fetch(\PDO::FETCH_NUM);
181
-			if($result !== false) {
181
+			if ($result !== false) {
182 182
 				return $result[0];
183 183
 			}
184 184
 			return $default;
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 		$query = $this->__toString();
219 219
 		$statement = $db->prepare($query);
220 220
 		$statement->execute($this->values);
221
-		if($this->getCalcFoundRows()) {
221
+		if ($this->getCalcFoundRows()) {
222 222
 			$this->foundRows = (int) $db->query('SELECT FOUND_ROWS()')->fetchColumn();
223 223
 		}
224 224
 		return $statement;
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(\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
 				$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.