@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * @param string $aggregate `ALL|DISTINCT` |
| 21 | 21 | * @return Numeric |
| 22 | 22 | */ |
| 23 | - public function getAvg ($aggregate = 'ALL') { |
|
| 23 | + public function getAvg($aggregate = 'ALL') { |
|
| 24 | 24 | return new Numeric($this->db, "AVG({$aggregate} {$this})"); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param string $delimiter |
| 31 | 31 | * @return Text |
| 32 | 32 | */ |
| 33 | - public function getConcat (string $delimiter = ',') { |
|
| 33 | + public function getConcat(string $delimiter = ',') { |
|
| 34 | 34 | $delimiter = $this->db->quote($delimiter); |
| 35 | 35 | switch ($this->db->getDriver()) { |
| 36 | 36 | case 'sqlite': |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * @param string $aggregate `ALL|DISTINCT` |
| 47 | 47 | * @return Numeric |
| 48 | 48 | */ |
| 49 | - public function getCount ($aggregate = 'ALL') { |
|
| 49 | + public function getCount($aggregate = 'ALL') { |
|
| 50 | 50 | return new Numeric($this->db, "COUNT({$aggregate} {$this})"); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * |
| 56 | 56 | * @return Numeric |
| 57 | 57 | */ |
| 58 | - public function getMax () { |
|
| 58 | + public function getMax() { |
|
| 59 | 59 | return new Numeric($this->db, "MAX({$this})"); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return Numeric |
| 66 | 66 | */ |
| 67 | - public function getMin () { |
|
| 67 | + public function getMin() { |
|
| 68 | 68 | return new Numeric($this->db, "MIN({$this})"); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @param string $aggregate `ALL|DISTINCT` |
| 75 | 75 | * @return Numeric |
| 76 | 76 | */ |
| 77 | - public function getSum ($aggregate = 'ALL') { |
|
| 77 | + public function getSum($aggregate = 'ALL') { |
|
| 78 | 78 | return new Numeric($this->db, "SUM({$aggregate} {$this})"); |
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | \ No newline at end of file |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | * @param string[] $conditions |
| 18 | 18 | * @return Predicate |
| 19 | 19 | */ |
| 20 | - public static function all (array $conditions) { |
|
| 20 | + public static function all(array $conditions) { |
|
| 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 Predicate |
| 32 | 32 | */ |
| 33 | - public static function any (array $conditions) { |
|
| 33 | + public static function any(array $conditions) { |
|
| 34 | 34 | if (count($conditions) === 1) { |
| 35 | 35 | return reset($conditions); |
| 36 | 36 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @param string $listOper |
| 58 | 58 | * @return Predicate |
| 59 | 59 | */ |
| 60 | - public static function compare ($a, $b, $oper = '=', $subOper = 'ANY', $listOper = 'IN') { |
|
| 60 | + public static function compare($a, $b, $oper = '=', $subOper = 'ANY', $listOper = 'IN') { |
|
| 61 | 61 | if (is_array($b)) { |
| 62 | 62 | return new static("{$a} {$listOper} (" . implode(',', $b) . ")"); |
| 63 | 63 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * @param string $listOper |
| 80 | 80 | * @return Predicate[] |
| 81 | 81 | */ |
| 82 | - public static function compareArray (array $values, $oper = '=', $subOper = 'ANY', $listOper = 'IN') { |
|
| 82 | + public static function compareArray(array $values, $oper = '=', $subOper = 'ANY', $listOper = 'IN') { |
|
| 83 | 83 | foreach ($values as $a => $b) { |
| 84 | 84 | $values[$a] = static::compare($a, $b, $oper, $subOper, $listOper); |
| 85 | 85 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * |
| 92 | 92 | * @return Predicate |
| 93 | 93 | */ |
| 94 | - public function invert () { |
|
| 94 | + public function invert() { |
|
| 95 | 95 | return new static("NOT({$this})"); |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | \ No newline at end of file |
@@ -60,8 +60,7 @@ |
||
| 60 | 60 | public static function compare ($a, $b, $oper = '=', $subOper = 'ANY', $listOper = 'IN') { |
| 61 | 61 | if (is_array($b)) { |
| 62 | 62 | return new static("{$a} {$listOper} (" . implode(',', $b) . ")"); |
| 63 | - } |
|
| 64 | - elseif ($b instanceof Select) { |
|
| 63 | + } elseif ($b instanceof Select) { |
|
| 65 | 64 | return new static("{$a} {$oper} {$subOper} ({$b->toSql()})"); |
| 66 | 65 | } |
| 67 | 66 | return new static("{$a} {$oper} {$b}"); |
@@ -173,8 +173,7 @@ discard block |
||
| 173 | 173 | public function group (string $column) { |
| 174 | 174 | if (!strlen($this->_group)) { |
| 175 | 175 | $this->_group = " GROUP BY {$column}"; |
| 176 | - } |
|
| 177 | - else { |
|
| 176 | + } else { |
|
| 178 | 177 | $this->_group .= ", {$column}"; |
| 179 | 178 | } |
| 180 | 179 | return $this; |
@@ -189,8 +188,7 @@ discard block |
||
| 189 | 188 | public function having (string $condition) { |
| 190 | 189 | if (!strlen($this->_having)) { |
| 191 | 190 | $this->_having = " HAVING {$condition}"; |
| 192 | - } |
|
| 193 | - else { |
|
| 191 | + } else { |
|
| 194 | 192 | $this->_having .= " AND {$condition}"; |
| 195 | 193 | } |
| 196 | 194 | return $this; |
@@ -222,8 +220,7 @@ discard block |
||
| 222 | 220 | public function limit (int $limit, int $offset = 0) { |
| 223 | 221 | if ($limit == 0) { |
| 224 | 222 | $this->_limit = ''; |
| 225 | - } |
|
| 226 | - else { |
|
| 223 | + } else { |
|
| 227 | 224 | $this->_limit = " LIMIT {$limit}"; |
| 228 | 225 | if ($offset > 1) { |
| 229 | 226 | $this->_limit .= " OFFSET {$offset}"; |
@@ -314,8 +311,7 @@ discard block |
||
| 314 | 311 | public function where (string $condition) { |
| 315 | 312 | if (!strlen($this->_where)) { |
| 316 | 313 | $this->_where = " WHERE {$condition}"; |
| 317 | - } |
|
| 318 | - else { |
|
| 314 | + } else { |
|
| 319 | 315 | $this->_where .= " AND {$condition}"; |
| 320 | 316 | } |
| 321 | 317 | return $this; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @param string|Select $table |
| 75 | 75 | * @param string[] $columns |
| 76 | 76 | */ |
| 77 | - public function __construct (DB $db, $table, array $columns) { |
|
| 77 | + public function __construct(DB $db, $table, array $columns) { |
|
| 78 | 78 | parent::__construct($db); |
| 79 | 79 | if ($table instanceof Select) { |
| 80 | 80 | $table = $table->toSubquery(); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | /** |
| 97 | 97 | * Gives the clone a new alias. |
| 98 | 98 | */ |
| 99 | - public function __clone () { |
|
| 99 | + public function __clone() { |
|
| 100 | 100 | $this->alias = uniqid('_') . "__{$this->table}"; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * @param array $args |
| 105 | 105 | * @return Statement |
| 106 | 106 | */ |
| 107 | - public function __invoke (array $args = []) { |
|
| 107 | + public function __invoke(array $args = []) { |
|
| 108 | 108 | return $this->execute($args); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @return string |
| 115 | 115 | */ |
| 116 | - final public function __toString () { |
|
| 116 | + final public function __toString() { |
|
| 117 | 117 | return $this->alias; |
| 118 | 118 | } |
| 119 | 119 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * @param array $args Execution arguments. |
| 124 | 124 | * @return int |
| 125 | 125 | */ |
| 126 | - public function count (array $args = []): int { |
|
| 126 | + public function count(array $args = []): int { |
|
| 127 | 127 | $clone = clone $this; |
| 128 | 128 | $clone->_columns = 'COUNT(*)'; |
| 129 | 129 | return (int)$clone->execute($args)->fetchColumn(); |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * @param array $args |
| 136 | 136 | * @return Statement |
| 137 | 137 | */ |
| 138 | - public function execute (array $args = []) { |
|
| 138 | + public function execute(array $args = []) { |
|
| 139 | 139 | if (empty($args)) { |
| 140 | 140 | return $this->db->query($this->toSql()); |
| 141 | 141 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * @param array $args Execution arguments. |
| 151 | 151 | * @return array |
| 152 | 152 | */ |
| 153 | - public function fetchAll (array $args = []): array { |
|
| 153 | + public function fetchAll(array $args = []): array { |
|
| 154 | 154 | return iterator_to_array($this->fetcher->__invoke($this->execute($args))); |
| 155 | 155 | } |
| 156 | 156 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * @param array $args Execution arguments. |
| 164 | 164 | * @return Generator |
| 165 | 165 | */ |
| 166 | - public function fetchEach (array $args = []) { |
|
| 166 | + public function fetchEach(array $args = []) { |
|
| 167 | 167 | yield from $this->fetcher->__invoke($this->execute($args)); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * |
| 175 | 175 | * @return Generator |
| 176 | 176 | */ |
| 177 | - public function getIterator () { |
|
| 177 | + public function getIterator() { |
|
| 178 | 178 | yield from $this->fetchEach(); |
| 179 | 179 | } |
| 180 | 180 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | * @param string $column |
| 185 | 185 | * @return $this |
| 186 | 186 | */ |
| 187 | - public function group (string $column) { |
|
| 187 | + public function group(string $column) { |
|
| 188 | 188 | if (!strlen($this->_group)) { |
| 189 | 189 | $this->_group = " GROUP BY {$column}"; |
| 190 | 190 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | * @param string $condition |
| 201 | 201 | * @return $this |
| 202 | 202 | */ |
| 203 | - public function having (string $condition) { |
|
| 203 | + public function having(string $condition) { |
|
| 204 | 204 | if (!strlen($this->_having)) { |
| 205 | 205 | $this->_having = " HAVING {$condition}"; |
| 206 | 206 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | * |
| 216 | 216 | * @return Predicate |
| 217 | 217 | */ |
| 218 | - public function isCorrelated () { |
|
| 218 | + public function isCorrelated() { |
|
| 219 | 219 | return new Predicate("EXISTS ({$this->toSql()})"); |
| 220 | 220 | } |
| 221 | 221 | |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | * |
| 225 | 225 | * @return Predicate |
| 226 | 226 | */ |
| 227 | - public function isNotCorrelated () { |
|
| 227 | + public function isNotCorrelated() { |
|
| 228 | 228 | return new Predicate("NOT EXISTS ({$this->toSql()}"); |
| 229 | 229 | } |
| 230 | 230 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @param string $type |
| 237 | 237 | * @return $this |
| 238 | 238 | */ |
| 239 | - public function join ($table, string $condition, string $type = 'INNER') { |
|
| 239 | + public function join($table, string $condition, string $type = 'INNER') { |
|
| 240 | 240 | if ($table instanceof Select) { |
| 241 | 241 | $table = $table->toSubquery(); |
| 242 | 242 | } |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | * @param int $offset |
| 252 | 252 | * @return $this |
| 253 | 253 | */ |
| 254 | - public function limit (int $limit, int $offset = 0) { |
|
| 254 | + public function limit(int $limit, int $offset = 0) { |
|
| 255 | 255 | if ($limit == 0) { |
| 256 | 256 | $this->_limit = ''; |
| 257 | 257 | } |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | * @param string $name Name or alias if used. |
| 271 | 271 | * @return bool |
| 272 | 272 | */ |
| 273 | - public function offsetExists ($name): bool { |
|
| 273 | + public function offsetExists($name): bool { |
|
| 274 | 274 | return true; |
| 275 | 275 | } |
| 276 | 276 | |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | * @param string $name Name, or alias if used. |
| 281 | 281 | * @return Column |
| 282 | 282 | */ |
| 283 | - public function offsetGet ($name) { |
|
| 283 | + public function offsetGet($name) { |
|
| 284 | 284 | return new Column($this->db, $name, $this->alias); |
| 285 | 285 | } |
| 286 | 286 | |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | * @param string $order |
| 291 | 291 | * @return $this |
| 292 | 292 | */ |
| 293 | - public function order (string $order) { |
|
| 293 | + public function order(string $order) { |
|
| 294 | 294 | if (strlen($order)) { |
| 295 | 295 | $order = " ORDER BY {$order}"; |
| 296 | 296 | } |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | /** |
| 302 | 302 | * @return Statement |
| 303 | 303 | */ |
| 304 | - public function prepare () { |
|
| 304 | + public function prepare() { |
|
| 305 | 305 | return $this->db->prepare($this->toSql()); |
| 306 | 306 | } |
| 307 | 307 | |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | * @param Closure $fetcher |
| 310 | 310 | * @return $this |
| 311 | 311 | */ |
| 312 | - public function setFetcher (Closure $fetcher) { |
|
| 312 | + public function setFetcher(Closure $fetcher) { |
|
| 313 | 313 | $this->fetcher = $fetcher; |
| 314 | 314 | return $this; |
| 315 | 315 | } |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | /** |
| 318 | 318 | * @return string |
| 319 | 319 | */ |
| 320 | - public function toSql (): string { |
|
| 320 | + public function toSql(): string { |
|
| 321 | 321 | $sql = "SELECT {$this->_columns} FROM {$this->table}"; |
| 322 | 322 | $sql .= $this->_join; |
| 323 | 323 | $sql .= $this->_where; |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | * |
| 334 | 334 | * @return string |
| 335 | 335 | */ |
| 336 | - public function toSubquery (): string { |
|
| 336 | + public function toSubquery(): string { |
|
| 337 | 337 | return "({$this->toSql()}) AS {$this->alias}"; |
| 338 | 338 | } |
| 339 | 339 | |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | * @param string $condition |
| 344 | 344 | * @return $this |
| 345 | 345 | */ |
| 346 | - public function where (string $condition) { |
|
| 346 | + public function where(string $condition) { |
|
| 347 | 347 | if (!strlen($this->_where)) { |
| 348 | 348 | $this->_where = " WHERE {$condition}"; |
| 349 | 349 | } |
@@ -31,8 +31,7 @@ |
||
| 31 | 31 | public static function fromInterface (DB $db, string $interface) { |
| 32 | 32 | try { |
| 33 | 33 | $ref = new ReflectionClass($interface); |
| 34 | - } |
|
| 35 | - catch (ReflectionException $exception) { |
|
| 34 | + } catch (ReflectionException $exception) { |
|
| 36 | 35 | throw new LogicException('Unexpected ReflectionException', 0, $exception); |
| 37 | 36 | } |
| 38 | 37 | $doc = $ref->getDocComment(); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param string $interface |
| 30 | 30 | * @return Junction |
| 31 | 31 | */ |
| 32 | - public static function fromInterface (DB $db, string $interface) { |
|
| 32 | + public static function fromInterface(DB $db, string $interface) { |
|
| 33 | 33 | try { |
| 34 | 34 | $ref = new ReflectionClass($interface); |
| 35 | 35 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @param string $table |
| 53 | 53 | * @param Record[] $records |
| 54 | 54 | */ |
| 55 | - public function __construct (DB $db, string $table, array $records) { |
|
| 55 | + public function __construct(DB $db, string $table, array $records) { |
|
| 56 | 56 | parent::__construct($db, $table, array_keys($records)); |
| 57 | 57 | $this->records = $records; |
| 58 | 58 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * @param array $match |
| 67 | 67 | * @return Select |
| 68 | 68 | */ |
| 69 | - public function getCollection (string $key, array $match = []) { |
|
| 69 | + public function getCollection(string $key, array $match = []) { |
|
| 70 | 70 | $record = $this->records[$key]; |
| 71 | 71 | $select = $record->select(); |
| 72 | 72 | $select->join($this, $this[$key]->isEqual($record['id'])); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * @param int[] $ids Keyed by column. |
| 83 | 83 | * @return int Rows affected. |
| 84 | 84 | */ |
| 85 | - public function link (array $ids): int { |
|
| 85 | + public function link(array $ids): int { |
|
| 86 | 86 | $link = $this->cache(__FUNCTION__, function() { |
| 87 | 87 | $columns = implode(',', array_keys($this->columns)); |
| 88 | 88 | $slots = implode(',', SQL::slots(array_keys($this->columns))); |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | * @param DB $db |
| 15 | 15 | * @param $name |
| 16 | 16 | */ |
| 17 | - public function __construct (DB $db, $name) { |
|
| 17 | + public function __construct(DB $db, $name) { |
|
| 18 | 18 | parent::__construct($db, $name, ['entity', 'attribute', 'value']); |
| 19 | 19 | } |
| 20 | 20 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @param string $attribute |
| 26 | 26 | * @return bool |
| 27 | 27 | */ |
| 28 | - public function exists (int $id, string $attribute): bool { |
|
| 28 | + public function exists(int $id, string $attribute): bool { |
|
| 29 | 29 | $exists = $this->cache(__FUNCTION__, function() { |
| 30 | 30 | $select = $this->select(['COUNT(*) > 0']); |
| 31 | 31 | $select->where('entity = ? AND attribute = ?'); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * @param array $match `[attribute => value]`. If empty, selects all IDs for entities having at least one attribute. |
| 44 | 44 | * @return Select |
| 45 | 45 | */ |
| 46 | - public function find (array $match) { |
|
| 46 | + public function find(array $match) { |
|
| 47 | 47 | $select = $this->select([$this['entity']]); |
| 48 | 48 | $prior = $this; |
| 49 | 49 | foreach ($match as $attribute => $value) { |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @param int $id |
| 66 | 66 | * @return array `[attribute => value]` |
| 67 | 67 | */ |
| 68 | - public function load (int $id): array { |
|
| 68 | + public function load(int $id): array { |
|
| 69 | 69 | $load = $this->cache(__FUNCTION__, function() { |
| 70 | 70 | $select = $this->select(['attribute', 'value']); |
| 71 | 71 | $select->where('entity = ?'); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * @param int[] $ids |
| 82 | 82 | * @return array[] `[id => attribute => value] |
| 83 | 83 | */ |
| 84 | - public function loadAll (array $ids): array { |
|
| 84 | + public function loadAll(array $ids): array { |
|
| 85 | 85 | if (empty($ids)) { |
| 86 | 86 | return []; |
| 87 | 87 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * @param array $values `[attribute => value]` |
| 107 | 107 | * @return $this |
| 108 | 108 | */ |
| 109 | - public function save (int $id, array $values) { |
|
| 109 | + public function save(int $id, array $values) { |
|
| 110 | 110 | $this->delete([ |
| 111 | 111 | $this['entity']->isEqual($id), |
| 112 | 112 | $this['attribute']->isNotEqual(array_keys($values)) |
@@ -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 | foreach ($columns as $column) { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @return string |
| 54 | 54 | */ |
| 55 | - final public function __toString () { |
|
| 55 | + final public function __toString() { |
|
| 56 | 56 | return $this->name; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @param array $values |
| 63 | 63 | * @return int Rows affected. |
| 64 | 64 | */ |
| 65 | - public function apply (array $values): int { |
|
| 65 | + public function apply(array $values): int { |
|
| 66 | 66 | $columns = implode(',', array_keys($values)); |
| 67 | 67 | $values = implode(', ', $this->db->quoteArray($values)); |
| 68 | 68 | if ($this->db->getDriver() === 'sqlite') { |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @param Closure $prepare `():Statement` |
| 79 | 79 | * @return Statement |
| 80 | 80 | */ |
| 81 | - protected function cache (string $key, Closure $prepare) { |
|
| 81 | + protected function cache(string $key, Closure $prepare) { |
|
| 82 | 82 | return $this->_cache[$key] ?? $this->_cache[$key] = $prepare->__invoke(); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @param array $match |
| 87 | 87 | * @return int |
| 88 | 88 | */ |
| 89 | - public function count (array $match = []) { |
|
| 89 | + public function count(array $match = []) { |
|
| 90 | 90 | $select = $this->select(['COUNT(*)']); |
| 91 | 91 | foreach ($this->db->matchArray($match) as $condition) { |
| 92 | 92 | $select->where($condition); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * @param array $match |
| 103 | 103 | * @return int Rows affected. |
| 104 | 104 | */ |
| 105 | - public function delete (array $match): int { |
|
| 105 | + public function delete(array $match): int { |
|
| 106 | 106 | $match = Predicate::all($this->db->matchArray($match)); |
| 107 | 107 | return $this->db->exec("DELETE FROM {$this} WHERE {$match}"); |
| 108 | 108 | } |
@@ -110,14 +110,14 @@ discard block |
||
| 110 | 110 | /** |
| 111 | 111 | * @return Column[] |
| 112 | 112 | */ |
| 113 | - final public function getColumns (): array { |
|
| 113 | + final public function getColumns(): array { |
|
| 114 | 114 | return $this->columns; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | 118 | * @return string |
| 119 | 119 | */ |
| 120 | - final public function getName (): string { |
|
| 120 | + final public function getName(): string { |
|
| 121 | 121 | return $this->name; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * @param array $values |
| 128 | 128 | * @return Statement |
| 129 | 129 | */ |
| 130 | - public function insert (array $values) { |
|
| 130 | + public function insert(array $values) { |
|
| 131 | 131 | $columns = implode(',', array_keys($values)); |
| 132 | 132 | $values = implode(', ', $this->db->quoteArray($values)); |
| 133 | 133 | return $this->db->query("INSERT INTO {$this} ($columns) VALUES ($values)"); |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @param string $name |
| 138 | 138 | * @return bool |
| 139 | 139 | */ |
| 140 | - public function offsetExists ($name): bool { |
|
| 140 | + public function offsetExists($name): bool { |
|
| 141 | 141 | return isset($this->columns[$name]); |
| 142 | 142 | } |
| 143 | 143 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * @param string $name |
| 146 | 146 | * @return Column |
| 147 | 147 | */ |
| 148 | - public function offsetGet ($name) { |
|
| 148 | + public function offsetGet($name) { |
|
| 149 | 149 | return $this->columns[$name]; |
| 150 | 150 | } |
| 151 | 151 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * @param string[] $columns Defaults to all columns. |
| 156 | 156 | * @return Select |
| 157 | 157 | */ |
| 158 | - public function select (array $columns = []) { |
|
| 158 | + public function select(array $columns = []) { |
|
| 159 | 159 | if (!$columns) { |
| 160 | 160 | $columns = array_values($this->columns); |
| 161 | 161 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | * @param string $name |
| 169 | 169 | * @return Table |
| 170 | 170 | */ |
| 171 | - public function setName (string $name) { |
|
| 171 | + public function setName(string $name) { |
|
| 172 | 172 | $clone = clone $this; |
| 173 | 173 | $clone->name = $name; |
| 174 | 174 | foreach ($this->columns as $name => $column) { |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * @param array $match |
| 187 | 187 | * @return int Rows affected. |
| 188 | 188 | */ |
| 189 | - public function update (array $values, array $match): int { |
|
| 189 | + public function update(array $values, array $match): int { |
|
| 190 | 190 | $values = implode(', ', $this->db->matchArray($values)); |
| 191 | 191 | $match = Predicate::all($this->db->matchArray($match)); |
| 192 | 192 | return $this->db->exec("UPDATE {$this} SET {$values} WHERE {$match}"); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * @param string|EntityInterface $class |
| 60 | 60 | * @return Record |
| 61 | 61 | */ |
| 62 | - public static function fromClass (DB $db, $class) { |
|
| 62 | + public static function fromClass(DB $db, $class) { |
|
| 63 | 63 | try { |
| 64 | 64 | $rClass = new ReflectionClass($class); |
| 65 | 65 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * @param string[] $columns Property names. |
| 93 | 93 | * @param EAV[] $eav Keyed by property name. |
| 94 | 94 | */ |
| 95 | - public function __construct (DB $db, EntityInterface $proto, string $table, array $columns, array $eav = []) { |
|
| 95 | + public function __construct(DB $db, EntityInterface $proto, string $table, array $columns, array $eav = []) { |
|
| 96 | 96 | parent::__construct($db, $table, $columns); |
| 97 | 97 | $this->proto = $proto; |
| 98 | 98 | try { |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * @param Statement $statement |
| 126 | 126 | * @return EntityInterface[] Enumerated |
| 127 | 127 | */ |
| 128 | - public function fetchAll (Statement $statement): array { |
|
| 128 | + public function fetchAll(Statement $statement): array { |
|
| 129 | 129 | return iterator_to_array($this->fetchEach($statement)); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * @param Statement $statement |
| 137 | 137 | * @return Generator |
| 138 | 138 | */ |
| 139 | - public function fetchEach (Statement $statement) { |
|
| 139 | + public function fetchEach(Statement $statement) { |
|
| 140 | 140 | do { |
| 141 | 141 | $entities = []; |
| 142 | 142 | for ($i = 0; $i < 256 and false !== $row = $statement->fetch(); $i++) { |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @param array[] $eavMatch Additional `[eav property => attribute => mixed]` |
| 160 | 160 | * @return Select |
| 161 | 161 | */ |
| 162 | - public function find (array $match, array $eavMatch = []) { |
|
| 162 | + public function find(array $match, array $eavMatch = []) { |
|
| 163 | 163 | $select = $this->select(); |
| 164 | 164 | foreach ($this->db->matchArray($match) as $condition) { |
| 165 | 165 | $select->where($condition); |
@@ -175,14 +175,14 @@ discard block |
||
| 175 | 175 | * @param string $property |
| 176 | 176 | * @return EAV |
| 177 | 177 | */ |
| 178 | - final public function getEav (string $property) { |
|
| 178 | + final public function getEav(string $property) { |
|
| 179 | 179 | return $this->eav[$property]; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | /** |
| 183 | 183 | * @return EntityInterface |
| 184 | 184 | */ |
| 185 | - public function getProto () { |
|
| 185 | + public function getProto() { |
|
| 186 | 186 | return $this->proto; |
| 187 | 187 | } |
| 188 | 188 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * @param EntityInterface $entity |
| 191 | 191 | * @return array |
| 192 | 192 | */ |
| 193 | - protected function getValues (EntityInterface $entity): array { |
|
| 193 | + protected function getValues(EntityInterface $entity): array { |
|
| 194 | 194 | $values = []; |
| 195 | 195 | foreach (array_keys($this->columns) as $name) { |
| 196 | 196 | $values[$name] = $this->properties[$name]->getValue($entity); |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @param int $id |
| 205 | 205 | * @return null|EntityInterface |
| 206 | 206 | */ |
| 207 | - public function load (int $id) { |
|
| 207 | + public function load(int $id) { |
|
| 208 | 208 | $load = $this->cache(__FUNCTION__, function() { |
| 209 | 209 | return $this->select(array_keys($this->columns))->where('id = ?')->prepare(); |
| 210 | 210 | }); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | * |
| 223 | 223 | * @param EntityInterface[] $entities |
| 224 | 224 | */ |
| 225 | - protected function loadEav (array $entities): void { |
|
| 225 | + protected function loadEav(array $entities): void { |
|
| 226 | 226 | $ids = array_keys($entities); |
| 227 | 227 | foreach ($this->eav as $name => $eav) { |
| 228 | 228 | foreach ($eav->loadAll($ids) as $id => $values) { |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | * @param EntityInterface $entity |
| 240 | 240 | * @return int ID |
| 241 | 241 | */ |
| 242 | - public function save (EntityInterface $entity): int { |
|
| 242 | + public function save(EntityInterface $entity): int { |
|
| 243 | 243 | if (!$entity->getId()) { |
| 244 | 244 | $this->saveInsert($entity); |
| 245 | 245 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | /** |
| 254 | 254 | * @param EntityInterface $entity |
| 255 | 255 | */ |
| 256 | - protected function saveEav (EntityInterface $entity): void { |
|
| 256 | + protected function saveEav(EntityInterface $entity): void { |
|
| 257 | 257 | $id = $entity->getId(); |
| 258 | 258 | foreach ($this->eav as $name => $eav) { |
| 259 | 259 | $values = $this->properties[$name]->getValue($entity); |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | * |
| 269 | 269 | * @param EntityInterface $entity |
| 270 | 270 | */ |
| 271 | - protected function saveInsert (EntityInterface $entity): void { |
|
| 271 | + protected function saveInsert(EntityInterface $entity): void { |
|
| 272 | 272 | $insert = $this->cache(__FUNCTION__, function() { |
| 273 | 273 | $slots = SQL::slots(array_keys($this->columns)); |
| 274 | 274 | unset($slots['id']); |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | * |
| 287 | 287 | * @param EntityInterface $entity |
| 288 | 288 | */ |
| 289 | - protected function saveUpdate (EntityInterface $entity): void { |
|
| 289 | + protected function saveUpdate(EntityInterface $entity): void { |
|
| 290 | 290 | $this->cache(__FUNCTION__, function() { |
| 291 | 291 | $slots = SQL::slotsEqual(array_keys($this->columns)); |
| 292 | 292 | unset($slots['id']); |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | * @param array $columns Defaults to all columns. |
| 302 | 302 | * @return Select |
| 303 | 303 | */ |
| 304 | - public function select (array $columns = []) { |
|
| 304 | + public function select(array $columns = []) { |
|
| 305 | 305 | return parent::select($columns)->setFetcher(function(Statement $statement) { |
| 306 | 306 | yield from $this->fetchEach($statement); |
| 307 | 307 | }); |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | * @param EntityInterface $proto |
| 312 | 312 | * @return $this |
| 313 | 313 | */ |
| 314 | - public function setProto (EntityInterface $proto) { |
|
| 314 | + public function setProto(EntityInterface $proto) { |
|
| 315 | 315 | $this->proto = $proto; |
| 316 | 316 | return $this; |
| 317 | 317 | } |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | * @param EntityInterface $entity |
| 321 | 321 | * @param array $values |
| 322 | 322 | */ |
| 323 | - protected function setValues (EntityInterface $entity, array $values): void { |
|
| 323 | + protected function setValues(EntityInterface $entity, array $values): void { |
|
| 324 | 324 | foreach ($values as $name => $value) { |
| 325 | 325 | settype($value, $this->types[$name]); |
| 326 | 326 | $this->properties[$name]->setValue($entity, $value); |
@@ -62,8 +62,7 @@ discard block |
||
| 62 | 62 | public static function fromClass (DB $db, $class) { |
| 63 | 63 | try { |
| 64 | 64 | $rClass = new ReflectionClass($class); |
| 65 | - } |
|
| 66 | - catch (ReflectionException $exception) { |
|
| 65 | + } catch (ReflectionException $exception) { |
|
| 67 | 66 | throw new LogicException('Unexpected ReflectionException', 0, $exception); |
| 68 | 67 | } |
| 69 | 68 | $columns = []; |
@@ -73,8 +72,7 @@ discard block |
||
| 73 | 72 | $name = $rProp->getName(); |
| 74 | 73 | if (preg_match('/@col(umn)?[\s$]/', $doc)) { |
| 75 | 74 | $columns[] = $name; |
| 76 | - } |
|
| 77 | - elseif (preg_match('/@eav\s+(?<table>\S+)/', $doc, $attr)) { |
|
| 75 | + } elseif (preg_match('/@eav\s+(?<table>\S+)/', $doc, $attr)) { |
|
| 78 | 76 | $eav[$name] = new EAV($db, $attr['table']); |
| 79 | 77 | } |
| 80 | 78 | } |
@@ -113,8 +111,7 @@ discard block |
||
| 113 | 111 | $rProp->setAccessible(true); |
| 114 | 112 | $this->properties[$name] = $rProp; |
| 115 | 113 | } |
| 116 | - } |
|
| 117 | - catch (ReflectionException $exception) { |
|
| 114 | + } catch (ReflectionException $exception) { |
|
| 118 | 115 | throw new LogicException('Unexpected ReflectionException', 0, $exception); |
| 119 | 116 | } |
| 120 | 117 | } |
@@ -242,8 +239,7 @@ discard block |
||
| 242 | 239 | public function save (EntityInterface $entity): int { |
| 243 | 240 | if (!$entity->getId()) { |
| 244 | 241 | $this->saveInsert($entity); |
| 245 | - } |
|
| 246 | - else { |
|
| 242 | + } else { |
|
| 247 | 243 | $this->saveUpdate($entity); |
| 248 | 244 | } |
| 249 | 245 | $this->saveEav($entity); |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | /** |
| 20 | 20 | * @param DB $db |
| 21 | 21 | */ |
| 22 | - public function __construct (DB $db) { |
|
| 22 | + public function __construct(DB $db) { |
|
| 23 | 23 | $this->db = $db; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -28,19 +28,19 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @return string |
| 30 | 30 | */ |
| 31 | - abstract public function __toString (); |
|
| 31 | + abstract public function __toString(); |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * @param string $name |
| 35 | 35 | * @return bool |
| 36 | 36 | */ |
| 37 | - abstract public function offsetExists ($name): bool; |
|
| 37 | + abstract public function offsetExists($name): bool; |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * @param string $name |
| 41 | 41 | * @return Column |
| 42 | 42 | */ |
| 43 | - abstract public function offsetGet ($name); |
|
| 43 | + abstract public function offsetGet($name); |
|
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * Throws. |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @param void $value |
| 50 | 50 | * @throws Exception |
| 51 | 51 | */ |
| 52 | - final public function offsetSet ($name, $value): void { |
|
| 52 | + final public function offsetSet($name, $value): void { |
|
| 53 | 53 | throw new Exception('Tables are immutable.'); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * @param void $name |
| 60 | 60 | * @throws Exception |
| 61 | 61 | */ |
| 62 | - final public function offsetUnset ($name): void { |
|
| 62 | + final public function offsetUnset($name): void { |
|
| 63 | 63 | $this->offsetSet($name, null); |
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | \ No newline at end of file |
@@ -196,8 +196,7 @@ |
||
| 196 | 196 | public function offsetSet ($class, $access) { |
| 197 | 197 | if ($access instanceof Record) { |
| 198 | 198 | $this->setRecord($class, $access); |
| 199 | - } |
|
| 200 | - else { |
|
| 199 | + } else { |
|
| 201 | 200 | $this->setJunction($class, $access); |
| 202 | 201 | } |
| 203 | 202 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @param string $passwd |
| 53 | 53 | * @param array $options |
| 54 | 54 | */ |
| 55 | - public function __construct ($dsn, $username = null, $passwd = null, $options = null) { |
|
| 55 | + public function __construct($dsn, $username = null, $passwd = null, $options = null) { |
|
| 56 | 56 | parent::__construct($dsn, $username, $passwd, $options); |
| 57 | 57 | $this->driver = $this->getAttribute(self::ATTR_DRIVER_NAME); |
| 58 | 58 | $this->setAttribute(self::ATTR_DEFAULT_FETCH_MODE, self::FETCH_ASSOC); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @param string $sql |
| 75 | 75 | * @return int |
| 76 | 76 | */ |
| 77 | - public function exec ($sql): int { |
|
| 77 | + public function exec($sql): int { |
|
| 78 | 78 | $this->logger->__invoke($sql); |
| 79 | 79 | return parent::exec($sql); |
| 80 | 80 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | /** |
| 83 | 83 | * @return string |
| 84 | 84 | */ |
| 85 | - final public function getDriver (): string { |
|
| 85 | + final public function getDriver(): string { |
|
| 86 | 86 | return $this->driver; |
| 87 | 87 | } |
| 88 | 88 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * @param string $interface |
| 93 | 93 | * @return Junction |
| 94 | 94 | */ |
| 95 | - public function getJunction ($interface) { |
|
| 95 | + public function getJunction($interface) { |
|
| 96 | 96 | if (!isset($this->junctions[$interface])) { |
| 97 | 97 | $this->junctions[$interface] = Junction::fromInterface($this, $interface); |
| 98 | 98 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | /** |
| 103 | 103 | * @return Closure |
| 104 | 104 | */ |
| 105 | - public function getLogger () { |
|
| 105 | + public function getLogger() { |
|
| 106 | 106 | return $this->logger; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * @param string|EntityInterface $class |
| 113 | 113 | * @return Record |
| 114 | 114 | */ |
| 115 | - public function getRecord ($class) { |
|
| 115 | + public function getRecord($class) { |
|
| 116 | 116 | $name = $class; |
| 117 | 117 | if (is_object($name)) { |
| 118 | 118 | $name = get_class($name); |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @param mixed $b |
| 138 | 138 | * @return string |
| 139 | 139 | */ |
| 140 | - public function match ($a, $b) { |
|
| 140 | + public function match($a, $b) { |
|
| 141 | 141 | if ($b instanceof Closure) { |
| 142 | 142 | if (!$a instanceof Column) { |
| 143 | 143 | $a = new Column($this, $a); |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * @param array $match |
| 164 | 164 | * @return string[] |
| 165 | 165 | */ |
| 166 | - public function matchArray (array $match) { |
|
| 166 | + public function matchArray(array $match) { |
|
| 167 | 167 | return array_map([$this, 'match'], array_keys($match), $match); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @param string $class Class or interface name. |
| 172 | 172 | * @return bool |
| 173 | 173 | */ |
| 174 | - public function offsetExists ($class): bool { |
|
| 174 | + public function offsetExists($class): bool { |
|
| 175 | 175 | return (bool)$this->offsetGet($class); |
| 176 | 176 | } |
| 177 | 177 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | * @param string $class Class or interface name. |
| 180 | 180 | * @return null|Record|Junction |
| 181 | 181 | */ |
| 182 | - public function offsetGet ($class) { |
|
| 182 | + public function offsetGet($class) { |
|
| 183 | 183 | if (class_exists($class)) { |
| 184 | 184 | return $this->getRecord($class); |
| 185 | 185 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | * @param string $class Class or interface name. |
| 194 | 194 | * @param Record|Junction $access |
| 195 | 195 | */ |
| 196 | - public function offsetSet ($class, $access) { |
|
| 196 | + public function offsetSet($class, $access) { |
|
| 197 | 197 | if ($access instanceof Record) { |
| 198 | 198 | $this->setRecord($class, $access); |
| 199 | 199 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | /** |
| 206 | 206 | * @param string $class Class or interface name. |
| 207 | 207 | */ |
| 208 | - public function offsetUnset ($class) { |
|
| 208 | + public function offsetUnset($class) { |
|
| 209 | 209 | unset($this->records[$class]); |
| 210 | 210 | unset($this->junctions[$class]); |
| 211 | 211 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * @param array $options |
| 218 | 218 | * @return Statement |
| 219 | 219 | */ |
| 220 | - public function prepare ($sql, $options = []) { |
|
| 220 | + public function prepare($sql, $options = []) { |
|
| 221 | 221 | $this->logger->__invoke($sql); |
| 222 | 222 | /** @var Statement $statement */ |
| 223 | 223 | $statement = parent::prepare($sql, $options); |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @param array $ctorargs |
| 234 | 234 | * @return Statement |
| 235 | 235 | */ |
| 236 | - public function query ($sql, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []) { |
|
| 236 | + public function query($sql, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []) { |
|
| 237 | 237 | $this->logger->__invoke($sql); |
| 238 | 238 | /** @var Statement $statement */ |
| 239 | 239 | $statement = parent::query(...func_get_args()); |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * @param int $type Ignored. |
| 253 | 253 | * @return string |
| 254 | 254 | */ |
| 255 | - public function quote ($value, $type = null) { |
|
| 255 | + public function quote($value, $type = null) { |
|
| 256 | 256 | if ($value instanceof ExpressionInterface) { |
| 257 | 257 | return $value; |
| 258 | 258 | } |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * @param array $values |
| 273 | 273 | * @return string[] |
| 274 | 274 | */ |
| 275 | - public function quoteArray (array $values): array { |
|
| 275 | + public function quoteArray(array $values): array { |
|
| 276 | 276 | return array_map([$this, 'quote'], $values); |
| 277 | 277 | } |
| 278 | 278 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * @param mixed $value |
| 283 | 283 | * @return string|string[] |
| 284 | 284 | */ |
| 285 | - public function quoteMixed ($value) { |
|
| 285 | + public function quoteMixed($value) { |
|
| 286 | 286 | if (is_array($value)) { |
| 287 | 287 | return $this->quoteArray($value); |
| 288 | 288 | } |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | * @param EntityInterface $entity |
| 296 | 296 | * @return int ID |
| 297 | 297 | */ |
| 298 | - public function save (EntityInterface $entity): int { |
|
| 298 | + public function save(EntityInterface $entity): int { |
|
| 299 | 299 | return $this->getRecord($entity)->save($entity); |
| 300 | 300 | } |
| 301 | 301 | |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | * @param Junction $junction |
| 305 | 305 | * @return $this |
| 306 | 306 | */ |
| 307 | - public function setJunction (string $interface, Junction $junction) { |
|
| 307 | + public function setJunction(string $interface, Junction $junction) { |
|
| 308 | 308 | $this->junctions[$interface] = $junction; |
| 309 | 309 | return $this; |
| 310 | 310 | } |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | * @param Closure $logger |
| 314 | 314 | * @return $this |
| 315 | 315 | */ |
| 316 | - public function setLogger (Closure $logger) { |
|
| 316 | + public function setLogger(Closure $logger) { |
|
| 317 | 317 | $this->logger = $logger; |
| 318 | 318 | return $this; |
| 319 | 319 | } |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | * @param Record $record |
| 324 | 324 | * @return $this |
| 325 | 325 | */ |
| 326 | - public function setRecord (string $class, Record $record) { |
|
| 326 | + public function setRecord(string $class, Record $record) { |
|
| 327 | 327 | $this->records[$class] = $record; |
| 328 | 328 | return $this; |
| 329 | 329 | } |