Passed
Push — main ( 85995a...64fb94 )
by Sammy
07:44
created
src/Relation/OneToMany.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
 
55 55
     public function getIds(int $source)
56 56
     {
57
-        $pivot_table =$this->connection->schema()->table($this->pivot_table);
57
+        $pivot_table = $this->connection->schema()->table($this->pivot_table);
58 58
         $res = $pivot_table->select([$this->pivot_secondary])->whereEQ($this->pivot_primary, $source);
59 59
         return $res->retCol();
60 60
     }
61 61
 
62 62
     public function getTargets(int $source): array
63 63
     {
64
-        $table =$this->connection->schema()->table($this->secondary_table);
64
+        $table = $this->connection->schema()->table($this->secondary_table);
65 65
         $select = $table->select()
66 66
             ->join([$this->pivot_table], [[$this->secondary_table, $this->secondary_col, $this->pivot_table, $this->pivot_secondary]], 'INNER')
67 67
             ->whereEQ($this->pivot_primary, $source, $this->pivot_table);
@@ -71,22 +71,22 @@  discard block
 block discarded – undo
71 71
 
72 72
     private function query(int $source, array $target_ids, string $method): array
73 73
     {
74
-        if($source < 1) {
74
+        if ($source < 1) {
75 75
             throw new \InvalidArgumentException('MISSING_PARENT_ID');
76 76
         }
77 77
         
78
-        if($method !== self::ACTION_LINK && $method !== self::ACTION_UNLINK) {
78
+        if ($method !== self::ACTION_LINK && $method !== self::ACTION_UNLINK) {
79 79
             throw new \InvalidArgumentException('INVALID_METHOD');
80 80
         }
81 81
         
82 82
         $target_ids = array_unique($target_ids);
83 83
         
84
-        if(empty($target_ids)){
84
+        if (empty($target_ids)) {
85 85
             throw new \InvalidArgumentException('NO_UNIQUE_CHILDREN');
86 86
         }
87 87
         
88 88
         $errors = [];
89
-        $pivot_table =$this->connection->schema()->table($this->pivot_table);
89
+        $pivot_table = $this->connection->schema()->table($this->pivot_table);
90 90
 
91 91
         foreach ($target_ids as $target) {
92 92
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             if (!$query->isSuccess()) {
104 104
                 $errors[] = $query->error();
105 105
 
106
-                if($query->error()->getCode() !== 1062){
106
+                if ($query->error()->getCode() !== 1062) {
107 107
                     throw CruditesExceptionFactory::make($query);
108 108
                 }
109 109
             }
Please login to merge, or discard this patch.
src/Relation/HasOne.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,19 +17,19 @@
 block discarded – undo
17 17
         $this->propertiesFromJoin($join);
18 18
     }
19 19
 
20
-    protected function propertiesFromJoin($join){
20
+    protected function propertiesFromJoin($join) {
21 21
         $this->primary_col = array_keys($join);
22 22
         $this->primary_col = array_pop($this->primary_col);
23 23
         [$this->secondary_table, $this->secondary_col] = $join[$this->primary_col];
24 24
     }
25 25
 
26
-    public function link(int $primary_id, $secondary_id){
27
-        $table =$this->connection->schema()->table($this->primary_table);
26
+    public function link(int $primary_id, $secondary_id) {
27
+        $table = $this->connection->schema()->table($this->primary_table);
28 28
         $table->insert($this->primary_table, [$this->primary_col => $primary_id, $this->secondary_col => $secondary_id]);
29 29
     }
30 30
 
31
-    public function unlink(int $primary_id, $secondary_id){
32
-        $table =$this->connection->schema()->table($this->primary_table);
31
+    public function unlink(int $primary_id, $secondary_id) {
32
+        $table = $this->connection->schema()->table($this->primary_table);
33 33
         $table->delete($this->primary_table, [$this->primary_col => $primary_id, $this->secondary_col => $secondary_id]);
34 34
 
35 35
     }
Please login to merge, or discard this patch.
src/Grammar/Deck.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function addRaw(string $raw): self
30 30
     {
31
-        $this->aggregates .= ',' . $raw;
31
+        $this->aggregates .= ','.$raw;
32 32
         return $this;
33 33
     }
34 34
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $ret = is_string($aggregate) ? $aggregate : self::identifier($aggregate);
44 44
 
45 45
         if ($alias !== null) {
46
-            $ret .= ' AS ' . self::identifier($alias);
46
+            $ret .= ' AS '.self::identifier($alias);
47 47
         }
48 48
 
49 49
         return $ret;
Please login to merge, or discard this patch.
src/Grammar/Clause/GroupBy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 
22 22
     public function __toString(): string
23 23
     {
24
-        return 'GROUP BY ' . $this->deck;
24
+        return 'GROUP BY '.$this->deck;
25 25
     }
26 26
 
27 27
     public function name(): string
Please login to merge, or discard this patch.
src/Grammar/Clause/OrderBy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 
22 22
     public function __toString(): string
23 23
     {
24
-        return 'ORDER BY ' . $this->deck;
24
+        return 'ORDER BY '.$this->deck;
25 25
     }
26 26
 
27 27
 
Please login to merge, or discard this patch.
src/Schema/Schema.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
     public function column(string $table, string $column): array
54 54
     {
55 55
         if (!$this->hasColumn($table, $column)) {
56
-            throw new \InvalidArgumentException('CANNOT FIND COLUMN ' . $column . ' IN TABLE ' . $table);
56
+            throw new \InvalidArgumentException('CANNOT FIND COLUMN '.$column.' IN TABLE '.$table);
57 57
         }
58 58
 
59 59
         if (!isset($this->tables[$table]['columns'][$column]['schema'])) {
Please login to merge, or discard this patch.
src/Schema/SchemaLoader.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 
22 22
     public static function cache(string $database): ?SchemaInterface
23 23
     {
24
-        $cache_file = __DIR__ . '/cache/' . $database . '.php';
25
-        if(!file_exists($cache_file)){
24
+        $cache_file = __DIR__.'/cache/'.$database.'.php';
25
+        if (!file_exists($cache_file)) {
26 26
             return null;
27 27
         }
28 28
 
@@ -36,18 +36,18 @@  discard block
 block discarded – undo
36 36
             $pdo->beginTransaction();
37 37
             
38 38
             // switch to the INFORMATION_SCHEMA database
39
-            if(false === $pdo->query(sprintf('USE %s;', $schema_database))){
39
+            if (false === $pdo->query(sprintf('USE %s;', $schema_database))) {
40 40
                 throw new CruditesException('SWICTH_TO_INFORMATION_SCHEMA');
41 41
             }
42 42
             
43 43
             // get the schema information
44 44
             $res = $pdo->query(self::informationSchemaQuery($database));
45
-            if(false === $res){
45
+            if (false === $res) {
46 46
                 throw new CruditesException('LOAD_INFORMATION_SCHEMA');
47 47
             }
48 48
             
49 49
             // switch back to the original database
50
-            if(false === $pdo->query(sprintf('USE %s;', $database))){
50
+            if (false === $pdo->query(sprintf('USE %s;', $database))) {
51 51
                 throw new CruditesException('SWICTH_BACK_TO_USER_DATABASE');
52 52
             }
53 53
 
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
         }
61 61
 
62 62
         $res = $res->fetchAll(\PDO::FETCH_ASSOC);
63
-        if($res === false){
63
+        if ($res === false) {
64 64
             throw new CruditesException('SCHEMA_LOAD_FETCHALL');
65 65
         }
66 66
         
67
-        if(empty($res)){
67
+        if (empty($res)) {
68 68
             throw new CruditesException('SCHEMA_LOAD_FETCHED_EMPTY_RESULTS');
69 69
         }
70 70
 
Please login to merge, or discard this patch.
tests/Clause/SetTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
         $alterations = ['field1' => 'value1', 'field2' => 'value2'];
17 17
         $setClause = new Set($alterations);
18 18
         $this->assertEquals('SET `field1` = :set_field1,`field2` = :set_field2', (string)$setClause);
19
-        $this->assertEquals(['set_field1' => 'value1','set_field2' => 'value2'], $setClause->bindings());
19
+        $this->assertEquals(['set_field1' => 'value1', 'set_field2' => 'value2'], $setClause->bindings());
20 20
         
21 21
     }
22 22
 
Please login to merge, or discard this patch.
src/Grammar/Clause/Set.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 
21 21
     public function __toString(): string
22 22
     {
23
-        return 'SET ' . rtrim($this->alterations, ',');
23
+        return 'SET '.rtrim($this->alterations, ',');
24 24
     }
25 25
 
26 26
     public function name(): string
Please login to merge, or discard this patch.