Passed
Push — master ( de7ea0...47a5c3 )
by Ron
01:40
created
src/Builder/Traits/GroupByBuilder.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
 	 * @return $this
13 13
 	 */
14 14
 	public function groupBy(...$args) {
15
-		foreach($args as $expression) {
16
-			if(is_array($expression)) {
17
-				if(!count($expression)) {
15
+		foreach ($args as $expression) {
16
+			if (is_array($expression)) {
17
+				if (!count($expression)) {
18 18
 					continue;
19 19
 				}
20 20
 				$arguments = [
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
 	 * @return string
34 34
 	 */
35 35
 	protected function buildGroups(string $query): string {
36
-		if(!count($this->groupBy)) {
36
+		if (!count($this->groupBy)) {
37 37
 			return $query;
38 38
 		}
39 39
 		$query .= "GROUP BY\n";
40 40
 		$arr = [];
41
-		foreach($this->groupBy as $expression) {
41
+		foreach ($this->groupBy as $expression) {
42 42
 			$arr[] = "\t{$expression}";
43 43
 		}
44 44
 		return $query.implode(",\n", $arr)."\n";
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/Delete.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  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 35
 		$this->addTable($alias, $table);
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	public function __toString(): string {
43 43
 		$query = "DELETE ";
44 44
 		$query .= implode(', ', $this->aliases);
45
-		$query = trim($query) . " FROM\n";
45
+		$query = trim($query)." FROM\n";
46 46
 		$query = $this->buildTables($query);
47 47
 		$query = $this->buildJoins($query);
48 48
 		$query = $this->buildWhereConditions($query);
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
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function setFetchMode(int $mode = PDO::FETCH_ASSOC, $arg0 = null, ?array $arg1 = null) {
49 49
 		$args = [$mode];
50
-		if($arg0 !== null) {
50
+		if ($arg0 !== null) {
51 51
 			$args[] = $arg0;
52 52
 		}
53
-		if($arg1 !== null) {
53
+		if ($arg1 !== null) {
54 54
 			$args[] = $arg1;
55 55
 		}
56 56
 		$this->statement->setFetchMode(...$args);
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 			$timer = microtime(true);
68 68
 			$response = $this->statement->execute($params);
69 69
 			$this->queryLoggers->log($this->query, microtime(true)-$timer);
70
-			if(!$response) {
70
+			if (!$response) {
71 71
 				throw new SqlException('Execution returned with "false".');
72 72
 			}
73 73
 		});
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	public function fetchAll($fetchStyle = null, $fetchArgument = null, array $ctorArgs = []): array {
84 84
 		return $this->exceptionHandler(function() use ($fetchStyle, $fetchArgument, $ctorArgs) {
85
-			if($fetchArgument !== null) {
85
+			if ($fetchArgument !== null) {
86 86
 				return $this->statement->fetchAll($fetchStyle, $fetchArgument, $ctorArgs);
87 87
 			}
88 88
 			return $this->statement->fetchAll($fetchStyle);
Please login to merge, or discard this patch.
src/Builder/Update.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
 	 * @return $this
62 62
 	 */
63 63
 	public function setExpr(string $expr, ...$args) {
64
-		if(count($args) > 0) {
64
+		if (count($args) > 0) {
65 65
 			$this->fields[] = func_get_args();
66 66
 		} else {
67 67
 			$this->fields[] = $expr;
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
@@ -13,34 +13,34 @@
 block discarded – undo
13 13
 	 * @return string
14 14
 	 */
15 15
 	protected function buildTableName(string $alias, $name): string {
16
-		if(is_object($name) && !($name instanceof VirtualTable) && method_exists($name, '__toString')) {
16
+		if (is_object($name) && !($name instanceof VirtualTable) && method_exists($name, '__toString')) {
17 17
 			$name = (string) $name;
18 18
 			$lines = explode("\n", $name);
19
-			$lines = array_map(static function (string $line) { return "\t{$line}"; }, $lines);
19
+			$lines = array_map(static function(string $line) { return "\t{$line}"; }, $lines);
20 20
 			$name = implode("\n", $lines);
21
-			$name = '(' . trim(rtrim(trim($name), ';')) . ')';
21
+			$name = '('.trim(rtrim(trim($name), ';')).')';
22 22
 		}
23
-		if(is_array($name)) {
23
+		if (is_array($name)) {
24 24
 			$parts = [];
25
-			foreach($name as $index => $bucket) {
26
-				if(is_scalar($bucket) && ctype_digit((string) $index)) {
25
+			foreach ($name as $index => $bucket) {
26
+				if (is_scalar($bucket) && ctype_digit((string) $index)) {
27 27
 					$parts[] = "SELECT {$this->db()->quote($bucket)} AS {$this->db()->quoteField('value')}";
28 28
 				} else {
29 29
 					$values = [];
30
-					foreach($bucket as $field => $value) {
30
+					foreach ($bucket as $field => $value) {
31 31
 						$values[] = sprintf('%s AS %s', $this->db()->quote($value), $this->db()->quoteField($field));
32 32
 					}
33 33
 					$parts[] = sprintf("SELECT %s", implode(', ', $values));
34 34
 				}
35 35
 			}
36
-			$name = '(' . implode("\n\tUNION\n\t", $parts) . ')';
36
+			$name = '('.implode("\n\tUNION\n\t", $parts).')';
37 37
 		}
38
-		if($this->db()->getVirtualTables()->has($name)) {
38
+		if ($this->db()->getVirtualTables()->has($name)) {
39 39
 			$select = (string) $this->db()->getVirtualTables()->get($name);
40 40
 			$name = sprintf('(%s)', implode("\n\t", explode("\n", trim($select))));
41 41
 		}
42 42
 		$name = $this->aliasReplacer()->replace($name);
43
-		if($alias !== null) {
43
+		if ($alias !== null) {
44 44
 			return sprintf("%s %s", $name, $alias);
45 45
 		}
46 46
 		return $name;
Please login to merge, or discard this patch.