Completed
Push — master ( ac6db6...9e1fb5 )
by Christopher
45:43 queued 25:48
created
src/Potato.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         if (!$this->tableName)
29 29
         {
30 30
             $ref = new ReflectionClass($this);
31
-            $tableName = strtolower($ref->getShortName()).'s';
31
+            $tableName = strtolower($ref->getShortName()) . 's';
32 32
         }
33 33
 
34 34
         // Test if table exists else throw an exception
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         $table = self::getTableNameFromClass();
98 98
 
99 99
         if ($fields != null && is_array($fields)) {
100
-            $query =  "SELECT ". implode(', ', $fields) ." FROM $table";
100
+            $query = "SELECT " . implode(', ', $fields) . " FROM $table";
101 101
         } else {
102 102
             $query = "SELECT * FROM $table";
103 103
         }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         $table = self::getTableNameFromClass();
127 127
 
128 128
         if ($fields != null && is_array($fields)) {
129
-            $query = "SELECT ". implode(', ', $fields) ." FROM $table WHERE id = $id";
129
+            $query = "SELECT " . implode(', ', $fields) . " FROM $table WHERE id = $id";
130 130
         } else {
131 131
             $query = "SELECT * FROM $table WHERE id = $id";
132 132
         }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
         if (!empty($res)) {
144 144
             return $res;
145 145
         } else {
146
-            throw new PotatoException('There is no user with id '. $id);
146
+            throw new PotatoException('There is no user with id ' . $id);
147 147
         }
148 148
     }
149 149
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 
180 180
         if (!self::$id) {
181 181
             // new record so we insert
182
-            $query = "INSERT INTO $this->tableName (".implode(", ", $availableColumnNames).") VALUES(";
182
+            $query = "INSERT INTO $this->tableName (" . implode(", ", $availableColumnNames) . ") VALUES(";
183 183
 
184 184
             for ($i = 0; $i < count($availableColumnNames); $i++)
185 185
             {
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
 
201 201
             for ($i = 0; $i < count($availableColumnNames); $i++) {
202 202
                 $prop = $availableColumnNames[$i];
203
-                $query .= " $prop = '". $this->{$prop}."'";
203
+                $query .= " $prop = '" . $this->{$prop} . "'";
204 204
 
205 205
                 if ($i != count($availableColumnNames) - 1) {
206 206
                     $query .= ",";
207 207
                 }
208 208
             }
209 209
 
210
-            $query .= " WHERE id = ".self::$id;
210
+            $query .= " WHERE id = " . self::$id;
211 211
         }
212 212
 
213 213
         $result = Connection::db()->query($query);
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
         self::getOne($id);
244 244
 
245
-        $query = "DELETE FROM $table WHERE id = ".$id;
245
+        $query = "DELETE FROM $table WHERE id = " . $id;
246 246
 
247 247
         $result = Connection::db()->query($query);
248 248
     }
Please login to merge, or discard this patch.