Completed
Pull Request — master (#3)
by Rémy
03:27
created
Source/QueryBuilder.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 /**
3 3
  * @author Rémy M. Böhler <[email protected]>
4 4
  */
5
-declare(strict_types=1);
5
+declare(strict_types = 1);
6 6
 
7 7
 namespace Rorm;
8 8
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     {
88 88
         $select = $expression;
89 89
         if ($as !== null) {
90
-            $select .= ' AS ' . $this->quoteIdentifier($as);
90
+            $select .= ' AS '.$this->quoteIdentifier($as);
91 91
         }
92 92
         $this->select[] = $select;
93 93
 
@@ -98,14 +98,14 @@  discard block
 block discarded – undo
98 98
     // where
99 99
     public function where(string $column, $value): QueryBuilder
100 100
     {
101
-        $this->where[] = $this->quoteIdentifier($column) . ' = ?';
101
+        $this->where[] = $this->quoteIdentifier($column).' = ?';
102 102
         $this->buildParams[] = $value;
103 103
         return $this;
104 104
     }
105 105
 
106 106
     public function whereNot(string $column, $value): QueryBuilder
107 107
     {
108
-        $this->where[] = $this->quoteIdentifier($column) . ' != ?';
108
+        $this->where[] = $this->quoteIdentifier($column).' != ?';
109 109
         $this->buildParams[] = $value;
110 110
         return $this;
111 111
     }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      */
134 134
     public function whereExpr(string $column, string $expression): QueryBuilder
135 135
     {
136
-        $this->where[] = $this->quoteIdentifier($column) . ' = ' . $expression;
136
+        $this->where[] = $this->quoteIdentifier($column).' = '.$expression;
137 137
         return $this;
138 138
     }
139 139
 
@@ -148,48 +148,48 @@  discard block
 block discarded – undo
148 148
 
149 149
     public function whereLt(string $column, $value): QueryBuilder
150 150
     {
151
-        $this->where[] = $this->quoteIdentifier($column) . ' < ?';
151
+        $this->where[] = $this->quoteIdentifier($column).' < ?';
152 152
         $this->buildParams[] = $value;
153 153
         return $this;
154 154
     }
155 155
 
156 156
     public function whereLte(string $column, $value): QueryBuilder
157 157
     {
158
-        $this->where[] = $this->quoteIdentifier($column) . ' <= ?';
158
+        $this->where[] = $this->quoteIdentifier($column).' <= ?';
159 159
         $this->buildParams[] = $value;
160 160
         return $this;
161 161
     }
162 162
 
163 163
     public function whereGt(string $column, $value): QueryBuilder
164 164
     {
165
-        $this->where[] = $this->quoteIdentifier($column) . ' > ?';
165
+        $this->where[] = $this->quoteIdentifier($column).' > ?';
166 166
         $this->buildParams[] = $value;
167 167
         return $this;
168 168
     }
169 169
 
170 170
     public function whereGte(string $column, $value): QueryBuilder
171 171
     {
172
-        $this->where[] = $this->quoteIdentifier($column) . ' >= ?';
172
+        $this->where[] = $this->quoteIdentifier($column).' >= ?';
173 173
         $this->buildParams[] = $value;
174 174
         return $this;
175 175
     }
176 176
 
177 177
     public function whereNotNull(string $column): QueryBuilder
178 178
     {
179
-        $this->where[] = $this->quoteIdentifier($column) . ' IS NOT NULL';
179
+        $this->where[] = $this->quoteIdentifier($column).' IS NOT NULL';
180 180
         return $this;
181 181
     }
182 182
 
183 183
     public function whereNull(string $column): QueryBuilder
184 184
     {
185
-        $this->where[] = $this->quoteIdentifier($column) . ' IS NULL';
185
+        $this->where[] = $this->quoteIdentifier($column).' IS NULL';
186 186
         return $this;
187 187
     }
188 188
 
189 189
     public function whereIn(string $column, array $data): QueryBuilder
190 190
     {
191
-        $this->where[] = $this->quoteIdentifier($column) . ' IN (' .
192
-            substr(str_repeat('?, ', count($data)), 0, -2) .
191
+        $this->where[] = $this->quoteIdentifier($column).' IN ('.
192
+            substr(str_repeat('?, ', count($data)), 0, -2).
193 193
             ')';
194 194
         $this->buildParams = array_merge($this->buildParams, $data);
195 195
         return $this;
@@ -198,13 +198,13 @@  discard block
 block discarded – undo
198 198
     // order by
199 199
     public function orderByAsc(string $column): QueryBuilder
200 200
     {
201
-        $this->order[] = $this->quoteIdentifier($column) . ' ASC';
201
+        $this->order[] = $this->quoteIdentifier($column).' ASC';
202 202
         return $this;
203 203
     }
204 204
 
205 205
     public function orderByDesc(string $column): QueryBuilder
206 206
     {
207
-        $this->order[] = $this->quoteIdentifier($column) . ' DESC';
207
+        $this->order[] = $this->quoteIdentifier($column).' DESC';
208 208
         return $this;
209 209
     }
210 210
 
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
         }
248 248
 
249 249
         // from
250
-        $query .= ' FROM ' . $this->quoteIdentifier($this->table);
250
+        $query .= ' FROM '.$this->quoteIdentifier($this->table);
251 251
 
252 252
         // where
253 253
         if (!empty($this->where)) {
254
-            $query .= ' WHERE ' . implode(' AND ', $this->where);
254
+            $query .= ' WHERE '.implode(' AND ', $this->where);
255 255
 
256 256
             // params (CAUTION, we override the array, faster and not used before!)
257 257
             $params = $this->buildParams;
@@ -259,16 +259,16 @@  discard block
 block discarded – undo
259 259
 
260 260
         // order
261 261
         if (!empty($this->order)) {
262
-            $query .= ' ORDER BY ' . implode(', ', $this->order);
262
+            $query .= ' ORDER BY '.implode(', ', $this->order);
263 263
         }
264 264
 
265 265
         // limit
266 266
         if ($this->limit !== null) {
267
-            $query .= ' LIMIT ' . (int)$this->limit;
267
+            $query .= ' LIMIT '.(int)$this->limit;
268 268
 
269 269
             // offset
270 270
             if ($this->offset !== null) {
271
-                $query .= ' OFFSET ' . (int)$this->offset;
271
+                $query .= ' OFFSET '.(int)$this->offset;
272 272
             }
273 273
         }
274 274
 
Please login to merge, or discard this patch.
Source/QueryBuilderException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 /**
3 3
  * @author Rémy M. Böhler <[email protected]>
4 4
  */
5
-declare(strict_types=1);
5
+declare(strict_types = 1);
6 6
 
7 7
 namespace Rorm;
8 8
 
Please login to merge, or discard this patch.
Source/Model.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 /**
3 3
  * @author Rémy M. Böhler <[email protected]>
4 4
  */
5
-declare(strict_types=1);
5
+declare(strict_types = 1);
6 6
 
7 7
 namespace Rorm;
8 8
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
              * Because REPLACE INTO does DELETE and INSERT,
156 156
              * which does not play nice with TRIGGERs and FOREIGN KEY CONSTRAINTS
157 157
              */
158
-            $sql = 'INSERT INTO ' . $quotedTable . ' ';
158
+            $sql = 'INSERT INTO '.$quotedTable.' ';
159 159
 
160 160
             $insertData = [];
161 161
             $updateData = [];
@@ -169,20 +169,20 @@  discard block
 block discarded – undo
169 169
                 $insertData[$quotedColumn] = Rorm::quote($dbh, $value);
170 170
 
171 171
                 if ($doMerge && !in_array($column, $idColumns, true)) {
172
-                    $updateData[] = $quotedColumn . ' = VALUES(' . $quotedColumn . ')';
172
+                    $updateData[] = $quotedColumn.' = VALUES('.$quotedColumn.')';
173 173
                 }
174 174
             }
175 175
             unset($column, $value, $quotedColumn);
176 176
 
177 177
             // insert
178 178
             $sql .=
179
-                '(' . implode(', ', array_keys($insertData)) . ')' .
180
-                ' VALUES ' .
181
-                '(' . implode(', ', $insertData) . ')';
179
+                '('.implode(', ', array_keys($insertData)).')'.
180
+                ' VALUES '.
181
+                '('.implode(', ', $insertData).')';
182 182
 
183 183
             if ($doMerge && count($updateData) > 0) {
184 184
                 // update
185
-                $sql .= ' ON DUPLICATE KEY UPDATE ' . implode(', ', $updateData);
185
+                $sql .= ' ON DUPLICATE KEY UPDATE '.implode(', ', $updateData);
186 186
             }
187 187
 
188 188
             // execute (most likely throws PDOException if there is an error)
@@ -202,9 +202,9 @@  discard block
 block discarded – undo
202 202
              * SQLite
203 203
              */
204 204
             if ($doMerge) {
205
-                $sql = 'INSERT OR REPLACE INTO ' . $quotedTable . ' ';
205
+                $sql = 'INSERT OR REPLACE INTO '.$quotedTable.' ';
206 206
             } else {
207
-                $sql = 'INSERT INTO ' . $quotedTable . ' ';
207
+                $sql = 'INSERT INTO '.$quotedTable.' ';
208 208
             }
209 209
 
210 210
             // build (column) VALUES (values)
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
             }
219 219
             unset($column, $value);
220 220
 
221
-            $sql .= '(' . implode(', ', array_keys($quotedData)) . ') VALUES (' . implode(', ', $quotedData) . ')';
221
+            $sql .= '('.implode(', ', array_keys($quotedData)).') VALUES ('.implode(', ', $quotedData).')';
222 222
 
223 223
             // execute (most likely throws PDOException if there is an error)
224 224
             if ($dbh->exec($sql) === false) {
@@ -244,10 +244,10 @@  discard block
 block discarded – undo
244 244
 
245 245
         $where = [];
246 246
         foreach ($idColumns as $columnName) {
247
-            $where[] = $quoteIdentifier($columnName) . ' = ' . Rorm::quote($dbh, $this->$columnName);
247
+            $where[] = $quoteIdentifier($columnName).' = '.Rorm::quote($dbh, $this->$columnName);
248 248
         }
249 249
 
250
-        $sql = 'DELETE FROM ' . $quoteIdentifier(static::getTable()) . ' WHERE ' . implode(' AND ', $where);
250
+        $sql = 'DELETE FROM '.$quoteIdentifier(static::getTable()).' WHERE '.implode(' AND ', $where);
251 251
 
252 252
         return $dbh->exec($sql) > 0;
253 253
     }
Please login to merge, or discard this patch.
Source/Query.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 /**
3 3
  * @author Rémy M. Böhler <[email protected]>
4 4
  */
5
-declare(strict_types=1);
5
+declare(strict_types = 1);
6 6
 
7 7
 namespace Rorm;
8 8
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         $this->params = $params;
55 55
     }
