@@ -59,7 +59,7 @@ |
||
59 | 59 | * |
60 | 60 | * @access public |
61 | 61 | * @param string $name |
62 | - * @param mixed $component |
|
62 | + * @param Dispatcher $component |
|
63 | 63 | * @return void |
64 | 64 | */ |
65 | 65 | public function addRequirement($name, $component) |
@@ -107,7 +107,7 @@ |
||
107 | 107 | public static function finder(IQuery $query = null, $single = false) |
108 | 108 | { |
109 | 109 | $query = ($query instanceof Query) ? $query : new Query((new ConnectionInjector)->build()); |
110 | - $query->table = static::$tableName . ' m'; |
|
110 | + $query->table = static::$tableName.' m'; |
|
111 | 111 | $query->objectName = get_called_class(); |
112 | 112 | $query->single = $single; |
113 | 113 |
@@ -155,7 +155,7 @@ |
||
155 | 155 | $query->distinct = true; |
156 | 156 | $query->select = $this->db->getDriverType() == 'pgsql' ? '"role" AS "name"' : '`role` AS `name`'; |
157 | 157 | $query->table = $this->db->getDriverType() == 'pgsql' ? '"rbac_user"' : '`rbac_user`'; |
158 | - $query->addWhere(($this->db->getDriverType() == 'pgsql' ? '"user"=' : '`user`=') . $userId); |
|
158 | + $query->addWhere(($this->db->getDriverType() == 'pgsql' ? '"user"=' : '`user`=').$userId); |
|
159 | 159 | $query->single = false; |
160 | 160 | |
161 | 161 | return $query->run(\PDO::FETCH_ASSOC); |
@@ -165,17 +165,17 @@ |
||
165 | 165 | |
166 | 166 | if ($this->db->getDriverType() === 'pgsql') { |
167 | 167 | if ($this->limit !== -1) { |
168 | - $query .= ' LIMIT ' . $this->limit . ' '; |
|
168 | + $query .= ' LIMIT '.$this->limit.' '; |
|
169 | 169 | } |
170 | 170 | if ($this->offset !== -1) { |
171 | - $query .= ' OFFSET ' . $this->offset . ' '; |
|
171 | + $query .= ' OFFSET '.$this->offset.' '; |
|
172 | 172 | } |
173 | 173 | } else { |
174 | 174 | if ($this->limit !== -1) { |
175 | 175 | $query .= ' LIMIT '; |
176 | 176 | |
177 | 177 | if ($this->offset !== -1) { |
178 | - $query .= $this->offset . ','; |
|
178 | + $query .= $this->offset.','; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | $query .= $this->limit; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $sql = 'SHOW TABLES;'; |
170 | 170 | |
171 | 171 | if ($this->getDriverType() == 'pgsql') { |
172 | - $sql = 'SELECT table_name FROM information_schema.tables WHERE table_schema = \'' . $this->tableSchema . '\''; |
|
172 | + $sql = 'SELECT table_name FROM information_schema.tables WHERE table_schema = \''.$this->tableSchema.'\''; |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | return $this->conn->query($sql)->fetchAll(\PDO::FETCH_COLUMN, 0); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | foreach ($sth->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
228 | 228 | $result[] = [ |
229 | 229 | 'field' => $row['column_name'], |
230 | - 'type' => $row['data_type'] . (($max = $row['character_maximum_length']) ? '(' . $max . ')' : ''), |
|
230 | + 'type' => $row['data_type'].(($max = $row['character_maximum_length']) ? '('.$max.')' : ''), |
|
231 | 231 | 'null' => $row['is_nullable'], |
232 | 232 | 'default' => $row['column_default'] |
233 | 233 | ]; |
@@ -278,10 +278,10 @@ discard block |
||
278 | 278 | */ |
279 | 279 | public function insert($table, array $line = [], $multi = false) |
280 | 280 | { |
281 | - $fields = '`' . implode('`, `', array_keys($multi ? $line[0] : $line)) . '`'; |
|
281 | + $fields = '`'.implode('`, `', array_keys($multi ? $line[0] : $line)).'`'; |
|
282 | 282 | |
283 | 283 | if ($this->getDriverType() === 'pgsql') { |
284 | - $fields = '"' . implode('", "', array_keys($multi ? $line[0] : $line)) . '"'; |
|
284 | + $fields = '"'.implode('", "', array_keys($multi ? $line[0] : $line)).'"'; |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | $values = ':'.implode(', :', array_keys($multi ? $line[0] : $line)); |
@@ -341,10 +341,10 @@ discard block |
||
341 | 341 | { |
342 | 342 | $keys = []; |
343 | 343 | foreach ($params AS $key => $val) { |
344 | - $keys[] = $table . '.' . $key . '=\'' . $val . '\''; |
|
344 | + $keys[] = $table.'.'.$key.'=\''.$val.'\''; |
|
345 | 345 | } |
346 | 346 | |
347 | - $sth = $this->conn->prepare('SELECT * FROM ' . $table . ' WHERE ' . implode(' AND ', $keys) . ' LIMIT 1;'); |
|
347 | + $sth = $this->conn->prepare('SELECT * FROM '.$table.' WHERE '.implode(' AND ', $keys).' LIMIT 1;'); |
|
348 | 348 | /** @noinspection PdoApiUsageInspection */ |
349 | 349 | $sth->execute(); |
350 | 350 |
@@ -81,6 +81,7 @@ |
||
81 | 81 | /** |
82 | 82 | * @inheritdoc |
83 | 83 | * @throws \Micro\Base\Exception |
84 | + * @param string $name |
|
84 | 85 | */ |
85 | 86 | protected function getElement($name) |
86 | 87 | { |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | { |
54 | 54 | unset($this->driver); |
55 | 55 | |
56 | - $class = '\Micro\Db\Drivers\\' . ucfirst(substr($dsn, 0, strpos($dsn, ':'))) . 'Connection'; |
|
56 | + $class = '\Micro\Db\Drivers\\'.ucfirst(substr($dsn, 0, strpos($dsn, ':'))).'Connection'; |
|
57 | 57 | |
58 | 58 | $this->driver = new $class($dsn, $config, $options); |
59 | 59 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | public function __call($name, array $arguments = []) |
73 | 73 | { |
74 | 74 | if (!method_exists($this->driver, $name)) { |
75 | - throw new \BadMethodCallException('Method `' . $name . '` not found in connection driver `' . get_class($this->driver) . '`'); |
|
75 | + throw new \BadMethodCallException('Method `'.$name.'` not found in connection driver `'.get_class($this->driver).'`'); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | return call_user_func_array([$this->driver, $name], $arguments); |