Completed
Push — develop ( 1cc4f3...6a89b9 )
by Oyebanji Jacob
05:01 queued 02:34
created
src/Model.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public function __get($key)
62 62
     {
63
-        if(isset($this->properties[$key])){
63
+        if (isset($this->properties[$key])) {
64 64
             return $this->properties[$key];
65 65
         } 
66 66
     }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      */
91 91
     public function getTableName()
92 92
     {
93
-        if(isset($this->table) && !empty($this->table)) {
93
+        if (isset($this->table) && !empty($this->table)) {
94 94
 
95 95
             return $this->table;
96 96
         }
@@ -167,17 +167,17 @@  discard block
 block discarded – undo
167 167
     public function update()
168 168
     {
169 169
         $bindNameParameters = [];
170
-        $sqlUpdate = 'UPDATE '.$this->getTableName().' SET ';
170
+        $sqlUpdate = 'UPDATE ' . $this->getTableName() . ' SET ';
171 171
         foreach ($this->properties as $columnName => $columnValue) {
172 172
             if ($columnName == 'id') {
173 173
                 continue;
174 174
             }
175
-            $bindColumnName = ':'.$columnName;
175
+            $bindColumnName = ':' . $columnName;
176 176
             $sqlUpdate .= "$columnName = $bindColumnName,";
177 177
             $bindNameParameters[$bindColumnName] = $columnValue;
178 178
         }
179 179
         //Remove the last comma in sql command then join it to the other query part.
180
-        $sqlUpdate = substr($sqlUpdate, 0, -1).' WHERE id = :id';
180
+        $sqlUpdate = substr($sqlUpdate, 0, -1) . ' WHERE id = :id';
181 181
         $sqlStatement = $this->databaseConnection->prepare($sqlUpdate);
182 182
         $bindNameParameters[':id'] = $this->properties['id'];
183 183
         $sqlStatement->execute($bindNameParameters);
@@ -195,18 +195,18 @@  discard block
 block discarded – undo
195 195
         $columnNames = '';
196 196
         $columnValues = '';
197 197
         $bindNameParameters = [];
198
-        $sqlCreate = 'INSERT'.' INTO '.$this->getTableName().' (';
198
+        $sqlCreate = 'INSERT' . ' INTO ' . $this->getTableName() . ' (';
199 199
         foreach ($this->properties as $columnName => $columnValue) {
200
-            $bindColumnName = ':'.$columnName;
201
-            $columnNames .= $columnName.',';
202
-            $columnValues .= $bindColumnName.',';
200
+            $bindColumnName = ':' . $columnName;
201
+            $columnNames .= $columnName . ',';
202
+            $columnValues .= $bindColumnName . ',';
203 203
             $bindNameParameters[$bindColumnName] = $columnValue;
204 204
         }
205 205
         // Remove ending comma and whitespace.
206 206
         $columnNames = substr($columnNames, 0, -1);
207 207
         $columnValues = substr($columnValues, 0, -1);
208 208
 
209
-        $sqlCreate .= $columnNames.') VALUES ('.$columnValues.')';
209
+        $sqlCreate .= $columnNames . ') VALUES (' . $columnValues . ')';
210 210
         $sqlStatement = $this->databaseConnection->prepare($sqlCreate);
211 211
         $sqlStatement->execute($bindNameParameters);
212 212
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
      */
247 247
     public function delete($id)
248 248
     {
249
-        $sql = 'DELETE'.' FROM '.self::getTableName().' WHERE id = '.$id;
249
+        $sql = 'DELETE' . ' FROM ' . self::getTableName() . ' WHERE id = ' . $id;
250 250
         $sqlStatment = $this->databaseConnection->prepare($sql);
251 251
         $sqlStatment->execute();
252 252
 
Please login to merge, or discard this patch.