@@ -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); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * @param string $name |
| 40 | 40 | * @param string[] $columns |
| 41 | 41 | */ |
| 42 | - public function __construct (DB $db, $name, array $columns) { |
|
| 42 | + public function __construct(DB $db, $name, array $columns) { |
|
| 43 | 43 | parent::__construct($db); |
| 44 | 44 | $this->name = $name; |
| 45 | 45 | asort($columns); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return string |
| 55 | 55 | */ |
| 56 | - final public function __toString () { |
|
| 56 | + final public function __toString() { |
|
| 57 | 57 | return $this->name; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @param array $values |
| 64 | 64 | * @return int Rows affected. |
| 65 | 65 | */ |
| 66 | - public function apply (array $values): int { |
|
| 66 | + public function apply(array $values): int { |
|
| 67 | 67 | $columns = implode(',', array_keys($values)); |
| 68 | 68 | $values = $this->db->quoteList($values); |
| 69 | 69 | switch ($this->db) { |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * @param Closure $prepare `():Statement` |
| 86 | 86 | * @return Statement |
| 87 | 87 | */ |
| 88 | - protected function cache (string $key, Closure $prepare) { |
|
| 88 | + protected function cache(string $key, Closure $prepare) { |
|
| 89 | 89 | return $this->_cache[$key] ?? $this->_cache[$key] = $prepare->__invoke(); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param array $match `[a => b]` |
| 94 | 94 | * @return int |
| 95 | 95 | */ |
| 96 | - public function count (array $match = []) { |
|
| 96 | + public function count(array $match = []) { |
|
| 97 | 97 | $select = $this->select(['COUNT(*)']); |
| 98 | 98 | foreach ($match as $a => $b) { |
| 99 | 99 | $select->where($this->db->match($this[$a] ?? $a, $b)); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @param array $match |
| 110 | 110 | * @return int Rows affected. |
| 111 | 111 | */ |
| 112 | - public function delete (array $match): int { |
|
| 112 | + public function delete(array $match): int { |
|
| 113 | 113 | foreach ($match as $a => $b) { |
| 114 | 114 | $match[$a] = $this->db->match($this[$a] ?? $a, $b); |
| 115 | 115 | } |
@@ -120,14 +120,14 @@ discard block |
||
| 120 | 120 | /** |
| 121 | 121 | * @return Column[] |
| 122 | 122 | */ |
| 123 | - final public function getColumns (): array { |
|
| 123 | + final public function getColumns(): array { |
|
| 124 | 124 | return $this->columns; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
| 128 | 128 | * @return string |
| 129 | 129 | */ |
| 130 | - final public function getName (): string { |
|
| 130 | + final public function getName(): string { |
|
| 131 | 131 | return $this->name; |
| 132 | 132 | } |
| 133 | 133 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @param array $values |
| 138 | 138 | * @return Statement |
| 139 | 139 | */ |
| 140 | - public function insert (array $values) { |
|
| 140 | + public function insert(array $values) { |
|
| 141 | 141 | $columns = implode(',', array_keys($values)); |
| 142 | 142 | $values = $this->db->quoteList($values); |
| 143 | 143 | return $this->db->query("INSERT INTO {$this} ($columns) VALUES ($values)"); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * @param string $name |
| 148 | 148 | * @return bool |
| 149 | 149 | */ |
| 150 | - public function offsetExists ($name): bool { |
|
| 150 | + public function offsetExists($name): bool { |
|
| 151 | 151 | return isset($this->columns[$name]); |
| 152 | 152 | } |
| 153 | 153 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * @param string $name |
| 156 | 156 | * @return Column |
| 157 | 157 | */ |
| 158 | - public function offsetGet ($name) { |
|
| 158 | + public function offsetGet($name) { |
|
| 159 | 159 | return $this->columns[$name]; |
| 160 | 160 | } |
| 161 | 161 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @param string[] $columns Defaults to all columns. |
| 166 | 166 | * @return Select |
| 167 | 167 | */ |
| 168 | - public function select (array $columns = []) { |
|
| 168 | + public function select(array $columns = []) { |
|
| 169 | 169 | if (empty($columns)) { |
| 170 | 170 | $columns = $this->columns; |
| 171 | 171 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * @param string $name |
| 179 | 179 | * @return Table |
| 180 | 180 | */ |
| 181 | - public function setName (string $name) { |
|
| 181 | + public function setName(string $name) { |
|
| 182 | 182 | $clone = clone $this; |
| 183 | 183 | $clone->name = $name; |
| 184 | 184 | foreach ($this->columns as $name => $column) { |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * @param array $match |
| 197 | 197 | * @return int Rows affected. |
| 198 | 198 | */ |
| 199 | - public function update (array $values, array $match): int { |
|
| 199 | + public function update(array $values, array $match): int { |
|
| 200 | 200 | foreach ($this->db->quoteArray($values) as $key => $value) { |
| 201 | 201 | $values[$key] = "{$key} = {$value}"; |
| 202 | 202 | } |
@@ -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 new static(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 new static(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 |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | /** |
| 31 | 31 | * @return array |
| 32 | 32 | */ |
| 33 | - public function getAttributes (): array { |
|
| 33 | + public function getAttributes(): array { |
|
| 34 | 34 | return $this->attributes ?: []; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @param mixed $attr |
| 39 | 39 | * @return bool |
| 40 | 40 | */ |
| 41 | - public function offsetExists ($attr): bool { |
|
| 41 | + public function offsetExists($attr): bool { |
|
| 42 | 42 | return $this->attributes and array_key_exists($attr, $this->attributes); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * @param mixed $attr |
| 47 | 47 | * @return null|mixed |
| 48 | 48 | */ |
| 49 | - public function offsetGet ($attr) { |
|
| 49 | + public function offsetGet($attr) { |
|
| 50 | 50 | return $this->attributes[$attr] ?? null; |
| 51 | 51 | } |
| 52 | 52 | |
@@ -54,14 +54,14 @@ discard block |
||
| 54 | 54 | * @param mixed $attr |
| 55 | 55 | * @param mixed $value |
| 56 | 56 | */ |
| 57 | - public function offsetSet ($attr, $value): void { |
|
| 57 | + public function offsetSet($attr, $value): void { |
|
| 58 | 58 | $this->attributes[$attr] = $value; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * @param mixed $attr |
| 63 | 63 | */ |
| 64 | - public function offsetUnset ($attr): void { |
|
| 64 | + public function offsetUnset($attr): void { |
|
| 65 | 65 | unset($this->attributes[$attr]); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @param array $attributes |
| 70 | 70 | * @return $this |
| 71 | 71 | */ |
| 72 | - public function setAttributes (array $attributes) { |
|
| 72 | + public function setAttributes(array $attributes) { |
|
| 73 | 73 | $this->attributes = $attributes; |
| 74 | 74 | return $this; |
| 75 | 75 | } |
@@ -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 string[] $classes |
| 54 | 54 | */ |
| 55 | - public function __construct (DB $db, string $table, array $classes) { |
|
| 55 | + public function __construct(DB $db, string $table, array $classes) { |
|
| 56 | 56 | parent::__construct($db, $table, array_keys($classes)); |
| 57 | 57 | $this->classes = $classes; |
| 58 | 58 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * @param array $match Keyed by junction column. |
| 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->db->getRecord($this->classes[$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))); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * @param array $ids Keyed by Column |
| 107 | 107 | * @return int Rows affected |
| 108 | 108 | */ |
| 109 | - public function unlink (array $ids): int { |
|
| 109 | + public function unlink(array $ids): int { |
|
| 110 | 110 | return $this->delete($ids); |
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * |
| 13 | 13 | * @return Predicate |
| 14 | 14 | */ |
| 15 | - public function isFalse () { |
|
| 15 | + public function isFalse() { |
|
| 16 | 16 | return $this->db->factory(Predicate::class, "{$this} IS FALSE"); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @return Predicate |
| 23 | 23 | */ |
| 24 | - public function isNotNull () { |
|
| 24 | + public function isNotNull() { |
|
| 25 | 25 | return $this->db->factory(Predicate::class, "{$this} IS NOT NULL"); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @return Predicate |
| 32 | 32 | */ |
| 33 | - public function isNull () { |
|
| 33 | + public function isNull() { |
|
| 34 | 34 | return $this->db->factory(Predicate::class, "{$this} IS NULL"); |
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | \ No newline at end of file |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | * |
| 15 | 15 | * @return Numeric |
| 16 | 16 | */ |
| 17 | - public function toFloat () { |
|
| 17 | + public function toFloat() { |
|
| 18 | 18 | switch ($this->db) { |
| 19 | 19 | case 'sqlite': |
| 20 | 20 | return $this->db->factory(Numeric::class, $this->db, "CAST({$this} AS REAL)"); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @return Numeric |
| 30 | 30 | */ |
| 31 | - public function toInt () { |
|
| 31 | + public function toInt() { |
|
| 32 | 32 | switch ($this->db) { |
| 33 | 33 | case 'sqlite': |
| 34 | 34 | return $this->db->factory(Numeric::class, $this->db, "CAST({$this} AS INTEGER)"); |
@@ -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 $this->db->factory(Numeric::class, $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) { |
| 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 (string $aggregate = 'ALL') { |
|
| 49 | + public function getCount(string $aggregate = 'ALL') { |
|
| 50 | 50 | return $this->db->factory(Numeric::class, $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 $this->db->factory(Numeric::class, $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 $this->db->factory(Numeric::class, $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 (string $aggregate = 'ALL') { |
|
| 77 | + public function getSum(string $aggregate = 'ALL') { |
|
| 78 | 78 | return $this->db->factory(Numeric::class, $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 | /** |
| 18 | 18 | * @return Text |
| 19 | 19 | */ |
| 20 | - public function getHex () { |
|
| 20 | + public function getHex() { |
|
| 21 | 21 | return $this->db->factory(Text::class, $this->db, "HEX({$this})"); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @return Numeric |
| 30 | 30 | */ |
| 31 | - public function getLength () { |
|
| 31 | + public function getLength() { |
|
| 32 | 32 | switch ($this->db) { |
| 33 | 33 | case 'sqlite': |
| 34 | 34 | return $this->db->factory(Numeric::class, $this->db, "LENGTH(CAST({$this} AS TEXT))"); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | * @return Text |
| 44 | 44 | */ |
| 45 | - public function getLower () { |
|
| 45 | + public function getLower() { |
|
| 46 | 46 | return $this->db->factory(Text::class, $this->db, "LOWER({$this})"); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @param string $substring |
| 55 | 55 | * @return Numeric |
| 56 | 56 | */ |
| 57 | - public function getPosition (string $substring) { |
|
| 57 | + public function getPosition(string $substring) { |
|
| 58 | 58 | $substring = $this->db->quote($substring); |
| 59 | 59 | switch ($this->db) { |
| 60 | 60 | case 'sqlite': |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * @param string $replace |
| 72 | 72 | * @return Text |
| 73 | 73 | */ |
| 74 | - public function getReplacement (string $search, string $replace) { |
|
| 74 | + public function getReplacement(string $search, string $replace) { |
|
| 75 | 75 | $search = $this->db->quote($search); |
| 76 | 76 | $replace = $this->db->quote($replace); |
| 77 | 77 | return $this->db->factory(Text::class, $this->db, "REPLACE({$this},{$search},{$replace})"); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * |
| 83 | 83 | * @return Numeric |
| 84 | 84 | */ |
| 85 | - public function getSize () { |
|
| 85 | + public function getSize() { |
|
| 86 | 86 | switch ($this->db) { |
| 87 | 87 | case 'sqlite': |
| 88 | 88 | return $this->db->factory(Numeric::class, $this->db, "LENGTH(CAST({$this} AS BLOB))"); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @param int $length |
| 99 | 99 | * @return Text |
| 100 | 100 | */ |
| 101 | - public function getSubstring (int $start, int $length = null) { |
|
| 101 | + public function getSubstring(int $start, int $length = null) { |
|
| 102 | 102 | if (isset($length)) { |
| 103 | 103 | return $this->db->factory(Text::class, $this->db, "SUBSTR({$this},{$start},{$length})"); |
| 104 | 104 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * |
| 111 | 111 | * @return Text |
| 112 | 112 | */ |
| 113 | - public function getUpper () { |
|
| 113 | + public function getUpper() { |
|
| 114 | 114 | return $this->db->factory(Text::class, $this->db, "UPPER({$this})"); |
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | \ No newline at end of file |