Completed
Push — master ( 354401...52d456 )
by Ron
01:49
created
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 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@
 block discarded – undo
74 74
 	}
75 75
 
76 76
 	/**
77
-	 * @return mixed
77
+	 * @return integer
78 78
 	 */
79 79
 	public function key() {
80 80
 		return $this->idx;
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -42,16 +42,16 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public function current() {
44 44
 		$row = $this->currentItem;
45
-		if($this->preserveTypes) {
45
+		if ($this->preserveTypes) {
46 46
 			$columnDefinitions = FieldTypeProvider::getFieldTypes($this->getStmt());
47 47
 			$row = FieldValueConverter::convertValues($row, $columnDefinitions);
48 48
 		}
49 49
 		$callback = $this->callback;
50
-		if($callback !== null) {
50
+		if ($callback !== null) {
51 51
 			$result = $callback($row);
52
-			if($result instanceof DBIgnoreRow) {
52
+			if ($result instanceof DBIgnoreRow) {
53 53
 				// Do nothing in this case
54
-			} elseif($result !== null) {
54
+			} elseif ($result !== null) {
55 55
 				return $result;
56 56
 			} else {
57 57
 				return $row;
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function valid() {
81 81
 		$result = !!$this->currentItem;
82
-		if(!$result) {
82
+		if (!$result) {
83 83
 			$this->closeCursor();
84 84
 		}
85 85
 		return $result;
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	/**
89 89
 	 */
90 90
 	public function rewind() {
91
-		if($this->stmt !== null) {
91
+		if ($this->stmt !== null) {
92 92
 			throw new RuntimeException("It's not possible to rewind this iterator");
93 93
 		}
94 94
 		$this->stmt = call_user_func($this->statementFactory);
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 * @return QueryStatement
101 101
 	 */
102 102
 	private function getStmt() {
103
-		if($this->stmt === null) {
103
+		if ($this->stmt === null) {
104 104
 			$this->rewind();
105 105
 		}
106 106
 		return $this->stmt;
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	/**
110 110
 	 */
111 111
 	private function closeCursor() {
112
-		if($this->stmt instanceof QueryStatement) {
112
+		if ($this->stmt instanceof QueryStatement) {
113 113
 			$this->stmt->closeCursor();
114 114
 		}
115 115
 		$this->stmt = null;
Please login to merge, or discard this patch.
src/Builder/Select.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
 	}
79 79
 
80 80
 	/**
81
-	 * @return array
81
+	 * @return string[]
82 82
 	 */
83 83
 	public function getFields() {
84 84
 		return $this->fields;
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/Traits/OrderByBuilder.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
 	 * @return $this
16 16
 	 */
17 17
 	public function orderBy($expression, $direction = 'asc') {
18
-		if($expression instanceof OrderBySpecification) {
19
-			foreach($expression->getFields() as $field) {
18
+		if ($expression instanceof OrderBySpecification) {
19
+			foreach ($expression->getFields() as $field) {
20 20
 				$this->addOrder($field[0], $field[1]);
21 21
 			}
22 22
 			return $this;
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public function orderByValues($fieldName, array $values) {
34 34
 		$expr = [];
35
-		foreach(array_values($values) as $idx => $value) {
35
+		foreach (array_values($values) as $idx => $value) {
36 36
 			$expr[] = $this->db()->quoteExpression("WHEN ? THEN ?", array($value, $idx));
37 37
 		}
38 38
 		$this->orderBy[] = array(sprintf("CASE %s\n\t\t%s\n\tEND", $this->db()->quoteField($fieldName), join("\n\t\t", $expr)), 'ASC');
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
 	 * @return string
45 45
 	 */
46 46
 	protected function buildOrder($query) {
47
-		if(!count($this->orderBy)) {
47
+		if (!count($this->orderBy)) {
48 48
 			return $query;
49 49
 		}
50 50
 		$query .= "ORDER BY\n";
51 51
 		$arr = array();
52
-		foreach($this->orderBy as $order) {
52
+		foreach ($this->orderBy as $order) {
53 53
 			list($expression, $direction) = $order;
54 54
 			$arr[] = sprintf("\t%s %s", $expression, strtoupper($direction));
55 55
 		}
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	private function addOrder($expression, $direction) {
64 64
 		$direction = $this->fixDirection($direction);
65
-		if(is_array($expression)) {
66
-			if(!count($expression)) {
65
+		if (is_array($expression)) {
66
+			if (!count($expression)) {
67 67
 				return;
68 68
 			}
69 69
 			$arguments = array(
Please login to merge, or discard this patch.