Completed
Branch develop (32cfca)
by Oyebanji Jacob
03:26
created
potatoTest.php 4 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -371,6 +371,7 @@  discard block
 block discarded – undo
371 371
     /**
372 372
      * Delete model with the specified id.
373 373
      * 
374
+     * @return boolean
374 375
      */
375 376
     static function destroy($id);
376 377
 }
@@ -445,7 +446,7 @@  discard block
 block discarded – undo
445 446
      * Determine if a given string contains a given substring.
446 447
      *
447 448
      * @param  string  $haystack
448
-     * @param  string|array  $needles
449
+     * @param  string[]  $needles
449 450
      * @return bool
450 451
      */
451 452
     public static function contains($haystack, $needles)
Please login to merge, or discard this patch.
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -146,28 +146,28 @@  discard block
 block discarded – undo
146 146
 
147 147
     /**
148 148
      * Store instance of database connection used.
149
-    * @var [type]
150
-    */
149
+     * @var [type]
150
+     */
151 151
     protected  $databaseConnection;
152 152
 
153
-     public function __construct()
153
+        public function __construct()
154 154
     {
155 155
         $this->databaseConnection = DatabaseConnection::getInstance()->databaseConnection;
156 156
         //$databaseConnection->databaseConnection->connect();
157 157
     }
158 158
     /**
159
-    * @param string $key rep column name
160
-    * @param string $val rep column value
161
-    * sets into $propertie the $key => $value pairs
162
-    */
159
+     * @param string $key rep column name
160
+     * @param string $val rep column value
161
+     * sets into $propertie the $key => $value pairs
162
+     */
163 163
     public  function __set($key, $val)
164 164
     {
165 165
         $this->properties[$key] = $val;
166 166
     }
167 167
     /**
168
-    * @param string $key reps the column name
169
-    * @return $key and $value
170
-    */
168
+     * @param string $key reps the column name
169
+     * @return $key and $value
170
+     */
171 171
     public function __get($key)
172 172
     {
173 173
         return $this->properties[$key];
@@ -177,17 +177,17 @@  discard block
 block discarded – undo
177 177
      *
178 178
      * @return array
179 179
      */
180
-     public function getProperties()
181
-     {
182
-         return $this->properties;
183
-     }
180
+        public function getProperties()
181
+        {
182
+            return $this->properties;
183
+        }
184 184
     /**
185
-    * Gets the name of the child class only
186
-    * without the namespace
187
-    * @var $className
188
-    * @var $table
189
-    * @return $table
190
-    */
185
+     * Gets the name of the child class only
186
+     * without the namespace
187
+     * @var $className
188
+     * @var $table
189
+     * @return $table
190
+     */
191 191
     public function getTableName()
192 192
     {
193 193
         $className = explode('\\', get_called_class());
@@ -195,22 +195,22 @@  discard block
 block discarded – undo
195 195
         return $table;
196 196
     }
197 197
     /**
198
-    * returns a particular record
199
-    * @param $id reps the record id
200
-    * @param $connection initialised to null
201
-    * @return object
202
-    */
198
+     * returns a particular record
199
+     * @param $id reps the record id
200
+     * @param $connection initialised to null
201
+     * @return object
202
+     */
203 203
     public static function find($id)
204 204
     {
205 205
         $model = new static;
206 206
         return $model->get($id); 
207 207
     }
208 208
     /**
209
-    * returns a particular record
210
-    * @param $id reps the record id
211
-    * @param $connection initialised to null
212
-    * @return object
213
-    */
209
+     * returns a particular record
210
+     * @param $id reps the record id
211
+     * @param $connection initialised to null
212
+     * @return object
213
+     */
214 214
     public function get($id)
215 215
     {
216 216
         $sql = "SELECT * FROM {$this->getTableName()} WHERE id={$id}";
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 
240 240
     }
241 241
     /** update table with instance properties
242
-    *
243
-    */
242
+     *
243
+     */
244 244
     private function update()
245 245
     {
246 246
         $connection = $this->getConnection();
@@ -266,8 +266,8 @@  discard block
 block discarded – undo
266 266
         return $stmt->rowCount();
267 267
     }
268 268
     /**
269
-    * insert instance data into the table
270
-    */
269
+     * insert instance data into the table
270
+     */
271 271
     private function create()
272 272
     {
273 273
         $connection = $this->getConnection();
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
         return $stmt->rowCount();
300 300
     }
301 301
     /**
302
-    * get db connection
303
-    */
302
+     * get db connection
303
+     */
304 304
     public function getConnection($connection = null)
305 305
     {
306 306
         if(is_null($connection))
@@ -309,10 +309,10 @@  discard block
 block discarded – undo
309 309
         }
310 310
     }
