@@ -24,7 +24,7 @@ |
||
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; |
@@ -43,13 +43,13 @@ discard block |
||
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 |
||
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | - return [ $database, $hostname, $username, $password ]; |
|
112 | + return [$database, $hostname, $username, $password]; |
|
113 | 113 | } |
114 | 114 | } |
@@ -65,7 +65,7 @@ |
||
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 | } |
@@ -211,8 +211,8 @@ |
||
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 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $this->columns = []; |
45 | 45 | |
46 | 46 | try { |
47 | - $query = $this->pdo->prepare('PRAGMA table_info("' . $tableName . '");'); |
|
47 | + $query = $this->pdo->prepare('PRAGMA table_info("'.$tableName.'");'); |
|
48 | 48 | |
49 | 49 | $query->execute(); |
50 | 50 | $query->setFetchMode(\PDO::FETCH_OBJ); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | protected function prepareForeignColumns(array $columns, $tableName) |
121 | 121 | { |
122 | - $query = $this->pdo->prepare('PRAGMA foreign_key_list("' . $tableName . '");'); |
|
122 | + $query = $this->pdo->prepare('PRAGMA foreign_key_list("'.$tableName.'");'); |
|
123 | 123 | |
124 | 124 | $query->execute(); |
125 | 125 | $query->setFetchMode(\PDO::FETCH_OBJ); |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | * @param \Rougin\Describe\Column &$column |
139 | 139 | * @return void |
140 | 140 | */ |
141 | - protected function setProperties($row, Column &$column) |
|
141 | + protected function setProperties($row, Column & $column) |
|
142 | 142 | { |
143 | - if (! $row->notnull) { |
|
143 | + if ( ! $row->notnull) { |
|
144 | 144 | $column->setNull(true); |
145 | 145 | } |
146 | 146 |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $this->columns = []; |
52 | 52 | |
53 | 53 | try { |
54 | - $information = $this->pdo->prepare('DESCRIBE ' . $tableName); |
|
54 | + $information = $this->pdo->prepare('DESCRIBE '.$tableName); |
|
55 | 55 | |
56 | 56 | $information->execute(); |
57 | 57 | $information->setFetchMode(\PDO::FETCH_OBJ); |
@@ -110,15 +110,15 @@ discard block |
||
110 | 110 | $column->setLength($match[2]); |
111 | 111 | } |
112 | 112 | |
113 | - $query = 'SELECT COLUMN_NAME as "column",' . |
|
114 | - 'REFERENCED_COLUMN_NAME as "referenced_column",' . |
|
115 | - 'CONCAT(' . |
|
116 | - 'REFERENCED_TABLE_SCHEMA, ".",' . |
|
117 | - 'REFERENCED_TABLE_NAME' . |
|
118 | - ') as "referenced_table"' . |
|
119 | - 'FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE ' . |
|
120 | - 'WHERE CONSTRAINT_SCHEMA = "' . $this->database . '" ' . |
|
121 | - 'AND TABLE_NAME = "' . $tableName . '";'; |
|
113 | + $query = 'SELECT COLUMN_NAME as "column",'. |
|
114 | + 'REFERENCED_COLUMN_NAME as "referenced_column",'. |
|
115 | + 'CONCAT('. |
|
116 | + 'REFERENCED_TABLE_SCHEMA, ".",'. |
|
117 | + 'REFERENCED_TABLE_NAME'. |
|
118 | + ') as "referenced_table"'. |
|
119 | + 'FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE '. |
|
120 | + 'WHERE CONSTRAINT_SCHEMA = "'.$this->database.'" '. |
|
121 | + 'AND TABLE_NAME = "'.$tableName.'";'; |
|
122 | 122 | |
123 | 123 | $foreignTable = $this->pdo->prepare($query); |
124 | 124 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @param \Rougin\Describe\Column &$column |
138 | 138 | * @return void |
139 | 139 | */ |
140 | - protected function setKey($row, Column &$column) |
|
140 | + protected function setKey($row, Column & $column) |
|
141 | 141 | { |
142 | 142 | switch ($row->Key) { |
143 | 143 | case 'PRI': |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @param \Rougin\Describe\Column &$column |
166 | 166 | * @return void |
167 | 167 | */ |
168 | - protected function setForeignColumns($foreignTable, $row, Column &$column) |
|
168 | + protected function setForeignColumns($foreignTable, $row, Column & $column) |
|
169 | 169 | { |
170 | 170 | while ($foreignRow = $foreignTable->fetch()) { |
171 | 171 | if ($foreignRow->column == $row->Field) { |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * @param \Rougin\Describe\Column &$column |
185 | 185 | * @return void |
186 | 186 | */ |
187 | - protected function setProperties($row, Column &$column) |
|
187 | + protected function setProperties($row, Column & $column) |
|
188 | 188 | { |
189 | 189 | $null = 'Null'; |
190 | 190 |