56 56
 
57
-    public function getParams(): ?array
57
+    public function getParams(): ? array
58 58
     {
59 59
         return $this->params;
60 60
     }
Please login to merge, or discard this patch.
Source/Rorm.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 /**
3 3
  * @author Rémy M. Böhler <[email protected]>
4 4
  */
5
-declare(strict_types=1);
5
+declare(strict_types = 1);
6 6
 
7 7
 namespace Rorm;
8 8
 
@@ -70,19 +70,19 @@  discard block
 block discarded – undo
70 70
      * Method to quote identifiers
71 71
      * Please make sure you keep the quoter as long you are needing it.
72 72
      */
73
-    public static function getIdentifierQuoter(PDO $dbh = null): ?callable
73
+    public static function getIdentifierQuoter(PDO $dbh = null): ? callable
74 74
     {
75 75
         $dbh = $dbh ?: static::getDatabase();
76 76
 
77 77
         if (static::isMySQL($dbh)) {
78 78
             // mysql mode
79 79
             return function ($identifier) {
80
-                return '`' . str_replace('`', '``', $identifier) . '`';
80
+                return '`'.str_replace('`', '``', $identifier).'`';
81 81
             };
82 82
         } else {
83 83
             // standard sql mode
84 84
             return function ($identifier) {
85
-                return '"' . str_replace('"', '""', $identifier) . '"';
85
+                return '"'.str_replace('"', '""', $identifier).'"';
86 86
             };
87 87
         }
88 88
     }
Please login to merge, or discard this patch.
Source/QueryException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 /**
3 3
  * @author Rémy M. Böhler <[email protected]>
4 4
  */
5
-declare(strict_types=1);
5
+declare(strict_types = 1);
6 6
 
7 7
 namespace Rorm;
8 8
 
Please login to merge, or discard this patch.
Source/Exception.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 /**
3 3
  * @author Rémy M. Böhler <[email protected]>
4 4
  */
5
-declare(strict_types=1);
5
+declare(strict_types = 1);
6 6
 
7 7
 namespace Rorm;
8 8
 
Please login to merge, or discard this patch.
Source/QueryIterator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 /**
3 3
  * @author Rémy M. Böhler <[email protected]>
4 4
  */
5
-declare(strict_types=1);
5
+declare(strict_types = 1);
6 6
 
7 7
 namespace Rorm;
8 8
 
Please login to merge, or discard this patch.