@@ -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(); |
@@ -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; |
@@ -15,19 +15,19 @@ discard block |
||
| 15 | 15 | * |
| 16 | 16 | * @return string |
| 17 | 17 | */ |
| 18 | - abstract public function __toString (): string; |
|
| 18 | + abstract public function __toString(): string; |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * @param string $name |
| 22 | 22 | * @return bool |
| 23 | 23 | */ |
| 24 | - abstract public function offsetExists ($name): bool; |
|
| 24 | + abstract public function offsetExists($name): bool; |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * @param string $name |
| 28 | 28 | * @return Column |
| 29 | 29 | */ |
| 30 | - abstract public function offsetGet ($name): Column; |
|
| 30 | + abstract public function offsetGet($name): Column; |
|
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Throws. |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @param void $value |
| 37 | 37 | * @throws Exception |
| 38 | 38 | */ |
| 39 | - final public function offsetSet ($name, $value): void { |
|
| 39 | + final public function offsetSet($name, $value): void { |
|
| 40 | 40 | throw new Exception('Columns cannot be altered by ArrayAccess.'); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * @param void $name |
| 47 | 47 | * @throws Exception |
| 48 | 48 | */ |
| 49 | - final public function offsetUnset ($name): void { |
|
| 49 | + final public function offsetUnset($name): void { |
|
| 50 | 50 | $this->offsetSet($name, null); |
| 51 | 51 | } |
| 52 | 52 | |