@@ -111,7 +111,7 @@ |
||
111 | 111 | $result = $this; |
112 | 112 | |
113 | 113 | if (method_exists($this, $method)) { |
114 | - $result = call_user_func_array([ $this, $method ], $parameters); |
|
114 | + $result = call_user_func_array([$this, $method], $parameters); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | return $result; |
@@ -211,8 +211,8 @@ discard block |
||
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 | |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | $result = null; |
353 | 353 | |
354 | 354 | if (method_exists($this, $method)) { |
355 | - $result = call_user_func_array([ $this, $method ], $parameters); |
|
355 | + $result = call_user_func_array([$this, $method], $parameters); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | return (is_null($result)) ? $this : $result; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function getColumns($tableName) |
44 | 44 | { |
45 | - return $this->getColumnsFromQuery($tableName, 'PRAGMA table_info("' . $tableName . '");'); |
|
45 | + return $this->getColumnsFromQuery($tableName, 'PRAGMA table_info("'.$tableName.'");'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | protected function setForeignColumn($tableName, Column $column) |
124 | 124 | { |
125 | - $query = $this->pdo->prepare('PRAGMA foreign_key_list("' . $tableName . '");'); |
|
125 | + $query = $this->pdo->prepare('PRAGMA foreign_key_list("'.$tableName.'");'); |
|
126 | 126 | |
127 | 127 | $query->execute(); |
128 | 128 | $query->setFetchMode(\PDO::FETCH_OBJ); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | protected function setProperties($row, Column $column) |
150 | 150 | { |
151 | - if (! $row->notnull) { |
|
151 | + if ( ! $row->notnull) { |
|
152 | 152 | $column->setNull(true); |
153 | 153 | } |
154 | 154 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function getColumns($tableName) |
46 | 46 | { |
47 | - return $this->getColumnsFromQuery($tableName, 'DESCRIBE ' . $tableName); |
|
47 | + return $this->getColumnsFromQuery($tableName, 'DESCRIBE '.$tableName); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -158,21 +158,21 @@ discard block |
||
158 | 158 | * @param \Rougin\Describe\Column &$column |
159 | 159 | * @return \Rougin\Describe\Column |
160 | 160 | */ |
161 | - protected function setForeignColumn($tableName, $row, Column &$column) |
|
161 | + protected function setForeignColumn($tableName, $row, Column & $column) |
|
162 | 162 | { |
163 | - $query = 'SELECT COLUMN_NAME as "column",' . |
|
164 | - 'REFERENCED_COLUMN_NAME as "referenced_column",' . |
|
165 | - 'CONCAT(REFERENCED_TABLE_SCHEMA, ".", REFERENCED_TABLE_NAME) as "referenced_table"' . |
|
166 | - 'FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE ' . |
|
167 | - 'WHERE CONSTRAINT_SCHEMA = "' . $this->database . '" ' . |
|
168 | - 'AND TABLE_NAME = "' . $tableName . '";'; |
|
163 | + $query = 'SELECT COLUMN_NAME as "column",'. |
|
164 | + 'REFERENCED_COLUMN_NAME as "referenced_column",'. |
|
165 | + 'CONCAT(REFERENCED_TABLE_SCHEMA, ".", REFERENCED_TABLE_NAME) as "referenced_table"'. |
|
166 | + 'FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE '. |
|
167 | + 'WHERE CONSTRAINT_SCHEMA = "'.$this->database.'" '. |
|
168 | + 'AND TABLE_NAME = "'.$tableName.'";'; |
|
169 | 169 | |
170 | 170 | $foreignTable = $this->pdo->prepare($query); |
171 | 171 | |
172 | 172 | $foreignTable->execute(); |
173 | 173 | $foreignTable->setFetchMode(\PDO::FETCH_OBJ); |
174 | 174 | |
175 | - $callback = function ($item) use ($row) { |
|
175 | + $callback = function($item) use ($row) { |
|
176 | 176 | return $item->column == $row->Field; |
177 | 177 | }; |
178 | 178 |