@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * @param array $values |
| 29 | 29 | * @return Value |
| 30 | 30 | */ |
| 31 | - public function coalesce (array $values) { |
|
| 31 | + public function coalesce(array $values) { |
|
| 32 | 32 | array_unshift($values, $this); |
| 33 | 33 | $values = $this->db->quoteList($values); |
| 34 | 34 | return new Value($this->db, "COALESCE({$values})"); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * @param array $values `[when => then]` |
| 41 | 41 | * @return Choice |
| 42 | 42 | */ |
| 43 | - public function getChoice (array $values) { |
|
| 43 | + public function getChoice(array $values) { |
|
| 44 | 44 | return new Choice($this->db, "{$this}", $values); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * @param null|bool|number|string|Select $arg |
| 54 | 54 | * @return Predicate |
| 55 | 55 | */ |
| 56 | - public function is ($arg): Predicate { |
|
| 56 | + public function is($arg): Predicate { |
|
| 57 | 57 | $driver = $this->db->getDriver(); |
| 58 | 58 | if ($arg instanceof Select) { |
| 59 | 59 | switch ($driver) { |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * @param number|string $max |
| 82 | 82 | * @return Predicate |
| 83 | 83 | */ |
| 84 | - public function isBetween ($min, $max) { |
|
| 84 | + public function isBetween($min, $max) { |
|
| 85 | 85 | $min = $this->db->quote($min); |
| 86 | 86 | $max = $this->db->quote($max); |
| 87 | 87 | return new Predicate("{$this} BETWEEN {$min} AND {$max}"); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param bool|number|string|array|Select $arg |
| 94 | 94 | * @return Predicate |
| 95 | 95 | */ |
| 96 | - public function isEqual ($arg) { |
|
| 96 | + public function isEqual($arg) { |
|
| 97 | 97 | return $this->db->match($this, $arg); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @param string $multi `ALL|ANY` |
| 110 | 110 | * @return Predicate |
| 111 | 111 | */ |
| 112 | - public function isGreater ($arg, string $multi = 'ALL') { |
|
| 112 | + public function isGreater($arg, string $multi = 'ALL') { |
|
| 113 | 113 | if ($arg instanceof Select) { |
| 114 | 114 | switch ($this->db) { |
| 115 | 115 | case 'sqlite': |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @param string $multi `ALL|ANY` |
| 140 | 140 | * @return Predicate |
| 141 | 141 | */ |
| 142 | - public function isGreaterOrEqual ($arg, string $multi = 'ALL') { |
|
| 142 | + public function isGreaterOrEqual($arg, string $multi = 'ALL') { |
|
| 143 | 143 | if ($arg instanceof Select) { |
| 144 | 144 | switch ($this->db) { |
| 145 | 145 | case 'sqlite': |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * @param string $multi `ALL|ANY` |
| 170 | 170 | * @return Predicate |
| 171 | 171 | */ |
| 172 | - public function isLess ($arg, string $multi = 'ALL') { |
|
| 172 | + public function isLess($arg, string $multi = 'ALL') { |
|
| 173 | 173 | if ($arg instanceof Select) { |
| 174 | 174 | switch ($this->db) { |
| 175 | 175 | case 'sqlite': |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | * @param string $multi `ALL|ANY` |
| 200 | 200 | * @return Predicate |
| 201 | 201 | */ |
| 202 | - public function isLessOrEqual ($arg, string $multi = 'ALL') { |
|
| 202 | + public function isLessOrEqual($arg, string $multi = 'ALL') { |
|
| 203 | 203 | if ($arg instanceof Select) { |
| 204 | 204 | switch ($this->db) { |
| 205 | 205 | case 'sqlite': |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | * @param string $pattern |
| 224 | 224 | * @return Predicate |
| 225 | 225 | */ |
| 226 | - public function isLike (string $pattern) { |
|
| 226 | + public function isLike(string $pattern) { |
|
| 227 | 227 | $pattern = $this->db->quote($pattern); |
| 228 | 228 | return new Predicate("{$this} LIKE {$pattern}"); |
| 229 | 229 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * @param null|bool|number|string|Select $arg |
| 235 | 235 | * @return Predicate |
| 236 | 236 | */ |
| 237 | - public function isNot ($arg) { |
|
| 237 | + public function isNot($arg) { |
|
| 238 | 238 | return $this->is($arg)->invert(); |
| 239 | 239 | } |
| 240 | 240 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | * @param number|string $max |
| 246 | 246 | * @return Predicate |
| 247 | 247 | */ |
| 248 | - public function isNotBetween ($min, $max) { |
|
| 248 | + public function isNotBetween($min, $max) { |
|
| 249 | 249 | $min = $this->db->quote($min); |
| 250 | 250 | $max = $this->db->quote($max); |
| 251 | 251 | return new Predicate("{$this} NOT BETWEEN {$min} AND {$max}"); |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | * @param bool|number|string|array|Select $arg |
| 258 | 258 | * @return Predicate |
| 259 | 259 | */ |
| 260 | - public function isNotEqual ($arg) { |
|
| 260 | + public function isNotEqual($arg) { |
|
| 261 | 261 | if ($arg instanceof Select) { |
| 262 | 262 | return new Predicate("{$this} NOT IN ({$arg->toSql()})"); |
| 263 | 263 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | * @param string $pattern |
| 274 | 274 | * @return Predicate |
| 275 | 275 | */ |
| 276 | - public function isNotLike (string $pattern) { |
|
| 276 | + public function isNotLike(string $pattern) { |
|
| 277 | 277 | $pattern = $this->db->quote($pattern); |
| 278 | 278 | return new Predicate("{$this} NOT LIKE {$pattern}"); |
| 279 | 279 | } |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | * @param string $pattern |
| 285 | 285 | * @return Predicate |
| 286 | 286 | */ |
| 287 | - public function isNotRegExp (string $pattern) { |
|
| 287 | + public function isNotRegExp(string $pattern) { |
|
| 288 | 288 | $pattern = $this->db->quote($pattern); |
| 289 | 289 | return new Predicate("{$this} NOT REGEXP {$pattern}"); |
| 290 | 290 | } |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | * @param string $pattern |
| 296 | 296 | * @return Predicate |
| 297 | 297 | */ |
| 298 | - public function isRegExp (string $pattern) { |
|
| 298 | + public function isRegExp(string $pattern) { |
|
| 299 | 299 | $pattern = $this->db->quote($pattern); |
| 300 | 300 | return new Predicate("{$this} REGEXP {$pattern}"); |
| 301 | 301 | } |
@@ -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 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | * @return Predicate |
| 44 | 44 | */ |
| 45 | - public function invert () { |
|
| 45 | + public function invert() { |
|
| 46 | 46 | return new static("NOT({$this})"); |
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | \ No newline at end of file |
@@ -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 = $this->db->quoteList($values); |
| 68 | 68 | switch ($this->db) { |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @param Closure $prepare `():Statement` |
| 85 | 85 | * @return Statement |
| 86 | 86 | */ |
| 87 | - protected function cache (string $key, Closure $prepare) { |
|
| 87 | + protected function cache(string $key, Closure $prepare) { |
|
| 88 | 88 | return $this->_cache[$key] ?? $this->_cache[$key] = $prepare->__invoke(); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * @param array $match `[a => b]` |
| 93 | 93 | * @return int |
| 94 | 94 | */ |
| 95 | - public function count (array $match = []) { |
|
| 95 | + public function count(array $match = []) { |
|
| 96 | 96 | $select = $this->select(['COUNT(*)']); |
| 97 | 97 | foreach ($match as $a => $b) { |
| 98 | 98 | $select->where($this->db->match($this[$a] ?? $a, $b)); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * @param array $match |
| 109 | 109 | * @return int Rows affected. |
| 110 | 110 | */ |
| 111 | - public function delete (array $match): int { |
|
| 111 | + public function delete(array $match): int { |
|
| 112 | 112 | foreach ($match as $a => $b) { |
| 113 | 113 | $match[$a] = $this->db->match($this[$a] ?? $a, $b); |
| 114 | 114 | } |
@@ -119,14 +119,14 @@ discard block |
||
| 119 | 119 | /** |
| 120 | 120 | * @return Column[] |
| 121 | 121 | */ |
| 122 | - final public function getColumns (): array { |
|
| 122 | + final public function getColumns(): array { |
|
| 123 | 123 | return $this->columns; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | 127 | * @return string |
| 128 | 128 | */ |
| 129 | - final public function getName (): string { |
|
| 129 | + final public function getName(): string { |
|
| 130 | 130 | return $this->name; |
| 131 | 131 | } |
| 132 | 132 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * @param array $values |
| 137 | 137 | * @return Statement |
| 138 | 138 | */ |
| 139 | - public function insert (array $values) { |
|
| 139 | + public function insert(array $values) { |
|
| 140 | 140 | $columns = implode(',', array_keys($values)); |
| 141 | 141 | $values = $this->db->quoteList($values); |
| 142 | 142 | return $this->db->query("INSERT INTO {$this} ($columns) VALUES ($values)"); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * @param string $name |
| 147 | 147 | * @return bool |
| 148 | 148 | */ |
| 149 | - public function offsetExists ($name): bool { |
|
| 149 | + public function offsetExists($name): bool { |
|
| 150 | 150 | return isset($this->columns[$name]); |
| 151 | 151 | } |
| 152 | 152 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * @param string $name |
| 155 | 155 | * @return Column |
| 156 | 156 | */ |
| 157 | - public function offsetGet ($name) { |
|
| 157 | + public function offsetGet($name) { |
|
| 158 | 158 | return $this->columns[$name]; |
| 159 | 159 | } |
| 160 | 160 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | * @param string[] $columns Defaults to all columns. |
| 165 | 165 | * @return Select |
| 166 | 166 | */ |
| 167 | - public function select (array $columns = []) { |
|
| 167 | + public function select(array $columns = []) { |
|
| 168 | 168 | if (empty($columns)) { |
| 169 | 169 | $columns = $this->columns; |
| 170 | 170 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | * @param string $name |
| 178 | 178 | * @return Table |
| 179 | 179 | */ |
| 180 | - public function setName (string $name) { |
|
| 180 | + public function setName(string $name) { |
|
| 181 | 181 | $clone = clone $this; |
| 182 | 182 | $clone->name = $name; |
| 183 | 183 | foreach ($this->columns as $name => $column) { |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * @param array $match |
| 196 | 196 | * @return int Rows affected. |
| 197 | 197 | */ |
| 198 | - public function update (array $values, array $match): int { |
|
| 198 | + public function update(array $values, array $match): int { |
|
| 199 | 199 | foreach ($this->db->quoteArray($values) as $key => $value) { |
| 200 | 200 | $values[$key] = "{$key} = {$value}"; |
| 201 | 201 | } |
@@ -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 { |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * @param array[] $eavMatch `[eav property => attribute => mixed]` |
| 129 | 129 | * @return Select |
| 130 | 130 | */ |
| 131 | - public function find (array $match, array $eavMatch = []) { |
|
| 131 | + public function find(array $match, array $eavMatch = []) { |
|
| 132 | 132 | $select = $this->select(); |
| 133 | 133 | foreach ($match as $a => $b) { |
| 134 | 134 | $select->where($this->db->match($this[$a] ?? $a, $b)); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * @param Statement $statement |
| 147 | 147 | * @return EntityInterface[] Enumerated |
| 148 | 148 | */ |
| 149 | - public function getAll (Statement $statement): array { |
|
| 149 | + public function getAll(Statement $statement): array { |
|
| 150 | 150 | return iterator_to_array($this->getEach($statement)); |
| 151 | 151 | } |
| 152 | 152 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @param Statement $statement |
| 158 | 158 | * @return Generator |
| 159 | 159 | */ |
| 160 | - public function getEach (Statement $statement) { |
|
| 160 | + public function getEach(Statement $statement) { |
|
| 161 | 161 | do { |
| 162 | 162 | $entities = []; |
| 163 | 163 | for ($i = 0; $i < 256 and false !== $row = $statement->fetch(); $i++) { |
@@ -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 | $select = parent::select($columns); |
| 306 | 306 | if (empty($columns)) { |
| 307 | 307 | $select->setFetcher(function(Statement $statement) { |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | * @param EntityInterface $proto |
| 316 | 316 | * @return $this |
| 317 | 317 | */ |
| 318 | - public function setProto (EntityInterface $proto) { |
|
| 318 | + public function setProto(EntityInterface $proto) { |
|
| 319 | 319 | $this->proto = $proto; |
| 320 | 320 | return $this; |
| 321 | 321 | } |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | * @param EntityInterface $entity |
| 325 | 325 | * @param array $values |
| 326 | 326 | */ |
| 327 | - protected function setValues (EntityInterface $entity, array $values): void { |
|
| 327 | + protected function setValues(EntityInterface $entity, array $values): void { |
|
| 328 | 328 | foreach ($values as $name => $value) { |
| 329 | 329 | settype($value, $this->types[$name]); |
| 330 | 330 | $this->properties[$name]->setValue($entity, $value); |
@@ -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); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @return string |
| 75 | 75 | */ |
| 76 | - final public function __toString () { |
|
| 76 | + final public function __toString() { |
|
| 77 | 77 | return $this->driver; |
| 78 | 78 | } |
| 79 | 79 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * @param string $sql |
| 84 | 84 | * @return int |
| 85 | 85 | */ |
| 86 | - public function exec ($sql): int { |
|
| 86 | + public function exec($sql): int { |
|
| 87 | 87 | $this->logger->__invoke($sql); |
| 88 | 88 | return parent::exec($sql); |
| 89 | 89 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | /** |
| 92 | 92 | * @return string |
| 93 | 93 | */ |
| 94 | - final public function getDriver (): string { |
|
| 94 | + final public function getDriver(): string { |
|
| 95 | 95 | return $this->driver; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * @param string $interface |
| 102 | 102 | * @return Junction |
| 103 | 103 | */ |
| 104 | - public function getJunction ($interface) { |
|
| 104 | + public function getJunction($interface) { |
|
| 105 | 105 | if (!isset($this->junctions[$interface])) { |
| 106 | 106 | $this->junctions[$interface] = Junction::fromInterface($this, $interface); |
| 107 | 107 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | /** |
| 112 | 112 | * @return Closure |
| 113 | 113 | */ |
| 114 | - public function getLogger () { |
|
| 114 | + public function getLogger() { |
|
| 115 | 115 | return $this->logger; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * @param string|EntityInterface $class |
| 122 | 122 | * @return Record |
| 123 | 123 | */ |
| 124 | - public function getRecord ($class) { |
|
| 124 | + public function getRecord($class) { |
|
| 125 | 125 | $name = $class; |
| 126 | 126 | if (is_object($name)) { |
| 127 | 127 | $name = get_class($name); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * @param mixed $b |
| 150 | 150 | * @return Predicate |
| 151 | 151 | */ |
| 152 | - public function match ($a, $b) { |
|
| 152 | + public function match($a, $b) { |
|
| 153 | 153 | if ($b instanceof Closure) { |
| 154 | 154 | return $b->__invoke($a, $this); |
| 155 | 155 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * @param string $class Class or interface name. |
| 170 | 170 | * @return bool |
| 171 | 171 | */ |
| 172 | - public function offsetExists ($class): bool { |
|
| 172 | + public function offsetExists($class): bool { |
|
| 173 | 173 | return (bool)$this->offsetGet($class); |
| 174 | 174 | } |
| 175 | 175 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | * @param string $class Class or interface name. |
| 178 | 178 | * @return null|Record|Junction |
| 179 | 179 | */ |
| 180 | - public function offsetGet ($class) { |
|
| 180 | + public function offsetGet($class) { |
|
| 181 | 181 | if (class_exists($class)) { |
| 182 | 182 | return $this->getRecord($class); |
| 183 | 183 | } |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @param string $class Class or interface name. |
| 192 | 192 | * @param Record|Junction $access |
| 193 | 193 | */ |
| 194 | - public function offsetSet ($class, $access) { |
|
| 194 | + public function offsetSet($class, $access) { |
|
| 195 | 195 | if ($access instanceof Record) { |
| 196 | 196 | $this->setRecord($class, $access); |
| 197 | 197 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | /** |
| 204 | 204 | * @param string $class Class or interface name. |
| 205 | 205 | */ |
| 206 | - public function offsetUnset ($class) { |
|
| 206 | + public function offsetUnset($class) { |
|
| 207 | 207 | unset($this->records[$class]); |
| 208 | 208 | unset($this->junctions[$class]); |
| 209 | 209 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | * @param array $options |
| 216 | 216 | * @return Statement |
| 217 | 217 | */ |
| 218 | - public function prepare ($sql, $options = []) { |
|
| 218 | + public function prepare($sql, $options = []) { |
|
| 219 | 219 | $this->logger->__invoke($sql); |
| 220 | 220 | /** @var Statement $statement */ |
| 221 | 221 | $statement = parent::prepare($sql, $options); |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | * @param array $ctorargs |
| 232 | 232 | * @return Statement |
| 233 | 233 | */ |
| 234 | - public function query ($sql, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []) { |
|
| 234 | + public function query($sql, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []) { |
|
| 235 | 235 | $this->logger->__invoke($sql); |
| 236 | 236 | /** @var Statement $statement */ |
| 237 | 237 | $statement = parent::query(...func_get_args()); |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | * @param int $type Ignored. |
| 251 | 251 | * @return string |
| 252 | 252 | */ |
| 253 | - public function quote ($value, $type = null) { |
|
| 253 | + public function quote($value, $type = null) { |
|
| 254 | 254 | if ($value instanceof ExpressionInterface) { |
| 255 | 255 | return $value; |
| 256 | 256 | } |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | * @param array $values |
| 271 | 271 | * @return string[] |
| 272 | 272 | */ |
| 273 | - public function quoteArray (array $values): array { |
|
| 273 | + public function quoteArray(array $values): array { |
|
| 274 | 274 | return array_map([$this, 'quote'], $values); |
| 275 | 275 | } |
| 276 | 276 | |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | * @param array $values |
| 281 | 281 | * @return string |
| 282 | 282 | */ |
| 283 | - public function quoteList (array $values): string { |
|
| 283 | + public function quoteList(array $values): string { |
|
| 284 | 284 | return implode(',', $this->quoteArray($values)); |
| 285 | 285 | } |
| 286 | 286 | |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | * @param EntityInterface $entity |
| 291 | 291 | * @return int ID |
| 292 | 292 | */ |
| 293 | - public function save (EntityInterface $entity): int { |
|
| 293 | + public function save(EntityInterface $entity): int { |
|
| 294 | 294 | return $this->getRecord($entity)->save($entity); |
| 295 | 295 | } |
| 296 | 296 | |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | * @param Junction $junction |
| 300 | 300 | * @return $this |
| 301 | 301 | */ |
| 302 | - public function setJunction (string $interface, Junction $junction) { |
|
| 302 | + public function setJunction(string $interface, Junction $junction) { |
|
| 303 | 303 | $this->junctions[$interface] = $junction; |
| 304 | 304 | return $this; |
| 305 | 305 | } |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | * @param Closure $logger |
| 309 | 309 | * @return $this |
| 310 | 310 | */ |
| 311 | - public function setLogger (Closure $logger) { |
|
| 311 | + public function setLogger(Closure $logger) { |
|
| 312 | 312 | $this->logger = $logger; |
| 313 | 313 | return $this; |
| 314 | 314 | } |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | * @param Record $record |
| 319 | 319 | * @return $this |
| 320 | 320 | */ |
| 321 | - public function setRecord (string $class, Record $record) { |
|
| 321 | + public function setRecord(string $class, Record $record) { |
|
| 322 | 322 | $this->records[$class] = $record; |
| 323 | 323 | return $this; |
| 324 | 324 | } |