Completed
Pull Request — master (#3)
by Rougin
02:40
created
src/Driver/MySQLDriver.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     {
50 50
         $this->columns = [];
51 51
 
52
-        $information = $this->pdo->prepare('DESCRIBE ' . $table);
52
+        $information = $this->pdo->prepare('DESCRIBE '.$table);
53 53
         $information->execute();
54 54
         $information->setFetchMode(\PDO::FETCH_OBJ);
55 55
 
@@ -75,15 +75,15 @@  discard block
 block discarded – undo
75 75
                 $column->setLength($match[2]);
76 76
             }
77 77
 
78
-            $query = 'SELECT COLUMN_NAME as "column",' .
79
-                'REFERENCED_COLUMN_NAME as "referenced_column",' .
80
-                'CONCAT(' .
81
-                    'REFERENCED_TABLE_SCHEMA, ".",' .
82
-                    'REFERENCED_TABLE_NAME' .
83
-                ') as "referenced_table"' .
84
-                'FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE ' .
85
-                'WHERE CONSTRAINT_SCHEMA = "' . $this->database . '" ' .
86
-                'AND TABLE_NAME = "' . $table . '";';
78
+            $query = 'SELECT COLUMN_NAME as "column",'.
79
+                'REFERENCED_COLUMN_NAME as "referenced_column",'.
80
+                'CONCAT('.
81
+                    'REFERENCED_TABLE_SCHEMA, ".",'.
82
+                    'REFERENCED_TABLE_NAME'.
83
+                ') as "referenced_table"'.
84
+                'FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE '.
85
+                'WHERE CONSTRAINT_SCHEMA = "'.$this->database.'" '.
86
+                'AND TABLE_NAME = "'.$table.'";';
87 87
 
88 88
             $foreignTable = $this->pdo->prepare($query);
89 89
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      * @param  \Rougin\Describe\Column &$column
125 125
      * @return void
126 126
      */
127
-    protected function setKey($row, Column &$column)
127
+    protected function setKey($row, Column & $column)
128 128
     {
129 129
         switch ($row->Key) {
130 130
             case 'PRI':
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      * @param  \Rougin\Describe\Column &$column
153 153
      * @return void
154 154
      */
155
-    protected function setForeignColumns($foreignTable, $row, Column &$column)
155
+    protected function setForeignColumns($foreignTable, $row, Column & $column)
156 156
     {
157 157
         while ($foreignRow = $foreignTable->fetch()) {
158 158
             if ($foreignRow->column == $row->Field) {
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      * @param  \Rougin\Describe\Column &$column
172 172
      * @return void
173 173
      */
174
-    protected function setProperties($row, Column &$column)
174
+    protected function setProperties($row, Column & $column)
175 175
     {
176 176
         if ($row->Extra == 'auto_increment') {
177 177
             $column->setAutoIncrement(true);
Please login to merge, or discard this patch.
src/Driver/CodeIgniterDriver.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function __construct(array $database)
27 27
     {
28
-        $mysql  = [ 'mysql', 'mysqli' ];
29
-        $sqlite = [ 'pdo', 'sqlite', 'sqlite3' ];
28
+        $mysql  = ['mysql', 'mysqli'];
29
+        $sqlite = ['pdo', 'sqlite', 'sqlite3'];
30 30
 
31 31
         // NOTE: To be removed in v1.0.0
32 32
         if (isset($database['default'])) {
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         }
35 35
 
36 36
         if (in_array($database['dbdriver'], $mysql)) {
37
-            $dsn = 'mysql:host=' . $database['hostname'] . ';dbname=' . $database['database'];
37
+            $dsn = 'mysql:host='.$database['hostname'].';dbname='.$database['database'];
38 38
             $pdo = new \PDO($dsn, $database['username'], $database['password']);
39 39
 
40 40
             $this->driver = new MySQLDriver($pdo, $database['database']);
Please login to merge, or discard this patch.
src/Describe.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
     /**
57 57
      * Returns the result.
58 58
      *
59
-     * @param  string $table
59
+     * @param  string $tableName
60 60
      * @return array
61 61
      * @throws \Rougin\Describe\Exceptions\TableNameNotFoundException
62 62
      */
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
         $table = $this->driver->getTable($tableName);
66 66
 
67 67
         if (empty($table) || is_null($table)) {
68
-            $message = '"' . $tableName . '" table not found in database!';
68
+            $message = '"'.$tableName.'" table not found in database!';
69 69
 
70 70
             throw new Exceptions\TableNameNotFoundException($message);
71 71
         }
Please login to merge, or discard this patch.
src/MagicMethodHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
         $result = $object;
25 25
 
26 26
         if (method_exists($object, $method)) {
27
-            $result = call_user_func_array([ $object, $method ], $parameters);
27
+            $result = call_user_func_array([$object, $method], $parameters);
28 28
         }
29 29
 
30 30
         return $result;
Please login to merge, or discard this patch.
src/Driver/DatabaseDriver.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,13 +43,13 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function getDriver($driverName, $configuration = [])
45 45
     {
46
-        $mysql  = [ 'mysql', 'mysqli' ];
47
-        $sqlite = [ 'pdo', 'sqlite', 'sqlite3' ];
46
+        $mysql  = ['mysql', 'mysqli'];
47
+        $sqlite = ['pdo', 'sqlite', 'sqlite3'];
48 48
 
49 49
         list($database, $hostname, $username, $password) = $this->parseConfiguration($configuration);
50 50
 
51 51
         if (in_array($driverName, $mysql)) {
52
-            $dsn = 'mysql:host=' . $hostname . ';dbname=' . $database;
52
+            $dsn = 'mysql:host='.$hostname.';dbname='.$database;
53 53
             $pdo = new \PDO($dsn, $username, $password);
54 54
 
55 55
             return new MySQLDriver($pdo, $database);
@@ -109,6 +109,6 @@  discard block
 block discarded – undo
109 109
             }
110 110
         }
111 111
 
112
-        return [ $database, $hostname, $username, $password ];
112
+        return [$database, $hostname, $username, $password];
113 113
     }
114 114
 }
Please login to merge, or discard this patch.
src/Driver/SQLiteDriver.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     {
38 38
         $columns = [];
39 39
 
40
-        $query = $this->pdo->prepare('PRAGMA table_info("' . $table . '");');
40
+        $query = $this->pdo->prepare('PRAGMA table_info("'.$table.'");');
41 41
 
42 42
         $query->execute();
43 43
         $query->setFetchMode(\PDO::FETCH_OBJ);
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     protected function prepareForeignColumns(array $columns, $tableName)
111 111
     {
112
-        $query = $this->pdo->prepare('PRAGMA foreign_key_list("' . $tableName . '");');
112
+        $query = $this->pdo->prepare('PRAGMA foreign_key_list("'.$tableName.'");');
113 113
 
114 114
         $query->execute();
115 115
         $query->setFetchMode(\PDO::FETCH_OBJ);
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
      * @param  \Rougin\Describe\Column &$column
129 129
      * @return void
130 130
      */
131
-    protected function setProperties($row, Column &$column)
131
+    protected function setProperties($row, Column & $column)
132 132
     {
133
-        if (! $row->notnull) {
133
+        if ( ! $row->notnull) {
134 134
             $column->setNull(true);
135 135
         }
136 136
 
Please login to merge, or discard this patch.
src/Column.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -211,8 +211,8 @@
 block discarded – undo
211 211
      */
212 212
     public function setDataType($dataType)
213 213
     {
214
-        $dataTypes = [ 'integer', 'string', 'string' ];
215
-        $shortHand = [ 'int', 'varchar', 'text' ];
214
+        $dataTypes = ['integer', 'string', 'string'];
215
+        $shortHand = ['int', 'varchar', 'text'];
216 216
 
217 217
         $index = array_search($dataType, $shortHand);
218 218
 
Please login to merge, or discard this patch.