@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * @param string $name |
| 40 | 40 | * @param string[] $columns |
| 41 | 41 | */ |
| 42 | - public function __construct (DB $db, $name, array $columns) { |
|
| 42 | + public function __construct(DB $db, $name, array $columns) { |
|
| 43 | 43 | parent::__construct($db); |
| 44 | 44 | $this->name = $name; |
| 45 | 45 | asort($columns); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return string |
| 55 | 55 | */ |
| 56 | - final public function __toString () { |
|
| 56 | + final public function __toString() { |
|
| 57 | 57 | return $this->name; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @param array $values |
| 64 | 64 | * @return int Rows affected. |
| 65 | 65 | */ |
| 66 | - public function apply (array $values): int { |
|
| 66 | + public function apply(array $values): int { |
|
| 67 | 67 | $columns = implode(',', array_keys($values)); |
| 68 | 68 | $values = $this->db->quoteList($values); |
| 69 | 69 | switch ($this->db) { |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * @param Closure $prepare `():Statement` |
| 86 | 86 | * @return Statement |
| 87 | 87 | */ |
| 88 | - protected function cache (string $key, Closure $prepare) { |
|
| 88 | + protected function cache(string $key, Closure $prepare) { |
|
| 89 | 89 | return $this->_cache[$key] ?? $this->_cache[$key] = $prepare->__invoke(); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param array $match `[a => b]` |
| 94 | 94 | * @return int |
| 95 | 95 | */ |
| 96 | - public function count (array $match = []) { |
|
| 96 | + public function count(array $match = []) { |
|
| 97 | 97 | $select = $this->select(['COUNT(*)']); |
| 98 | 98 | foreach ($match as $a => $b) { |
| 99 | 99 | $select->where($this->db->match($this[$a] ?? $a, $b)); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @param array $match |
| 110 | 110 | * @return int Rows affected. |
| 111 | 111 | */ |
| 112 | - public function delete (array $match): int { |
|
| 112 | + public function delete(array $match): int { |
|
| 113 | 113 | foreach ($match as $a => $b) { |
| 114 | 114 | $match[$a] = $this->db->match($this[$a] ?? $a, $b); |
| 115 | 115 | } |
@@ -120,14 +120,14 @@ discard block |
||
| 120 | 120 | /** |
| 121 | 121 | * @return Column[] |
| 122 | 122 | */ |
| 123 | - final public function getColumns (): array { |
|
| 123 | + final public function getColumns(): array { |
|
| 124 | 124 | return $this->columns; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
| 128 | 128 | * @return string |
| 129 | 129 | */ |
| 130 | - final public function getName (): string { |
|
| 130 | + final public function getName(): string { |
|
| 131 | 131 | return $this->name; |
| 132 | 132 | } |
| 133 | 133 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @param array $values |
| 138 | 138 | * @return Statement |
| 139 | 139 | */ |
| 140 | - public function insert (array $values) { |
|
| 140 | + public function insert(array $values) { |
|
| 141 | 141 | $columns = implode(',', array_keys($values)); |
| 142 | 142 | $values = $this->db->quoteList($values); |
| 143 | 143 | return $this->db->query("INSERT INTO {$this} ($columns) VALUES ($values)"); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * @param string $name |
| 148 | 148 | * @return bool |
| 149 | 149 | */ |
| 150 | - public function offsetExists ($name): bool { |
|
| 150 | + public function offsetExists($name): bool { |
|
| 151 | 151 | return isset($this->columns[$name]); |
| 152 | 152 | } |
| 153 | 153 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * @param string $name |
| 156 | 156 | * @return Column |
| 157 | 157 | */ |
| 158 | - public function offsetGet ($name) { |
|
| 158 | + public function offsetGet($name) { |
|
| 159 | 159 | return $this->columns[$name]; |
| 160 | 160 | } |
| 161 | 161 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @param string[] $columns Defaults to all columns. |
| 166 | 166 | * @return Select |
| 167 | 167 | */ |
| 168 | - public function select (array $columns = []) { |
|
| 168 | + public function select(array $columns = []) { |
|
| 169 | 169 | if (empty($columns)) { |
| 170 | 170 | $columns = $this->columns; |
| 171 | 171 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * @param string $name |
| 179 | 179 | * @return Table |
| 180 | 180 | */ |
| 181 | - public function setName (string $name) { |
|
| 181 | + public function setName(string $name) { |
|
| 182 | 182 | $clone = clone $this; |
| 183 | 183 | $clone->name = $name; |
| 184 | 184 | foreach ($this->columns as $name => $column) { |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * @param array $match |
| 197 | 197 | * @return int Rows affected. |
| 198 | 198 | */ |
| 199 | - public function update (array $values, array $match): int { |
|
| 199 | + public function update(array $values, array $match): int { |
|
| 200 | 200 | foreach ($this->db->quoteArray($values) as $key => $value) { |
| 201 | 201 | $values[$key] = "{$key} = {$value}"; |
| 202 | 202 | } |