Passed
Push — master ( 63a9ca...5a0ea1 )
by Ron
11:58 queued 09:56
created
src/Builder/Internal/ConditionBuilder.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,16 +14,16 @@  discard block
 block discarded – undo
14 14
 	 * @return string
15 15
 	 */
16 16
 	public static function build(Database $db, string $query, array $conditions, string $token): string {
17
-		if(!count($conditions)) {
17
+		if (!count($conditions)) {
18 18
 			return $query;
19 19
 		}
20 20
 		$query .= "{$token}\n";
21 21
 		$arr = [];
22
-		foreach($conditions as [$expression, $arguments]) {
23
-			if(is_array($expression)) {
24
-				foreach($expression as $key => $value) {
22
+		foreach ($conditions as [$expression, $arguments]) {
23
+			if (is_array($expression)) {
24
+				foreach ($expression as $key => $value) {
25 25
 					$key = self::formatKey($key);
26
-					if($value === null) {
26
+					if ($value === null) {
27 27
 						$arr = self::buildCondition($arr, "ISNULL({$key})", [$value], $db);
28 28
 					} else {
29 29
 						$arr = self::buildCondition($arr, "{$key}=?", [$value], $db);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 * @return string
56 56
 	 */
57 57
 	private static function formatKey(string $key): string {
58
-		if(strpos($key, '`') !== false || strpos($key, '(') !== false) {
58
+		if (strpos($key, '`') !== false || strpos($key, '(') !== false) {
59 59
 			return $key;
60 60
 		}
61 61
 		$keyParts = explode('.', $key);
Please login to merge, or discard this patch.
src/Builder/Traits/TableNameBuilder.php 1 patch
Spacing   +9 added lines, -9 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 20
 			$lines = array_map(static fn(string $line) => "\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 ALL\n\t", $parts) . ')';
37
+			$name = '('.implode("\n\tUNION ALL\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/Delete.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
 	 * @param null|string|Select $table
29 29
 	 * @return $this
30 30
 	 */
31
-	public function from(string $alias, null|string|Select $table = null) {
32
-		if($table !== null) {
31
+	public function from(string $alias, null | string | Select $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.
src/Builder/Expr/DBExprFilter.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
 		$this->keyPath = $this->buildKey($keyPath);
31 31
 		$this->value = RecursiveStructureAccess::recursiveGet($data, $this->keyPath, null);
32 32
 		$this->hasValue = is_scalar($this->value) ? trim((string) $this->value) !== '' : !empty($this->value);
33
-		if($validator === null) {
33
+		if ($validator === null) {
34 34
 			$validator = static fn() => true;
35 35
 		}
36 36
 		$this->validator = $validator;
37
-		if($validationResultHandler === null) {
38
-			$validationResultHandler = static function () {};
37
+		if ($validationResultHandler === null) {
38
+			$validationResultHandler = static function() {};
39 39
 		}
40 40
 		$this->validationResultHandler = $validationResultHandler;
41 41
 	}
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
 	 * @return bool
52 52
 	 */
53 53
 	public function isValid(): bool {
54
-		if(!$this->hasValue) {
54
+		if (!$this->hasValue) {
55 55
 			return false;
56 56
 		}
57
-		if($this->validator !== null) {
57
+		if ($this->validator !== null) {
58 58
 			$result = call_user_func($this->validator, $this->value);
59 59
 			call_user_func($this->validationResultHandler, $result, [
60 60
 				'value' => $this->value,
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
 	 * @return string[]
78 78
 	 */
79 79
 	private function buildKey($keyPath): array {
80
-		if(is_string($keyPath)) {
80
+		if (is_string($keyPath)) {
81 81
 			$keyPath = explode('.', $keyPath);
82 82
 		}
83
-		if(!is_array($keyPath)) {
83
+		if (!is_array($keyPath)) {
84 84
 			throw new RuntimeException('Invalid key');
85 85
 		}
86 86
 		return $keyPath;
Please login to merge, or discard this patch.