@@ -276,14 +276,12 @@ discard block |
||
| 276 | 276 | if ($column instanceof Column) { |
| 277 | 277 | $name = $column->getName(); |
| 278 | 278 | $column = (string)$column; |
| 279 | - } |
|
| 280 | - else { |
|
| 279 | + } else { |
|
| 281 | 280 | $name = $column = (string)$column; |
| 282 | 281 | } |
| 283 | 282 | if (is_string($alias) and $alias !== $name) { |
| 284 | 283 | $this->columns[$alias] = $column; |
| 285 | - } |
|
| 286 | - else { |
|
| 284 | + } else { |
|
| 287 | 285 | $this->columns[$column] = $column; |
| 288 | 286 | } |
| 289 | 287 | } |
@@ -307,8 +305,7 @@ discard block |
||
| 307 | 305 | foreach ($this->columns as $alias => $column) { |
| 308 | 306 | if ($alias !== $column) { |
| 309 | 307 | $columns[] = "{$column} AS {$alias}"; |
| 310 | - } |
|
| 311 | - else { |
|
| 308 | + } else { |
|
| 312 | 309 | $columns[] = "{$column}"; |
| 313 | 310 | } |
| 314 | 311 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @param string|Select $table |
| 76 | 76 | * @param array $columns Strings or {@link Column}. Keys are used for aliasing. |
| 77 | 77 | */ |
| 78 | - public function __construct (DB $db, $table, array $columns) { |
|
| 78 | + public function __construct(DB $db, $table, array $columns) { |
|
| 79 | 79 | parent::__construct($db); |
| 80 | 80 | if ($table instanceof Select) { |
| 81 | 81 | $table = $table->toSubquery(); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | /** |
| 92 | 92 | * Gives the clone a new alias. |
| 93 | 93 | */ |
| 94 | - public function __clone () { |
|
| 94 | + public function __clone() { |
|
| 95 | 95 | $this->alias = uniqid('_') . "__{$this->table}"; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @param array $args |
| 100 | 100 | * @return PDOStatement |
| 101 | 101 | */ |
| 102 | - public function __invoke (array $args = []) { |
|
| 102 | + public function __invoke(array $args = []) { |
|
| 103 | 103 | return $this->execute($args); |
| 104 | 104 | } |
| 105 | 105 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * |
| 109 | 109 | * @return string |
| 110 | 110 | */ |
| 111 | - public function __toString (): string { |
|
| 111 | + public function __toString(): string { |
|
| 112 | 112 | return $this->alias; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @param array $args Execution arguments. |
| 119 | 119 | * @return int |
| 120 | 120 | */ |
| 121 | - public function count (array $args = []): int { |
|
| 121 | + public function count(array $args = []): int { |
|
| 122 | 122 | $clone = clone $this; |
| 123 | 123 | $clone->setColumns(['COUNT(*)']); |
| 124 | 124 | return (int)$clone->execute($args)->fetchColumn(); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * @param array $args |
| 131 | 131 | * @return PDOStatement |
| 132 | 132 | */ |
| 133 | - public function execute (array $args = []): PDOStatement { |
|
| 133 | + public function execute(array $args = []): PDOStatement { |
|
| 134 | 134 | $statement = $this->prepare(); |
| 135 | 135 | $statement->execute($args); |
| 136 | 136 | return $statement; |
@@ -144,21 +144,21 @@ discard block |
||
| 144 | 144 | * @param array $args Execution arguments. |
| 145 | 145 | * @return array |
| 146 | 146 | */ |
| 147 | - public function fetchAll (array $args = []): array { |
|
| 147 | + public function fetchAll(array $args = []): array { |
|
| 148 | 148 | return $this->fetcher->__invoke($this->execute($args)); |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
| 152 | 152 | * @return string |
| 153 | 153 | */ |
| 154 | - final public function getAlias (): string { |
|
| 154 | + final public function getAlias(): string { |
|
| 155 | 155 | return $this->alias; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
| 159 | 159 | * @return Closure |
| 160 | 160 | */ |
| 161 | - public function getFetcher (): Closure { |
|
| 161 | + public function getFetcher(): Closure { |
|
| 162 | 162 | return $this->fetcher; |
| 163 | 163 | } |
| 164 | 164 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * |
| 170 | 170 | * @return ArrayIterator |
| 171 | 171 | */ |
| 172 | - public function getIterator () { |
|
| 172 | + public function getIterator() { |
|
| 173 | 173 | return new ArrayIterator($this->fetchAll()); |
| 174 | 174 | } |
| 175 | 175 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | * @param string $column |
| 180 | 180 | * @return $this |
| 181 | 181 | */ |
| 182 | - public function group ($column) { |
|
| 182 | + public function group($column) { |
|
| 183 | 183 | $this->_group[] = $column; |
| 184 | 184 | return $this; |
| 185 | 185 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * @param string $condition |
| 191 | 191 | * @return $this |
| 192 | 192 | */ |
| 193 | - public function having ($condition) { |
|
| 193 | + public function having($condition) { |
|
| 194 | 194 | $this->_having[] = $condition; |
| 195 | 195 | return $this; |
| 196 | 196 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * @param string $type |
| 204 | 204 | * @return $this |
| 205 | 205 | */ |
| 206 | - public function join ($table, $condition, $type = 'INNER') { |
|
| 206 | + public function join($table, $condition, $type = 'INNER') { |
|
| 207 | 207 | if ($table instanceof Select) { |
| 208 | 208 | $table = $table->toSubquery(); |
| 209 | 209 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * @param int $offset |
| 219 | 219 | * @return $this |
| 220 | 220 | */ |
| 221 | - public function limit ($limit, $offset = 0) { |
|
| 221 | + public function limit($limit, $offset = 0) { |
|
| 222 | 222 | $this->_limit = " LIMIT {$limit}"; |
| 223 | 223 | if ($offset) { |
| 224 | 224 | $this->_limit .= " OFFSET {$offset}"; |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * @param string $name Name or alias if used. |
| 233 | 233 | * @return bool |
| 234 | 234 | */ |
| 235 | - public function offsetExists ($name): bool { |
|
| 235 | + public function offsetExists($name): bool { |
|
| 236 | 236 | return isset($this->columns[$name]); |
| 237 | 237 | } |
| 238 | 238 | |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | * @param string $name Name or alias if used. |
| 243 | 243 | * @return Column |
| 244 | 244 | */ |
| 245 | - public function offsetGet ($name): Column { |
|
| 245 | + public function offsetGet($name): Column { |
|
| 246 | 246 | return new Column($this->db, $name, $this->alias); |
| 247 | 247 | } |
| 248 | 248 | |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * @param string $order |
| 253 | 253 | * @return $this |
| 254 | 254 | */ |
| 255 | - public function order ($order) { |
|
| 255 | + public function order($order) { |
|
| 256 | 256 | $this->_order = " ORDER BY {$order}"; |
| 257 | 257 | return $this; |
| 258 | 258 | } |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | /** |
| 261 | 261 | * @return PDOStatement |
| 262 | 262 | */ |
| 263 | - public function prepare (): PDOStatement { |
|
| 263 | + public function prepare(): PDOStatement { |
|
| 264 | 264 | return $this->db->prepare($this->toSql()); |
| 265 | 265 | } |
| 266 | 266 | |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | * @param array $columns Strings or {@link Column}. Keys are used for aliasing. |
| 271 | 271 | * @return $this |
| 272 | 272 | */ |
| 273 | - public function setColumns (array $columns) { |
|
| 273 | + public function setColumns(array $columns) { |
|
| 274 | 274 | $this->columns = []; |
| 275 | 275 | foreach ($columns as $alias => $column) { |
| 276 | 276 | if ($column instanceof Column) { |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | * @param Closure $fetcher |
| 295 | 295 | * @return $this |
| 296 | 296 | */ |
| 297 | - public function setFetcher (Closure $fetcher) { |
|
| 297 | + public function setFetcher(Closure $fetcher) { |
|
| 298 | 298 | $this->fetcher = $fetcher; |
| 299 | 299 | return $this; |
| 300 | 300 | } |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | /** |
| 303 | 303 | * @return string |
| 304 | 304 | */ |
| 305 | - public function toSql (): string { |
|
| 305 | + public function toSql(): string { |
|
| 306 | 306 | $columns = []; |
| 307 | 307 | foreach ($this->columns as $alias => $column) { |
| 308 | 308 | if ($alias !== $column) { |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | * |
| 337 | 337 | * @return string |
| 338 | 338 | */ |
| 339 | - public function toSubquery (): string { |
|
| 339 | + public function toSubquery(): string { |
|
| 340 | 340 | return "({$this->toSql()}) AS {$this->getAlias()}"; |
| 341 | 341 | } |
| 342 | 342 | |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | * @param string $condition |
| 347 | 347 | * @return $this |
| 348 | 348 | */ |
| 349 | - public function where ($condition) { |
|
| 349 | + public function where($condition) { |
|
| 350 | 350 | $this->_where[] = $condition; |
| 351 | 351 | return $this; |
| 352 | 352 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | /** |
| 27 | 27 | * @param DB $db |
| 28 | 28 | */ |
| 29 | - public function __construct (DB $db) { |
|
| 29 | + public function __construct(DB $db) { |
|
| 30 | 30 | $this->db = $db; |
| 31 | 31 | } |
| 32 | 32 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @param Closure $prepare `():PDOStatement` |
| 38 | 38 | * @return PDOStatement |
| 39 | 39 | */ |
| 40 | - protected function cache (string $key, Closure $prepare): PDOStatement { |
|
| 40 | + protected function cache(string $key, Closure $prepare): PDOStatement { |
|
| 41 | 41 | return $this->_cache[$key] ?? $this->_cache[$key] = $prepare->__invoke(); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -68,8 +68,7 @@ discard block |
||
| 68 | 68 | $this->class = $class; |
| 69 | 69 | try { |
| 70 | 70 | $class = new ReflectionClass($class); |
| 71 | - } |
|
| 72 | - catch (ReflectionException $exception) { |
|
| 71 | + } catch (ReflectionException $exception) { |
|
| 73 | 72 | throw new LogicException('Unexpected ReflectionException', 0, $exception); |
| 74 | 73 | } |
| 75 | 74 | $this->proto = $class->newInstanceWithoutConstructor(); |
@@ -88,8 +87,7 @@ discard block |
||
| 88 | 87 | if (preg_match('/@var\s+(?<type>\S+)/', $doc, $var)) { |
| 89 | 88 | $types[$name] = $var['type']; |
| 90 | 89 | } |
| 91 | - } |
|
| 92 | - elseif (preg_match('/@eav\s+(?<table>\S+)/', $doc, $match)) { |
|
| 90 | + } elseif (preg_match('/@eav\s+(?<table>\S+)/', $doc, $match)) { |
|
| 93 | 91 | $eav[$name] = $match['table']; |
| 94 | 92 | $this->properties[$name] = $property; |
| 95 | 93 | } |
@@ -218,8 +216,7 @@ discard block |
||
| 218 | 216 | public function save (EntityInterface $entity): int { |
| 219 | 217 | if (!$entity->getId()) { |
| 220 | 218 | $this->saveInsert($entity); |
| 221 | - } |
|
| 222 | - else { |
|
| 219 | + } else { |
|
| 223 | 220 | $this->saveUpdate($entity); |
| 224 | 221 | } |
| 225 | 222 | $this->saveEav($entity); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @param DB $db |
| 64 | 64 | * @param string $class |
| 65 | 65 | */ |
| 66 | - public function __construct (DB $db, string $class) { |
|
| 66 | + public function __construct(DB $db, string $class) { |
|
| 67 | 67 | $this->db = $db; |
| 68 | 68 | $this->class = $class; |
| 69 | 69 | try { |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @param PDOStatement $statement |
| 110 | 110 | * @return EntityInterface[] Enumerated |
| 111 | 111 | */ |
| 112 | - public function fetchAll (PDOStatement $statement): array { |
|
| 112 | + public function fetchAll(PDOStatement $statement): array { |
|
| 113 | 113 | $entities = []; |
| 114 | 114 | foreach ($statement->fetchAll() as $row) { |
| 115 | 115 | $clone = clone $this->proto; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * @param array[] $eavMatch Additional `[eav property => attribute => mixed]` |
| 130 | 130 | * @return Select |
| 131 | 131 | */ |
| 132 | - public function find (array $match, array $eavMatch = []): Select { |
|
| 132 | + public function find(array $match, array $eavMatch = []): Select { |
|
| 133 | 133 | $select = $this->select(); |
| 134 | 134 | foreach ($match as $column => $value) { |
| 135 | 135 | $select->where($this->db->match($column, $value)); |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | /** |
| 145 | 145 | * @return string |
| 146 | 146 | */ |
| 147 | - final public function getClass (): string { |
|
| 147 | + final public function getClass(): string { |
|
| 148 | 148 | return $this->class; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -152,14 +152,14 @@ discard block |
||
| 152 | 152 | * @param string $property |
| 153 | 153 | * @return EAV |
| 154 | 154 | */ |
| 155 | - final public function getEav (string $property): EAV { |
|
| 155 | + final public function getEav(string $property): EAV { |
|
| 156 | 156 | return $this->eav[$property]; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | 160 | * @return EntityInterface |
| 161 | 161 | */ |
| 162 | - public function getProto (): EntityInterface { |
|
| 162 | + public function getProto(): EntityInterface { |
|
| 163 | 163 | return $this->proto; |
| 164 | 164 | } |
| 165 | 165 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | * @param EntityInterface $entity |
| 168 | 168 | * @return array |
| 169 | 169 | */ |
| 170 | - protected function getValues (EntityInterface $entity): array { |
|
| 170 | + protected function getValues(EntityInterface $entity): array { |
|
| 171 | 171 | $values = []; |
| 172 | 172 | foreach (array_keys($this->columns) as $name) { |
| 173 | 173 | $values[$name] = $this->properties[$name]->getValue($entity); |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * @param int $id |
| 182 | 182 | * @return null|EntityInterface |
| 183 | 183 | */ |
| 184 | - public function load (int $id): ?EntityInterface { |
|
| 184 | + public function load(int $id): ?EntityInterface { |
|
| 185 | 185 | $load = $this->cache(__FUNCTION__, function() { |
| 186 | 186 | return $this->select()->where('id=:id')->prepare(); |
| 187 | 187 | }); |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | * |
| 201 | 201 | * @param EntityInterface[] $entities |
| 202 | 202 | */ |
| 203 | - protected function loadEav (array $entities): void { |
|
| 203 | + protected function loadEav(array $entities): void { |
|
| 204 | 204 | $ids = array_keys($entities); |
| 205 | 205 | foreach ($this->eav as $name => $eav) { |
| 206 | 206 | foreach ($eav->loadAll($ids) as $id => $values) { |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | * @param EntityInterface $entity |
| 216 | 216 | * @return int ID |
| 217 | 217 | */ |
| 218 | - public function save (EntityInterface $entity): int { |
|
| 218 | + public function save(EntityInterface $entity): int { |
|
| 219 | 219 | if (!$entity->getId()) { |
| 220 | 220 | $this->saveInsert($entity); |
| 221 | 221 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | /** |
| 230 | 230 | * @param EntityInterface $entity |
| 231 | 231 | */ |
| 232 | - protected function saveEav (EntityInterface $entity): void { |
|
| 232 | + protected function saveEav(EntityInterface $entity): void { |
|
| 233 | 233 | $id = $entity->getId(); |
| 234 | 234 | foreach ($this->eav as $name => $eav) { |
| 235 | 235 | $values = $this->properties[$name]->getValue($entity); |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | * |
| 245 | 245 | * @param EntityInterface $entity |
| 246 | 246 | */ |
| 247 | - protected function saveInsert (EntityInterface $entity): void { |
|
| 247 | + protected function saveInsert(EntityInterface $entity): void { |
|
| 248 | 248 | $insert = $this->cache(__FUNCTION__, function() { |
| 249 | 249 | $slots = SQL::slots(array_keys($this->columns)); |
| 250 | 250 | unset($slots['id']); |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | * |
| 264 | 264 | * @param EntityInterface $entity |
| 265 | 265 | */ |
| 266 | - protected function saveUpdate (EntityInterface $entity): void { |
|
| 266 | + protected function saveUpdate(EntityInterface $entity): void { |
|
| 267 | 267 | $this->cache(__FUNCTION__, function() { |
| 268 | 268 | $slots = SQL::slots(array_keys($this->columns)); |
| 269 | 269 | unset($slots['id']); |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | * @param array $columns Defaults to all columns. |
| 279 | 279 | * @return Select |
| 280 | 280 | */ |
| 281 | - public function select (array $columns = []): Select { |
|
| 281 | + public function select(array $columns = []): Select { |
|
| 282 | 282 | $select = parent::select($columns); |
| 283 | 283 | $select->setFetcher(function(PDOStatement $statement) { |
| 284 | 284 | return $this->fetchAll($statement); |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | * @param EntityInterface $proto |
| 291 | 291 | * @return $this |
| 292 | 292 | */ |
| 293 | - public function setProto (EntityInterface $proto) { |
|
| 293 | + public function setProto(EntityInterface $proto) { |
|
| 294 | 294 | $this->proto = $proto; |
| 295 | 295 | return $this; |
| 296 | 296 | } |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | * @param EntityInterface $entity |
| 300 | 300 | * @param array $values |
| 301 | 301 | */ |
| 302 | - protected function setValues (EntityInterface $entity, array $values): void { |
|
| 302 | + protected function setValues(EntityInterface $entity, array $values): void { |
|
| 303 | 303 | foreach ($values as $name => $value) { |
| 304 | 304 | settype($value, $this->types[$name]); |
| 305 | 305 | $this->properties[$name]->setValue($entity, $value); |
@@ -74,11 +74,9 @@ |
||
| 74 | 74 | $cmp[$k] = static::compare($k, $operator, $v, $subqueryOperator, $listOperator); |
| 75 | 75 | } |
| 76 | 76 | return $cmp; |
| 77 | - } |
|
| 78 | - elseif (is_array($b)) { |
|
| 77 | + } elseif (is_array($b)) { |
|
| 79 | 78 | return "{$a} {$listOperator} (" . implode(',', $b) . ")"; |
| 80 | - } |
|
| 81 | - elseif ($b instanceof Select) { |
|
| 79 | + } elseif ($b instanceof Select) { |
|
| 82 | 80 | return "{$a} {$operator} {$subqueryOperator} ({$b->toSql()})"; |
| 83 | 81 | } |
| 84 | 82 | return "{$a} {$operator} {$b}"; |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | * @param string[] $conditions |
| 18 | 18 | * @return string |
| 19 | 19 | */ |
| 20 | - public static function all (array $conditions): string { |
|
| 20 | + public static function all(array $conditions): string { |
|
| 21 | 21 | if (count($conditions) === 1) { |
| 22 | 22 | return reset($conditions); |
| 23 | 23 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param string[] $conditions |
| 31 | 31 | * @return string |
| 32 | 32 | */ |
| 33 | - public static function any (array $conditions): string { |
|
| 33 | + public static function any(array $conditions): string { |
|
| 34 | 34 | if (count($conditions) === 1) { |
| 35 | 35 | return reset($conditions); |
| 36 | 36 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @param string $listOperator |
| 70 | 70 | * @return string|array |
| 71 | 71 | */ |
| 72 | - public static function compare ($a, $operator, $b = null, $subqueryOperator = null, $listOperator = null) { |
|
| 72 | + public static function compare($a, $operator, $b = null, $subqueryOperator = null, $listOperator = null) { |
|
| 73 | 73 | if (is_array($a)) { |
| 74 | 74 | $cmp = []; |
| 75 | 75 | foreach ($a as $k => $v) { |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param string|array|Select $b |
| 94 | 94 | * @return string|array |
| 95 | 95 | */ |
| 96 | - public static function isEqual ($a, $b = null) { |
|
| 96 | + public static function isEqual($a, $b = null) { |
|
| 97 | 97 | return static::compare($a, '=', $b, 'ANY', 'IN'); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * @param string|Select $b |
| 105 | 105 | * @return string|array |
| 106 | 106 | */ |
| 107 | - public static function isGreater ($a, $b = null) { |
|
| 107 | + public static function isGreater($a, $b = null) { |
|
| 108 | 108 | return static::compare($a, '>', $b, 'ALL'); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @param string|Select $b |
| 116 | 116 | * @return string|array |
| 117 | 117 | */ |
| 118 | - public static function isGreaterOrEqual ($a, $b = null) { |
|
| 118 | + public static function isGreaterOrEqual($a, $b = null) { |
|
| 119 | 119 | return static::compare($a, '>=', $b, 'ALL'); |
| 120 | 120 | } |
| 121 | 121 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @param string|Select $b |
| 127 | 127 | * @return string|array |
| 128 | 128 | */ |
| 129 | - public static function isLess ($a, $b = null) { |
|
| 129 | + public static function isLess($a, $b = null) { |
|
| 130 | 130 | return static::compare($a, '<', $b, 'ALL'); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @param string|Select $b |
| 138 | 138 | * @return string|array |
| 139 | 139 | */ |
| 140 | - public static function isLessOrEqual ($a, $b = null) { |
|
| 140 | + public static function isLessOrEqual($a, $b = null) { |
|
| 141 | 141 | return static::compare($a, '<=', $b, 'ALL'); |
| 142 | 142 | } |
| 143 | 143 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * @param string $pattern |
| 149 | 149 | * @return string|array |
| 150 | 150 | */ |
| 151 | - public static function isLike ($x, string $pattern = null) { |
|
| 151 | + public static function isLike($x, string $pattern = null) { |
|
| 152 | 152 | return static::compare($x, 'LIKE', $pattern); |
| 153 | 153 | } |
| 154 | 154 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @param null|bool $identity |
| 160 | 160 | * @return string|array |
| 161 | 161 | */ |
| 162 | - public static function isNot ($x, $identity) { |
|
| 162 | + public static function isNot($x, $identity) { |
|
| 163 | 163 | return static::compare($x, 'IS NOT', ['' => 'UNKNOWN', 1 => 'TRUE', 0 => 'FALSE'][$identity]); |
| 164 | 164 | } |
| 165 | 165 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * @param string|array|Select $b |
| 171 | 171 | * @return string|array |
| 172 | 172 | */ |
| 173 | - public static function isNotEqual ($a, $b = null) { |
|
| 173 | + public static function isNotEqual($a, $b = null) { |
|
| 174 | 174 | return static::compare($a, '<>', $b, 'ALL', 'NOT IN'); |
| 175 | 175 | } |
| 176 | 176 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * @param string $pattern |
| 182 | 182 | * @return string|array |
| 183 | 183 | */ |
| 184 | - public static function isNotLike ($x, string $pattern = null) { |
|
| 184 | + public static function isNotLike($x, string $pattern = null) { |
|
| 185 | 185 | return static::compare($x, 'NOT LIKE', $pattern); |
| 186 | 186 | } |
| 187 | 187 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @param string|array $x |
| 192 | 192 | * @return string|array |
| 193 | 193 | */ |
| 194 | - public static function isNotNull ($x) { |
|
| 194 | + public static function isNotNull($x) { |
|
| 195 | 195 | if (is_array($x)) { |
| 196 | 196 | return array_map(__METHOD__, $x); |
| 197 | 197 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | * @param string $pattern |
| 206 | 206 | * @return string|array |
| 207 | 207 | */ |
| 208 | - public static function isNotRegExp ($x, string $pattern = null) { |
|
| 208 | + public static function isNotRegExp($x, string $pattern = null) { |
|
| 209 | 209 | return static::compare($x, 'NOT REGEXP', $pattern); |
| 210 | 210 | } |
| 211 | 211 | |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | * @param string $pattern |
| 217 | 217 | * @return string|array |
| 218 | 218 | */ |
| 219 | - public static function isRegExp ($x, string $pattern = null) { |
|
| 219 | + public static function isRegExp($x, string $pattern = null) { |
|
| 220 | 220 | return static::compare($x, 'REGEXP', $pattern); |
| 221 | 221 | } |
| 222 | 222 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | * @param int|array|Countable $count |
| 227 | 227 | * @return string[] |
| 228 | 228 | */ |
| 229 | - public static function marks ($count): array { |
|
| 229 | + public static function marks($count): array { |
|
| 230 | 230 | if (is_array($count) or $count instanceof Countable) { |
| 231 | 231 | $count = count($count); |
| 232 | 232 | } |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | * @param string|array $x |
| 240 | 240 | * @return string|array |
| 241 | 241 | */ |
| 242 | - public static function not ($x) { |
|
| 242 | + public static function not($x) { |
|
| 243 | 243 | if (is_array($x)) { |
| 244 | 244 | return array_map(__METHOD__, $x); |
| 245 | 245 | } |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | * @param string[] $columns |
| 255 | 255 | * @return string[] `[column => :column]` |
| 256 | 256 | */ |
| 257 | - public static function slots (array $columns): array { |
|
| 257 | + public static function slots(array $columns): array { |
|
| 258 | 258 | $slots = []; |
| 259 | 259 | foreach ($columns as $column) { |
| 260 | 260 | $slots[(string)$column] = ':' . str_replace('.', '__', $column); |
@@ -262,6 +262,6 @@ discard block |
||
| 262 | 262 | return $slots; |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - final private function __construct () { } |
|
| 265 | + final private function __construct() { } |
|
| 266 | 266 | |
| 267 | 267 | } |
| 268 | 268 | \ No newline at end of file |
@@ -35,8 +35,7 @@ |
||
| 35 | 35 | $this->interface = $interface; |
| 36 | 36 | try { |
| 37 | 37 | $interface = new ReflectionClass($interface); |
| 38 | - } |
|
| 39 | - catch (ReflectionException $exception) { |
|
| 38 | + } catch (ReflectionException $exception) { |
|
| 40 | 39 | throw new LogicException('Unexpected ReflectionException', 0, $exception); |
| 41 | 40 | } |
| 42 | 41 | $doc = $interface->getDocComment(); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @param DB $db |
| 32 | 32 | * @param string $interface |
| 33 | 33 | */ |
| 34 | - public function __construct (DB $db, string $interface) { |
|
| 34 | + public function __construct(DB $db, string $interface) { |
|
| 35 | 35 | $this->interface = $interface; |
| 36 | 36 | try { |
| 37 | 37 | $interface = new ReflectionClass($interface); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @param EntityInterface $entity |
| 58 | 58 | * @return int |
| 59 | 59 | */ |
| 60 | - public function count (EntityInterface $entity): int { |
|
| 60 | + public function count(EntityInterface $entity): int { |
|
| 61 | 61 | $key = $this->getKey($entity); |
| 62 | 62 | $count = $this->cache("count.{$key}", function() use ($key) { |
| 63 | 63 | return $this->select(['COUNT(*)'])->where("{$key}=:id")->prepare(); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @param string $class |
| 76 | 76 | * @return Select |
| 77 | 77 | */ |
| 78 | - public function getCollection (EntityInterface $owner, string $class): Select { |
|
| 78 | + public function getCollection(EntityInterface $owner, string $class): Select { |
|
| 79 | 79 | $record = $this->db->getRecord($class); |
| 80 | 80 | $select = $record->select(); |
| 81 | 81 | $select->join($this, $this[$class]->isEqual($record['id'])); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | /** |
| 87 | 87 | * @return string |
| 88 | 88 | */ |
| 89 | - final public function getInterface (): string { |
|
| 89 | + final public function getInterface(): string { |
|
| 90 | 90 | return $this->interface; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @param EntityInterface|string $class |
| 97 | 97 | * @return string |
| 98 | 98 | */ |
| 99 | - public function getKey ($class): string { |
|
| 99 | + public function getKey($class): string { |
|
| 100 | 100 | if (is_object($class)) { |
| 101 | 101 | $class = get_class($class); |
| 102 | 102 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * @param EntityInterface[] $entities |
| 115 | 115 | * @return int Rows affected. |
| 116 | 116 | */ |
| 117 | - public function link (array $entities): int { |
|
| 117 | + public function link(array $entities): int { |
|
| 118 | 118 | $apply = []; |
| 119 | 119 | foreach ($entities as $entity) { |
| 120 | 120 | $apply[$this->getKey($entity)] = $entity->getId(); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * @param string $name |
| 129 | 129 | * @return bool |
| 130 | 130 | */ |
| 131 | - public function offsetExists ($name): bool { |
|
| 131 | + public function offsetExists($name): bool { |
|
| 132 | 132 | return isset($this->columns[$name]) or isset($this->columns[$this->keys[$name]]); |
| 133 | 133 | } |
| 134 | 134 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * @param string $name |
| 139 | 139 | * @return Column |
| 140 | 140 | */ |
| 141 | - public function offsetGet ($name): Column { |
|
| 141 | + public function offsetGet($name): Column { |
|
| 142 | 142 | return $this->columns[$name] ?? $this->columns[$this->keys[$name]]; |
| 143 | 143 | } |
| 144 | 144 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * @param EntityInterface[] $entities |
| 152 | 152 | * @return int Rows affected. |
| 153 | 153 | */ |
| 154 | - public function unlink (array $entities): int { |
|
| 154 | + public function unlink(array $entities): int { |
|
| 155 | 155 | $match = []; |
| 156 | 156 | foreach ($entities as $entity) { |
| 157 | 157 | $match[$this->getKey($entity)] = $entity->getId(); |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * Required by PDO, and must be protected. |
| 15 | 15 | */ |
| 16 | - protected function __construct () { } |
|
| 16 | + protected function __construct() { } |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * PHP returns `false` instead of throwing if too many arguments were given. |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @return bool |
| 24 | 24 | * @throws PDOException |
| 25 | 25 | */ |
| 26 | - public function execute ($args = null) { |
|
| 26 | + public function execute($args = null) { |
|
| 27 | 27 | if ($result = !parent::execute($args)) { |
| 28 | 28 | $info = $this->errorInfo(); |
| 29 | 29 | if ($info[0] == 0) { |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param string $name |
| 31 | 31 | * @param string[] $columns |
| 32 | 32 | */ |
| 33 | - public function __construct (DB $db, $name, array $columns) { |
|
| 33 | + public function __construct(DB $db, $name, array $columns) { |
|
| 34 | 34 | parent::__construct($db); |
| 35 | 35 | $this->name = $name; |
| 36 | 36 | foreach ($columns as $column) { |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @return string |
| 45 | 45 | */ |
| 46 | - final public function __toString (): string { |
|
| 46 | + final public function __toString(): string { |
|
| 47 | 47 | return $this->name; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * @param array $values |
| 54 | 54 | * @return int Rows affected. |
| 55 | 55 | */ |
| 56 | - public function apply (array $values): int { |
|
| 56 | + public function apply(array $values): int { |
|
| 57 | 57 | $columns = implode(',', array_keys($values)); |
| 58 | 58 | $values = implode(',', $this->db->quote($values)); |
| 59 | 59 | switch ($this->db->getDriver()) { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * @param array $match |
| 73 | 73 | * @return int Rows affected. |
| 74 | 74 | */ |
| 75 | - public function delete (array $match): int { |
|
| 75 | + public function delete(array $match): int { |
|
| 76 | 76 | $match = SQL::all($this->db->match($match)); |
| 77 | 77 | return $this->db->exec("DELETE FROM {$this} WHERE {$match}"); |
| 78 | 78 | } |
@@ -80,14 +80,14 @@ discard block |
||
| 80 | 80 | /** |
| 81 | 81 | * @return Column[] |
| 82 | 82 | */ |
| 83 | - final public function getColumns (): array { |
|
| 83 | + final public function getColumns(): array { |
|
| 84 | 84 | return $this->columns; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * @return string |
| 89 | 89 | */ |
| 90 | - final public function getName (): string { |
|
| 90 | + final public function getName(): string { |
|
| 91 | 91 | return $this->name; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * @param array $values |
| 98 | 98 | * @return int Insertion ID. |
| 99 | 99 | */ |
| 100 | - public function insert (array $values): int { |
|
| 100 | + public function insert(array $values): int { |
|
| 101 | 101 | $columns = implode(',', array_keys($values)); |
| 102 | 102 | $values = implode(',', $this->db->quote($values)); |
| 103 | 103 | $this->db->exec("INSERT INTO {$this} ($columns) VALUES ($values)"); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * @param string $name |
| 109 | 109 | * @return bool |
| 110 | 110 | */ |
| 111 | - public function offsetExists ($name): bool { |
|
| 111 | + public function offsetExists($name): bool { |
|
| 112 | 112 | return isset($this->columns[$name]); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * @param string $name |
| 117 | 117 | * @return Column |
| 118 | 118 | */ |
| 119 | - public function offsetGet ($name): Column { |
|
| 119 | + public function offsetGet($name): Column { |
|
| 120 | 120 | return $this->columns[$name]; |
| 121 | 121 | } |
| 122 | 122 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @param string[] $columns Defaults to all columns. |
| 127 | 127 | * @return Select |
| 128 | 128 | */ |
| 129 | - public function select (array $columns = []): Select { |
|
| 129 | + public function select(array $columns = []): Select { |
|
| 130 | 130 | if (!$columns) { |
| 131 | 131 | $columns = $this->columns; |
| 132 | 132 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @param string $name |
| 140 | 140 | * @return Table |
| 141 | 141 | */ |
| 142 | - public function setName (string $name) { |
|
| 142 | + public function setName(string $name) { |
|
| 143 | 143 | $clone = clone $this; |
| 144 | 144 | $clone->name = $name; |
| 145 | 145 | foreach ($this->columns as $name => $column) { |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @param array $match |
| 158 | 158 | * @return int Rows affected. |
| 159 | 159 | */ |
| 160 | - public function update (array $values, array $match): int { |
|
| 160 | + public function update(array $values, array $match): int { |
|
| 161 | 161 | $values = implode(', ', SQL::isEqual($this->db->quote($values))); |
| 162 | 162 | $match = SQL::all($this->db->match($match)); |
| 163 | 163 | return $this->db->exec("UPDATE {$this} SET {$values} WHERE {$match}"); |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | * @param Record $record The entity's storage access. |
| 19 | 19 | * @param $name |
| 20 | 20 | */ |
| 21 | - public function __construct (Record $record, $name) { |
|
| 21 | + public function __construct(Record $record, $name) { |
|
| 22 | 22 | $this->record = $record; |
| 23 | 23 | parent::__construct($record->db, $name, ['entity', 'attribute', 'value']); |
| 24 | 24 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param int $id |
| 30 | 30 | * @return int |
| 31 | 31 | */ |
| 32 | - public function count (int $id): int { |
|
| 32 | + public function count(int $id): int { |
|
| 33 | 33 | $count = $this->cache(__FUNCTION__, function() { |
| 34 | 34 | return $this->select(['COUNT(*)'])->where('entity=?')->prepare(); |
| 35 | 35 | }); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @param string $attribute |
| 45 | 45 | * @return bool |
| 46 | 46 | */ |
| 47 | - public function exists (int $id, string $attribute): bool { |
|
| 47 | + public function exists(int $id, string $attribute): bool { |
|
| 48 | 48 | $exists = $this->cache(__FUNCTION__, function() { |
| 49 | 49 | return $this->select(['COUNT(*) > 0'])->where('entity=:e AND attribute=:a')->prepare(); |
| 50 | 50 | }); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @param array $match `[attribute => value]`. If empty, selects all IDs for entities having at least one attribute. |
| 62 | 62 | * @return Select |
| 63 | 63 | */ |
| 64 | - public function find (array $match): Select { |
|
| 64 | + public function find(array $match): Select { |
|
| 65 | 65 | $select = $this->select([$this['entity']]); |
| 66 | 66 | $prior = $this; |
| 67 | 67 | foreach ($match as $attribute => $value) { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * @param int $id |
| 84 | 84 | * @return array `[attribute => value]` |
| 85 | 85 | */ |
| 86 | - public function load (int $id): array { |
|
| 86 | + public function load(int $id): array { |
|
| 87 | 87 | $load = $this->cache(__FUNCTION__, function() { |
| 88 | 88 | return $this->select(['attribute', 'value'])->where('entity=?')->prepare(); |
| 89 | 89 | }); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * @param int[] $ids |
| 98 | 98 | * @return array[] `[id => attribute => value] |
| 99 | 99 | */ |
| 100 | - public function loadAll (array $ids): array { |
|
| 100 | + public function loadAll(array $ids): array { |
|
| 101 | 101 | if (count($ids) === 1) { |
| 102 | 102 | return [current($ids) => $this->load(current($ids))]; |
| 103 | 103 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @param array $values `[attribute => value]` |
| 119 | 119 | * @return $this |
| 120 | 120 | */ |
| 121 | - public function save (int $id, array $values) { |
|
| 121 | + public function save(int $id, array $values) { |
|
| 122 | 122 | $this->delete([ |
| 123 | 123 | $this['entity']->isEqual($id), |
| 124 | 124 | $this['attribute']->isNotEqual(array_keys($values)) |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param string $name |
| 30 | 30 | * @param string $qualifier |
| 31 | 31 | */ |
| 32 | - public function __construct (DB $db, string $name, string $qualifier = '') { |
|
| 32 | + public function __construct(DB $db, string $name, string $qualifier = '') { |
|
| 33 | 33 | parent::__construct($db); |
| 34 | 34 | $this->name = $name; |
| 35 | 35 | $this->qualifier = $qualifier; |
@@ -40,21 +40,21 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @return string |
| 42 | 42 | */ |
| 43 | - public function __toString (): string { |
|
| 43 | + public function __toString(): string { |
|
| 44 | 44 | return strlen($this->qualifier) ? "{$this->qualifier}.{$this->name}" : $this->name; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * @return string |
| 49 | 49 | */ |
| 50 | - final public function getName (): string { |
|
| 50 | + final public function getName(): string { |
|
| 51 | 51 | return $this->name; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | 55 | * @return string |
| 56 | 56 | */ |
| 57 | - final public function getQualifier (): string { |
|
| 57 | + final public function getQualifier(): string { |
|
| 58 | 58 | return $this->qualifier; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @param null|bool|string|Select $arg |
| 68 | 68 | * @return string |
| 69 | 69 | */ |
| 70 | - public function is ($arg): string { |
|
| 70 | + public function is($arg): string { |
|
| 71 | 71 | if ($arg === null or is_bool($arg)) { |
| 72 | 72 | $arg = ['' => 'NULL', 1 => 'TRUE', 0 => 'FALSE'][$arg]; |
| 73 | 73 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * @param string|array|Select $arg |
| 82 | 82 | * @return string |
| 83 | 83 | */ |
| 84 | - public function isEqual ($arg): string { |
|
| 84 | + public function isEqual($arg): string { |
|
| 85 | 85 | return SQL::isEqual($this, $this->db->quote($arg)); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * @param string|Select $arg |
| 92 | 92 | * @return string |
| 93 | 93 | */ |
| 94 | - public function isGreater ($arg): string { |
|
| 94 | + public function isGreater($arg): string { |
|
| 95 | 95 | return SQL::isGreater($this, $this->db->quote($arg)); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * @param string|Select $arg |
| 102 | 102 | * @return string |
| 103 | 103 | */ |
| 104 | - public function isGreaterOrEqual ($arg): string { |
|
| 104 | + public function isGreaterOrEqual($arg): string { |
|
| 105 | 105 | return SQL::isGreaterOrEqual($this, $this->db->quote($arg)); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * @param string|Select $arg |
| 112 | 112 | * @return string |
| 113 | 113 | */ |
| 114 | - public function isLess ($arg): string { |
|
| 114 | + public function isLess($arg): string { |
|
| 115 | 115 | return SQL::isLess($this, $this->db->quote($arg)); |
| 116 | 116 | } |
| 117 | 117 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * @param string|Select $arg |
| 122 | 122 | * @return string |
| 123 | 123 | */ |
| 124 | - public function isLessOrEqual ($arg): string { |
|
| 124 | + public function isLessOrEqual($arg): string { |
|
| 125 | 125 | return SQL::isLessOrEqual($this, $this->db->quote($arg)); |
| 126 | 126 | } |
| 127 | 127 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * @param string $pattern |
| 132 | 132 | * @return string |
| 133 | 133 | */ |
| 134 | - public function isLike (string $pattern): string { |
|
| 134 | + public function isLike(string $pattern): string { |
|
| 135 | 135 | return SQL::isLike($this, $this->db->quote($pattern)); |
| 136 | 136 | } |
| 137 | 137 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @param null|bool|string|Select $arg |
| 144 | 144 | * @return string |
| 145 | 145 | */ |
| 146 | - public function isNot ($arg): string { |
|
| 146 | + public function isNot($arg): string { |
|
| 147 | 147 | return SQL::not($this->is($this->db->quote($arg))); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * @param string|array|Select $arg |
| 154 | 154 | * @return string |
| 155 | 155 | */ |
| 156 | - public function isNotEqual ($arg): string { |
|
| 156 | + public function isNotEqual($arg): string { |
|
| 157 | 157 | return SQL::isNotEqual($this, $this->db->quote($arg)); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * @param string $pattern |
| 164 | 164 | * @return string |
| 165 | 165 | */ |
| 166 | - public function isNotLike (string $pattern): string { |
|
| 166 | + public function isNotLike(string $pattern): string { |
|
| 167 | 167 | return SQL::isNotLike($this, $this->db->quote($pattern)); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * |
| 173 | 173 | * @return string |
| 174 | 174 | */ |
| 175 | - public function isNotNull (): string { |
|
| 175 | + public function isNotNull(): string { |
|
| 176 | 176 | return SQL::isNotNull($this); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * @param string $pattern |
| 183 | 183 | * @return string |
| 184 | 184 | */ |
| 185 | - public function isNotRegExp (string $pattern): string { |
|
| 185 | + public function isNotRegExp(string $pattern): string { |
|
| 186 | 186 | return SQL::isNotRegExp($this, $this->db->quote($pattern)); |
| 187 | 187 | } |
| 188 | 188 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | * @param string $pattern |
| 193 | 193 | * @return string |
| 194 | 194 | */ |
| 195 | - public function isRegExp (string $pattern): string { |
|
| 195 | + public function isRegExp(string $pattern): string { |
|
| 196 | 196 | return SQL::isRegExp($this, $this->db->quote($pattern)); |
| 197 | 197 | } |
| 198 | 198 | |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | * @param string $name |
| 201 | 201 | * @return $this |
| 202 | 202 | */ |
| 203 | - public function setName (string $name) { |
|
| 203 | + public function setName(string $name) { |
|
| 204 | 204 | $clone = clone $this; |
| 205 | 205 | $clone->name = $name; |
| 206 | 206 | return $clone; |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * @param string $qualifier |
| 211 | 211 | * @return $this |
| 212 | 212 | */ |
| 213 | - public function setQualifier (string $qualifier) { |
|
| 213 | + public function setQualifier(string $qualifier) { |
|
| 214 | 214 | $clone = clone $this; |
| 215 | 215 | $clone->qualifier = $qualifier; |
| 216 | 216 | return $clone; |
@@ -70,8 +70,7 @@ |
||
| 70 | 70 | public function is ($arg): string { |
| 71 | 71 | if ($arg === null or is_bool($arg)) { |
| 72 | 72 | $arg = ['' => 'NULL', 1 => 'TRUE', 0 => 'FALSE'][$arg]; |
| 73 | - } |
|
| 74 | - else { |
|
| 73 | + } else { |
|
| 75 | 74 | $arg = $this->db->quote($arg); |
| 76 | 75 | } |
| 77 | 76 | $operator = ['mysql' => '<=>', 'sqlite' => 'IS'][$this->db->getDriver()]; |