Passed
Push — master ( 9e2434...486cd6 )
by Ron
01:59
created
src/Databases/MySQL/MySQLExceptionInterpreter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 		/** @link http://php.net/manual/en/class.exception.php#Hcom115813 (cHao's comment) */
20 20
 		$code = is_array($errorInfo) && isset($errorInfo[1]) ? ((int) $errorInfo[1]) : ((int) $exception->getCode());
21 21
 		$message = $exception->getMessage();
22
-		switch($code) {
22
+		switch ($code) {
23 23
 			case 2006: throw new DatabaseHasGoneAwayException($message, $code, $exception);
24 24
 			case 1213: throw new SqlDeadLockException($message, $code, $exception);
25 25
 			case 1205: throw new LockWaitTimeoutExceededException($message, $code, $exception);
Please login to merge, or discard this patch.
src/Tools/VirtualTables.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@
 block discarded – undo
31 31
 	 * @return Select|null
32 32
 	 */
33 33
 	public function get($tableName): ?Select {
34
-		if($this->has($tableName)) {
34
+		if ($this->has($tableName)) {
35 35
 			$table = $this->virtualTables[(string) $tableName];
36
-			if($table instanceof Closure) {
37
-				if($tableName instanceof VirtualTable) {
36
+			if ($table instanceof Closure) {
37
+				if ($tableName instanceof VirtualTable) {
38 38
 					$params = $tableName->getParams();
39 39
 					return $table($params);
40 40
 				}
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
@@ -34,8 +34,8 @@
 block discarded – undo
34 34
 	 * @return DBExprFilter
35 35
 	 */
36 36
 	public function __invoke(string $expression, $keyPath, $validator = null) {
37
-		return new DBExprFilter($expression, $this->map, $keyPath, $validator, static function ($result, array $data) {
38
-			if(!$result) {
37
+		return new DBExprFilter($expression, $this->map, $keyPath, $validator, static function($result, array $data) {
38
+			if (!$result) {
39 39
 				throw new RequiredValueNotFoundException(sprintf("Required value %s not found", $data['key']));
40 40
 			}
41 41
 		});
Please login to merge, or discard this patch.
src/Builder/Expr/DBExprOrderBySpec.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,16 +11,16 @@
 block discarded – undo
11 11
 	 */
12 12
 	public function __construct(array $spec, array $sortFieldsSpec) {
13 13
 		$expressions = [];
14
-		foreach($spec as $specReference => $dbExpr) {
15
-			if(is_int($specReference)) {
14
+		foreach ($spec as $specReference => $dbExpr) {
15
+			if (is_int($specReference)) {
16 16
 				$specReference = $dbExpr;
17 17
 			}
18 18
 			$expressions[$specReference] = $dbExpr;
19 19
 		}
20
-		foreach($sortFieldsSpec as $sortFieldSpec) {
21
-			if(array_key_exists(0, $sortFieldSpec) && array_key_exists($sortFieldSpec[0], $expressions)) {
20
+		foreach ($sortFieldsSpec as $sortFieldSpec) {
21
+			if (array_key_exists(0, $sortFieldSpec) && array_key_exists($sortFieldSpec[0], $expressions)) {
22 22
 				$direction = 'ASC';
23
-				if(array_key_exists(1, $sortFieldSpec) && strtoupper($sortFieldSpec[1]) !== 'ASC') {
23
+				if (array_key_exists(1, $sortFieldSpec) && strtoupper($sortFieldSpec[1]) !== 'ASC') {
24 24
 					$direction = 'DESC';
25 25
 				}
26 26
 				$this->fields[] = [
Please login to merge, or discard this patch.
src/Builder/Traits/JoinBuilder.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -49,15 +49,15 @@
 block discarded – undo
49 49
 	 */
50 50
 	protected function buildJoins(string $query): string {
51 51
 		$arr = [];
52
-		foreach($this->joinTables as $table) {
52
+		foreach ($this->joinTables as $table) {
53 53
 			$join = $table['type']." JOIN\n";
54
-			$join .= "\t" . $this->buildTableName($table['alias'], $table['name']);
55
-			if($table['expression']) {
56
-				$join .= " ON " . $this->db()->quoteExpression($table['expression'], $table['arguments']);
54
+			$join .= "\t".$this->buildTableName($table['alias'], $table['name']);
55
+			if ($table['expression']) {
56
+				$join .= " ON ".$this->db()->quoteExpression($table['expression'], $table['arguments']);
57 57
 			}
58 58
 			$arr[] = $join;
59 59
 		}
60
-		if(count($arr)) {
60
+		if (count($arr)) {
61 61
 			$query .= implode("\n", $arr)."\n";
62 62
 		}
63 63
 		return $query;
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(string $query, ?int $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/Traits/OffsetBuilder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 	 * @return string
27 27
 	 */
28 28
 	protected function buildOffset(string $query): string {
29
-		if($this->offset !== null) {
29
+		if ($this->offset !== null) {
30 30
 			$query .= "OFFSET\n\t{$this->offset}\n";
31 31
 		}
32 32
 		return $query;
Please login to merge, or discard this patch.
src/Builder/Traits/UnionBuilder.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	 * @return $this
15 15
 	 */
16 16
 	public function union(...$queries) {
17
-		foreach($queries as $query) {
17
+		foreach ($queries as $query) {
18 18
 			$this->unions[] = ['', $query];
19 19
 		}
20 20
 		return $this;
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @return $this
26 26
 	 */
27 27
 	public function unionAll(...$queries) {
28
-		foreach($queries as $query) {
28
+		foreach ($queries as $query) {
29 29
 			$this->unions[] = ['ALL', $query];
30 30
 		}
31 31
 		return $this;
@@ -36,21 +36,21 @@  discard block
 block discarded – undo
36 36
 	 * @return string
37 37
 	 */
38 38
 	protected function buildUnions(string $query): string {
39
-		$wrap = static function ($query) {
39
+		$wrap = static function($query) {
40 40
 			$query = trim($query);
41 41
 			$query = implode("\n\t", explode("\n", $query));
42 42
 			return sprintf("(\n\t%s\n)", $query);
43 43
 		};
44 44
 		$queries = [$wrap($query)];
45
-		foreach($this->unions as $unionQuery) {
46
-			if($unionQuery[0] === 'ALL') {
45
+		foreach ($this->unions as $unionQuery) {
46
+			if ($unionQuery[0] === 'ALL') {
47 47
 				$queries[] = 'UNION ALL';
48 48
 			} else {
49 49
 				$queries[] = 'UNION';
50 50
 			}
51 51
 			$queries[] = $wrap($unionQuery[1]);
52 52
 		}
53
-		if(count($queries) > 1) {
53
+		if (count($queries) > 1) {
54 54
 			return implode(' ', $queries);
55 55
 		}
56 56
 		return $query;
Please login to merge, or discard this patch.
src/Builder/Expr/DBExprFilter.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
 		$this->expression = $expression;
27 27
 		$this->keyPath = $this->buildKey($keyPath);
28 28
 		$this->value = $this->recursiveGet($data, $this->keyPath, null);
29
-		if($validator === null) {
30
-			$validator = function ($data) {
31
-				if(is_array($data)) {
29
+		if ($validator === null) {
30
+			$validator = function($data) {
31
+				if (is_array($data)) {
32 32
 					return $this->isValidArray($data);
33 33
 				}
34 34
 				return (string) $data !== '';
35 35
 			};
36 36
 		}
37
-		if($validationResultHandler === null) {
38
-			$validationResultHandler = static function () {};
37
+		if ($validationResultHandler === null) {
38
+			$validationResultHandler = static function() {};
39 39
 		}
40 40
 		$this->validator = $validator;
41 41
 		$this->validationResultHandler = $validationResultHandler;
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function isValid(): bool {
55 55
 		$result = true;
56
-		if($this->validator !== null) {
56
+		if ($this->validator !== null) {
57 57
 			$result = call_user_func($this->validator, $this->value);
58 58
 			call_user_func($this->validationResultHandler, $result, [
59 59
 				'value' => $this->value,
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
 	 * @return string[]
76 76
 	 */
77 77
 	private function buildKey($keyPath): array {
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 RuntimeException('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): bool {
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
-		foreach($path as $idxValue) {
112
+		foreach ($path as $idxValue) {
113 113
 			$part = $idxValue;
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.