311 311
     /**
312
-    * checks if the id exists
313
-    * update if exist
314
-    * create if not exist
315
-    */
312
+     * checks if the id exists
313
+     * update if exist
314
+     * create if not exist
315
+     */
316 316
     public function save()
317 317
     {
318 318
         if ($this->id) {
@@ -322,10 +322,10 @@  discard block
 block discarded – undo
322 322
         }
323 323
     }
324 324
     /**
325
-    * @param row reps record id
326
-    * @param $connection initialised to null
327
-    * @return boolean
328
-    */
325
+     * @param row reps record id
326
+     * @param $connection initialised to null
327
+     * @return boolean
328
+     */
329 329
     public static function destroy($id)
330 330
     {
331 331
         
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     public function getTableName()
192 192
     {
193 193
         $className = explode('\\', get_called_class());
194
-        $table = strtolower(end($className) .'s');
194
+        $table = strtolower(end($className) . 's');
195 195
         return $table;
196 196
     }
197 197
     /**
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
         $sqlStatement = $this->databaseConnection->prepare($sql);
218 218
         $sqlStatement->setFetchMode(PDO::FETCH_CLASS, get_called_class());
219 219
         $sqlStatement->execute();
220
-        if($sqlStatement->rowCount() < 1){
220
+        if ($sqlStatement->rowCount() < 1) {
221 221
             throw new ModelNotFoundException($id);
222 222
         }
223 223
         return $sqlStatement->fetch();
@@ -247,20 +247,20 @@  discard block
 block discarded – undo
247 247
         $columnNames = "";
248 248
         $columnValues = "";
249 249
         $count = 0;
250
-        $update = "UPDATE " . $this->getTableName() . " SET " ;
250
+        $update = "UPDATE " . $this->getTableName() . " SET ";
251 251
         foreach ($this->properties as $key => $val) {
252 252
             $count++;
253
-            if(($key == 'id')) continue;
253
+            if (($key == 'id')) continue;
254 254
             $update .= "$key = '$val'";
255
-            if ($count < count($this->properties) )
255
+            if ($count < count($this->properties))
256 256
             {
257
-                $update .=",";
257
+                $update .= ",";
258 258
             }
259 259
         }
260 260
         $update .= " WHERE id = " . $this->properties['id'];
261 261
         $stmt = $connection->prepare($update);
262 262
             foreach ($this->properties as $key => $val) {
263
-                if($key == 'id') continue;
263
+                if ($key == 'id') continue;
264 264
             }
265 265
         $stmt->execute();
266 266
         return $stmt->rowCount();
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
         $columnNames = "";
275 275
         $columnValues = "";
276 276
         $count = 0;
277
-        $create = "INSERT" . " INTO " . $this->getTableName()." (";
277
+        $create = "INSERT" . " INTO " . $this->getTableName() . " (";
278 278
             foreach ($this->properties as $key => $val) {
279 279
                 $columnNames .= $key;
280 280
                 $columnValues .= ':' . $key;
@@ -285,15 +285,15 @@  discard block
 block discarded – undo
285 285
                     $columnValues .= ', ';
286 286
                 }
287 287
             }
288
-        $create .= $columnNames.') VALUES (' .$columnValues.')';
288
+        $create .= $columnNames . ') VALUES (' . $columnValues . ')';
289 289
         $stmt = $connection->prepare($create);
290 290
             foreach ($this->properties as $key => $val) {
291
-                $stmt->bindValue(':'.$key, $val);
291
+                $stmt->bindValue(':' . $key, $val);
292 292
             }
293 293
             try {
294 294
                 // if prop returned and props from db differ throw exception
295 295
                 $stmt->execute();
296
-            } catch(PDOException $e){
296
+            } catch (PDOException $e) {
297 297
                 return $e->getExceptionMessage();
298 298
             }
299 299
         return $stmt->rowCount();
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
     */
304 304
     public function getConnection($connection = null)
305 305
     {
306
-        if(is_null($connection))
306
+        if (is_null($connection))
307 307
         {
308 308
             return new Connection();
309 309
         }
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
     public static function destroy($id)
330 330
     {
331 331
         
332
-        $sql = "DELETE" . " FROM " . self::getTableName()." WHERE id = ". $id;
332
+        $sql = "DELETE" . " FROM " . self::getTableName() . " WHERE id = " . $id;
333 333
         $delete = $connection->prepare($sql);
334 334
         $delete->execute();
335 335
         $count = $delete->rowCount();
@@ -391,13 +391,13 @@  discard block
 block discarded – undo
391 391
 
392 392
         switch ($driver) {
393 393
             case 'sqlite':
394
-                $dsn = $driver.'::memory:';
394
+                $dsn = $driver . '::memory:';
395 395
                 break;
396 396
             case 'mysql':
397 397
             case 'postgres':
398
-                if(strcasecmp($driver, 'postgres') == 0) $driver="pgsql";
399
-                $dsn = $driver.':host='.$config['HOSTNAME'].';dbname='.$config['DBNAME'];
400
-                if(isset($config['PORT'])) $dsn .= ';port='.$config['PORT'];
398
+                if (strcasecmp($driver, 'postgres') == 0) $driver = "pgsql";
399
+                $dsn = $driver . ':host=' . $config['HOSTNAME'] . ';dbname=' . $config['DBNAME'];
400
+                if (isset($config['PORT'])) $dsn .= ';port=' . $config['PORT'];
401 401
                 break;
402 402
             default:
403 403
                 throw new DatabaseDriverNotSupportedException;
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -250,7 +250,9 @@  discard block
 block discarded – undo
250 250
         $update = "UPDATE " . $this->getTableName() . " SET " ;
251 251
         foreach ($this->properties as $key => $val) {
252 252
             $count++;
253
-            if(($key == 'id')) continue;
253
+            if(($key == 'id')) {
254
+                continue;
255
+            }
254 256
             $update .= "$key = '$val'";
255 257
             if ($count < count($this->properties) )
256 258
             {
@@ -260,7 +262,9 @@  discard block
 block discarded – undo
260 262
         $update .= " WHERE id = " . $this->properties['id'];
261 263
         $stmt = $connection->prepare($update);
262 264
             foreach ($this->properties as $key => $val) {
263
-                if($key == 'id') continue;
265
+                if($key == 'id') {
266
+                    continue;
267
+                }
264 268
             }
265 269
         $stmt->execute();
266 270
         return $stmt->rowCount();
@@ -395,9 +399,13 @@  discard block
 block discarded – undo
395 399
                 break;
396 400
             case 'mysql':
397 401
             case 'postgres':
398
-                if(strcasecmp($driver, 'postgres') == 0) $driver="pgsql";
402
+                if(strcasecmp($driver, 'postgres') == 0) {
403
+                    $driver="pgsql";
404
+                }
399 405
                 $dsn = $driver.':host='.$config['HOSTNAME'].';dbname='.$config['DBNAME'];
400
-                if(isset($config['PORT'])) $dsn .= ';port='.$config['PORT'];
406
+                if(isset($config['PORT'])) {
407
+                    $dsn .= ';port='.$config['PORT'];
408
+                }
401 409
                 break;
402 410
             default:
403 411
                 throw new DatabaseDriverNotSupportedException;
Please login to merge, or discard this patch.
src/DatabaseConnectionStringFactory.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,13 +18,13 @@
 block discarded – undo
18 18
 
19 19
         switch ($driver) {
20 20
             case 'sqlite':
21
-                $dsn = $driver.'::memory:';
21
+                $dsn = $driver . '::memory:';
22 22
                 break;
23 23
             case 'mysql':
24 24
             case 'postgres':
25
-                if(strcasecmp($driver, 'postgres') == 0) $driver="pgsql";
26
-                $dsn = $driver.':host='.$config['HOSTNAME'].';dbname='.$config['DBNAME'];
27
-                if(isset($config['PORT'])) $dsn .= ';port='.$config['PORT'];
25
+                if (strcasecmp($driver, 'postgres') == 0) $driver = "pgsql";
26
+                $dsn = $driver . ':host=' . $config['HOSTNAME'] . ';dbname=' . $config['DBNAME'];
27
+                if (isset($config['PORT'])) $dsn .= ';port=' . $config['PORT'];
28 28
                 break;
29 29
             default:
30 30
                 throw new DatabaseDriverNotSupportedException;
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,9 +22,13 @@
 block discarded – undo
22 22
                 break;
23 23
             case 'mysql':
24 24
             case 'postgres':
25
-                if(strcasecmp($driver, 'postgres') == 0) $driver="pgsql";
25
+                if(strcasecmp($driver, 'postgres') == 0) {
26
+                    $driver="pgsql";
27
+                }
26 28
                 $dsn = $driver.':host='.$config['HOSTNAME'].';dbname='.$config['DBNAME'];
27
-                if(isset($config['PORT'])) $dsn .= ';port='.$config['PORT'];
29
+                if(isset($config['PORT'])) {
30
+                    $dsn .= ';port='.$config['PORT'];
31
+                }
28 32
                 break;
29 33
             default:
30 34
                 throw new DatabaseDriverNotSupportedException;
Please login to merge, or discard this patch.
src/Model.php 3 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -10,28 +10,28 @@  discard block
 block discarded – undo
10 10
 
11 11
     /**
12 12
      * Store instance of database connection used.
13
-    * @var [type]
14
-    */
13
+     * @var [type]
14
+     */
15 15
     protected  $databaseConnection;
16 16
 
17
-     public function __construct()
17
+        public function __construct()
18 18
     {
19 19
         $this->databaseConnection = DatabaseConnection::getInstance()->databaseConnection;
20 20
         //$databaseConnection->databaseConnection->connect();
21 21
     }
22 22
     /**
23
-    * @param string $key rep column name
24
-    * @param string $val rep column value
25
-    * sets into $propertie the $key => $value pairs
26
-    */
23
+     * @param string $key rep column name
24
+     * @param string $val rep column value
25
+     * sets into $propertie the $key => $value pairs
26
+     */
27 27
     public  function __set($key, $val)
28 28
     {
29 29
         $this->properties[$key] = $val;
30 30
     }
31 31
     /**
32
-    * @param string $key reps the column name
33
-    * @return $key and $value
34
-    */
32
+     * @param string $key reps the column name
33
+     * @return $key and $value
34
+     */
35 35
     public function __get($key)
36 36
     {
37 37
         return $this->properties[$key];
@@ -41,17 +41,17 @@  discard block
 block discarded – undo
41 41
      *
42 42
      * @return array
43 43
      */
44
-     public function getProperties()
45
-     {
46
-         return $this->properties;
47
-     }
44
+        public function getProperties()
45
+        {
46
+            return $this->properties;
47
+        }
48 48
     /**
49
-    * Gets the name of the child class only
50
-    * without the namespace
51
-    * @var $className
52
-    * @var $table
53
-    * @return $table
54
-    */
49
+     * Gets the name of the child class only
50
+     * without the namespace
51
+     * @var $className
52
+     * @var $table
53
+     * @return $table
54
+     */
55 55
     public function getTableName()
56 56
     {
57 57
         $className = explode('\\', get_called_class());
@@ -59,22 +59,22 @@  discard block
 block discarded – undo
59 59
         return $table;
60 60
     }
61 61
     /**
62
-    * returns a particular record
63
-    * @param $id reps the record id
64
-    * @param $connection initialised to null
65
-    * @return object
66
-    */
62
+     * returns a particular record
63
+     * @param $id reps the record id
64
+     * @param $connection initialised to null
65
+     * @return object
66
+     */
67 67
     public static function find($id)
68 68
     {
69 69
         $model = new static;
70 70
         return $model->get($id); 
71 71
     }
72 72
     /**
73
-    * returns a particular record
74
-    * @param $id reps the record id
75
-    * @param $connection initialised to null
76
-    * @return object
77
-    */
73
+     * returns a particular record
74
+     * @param $id reps the record id
75
+     * @param $connection initialised to null
76
+     * @return object
77
+     */
78 78
     public function get($id)
79 79
     {
80 80
         $sql = "SELECT * FROM {$this->getTableName()} WHERE id={$id}";
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 
104 104
     }
105 105
     /** update table with instance properties
106
-    *
107
-    */
106
+     *
107
+     */
108 108
     private function update()
109 109
     {
110 110
         $connection = $this->getConnection();
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
         return $stmt->rowCount();
131 131
     }
132 132
     /**
133
-    * insert instance data into the table
134
-    */
133
+     * insert instance data into the table
134
+     */
135 135
     private function create()
136 136
     {
137 137
         $connection = $this->getConnection();
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
         return $stmt->rowCount();
164 164
     }
165 165
     /**
166
-    * get db connection
167
-    */
166
+     * get db connection
167
+     */
168 168
     public function getConnection($connection = null)
169 169
     {
170 170
         if(is_null($connection))
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
         }
174 174
     }
175 175
     /**
176
-    * checks if the id exists
177
-    * update if exist
178
-    * create if not exist
179
-    */
176
+     * checks if the id exists
177
+     * update if exist
178
+     * create if not exist
179
+     */
180 180
     public function save()
181 181
     {
182 182
         if ($this->id) {
@@ -186,10 +186,10 @@  discard block
 block discarded – undo
186 186
         }
187 187
     }
188 188
     /**
189
-    * @param row reps record id
190
-    * @param $connection initialised to null
191
-    * @return boolean
192
-    */
189
+     * @param row reps record id
190
+     * @param $connection initialised to null
191
+     * @return boolean
192
+     */
193 193
     public static function destroy($id)
194 194
     {
195 195
         
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     public function getTableName()
56 56
     {
57 57
         $className = explode('\\', get_called_class());
58
-        $table = strtolower(end($className) .'s');
58
+        $table = strtolower(end($className) . 's');
59 59
         return $table;
60 60
     }
61 61
     /**
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         $sqlStatement = $this->databaseConnection->prepare($sql);
82 82
         $sqlStatement->setFetchMode($this->databaseConnection::FETCH_CLASS, get_called_class());
83 83
         $sqlStatement->execute();
84
-        if($sqlStatement->rowCount() < 1){
84
+        if ($sqlStatement->rowCount() < 1) {
85 85
             throw new ModelNotFoundException($id);
86 86
         }
87 87
         return $sqlStatement->fetch();
@@ -111,20 +111,20 @@  discard block
 block discarded – undo
111 111
         $columnNames = "";
112 112
         $columnValues = "";
113 113
         $count = 0;
114
-        $update = "UPDATE " . $this->getTableName() . " SET " ;
114
+        $update = "UPDATE " . $this->getTableName() . " SET ";
115 115
         foreach ($this->properties as $key => $val) {
116 116
             $count++;
117
-            if(($key == 'id')) continue;
117
+            if (($key == 'id')) continue;
118 118
             $update .= "$key = '$val'";
119
-            if ($count < count($this->properties) )
119
+            if ($count < count($this->properties))
120 120
             {
121
-                $update .=",";
121
+                $update .= ",";
122 122
             }
123 123
         }
124 124
         $update .= " WHERE id = " . $this->properties['id'];
125 125
         $stmt = $connection->prepare($update);
126 126
             foreach ($this->properties as $key => $val) {
127
-                if($key == 'id') continue;
127
+                if ($key == 'id') continue;
128 128
             }
129 129
         $stmt->execute();
130 130
         return $stmt->rowCount();
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         $columnNames = "";
139 139
         $columnValues = "";
140 140
         $count = 0;
141
-        $create = "INSERT" . " INTO " . $this->getTableName()." (";
141
+        $create = "INSERT" . " INTO " . $this->getTableName() . " (";
142 142
             foreach ($this->properties as $key => $val) {
143 143
                 $columnNames .= $key;
144 144
                 $columnValues .= ':' . $key;
@@ -149,15 +149,15 @@  discard block
 block discarded – undo
149 149
                     $columnValues .= ', ';
150 150
                 }
151 151
             }
152
-        $create .= $columnNames.') VALUES (' .$columnValues.')';
152
+        $create .= $columnNames . ') VALUES (' . $columnValues . ')';
153 153
         $stmt = $connection->prepare($create);
154 154
             foreach ($this->properties as $key => $val) {
155
-                $stmt->bindValue(':'.$key, $val);
155
+                $stmt->bindValue(':' . $key, $val);
156 156
             }
157 157
             try {
158 158
                 // if prop returned and props from db differ throw exception
159 159
                 $stmt->execute();
160
-            } catch(PDOException $e){
160
+            } catch (PDOException $e) {
161 161
                 return $e->getExceptionMessage();
162 162
             }
163 163
         return $stmt->rowCount();
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
     */
168 168
     public function getConnection($connection = null)
169 169
     {
170
-        if(is_null($connection))
170
+        if (is_null($connection))
171 171
         {
172 172
             return new Connection();
173 173
         }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     public static function destroy($id)
194 194
     {
195 195
         
196
-        $sql = "DELETE" . " FROM " . self::getTableName()." WHERE id = ". $id;
196
+        $sql = "DELETE" . " FROM " . self::getTableName() . " WHERE id = " . $id;
197 197
         $delete = $connection->prepare($sql);
198 198
         $delete->execute();
199 199
         $count = $delete->rowCount();
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -114,7 +114,9 @@  discard block
 block discarded – undo
114 114
         $update = "UPDATE " . $this->getTableName() . " SET " ;
115 115
         foreach ($this->properties as $key => $val) {
116 116
             $count++;
117
-            if(($key == 'id')) continue;
117
+            if(($key == 'id')) {
118
+                continue;
119
+            }
118 120
             $update .= "$key = '$val'";
119 121
             if ($count < count($this->properties) )
120 122
             {
@@ -124,7 +126,9 @@  discard block
 block discarded – undo
124 126
         $update .= " WHERE id = " . $this->properties['id'];
125 127
         $stmt = $connection->prepare($update);
126 128
             foreach ($this->properties as $key => $val) {
127
-                if($key == 'id') continue;
129
+                if($key == 'id') {
130
+                    continue;
131
+                }
128 132
             }
129 133
         $stmt->execute();
130 134
         return $stmt->rowCount();
Please login to merge, or discard this patch.
test.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 abstract class A {
4
-	function __construct()
5
-	{
6
-		echo "Here\n";
7
-	}
4
+    function __construct()
5
+    {
6
+        echo "Here\n";
7
+    }
8 8
 
9 9
 }
10 10
 
Please login to merge, or discard this patch.
test/DatabaseConnectionStringFactoryTest.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -4,11 +4,11 @@
 block discarded – undo
4 4
 
5 5
 class DatabaseConnectionStringFactoryTest extends PHPUnit_Framework_TestCase
6 6
 {
7
-     /**
8
-     * The instance of DatabaseConnectionStringFactory used in the test.
9
-     *
10
-     * @var Pyjac\ORM\DatabaseConnectionStringFactory
11
-     */
7
+        /**
8
+         * The instance of DatabaseConnectionStringFactory used in the test.
9
+         *
10
+         * @var Pyjac\ORM\DatabaseConnectionStringFactory
11
+         */
12 12
     protected $openSourceEvangelistFactory;
13 13
 
14 14
     /**
Please login to merge, or discard this patch.
indexPDO.php 2 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -2,28 +2,28 @@  discard block
 block discarded – undo
2 2
 
3 3
 
4 4
 interface ModelInterface {
5
-	/**
6
-	 * Get all models from database.
7
-	 *
8
-	 * @return array
9
-	 */
10
-	function static getAll();
11
-
12
-	/**
13
-	 * Find model with the specified id.
14
-	 */
15
-	function static find($id);
16
-
17
-	/**
18
-	 * Delete model with the specified id.
19
-	 * 
20
-	 */
21
-	function static destroy($id);
5
+    /**
6
+     * Get all models from database.
7
+     *
8
+     * @return array
9
+     */
10
+    function static getAll();
11
+
12
+    /**
13
+     * Find model with the specified id.
14
+     */
15
+    function static find($id);
16
+
17
+    /**
18
+     * Delete model with the specified id.
19
+     * 
20
+     */
21
+    function static destroy($id);
22 22
 }
23 23
 
24 24
 abstract Model {
25 25
 
26
-	/**
26
+    /**
27 27
      * The connection name for the model.
28 28
      *
29 29
      * @var string
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
 class Connection {
45 45
 
46
-	/**
46
+    /**
47 47
      * The current globally used instance.
48 48
      *
49 49
      * @var object
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     private $error;
60 60
  
61 61
     public function __construct(){
62
-    	$config = parse_ini_file('config.ini');
62
+        $config = parse_ini_file('config.ini');
63 63
         // Set DSN
64 64
         $dsn = 'mysql:host=' . $this->host . ';dbname=' . $this->dbname;
65 65
         // Set options
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
 
82 82
 try {
83 83
 	 
84
-	$dbh = new PDO('mysql:host=localhost;dbname=potatoORM', 'homestead', 'secret');
85
-	foreach($dbh->query('SELECT * from test') as $row) {
86
-	        print_r($row);
87
-	    }
84
+    $dbh = new PDO('mysql:host=localhost;dbname=potatoORM', 'homestead', 'secret');
85
+    foreach($dbh->query('SELECT * from test') as $row) {
86
+            print_r($row);
87
+        }
88 88
 } catch (PDOException $e) {
89 89
     print "Error!: " . $e->getMessage() . "<br/>";
90 90
     die();
@@ -109,12 +109,12 @@  discard block
 block discarded – undo
109 109
 
110 110
 
111 111
 
112
-	function __construct()
113
-	{
114
-		/**
115
-        * Load the environment variables
116
-        * @return connection object
117
-        */
112
+    function __construct()
113
+    {
114
+        /**
115
+         * Load the environment variables
116
+         * @return connection object
117
+         */
118 118
         $this->loadDotenv();
119 119
 
120 120
         $this->database = getenv('DB_DATABASE');
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
         $this->password = getenv('DB_PASSWORD');
124 124
         $this->driver = getenv('DB_CONNECTION');
125 125
 
126
-	}
127
-	/**
128
-    * use vlucas dotenv to access the .env file
129
-    **/
126
+    }
127
+    /**
128
+     * use vlucas dotenv to access the .env file
129
+     **/
130 130
     protected function loadDotenv()
131 131
     {
132 132
         if(getenv('APP_ENV') !== 'production')
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 
392 392
 class Helpers {
393 393
 
394
-	/**
394
+    /**
395 395
      * Determine if a given string contains a given substring.
396 396
      *
397 397
      * @param  string  $haystack
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     private $dbh;
59 59
     private $error;
60 60
  
61
-    public function __construct(){
61
+    public function __construct() {
62 62
     	$config = parse_ini_file('config.ini');
63 63
         // Set DSN
64 64
         $dsn = 'mysql:host=' . $this->host . ';dbname=' . $this->dbname;
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
             PDO::ATTR_ERRMODE       => PDO::ERRMODE_EXCEPTION
69 69
         );
70 70
         // Create a new PDO instanace
71
-        try{
71
+        try {
72 72
             $this->dbh = new PDO($dsn, $this->user, $this->pass, $options);
73 73
         }
74 74
         // Catch any errors
75
-        catch(PDOException $e){
75
+        catch (PDOException $e) {
76 76
             $this->error = $e->getMessage();
77 77
         }
78 78
     }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 try {
83 83
 	 
84 84
 	$dbh = new PDO('mysql:host=localhost;dbname=potatoORM', 'homestead', 'secret');
85
-	foreach($dbh->query('SELECT * from test') as $row) {
85
+	foreach ($dbh->query('SELECT * from test') as $row) {
86 86
 	        print_r($row);
87 87
 	    }
88 88
 } catch (PDOException $e) {
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     **/
130 130
     protected function loadDotenv()
131 131
     {
132
-        if(getenv('APP_ENV') !== 'production')
132
+        if (getenv('APP_ENV') !== 'production')
133 133
         {
134 134
             $dotenv = new Dotenv(__DIR__);
135 135
             $dotenv->load();
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
         // is set on the server but needs to be set here on this client objects.
180 180
         $charset = $config['charset'];
181 181
 
182
-        $names = "set names '$charset'".
183
-            (! is_null($collation) ? " collate '$collation'" : '');
182
+        $names = "set names '$charset'" .
183
+            (!is_null($collation) ? " collate '$collation'" : '');
184 184
 
185 185
         $connection->prepare($names)->execute();
186 186
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
      */
209 209
     protected function configHasSocket(array $config)
210 210
     {
211
-        return isset($config['unix_socket']) && ! empty($config['unix_socket']);
211
+        return isset($config['unix_socket']) && !empty($config['unix_socket']);
212 212
     }
213 213
 
214 214
     /**
Please login to merge, or discard this patch.