Passed
Branch main (b4b05f)
by Sammy
03:19
created
src/Row.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 
46 46
     public function __toString()
47 47
     {
48
-        return PHP_EOL . 'load: '
48
+        return PHP_EOL.'load: '
49 49
             . json_encode($this->load)
50
-            . PHP_EOL . 'alterations: '
50
+            . PHP_EOL.'alterations: '
51 51
             . json_encode(array_keys($this->alterations));
52 52
     }
53 53
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     {
135 135
         foreach (array_keys($datass) as $field_name) {
136 136
 
137
-            if($datass[$field_name] === $this->get($field_name)) {
137
+            if ($datass[$field_name] === $this->get($field_name)) {
138 138
                 continue;
139 139
             }
140 140
             
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             }
151 151
 
152 152
             // Replace empty strings with null if the column is nullable
153
-            if (trim('' . $datass[$field_name]) === '' && $attributes->nullable()) {
153
+            if (trim(''.$datass[$field_name]) === '' && $attributes->nullable()) {
154 154
                 $datass[$field_name] = null;
155 155
             }
156 156
 
Please login to merge, or discard this patch.
src/Crudites.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         $res = self::$connection->result($select);
62 62
         $res = $res->ret(\PDO::FETCH_COLUMN);
63 63
         if (is_array($res)) {
64
-            return (int) current($res);
64
+            return (int)current($res);
65 65
         }
66 66
 
67 67
         return null;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         $ret = [];
79 79
 
80 80
         $res = self::$connection->result($select);
81
-        if($res->ran()) {
81
+        if ($res->ran()) {
82 82
 
83 83
             $primary_keys = self::$connection->schema()->primaryKeys($select->table());
84 84
             $pk_name = implode('_', $primary_keys);
Please login to merge, or discard this patch.
src/Grammar/Query/Query.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         if (empty($this->bindings)) {
38 38
             unset($dbg['bindings']);
39 39
         }
40
-        else{
40
+        else {
41 41
             $dbg['bindings'] = json_encode($dbg['bindings']);
42 42
         }
43 43
 
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 
99 99
     public function bindings(): array
100 100
     {
101
-        if(empty($this->clauses)){
101
+        if (empty($this->clauses)) {
102 102
             return $this->bindings;
103 103
         }
104 104
 
105
-        return array_merge($this->bindings, array_reduce($this->clauses, function ($carry, $clause) {
105
+        return array_merge($this->bindings, array_reduce($this->clauses, function($carry, $clause) {
106 106
             return array_merge($carry, $clause->bindings());
107 107
         }, []));
108 108
     }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
     public function bindLabel($field, $table_name = null): string
120 120
     {
121
-        return ':' . $this->tableLabel($table_name) . '_' . $field;
121
+        return ':'.$this->tableLabel($table_name).'_'.$field;
122 122
     }
123 123
 
124 124
     public function addBindings($assoc_data, $binding_label = null): array
Please login to merge, or discard this patch.
src/Grammar/Query/Insert.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
     public function values(array $dat_ass): self
23 23
     {
24
-        $this->binding_names []= $this->addBindings($dat_ass);
24
+        $this->binding_names [] = $this->addBindings($dat_ass);
25 25
 
26 26
         return $this;
27 27
     }
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 
38 38
         $fields_labels = array_shift($this->binding_names);
39 39
         $fields = array_keys($fields_labels);
40
-        $fields = '`' . implode('`,`', $fields) . '`';
40
+        $fields = '`'.implode('`,`', $fields).'`';
41 41
 
42 42
         $bindings = implode(',:', $fields_labels);
43 43
 
44 44
         $statement = sprintf('INSERT INTO `%s` (%s) VALUES (:%s)', $this->table, $fields, $bindings);
45
-        foreach($this->binding_names as $bindings){
45
+        foreach ($this->binding_names as $bindings) {
46 46
             $statement .= sprintf(',(:%s)', implode(',:', $bindings));
47 47
         }
48 48
 
Please login to merge, or discard this patch.
src/Grammar/Query/Select.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     {
31 31
         $schema = Grammar::identifier($this->table());
32 32
         if (!empty($this->alias())) {
33
-            $schema .= ' ' . Grammar::identifier($this->alias());
33
+            $schema .= ' '.Grammar::identifier($this->alias());
34 34
         }
35 35
 
36 36
         $ret = sprintf('SELECT %s FROM %s', $this->deck, $schema);
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
                 Clause::LIMIT
47 47
             ] as $clause
48 48
         ) {
49
-            if($this->clause($clause) === null)
49
+            if ($this->clause($clause) === null)
50 50
                 continue;
51 51
 
52
-            $ret .= ' ' . $this->clause($clause);
52
+            $ret .= ' '.$this->clause($clause);
53 53
         }
54 54
 
55 55
         return $ret;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
             if (is_int($alias)) {
87 87
                 $alias = null;
88 88
             }
89
-            if(!isset($this->deck)){
89
+            if (!isset($this->deck)) {
90 90
                 $this->deck = new Deck($column, $alias);
91 91
             } else {
92 92
                 $this->deck->add($column, $alias);
@@ -103,15 +103,15 @@  discard block
 block discarded – undo
103 103
         return $where;
104 104
     }
105 105
 
106
-    public function join(string $table, ?string $alias=null): Join
106
+    public function join(string $table, ?string $alias = null): Join
107 107
     {
108 108
         $join = new Join($table, $alias);
109 109
 
110
-        if($this->clause(Clause::JOINS) === null){
110
+        if ($this->clause(Clause::JOINS) === null) {
111 111
             $joins = new Joins([$join]);
112 112
             $this->add($joins);
113 113
         }
114
-        else{
114
+        else {
115 115
             $this->clause(Clause::JOINS)->add($join);
116 116
         }
117 117
 
Please login to merge, or discard this patch.
src/Grammar/Clause/Join.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
     public function __toString(): string
54 54
     {
55
-        if(isset($this->column, $this->referenced_table, $this->referenced_column)) {
55
+        if (isset($this->column, $this->referenced_table, $this->referenced_column)) {
56 56
             $on = (string)(new Predicate([$this->alias, $this->column], '=', [$this->referenced_table, $this->referenced_column]));
57 57
         }
58 58
         
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function referenced(): ?array
94 94
     {
95
-        if(isset($this->referenced_table, $this->referenced_column)) {
95
+        if (isset($this->referenced_table, $this->referenced_column)) {
96 96
             return [$this->referenced_table, $this->referenced_column];
97 97
         }
98 98
 
Please login to merge, or discard this patch.
tests/Query/SelectTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -100,13 +100,13 @@
 block discarded – undo
100 100
         $this->assertEquals($expected, (string)$query);
101 101
 
102 102
         $query->join('products', 'p')->on('product_id', 'oi', 'product_id');
103
-        $this->assertEquals($expected .' JOIN `products` `p` ON `p`.`product_id` = `oi`.`product_id`', (string)$query);
103
+        $this->assertEquals($expected.' JOIN `products` `p` ON `p`.`product_id` = `oi`.`product_id`', (string)$query);
104 104
         
105 105
         $query->selectAlso(['productName' => ['p', 'name']]);
106 106
         $expected = 'SELECT quantity,price AS `sold_price`,`p`.`name` AS `productName` FROM `order_items` `oi` JOIN `products` `p` ON `p`.`product_id` = `oi`.`product_id`';
107 107
         $this->assertEquals($expected, (string)$query);
108 108
 
109
-        $query->join('orders', 'o')->on('order_id','oi', 'order_id');
109
+        $query->join('orders', 'o')->on('order_id', 'oi', 'order_id');
110 110
         $expected .= ' JOIN `orders` `o` ON `o`.`order_id` = `oi`.`order_id`';
111 111
         $this->assertEquals($expected, (string)$query);
112 112
 
Please login to merge, or discard this patch.
tests/RowTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
     private string $table = 'users';
13 13
     private array $data_pk_match = ['id' => 1];
14 14
     private array $data_form = ['name' => 'Test', 'username' => 'john_doe'];
15
-    private array $data_form_with_id = ['name' => 'Test', 'username' => 'john_doe'] + ['id' => 1];
15
+    private array $data_form_with_id = ['name' => 'Test', 'username' => 'john_doe']+['id' => 1];
16 16
     
17 17
     // setup
18 18
     public function setUp(): void
Please login to merge, or discard this patch.