@@ -21,7 +21,7 @@ |
||
| 21 | 21 | protected $pdo; |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | - * @param PDO $pdo |
|
| 24 | + * @param \PDO $pdo |
|
| 25 | 25 | */ |
| 26 | 26 | public function __construct(\PDO $pdo) |
| 27 | 27 | { |
@@ -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); |
@@ -112,9 +112,9 @@ discard block |
||
| 112 | 112 | * @param \Rougin\Describe\Column &$column |
| 113 | 113 | * @return void |
| 114 | 114 | */ |
| 115 | - protected function setForeignColumn($tableName, $row, Column &$column) |
|
| 115 | + protected function setForeignColumn($tableName, $row, Column & $column) |
|
| 116 | 116 | { |
| 117 | - $query = $this->pdo->prepare('PRAGMA foreign_key_list("' . $tableName . '");'); |
|
| 117 | + $query = $this->pdo->prepare('PRAGMA foreign_key_list("'.$tableName.'");'); |
|
| 118 | 118 | |
| 119 | 119 | $query->execute(); |
| 120 | 120 | $query->setFetchMode(\PDO::FETCH_OBJ); |
@@ -136,9 +136,9 @@ discard block |
||
| 136 | 136 | * @param \Rougin\Describe\Column &$column |
| 137 | 137 | * @return void |
| 138 | 138 | */ |
| 139 | - protected function setProperties($row, Column &$column) |
|
| 139 | + protected function setProperties($row, Column & $column) |
|
| 140 | 140 | { |
| 141 | - if (! $row->notnull) { |
|
| 141 | + if ( ! $row->notnull) { |
|
| 142 | 142 | $column->setNull(true); |
| 143 | 143 | } |
| 144 | 144 | |
@@ -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); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * @param \Rougin\Describe\Column &$column |
| 123 | 123 | * @return void |
| 124 | 124 | */ |
| 125 | - protected function setKey($row, Column &$column) |
|
| 125 | + protected function setKey($row, Column & $column) |
|
| 126 | 126 | { |
| 127 | 127 | switch ($row->Key) { |
| 128 | 128 | case 'PRI': |
@@ -150,14 +150,14 @@ discard block |
||
| 150 | 150 | * @param \Rougin\Describe\Column &$column |
| 151 | 151 | * @return void |
| 152 | 152 | */ |
| 153 | - protected function setForeignColumn($tableName, $row, Column &$column) |
|
| 153 | + protected function setForeignColumn($tableName, $row, Column & $column) |
|
| 154 | 154 | { |
| 155 | - $query = 'SELECT COLUMN_NAME as "column",' . |
|
| 156 | - 'REFERENCED_COLUMN_NAME as "referenced_column",' . |
|
| 157 | - 'CONCAT(REFERENCED_TABLE_SCHEMA, ".", REFERENCED_TABLE_NAME) as "referenced_table"' . |
|
| 158 | - 'FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE ' . |
|
| 159 | - 'WHERE CONSTRAINT_SCHEMA = "' . $this->database . '" ' . |
|
| 160 | - 'AND TABLE_NAME = "' . $tableName . '";'; |
|
| 155 | + $query = 'SELECT COLUMN_NAME as "column",'. |
|
| 156 | + 'REFERENCED_COLUMN_NAME as "referenced_column",'. |
|
| 157 | + 'CONCAT(REFERENCED_TABLE_SCHEMA, ".", REFERENCED_TABLE_NAME) as "referenced_table"'. |
|
| 158 | + 'FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE '. |
|
| 159 | + 'WHERE CONSTRAINT_SCHEMA = "'.$this->database.'" '. |
|
| 160 | + 'AND TABLE_NAME = "'.$tableName.'";'; |
|
| 161 | 161 | |
| 162 | 162 | $foreignTable = $this->pdo->prepare($query); |
| 163 | 163 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * @param \Rougin\Describe\Column &$column |
| 182 | 182 | * @return void |
| 183 | 183 | */ |
| 184 | - protected function setProperties($row, Column &$column) |
|
| 184 | + protected function setProperties($row, Column & $column) |
|
| 185 | 185 | { |
| 186 | 186 | $null = 'Null'; |
| 187 | 187 | |