Completed
Push — develop ( 819d57...da80fe )
by Christopher
13:27
created
src/Connection.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 
53 53
     /**
54 54
      * Get an instance of the db connection
55
-     * @return SQLite3 connection
55
+     * @return null|PDO connection
56 56
      */
57 57
     public static function db()
58 58
     {
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,10 +58,10 @@
 block discarded – undo
58 58
     {
59 59
         return self::$conn;
60 60
     }
61
-     public static function close()
62
-     {
61
+        public static function close()
62
+        {
63 63
         self::$conn = null;
64
-     }
64
+        }
65 65
 
66 66
     public function connectMySQL($config)
67 67
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         }
79 79
 
80 80
         try {
81
-            $db = new PDO("mysql:host=".$config['host'].";dbname=".$config['database'], $config['user'], $config['password']);
81
+            $db = new PDO("mysql:host=" . $config['host'] . ";dbname=" . $config['database'], $config['user'], $config['password']);
82 82
         } catch (PDOException $e) {
83 83
             throw new PotatoException($e->getMessage());
84 84
         }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     public function connectSQLite($config)
90 90
     {
91 91
         try {
92
-            $db =  new PDO("sqlite:".$config['database']);
92
+            $db = new PDO("sqlite:" . $config['database']);
93 93
         } catch (PDOException $e) {
94 94
             throw new PotatoException($e->getMessage());
95 95
         }
Please login to merge, or discard this patch.
src/Potato.php 1 patch
Spacing   +6 added lines, -6 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
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         if (!empty($res)) {
133 133
             return $res;
134 134
         } else {
135
-            throw new PotatoException('There is no user with id '. $id);
135
+            throw new PotatoException('There is no user with id ' . $id);
136 136
         }
137 137
     }
138 138
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
         if (!self::$id) {
170 170
             // new record so we insert
171
-            $query = "INSERT INTO $this->tableName (".implode(", ", $availableColumnNames).") VALUES(";
171
+            $query = "INSERT INTO $this->tableName (" . implode(", ", $availableColumnNames) . ") VALUES(";
172 172
 
173 173
             for ($i = 0; $i < count($availableColumnNames); $i++)
174 174
             {
@@ -189,14 +189,14 @@  discard block
 block discarded – undo
189 189
 
190 190
             for ($i = 0; $i < count($availableColumnNames); $i++) {
191 191
                 $prop = $availableColumnNames[$i];
192
-                $query .= " $prop = '". $this->{$prop}."'";
192
+                $query .= " $prop = '" . $this->{$prop} . "'";
193 193
 
194 194
                 if ($i != count($availableColumnNames) - 1) {
195 195
                     $query .= ",";
196 196
                 }
197 197
             }
198 198
 
199
-            $query .= " WHERE id = ".self::$id;
199
+            $query .= " WHERE id = " . self::$id;
200 200
         }
201 201
 
202 202
         $result = Connection::db()->query($query);
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
         self::getOne($id);
233 233
 
234
-        $query = "DELETE FROM $table WHERE id = ".$id;
234
+        $query = "DELETE FROM $table WHERE id = " . $id;
235 235
 
236 236
         $result = Connection::db()->query($query);
237 237
     }
Please login to merge, or discard this patch.