Passed
Push — master ( 3986a9...bde7f9 )
by Ron
03:00
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/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/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/Traits/TableNameBuilder.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,34 +14,34 @@
 block discarded – undo
14 14
 	 * @return string
15 15
 	 */
16 16
 	protected function buildTableName(?string $alias, $name): string {
17
-		if(is_object($name) && !($name instanceof VirtualTable) && method_exists($name, '__toString')) {
17
+		if (is_object($name) && !($name instanceof VirtualTable) && method_exists($name, '__toString')) {
18 18
 			$name = (string) $name;
19 19
 			$lines = explode("\n", $name);
20
-			$lines = array_map(static function (string $line) { return "\t{$line}"; }, $lines);
20
+			$lines = array_map(static function(string $line) { return "\t{$line}"; }, $lines);
21 21
 			$name = implode("\n", $lines);
22
-			$name = '(' . trim(rtrim(trim($name), ';')) . ')';
22
+			$name = '('.trim(rtrim(trim($name), ';')).')';
23 23
 		}
24
-		if(is_array($name)) {
24
+		if (is_array($name)) {
25 25
 			$parts = [];
26
-			foreach($name as $index => $bucket) {
27
-				if(is_scalar($bucket) && ctype_digit((string) $index)) {
26
+			foreach ($name as $index => $bucket) {
27
+				if (is_scalar($bucket) && ctype_digit((string) $index)) {
28 28
 					$parts[] = "SELECT {$this->db()->quote($bucket)} AS {$this->db()->quoteField('value')}";
29 29
 				} else {
30 30
 					$values = [];
31
-					foreach($bucket as $field => $value) {
31
+					foreach ($bucket as $field => $value) {
32 32
 						$values[] = sprintf('%s AS %s', $this->db()->quote($value), $this->db()->quoteField($field));
33 33
 					}
34 34
 					$parts[] = sprintf("SELECT %s", implode(', ', $values));
35 35
 				}
36 36
 			}
37
-			$name = '(' . implode("\n\tUNION\n\t", $parts) . ')';
37
+			$name = '('.implode("\n\tUNION\n\t", $parts).')';
38 38
 		}
39
-		if((is_string($name) || $name instanceof VirtualTable) && $this->db()->getVirtualTables()->has($name)) {
39
+		if ((is_string($name) || $name instanceof VirtualTable) && $this->db()->getVirtualTables()->has($name)) {
40 40
 			$select = (string) $this->db()->getVirtualTables()->get($name);
41 41
 			$name = sprintf('(%s)', implode("\n\t", explode("\n", trim($select))));
42 42
 		}
43 43
 		$name = $this->aliasReplacer()->replace((string) $name);
44
-		if($alias !== null) {
44
+		if ($alias !== null) {
45 45
 			return sprintf("%s %s", $name, $alias);
46 46
 		}
47 47
 		return $name;
Please login to merge, or discard this patch.
src/Builder/Traits/GroupByBuilder.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
 	 * @return $this
15 15
 	 */
16 16
 	public function groupBy(...$args) {
17
-		foreach($args as $expression) {
18
-			if(is_array($expression)) {
19
-				if(!count($expression)) {
17
+		foreach ($args as $expression) {
18
+			if (is_array($expression)) {
19
+				if (!count($expression)) {
20 20
 					continue;
21 21
 				}
22 22
 				$expression = $this->quoteExpr($expression[0], array_slice($expression, 1));
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 	 * @return string
32 32
 	 */
33 33
 	protected function buildGroups(string $query): string {
34
-		if(!count($this->groupBy)) {
34
+		if (!count($this->groupBy)) {
35 35
 			return $query;
36 36
 		}
37 37
 		$query .= "GROUP BY\n";
38 38
 		$arr = [];
39
-		foreach($this->groupBy as $expression) {
39
+		foreach ($this->groupBy as $expression) {
40 40
 			$arr[] = "\t{$expression}";
41 41
 		}
42 42
 		return $query.implode(",\n", $arr)."\n";
Please login to merge, or discard this patch.
src/Builder/Traits/TableBuilder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,10 +26,10 @@
 block discarded – undo
26 26
 	 */
27 27
 	protected function buildTables(string $query): string {
28 28
 		$arr = [];
29
-		foreach($this->tables as $table) {
29
+		foreach ($this->tables as $table) {
30 30
 			$arr[] = "\t".$this->buildTableName($table['alias'], $table['name']);
31 31
 		}
32
-		if(count($arr)) {
32
+		if (count($arr)) {
33 33
 			$query .= implode(",\n", $arr)."\n";
34 34
 		}
35 35
 		return $query;
Please login to merge, or discard this patch.
src/Builder/InsertUpdateStatement.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,13 +31,13 @@
 block discarded – undo
31 31
 	 */
32 32
 	protected function buildFieldList(array $fields, array $query = []): array {
33 33
 		foreach ($fields as $fieldName => $fieldValue) {
34
-			if($fieldValue instanceof DefaultValue) {
34
+			if ($fieldValue instanceof DefaultValue) {
35 35
 				$fieldValue = 'DEFAULT';
36 36
 			}
37
-			if(is_array($this->mask) && !in_array($fieldName, $this->mask, true)) {
37
+			if (is_array($this->mask) && !in_array($fieldName, $this->mask, true)) {
38 38
 				continue;
39 39
 			}
40
-			if(is_int($fieldName)) {
40
+			if (is_int($fieldName)) {
41 41
 				if (is_array($fieldValue)) {
42 42
 					$fieldValue = $this->db()->quoteExpression($fieldValue[0], array_slice($fieldValue, 1));
43 43
 				}
Please login to merge, or discard this patch.
src/Builder/Delete.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
 	 * @return $this
30 30
 	 */
31 31
 	public function from(string $alias, $table = null) {
32
-		if($table !== null) {
32
+		if ($table !== null) {
33 33
 			$this->aliases[] = $alias;
34 34
 		}
35
-		if($table === null) {
35
+		if ($table === null) {
36 36
 			[$alias, $table] = [$table, $alias];
37 37
 		}
38 38
 		$this->addTable($alias, $table);
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	public function __toString(): string {
52 52
 		$query = "DELETE ";
53 53
 		$query .= implode(', ', $this->aliases);
54
-		$query = trim($query) . " FROM\n";
54
+		$query = trim($query)." FROM\n";
55 55
 		$query = $this->buildTables($query);
56 56
 		$query = $this->buildJoins($query);
57 57
 		$query = $this->buildWhereConditions($query);
Please login to merge, or discard this patch.