Completed
Push — master ( 23f593...5271f8 )
by Ron
03:22
created
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/RunnableSelect.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -61,19 +61,19 @@  discard block
 block discarded – undo
61 61
 	 * @return array[]
62 62
 	 */
63 63
 	public function fetchRows(Closure $callback = null) {
64
-		return $this->createTempStatement(function (QueryStatement $statement) use ($callback) {
64
+		return $this->createTempStatement(function(QueryStatement $statement) use ($callback) {
65 65
 			$data = $statement->fetchAll(\PDO::FETCH_ASSOC);
66
-			if($this->preserveTypes) {
66
+			if ($this->preserveTypes) {
67 67
 				$columnDefinitions = FieldTypeProvider::getFieldTypes($statement);
68
-				foreach($data as &$row) {
68
+				foreach ($data as &$row) {
69 69
 					$row = FieldValueConverter::convertValues($row, $columnDefinitions);
70 70
 				}
71 71
 			}
72
-			if($callback !== null) {
72
+			if ($callback !== null) {
73 73
 				$resultData = [];
74
-				foreach($data as $row) {
74
+				foreach ($data as $row) {
75 75
 					$result = $callback($row);
76
-					if($result !== null && !($result instanceof DBIgnoreRow)) {
76
+					if ($result !== null && !($result instanceof DBIgnoreRow)) {
77 77
 						$resultData[] = $result;
78 78
 					} else {
79 79
 						$resultData[] = $row;
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 	 * @return array[]|\Generator
91 91
 	 */
92 92
 	public function fetchRowsLazy(Closure $callback = null) {
93
-		if(version_compare(PHP_VERSION, '5.5', '<')) {
94
-			return new YieldPolyfillIterator($this, $callback, $this->preserveTypes, function () {
93
+		if (version_compare(PHP_VERSION, '5.5', '<')) {
94
+			return new YieldPolyfillIterator($this, $callback, $this->preserveTypes, function() {
95 95
 				return $this->createStatement();
96 96
 			});
97 97
 		}
@@ -106,18 +106,18 @@  discard block
 block discarded – undo
106 106
 	 * @throws \Exception
107 107
 	 */
108 108
 	public function fetchRow(Closure $callback = null) {
109
-		return $this->createTempStatement(function (QueryStatement $statement) use ($callback) {
109
+		return $this->createTempStatement(function(QueryStatement $statement) use ($callback) {
110 110
 			$row = $statement->fetch(\PDO::FETCH_ASSOC);
111
-			if(!is_array($row)) {
111
+			if (!is_array($row)) {
112 112
 				return [];
113 113
 			}
114
-			if($this->preserveTypes) {
114
+			if ($this->preserveTypes) {
115 115
 				$columnDefinitions = FieldTypeProvider::getFieldTypes($statement);
116 116
 				$row = FieldValueConverter::convertValues($row, $columnDefinitions);
117 117
 			}
118
-			if($callback !== null) {
118
+			if ($callback !== null) {
119 119
 				$result = $callback($row);
120
-				if($result !== null) {
120
+				if ($result !== null) {
121 121
 					$row = $result;
122 122
 				}
123 123
 			}
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
 	 * @return mixed[]
131 131
 	 */
132 132
 	public function fetchKeyValue($treatValueAsArray = false) {
133
-		return $this->createTempStatement(function (QueryStatement $statement) use ($treatValueAsArray) {
134
-			if($treatValueAsArray) {
133
+		return $this->createTempStatement(function(QueryStatement $statement) use ($treatValueAsArray) {
134
+			if ($treatValueAsArray) {
135 135
 				$rows = $statement->fetchAll(\PDO::FETCH_ASSOC);
136 136
 				$result = array();
137
-				foreach($rows as $row) {
137
+				foreach ($rows as $row) {
138 138
 					list($key) = array_values($row);
139 139
 					$result[$key] = $row;
140 140
 				}
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
 	public function fetchGroups(array $fields) {
152 152
 		$rows = $this->fetchRows();
153 153
 		$result = array();
154
-		foreach($rows as $row) {
154
+		foreach ($rows as $row) {
155 155
 			$tmp = &$result;
156
-			foreach($fields as $field) {
156
+			foreach ($fields as $field) {
157 157
 				$value = $row[$field];
158
-				if(!array_key_exists($value, $tmp)) {
158
+				if (!array_key_exists($value, $tmp)) {
159 159
 					$tmp[$value] = [];
160 160
 				}
161 161
 				$tmp = &$tmp[$value];
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 * @return string[]
170 170
 	 */
171 171
 	public function fetchArray() {
172
-		return $this->createTempStatement(function (QueryStatement $stmt) {
172
+		return $this->createTempStatement(function(QueryStatement $stmt) {
173 173
 			return $stmt->fetchAll(\PDO::FETCH_COLUMN);
174 174
 		});
175 175
 	}
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
 	 * @return null|bool|string|int|float
180 180
 	 */
181 181
 	public function fetchValue($default = null) {
182
-		return $this->createTempStatement(function (QueryStatement $stmt) use ($default) {
182
+		return $this->createTempStatement(function(QueryStatement $stmt) use ($default) {
183 183
 			$result = $stmt->fetch(\PDO::FETCH_NUM);
184
-			if($result !== false) {
184
+			if ($result !== false) {
185 185
 				return $result[0];
186 186
 			}
187 187
 			return $default;
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		$query = $this->__toString();
222 222
 		$statement = $db->prepare($query);
223 223
 		$statement->execute($this->values);
224
-		if($this->getCalcFoundRows()) {
224
+		if ($this->getCalcFoundRows()) {
225 225
 			$this->foundRows = (int) $db->query('SELECT FOUND_ROWS()')->fetchColumn();
226 226
 		}
227 227
 		return $statement;
Please login to merge, or discard this patch.