@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | /** |
| 28 | 28 | * @param DB $db |
| 29 | 29 | */ |
| 30 | - public function __construct (DB $db) { |
|
| 30 | + public function __construct(DB $db) { |
|
| 31 | 31 | $this->db = $db; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @return string |
| 38 | 38 | */ |
| 39 | - abstract public function __toString (); |
|
| 39 | + abstract public function __toString(); |
|
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * Caches a prepared query. |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param Closure $prepare `():Statement` |
| 46 | 46 | * @return Statement |
| 47 | 47 | */ |
| 48 | - protected function cache (string $key, Closure $prepare): Statement { |
|
| 48 | + protected function cache(string $key, Closure $prepare): Statement { |
|
| 49 | 49 | return $this->_cache[$key] ?? $this->_cache[$key] = $prepare->__invoke(); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -53,13 +53,13 @@ discard block |
||
| 53 | 53 | * @param string $name |
| 54 | 54 | * @return bool |
| 55 | 55 | */ |
| 56 | - abstract public function offsetExists ($name): bool; |
|
| 56 | + abstract public function offsetExists($name): bool; |
|
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * @param string $name |
| 60 | 60 | * @return Column |
| 61 | 61 | */ |
| 62 | - abstract public function offsetGet ($name): Column; |
|
| 62 | + abstract public function offsetGet($name): Column; |
|
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * Throws. |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @param void $value |
| 69 | 69 | * @throws Exception |
| 70 | 70 | */ |
| 71 | - final public function offsetSet ($name, $value): void { |
|
| 71 | + final public function offsetSet($name, $value): void { |
|
| 72 | 72 | throw new Exception('Tables are immutable.'); |
| 73 | 73 | } |
| 74 | 74 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @param void $name |
| 79 | 79 | * @throws Exception |
| 80 | 80 | */ |
| 81 | - final public function offsetUnset ($name): void { |
|
| 81 | + final public function offsetUnset($name): void { |
|
| 82 | 82 | $this->offsetSet($name, null); |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | \ No newline at end of file |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @param DB $db |
| 63 | 63 | * @param string $class |
| 64 | 64 | */ |
| 65 | - public function __construct (DB $db, string $class) { |
|
| 65 | + public function __construct(DB $db, string $class) { |
|
| 66 | 66 | $this->class = $class; |
| 67 | 67 | try { |
| 68 | 68 | $class = new ReflectionClass($class); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * @param Statement $statement |
| 106 | 106 | * @return EntityInterface[] Enumerated |
| 107 | 107 | */ |
| 108 | - public function fetchAll (Statement $statement): array { |
|
| 108 | + public function fetchAll(Statement $statement): array { |
|
| 109 | 109 | $entities = []; |
| 110 | 110 | foreach ($statement->fetchAll() as $row) { |
| 111 | 111 | $clone = clone $this->proto; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * @param array[] $eavMatch Additional `[eav property => attribute => mixed]` |
| 126 | 126 | * @return Select |
| 127 | 127 | */ |
| 128 | - public function find (array $match, array $eavMatch = []): Select { |
|
| 128 | + public function find(array $match, array $eavMatch = []): Select { |
|
| 129 | 129 | $select = $this->select(); |
| 130 | 130 | foreach ($match as $column => $value) { |
| 131 | 131 | $select->where($this->db->match($column, $value)); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | /** |
| 141 | 141 | * @return string |
| 142 | 142 | */ |
| 143 | - final public function getClass (): string { |
|
| 143 | + final public function getClass(): string { |
|
| 144 | 144 | return $this->class; |
| 145 | 145 | } |
| 146 | 146 | |
@@ -148,14 +148,14 @@ discard block |
||
| 148 | 148 | * @param string $property |
| 149 | 149 | * @return EAV |
| 150 | 150 | */ |
| 151 | - final public function getEav (string $property): EAV { |
|
| 151 | + final public function getEav(string $property): EAV { |
|
| 152 | 152 | return $this->eav[$property]; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
| 156 | 156 | * @return EntityInterface |
| 157 | 157 | */ |
| 158 | - public function getProto (): EntityInterface { |
|
| 158 | + public function getProto(): EntityInterface { |
|
| 159 | 159 | return $this->proto; |
| 160 | 160 | } |
| 161 | 161 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * @param EntityInterface $entity |
| 164 | 164 | * @return array |
| 165 | 165 | */ |
| 166 | - protected function getValues (EntityInterface $entity): array { |
|
| 166 | + protected function getValues(EntityInterface $entity): array { |
|
| 167 | 167 | $values = []; |
| 168 | 168 | foreach (array_keys($this->columns) as $name) { |
| 169 | 169 | $values[$name] = $this->properties[$name]->getValue($entity); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | * @param int $id |
| 178 | 178 | * @return null|EntityInterface |
| 179 | 179 | */ |
| 180 | - public function load (int $id): ?EntityInterface { |
|
| 180 | + public function load(int $id): ?EntityInterface { |
|
| 181 | 181 | $load = $this->cache(__FUNCTION__, function() { |
| 182 | 182 | return $this->select(array_keys($this->columns))->where('id = ?')->prepare(); |
| 183 | 183 | }); |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * |
| 196 | 196 | * @param EntityInterface[] $entities |
| 197 | 197 | */ |
| 198 | - protected function loadEav (array $entities): void { |
|
| 198 | + protected function loadEav(array $entities): void { |
|
| 199 | 199 | $ids = array_keys($entities); |
| 200 | 200 | foreach ($this->eav as $name => $eav) { |
| 201 | 201 | foreach ($eav->loadAll($ids) as $id => $values) { |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * @param EntityInterface $entity |
| 211 | 211 | * @return int ID |
| 212 | 212 | */ |
| 213 | - public function save (EntityInterface $entity): int { |
|
| 213 | + public function save(EntityInterface $entity): int { |
|
| 214 | 214 | if (!$entity->getId()) { |
| 215 | 215 | $this->saveInsert($entity); |
| 216 | 216 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | /** |
| 225 | 225 | * @param EntityInterface $entity |
| 226 | 226 | */ |
| 227 | - protected function saveEav (EntityInterface $entity): void { |
|
| 227 | + protected function saveEav(EntityInterface $entity): void { |
|
| 228 | 228 | $id = $entity->getId(); |
| 229 | 229 | foreach ($this->eav as $name => $eav) { |
| 230 | 230 | $values = $this->properties[$name]->getValue($entity); |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | * |
| 240 | 240 | * @param EntityInterface $entity |
| 241 | 241 | */ |
| 242 | - protected function saveInsert (EntityInterface $entity): void { |
|
| 242 | + protected function saveInsert(EntityInterface $entity): void { |
|
| 243 | 243 | $insert = $this->cache(__FUNCTION__, function() { |
| 244 | 244 | $slots = SQL::slots(array_keys($this->columns)); |
| 245 | 245 | unset($slots['id']); |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | * |
| 258 | 258 | * @param EntityInterface $entity |
| 259 | 259 | */ |
| 260 | - protected function saveUpdate (EntityInterface $entity): void { |
|
| 260 | + protected function saveUpdate(EntityInterface $entity): void { |
|
| 261 | 261 | $this->cache(__FUNCTION__, function() { |
| 262 | 262 | $slots = SQL::slotsEqual(array_keys($this->columns)); |
| 263 | 263 | unset($slots['id']); |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * @param array $columns Defaults to all columns. |
| 273 | 273 | * @return Select |
| 274 | 274 | */ |
| 275 | - public function select (array $columns = []): Select { |
|
| 275 | + public function select(array $columns = []): Select { |
|
| 276 | 276 | return parent::select($columns)->setFetcher(function(Statement $statement) { |
| 277 | 277 | return $this->fetchAll($statement); |
| 278 | 278 | }); |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * @param EntityInterface $proto |
| 283 | 283 | * @return $this |
| 284 | 284 | */ |
| 285 | - public function setProto (EntityInterface $proto) { |
|
| 285 | + public function setProto(EntityInterface $proto) { |
|
| 286 | 286 | $this->proto = $proto; |
| 287 | 287 | return $this; |
| 288 | 288 | } |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | * @param EntityInterface $entity |
| 292 | 292 | * @param array $values |
| 293 | 293 | */ |
| 294 | - protected function setValues (EntityInterface $entity, array $values): void { |
|
| 294 | + protected function setValues(EntityInterface $entity, array $values): void { |
|
| 295 | 295 | foreach ($values as $name => $value) { |
| 296 | 296 | settype($value, $this->types[$name]); |
| 297 | 297 | $this->properties[$name]->setValue($entity, $value); |
@@ -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 = null, $oper = '=', $subOper = 'ANY', $listOper = 'IN') { |
|
| 60 | + public static function compare($a, $b = null, $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 |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * |
| 20 | 20 | * @return Text |
| 21 | 21 | */ |
| 22 | - public function getDate () { |
|
| 22 | + public function getDate() { |
|
| 23 | 23 | return new Text($this->db, $this->getDateTimeFormat('%Y-%m-%d')); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param string|array $format Format, or formats keyed by driver name. |
| 30 | 30 | * @return Text |
| 31 | 31 | */ |
| 32 | - public function getDateTimeFormat ($format) { |
|
| 32 | + public function getDateTimeFormat($format) { |
|
| 33 | 33 | if (is_array($format)) { |
| 34 | 34 | $format = $format[$this->db->getDriver()]; |
| 35 | 35 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @return Numeric |
| 50 | 50 | */ |
| 51 | - public function getDay () { |
|
| 51 | + public function getDay() { |
|
| 52 | 52 | return new Numeric($this->db, $this->getDateTimeFormat('%d')); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return Numeric |
| 59 | 59 | */ |
| 60 | - public function getDayOfWeek () { |
|
| 60 | + public function getDayOfWeek() { |
|
| 61 | 61 | return new Numeric($this->db, $this->getDateTimeFormat('%w')); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @return Numeric |
| 68 | 68 | */ |
| 69 | - public function getDayOfYear () { |
|
| 69 | + public function getDayOfYear() { |
|
| 70 | 70 | return new Numeric($this->db, $this->getDateTimeFormat('%j')); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @return Numeric |
| 77 | 77 | */ |
| 78 | - public function getHours () { |
|
| 78 | + public function getHours() { |
|
| 79 | 79 | return new Numeric($this->db, $this->getDateTimeFormat('%H')); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * |
| 85 | 85 | * @return Numeric |
| 86 | 86 | */ |
| 87 | - public function getMinutes () { |
|
| 87 | + public function getMinutes() { |
|
| 88 | 88 | return new Numeric($this->db, $this->getDateTimeFormat([ |
| 89 | 89 | 'mysql' => '%i', |
| 90 | 90 | 'sqlite' => '%M' |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * |
| 97 | 97 | * @return Numeric |
| 98 | 98 | */ |
| 99 | - public function getMonth () { |
|
| 99 | + public function getMonth() { |
|
| 100 | 100 | return new Numeric($this->db, $this->getDateTimeFormat('%m')); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * |
| 106 | 106 | * @return Numeric |
| 107 | 107 | */ |
| 108 | - public function getSeconds () { |
|
| 108 | + public function getSeconds() { |
|
| 109 | 109 | return new Numeric($this->db, $this->getDateTimeFormat('%S')); |
| 110 | 110 | } |
| 111 | 111 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * |
| 115 | 115 | * @return Text |
| 116 | 116 | */ |
| 117 | - public function getTime () { |
|
| 117 | + public function getTime() { |
|
| 118 | 118 | return new Text($this->db, $this->getDateTimeFormat([ |
| 119 | 119 | 'mysql' => '%H:%i:%S', |
| 120 | 120 | 'sqlite' => '%H:%M:%S' |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * |
| 127 | 127 | * @return Numeric |
| 128 | 128 | */ |
| 129 | - public function getTimestamp () { |
|
| 129 | + public function getTimestamp() { |
|
| 130 | 130 | switch ($this->db->getDriver()) { |
| 131 | 131 | case 'sqlite': |
| 132 | 132 | return new Numeric($this->db, "STRFTIME('%s',{$this})"); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @return Numeric |
| 142 | 142 | */ |
| 143 | - public function getWeekOfYear () { |
|
| 143 | + public function getWeekOfYear() { |
|
| 144 | 144 | return new Numeric($this->db, $this->getDateTimeFormat([ |
| 145 | 145 | 'mysql' => '%U', |
| 146 | 146 | 'sqlite' => '%W' |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | * |
| 153 | 153 | * @return Numeric |
| 154 | 154 | */ |
| 155 | - public function getYear () { |
|
| 155 | + public function getYear() { |
|
| 156 | 156 | return new Numeric($this->db, $this->getDateTimeFormat('%Y')); |
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | \ No newline at end of file |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * |
| 20 | 20 | * @return Numeric |
| 21 | 21 | */ |
| 22 | - public function abs () { |
|
| 22 | + public function abs() { |
|
| 23 | 23 | return new Numeric($this->db, "ABS({$this})"); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param number|ExpressionInterface $arg |
| 30 | 30 | * @return Numeric |
| 31 | 31 | */ |
| 32 | - public function add ($arg) { |
|
| 32 | + public function add($arg) { |
|
| 33 | 33 | return new Numeric($this->db, "({$this} + {$arg})"); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @return Numeric |
| 40 | 40 | */ |
| 41 | - public function ceil () { |
|
| 41 | + public function ceil() { |
|
| 42 | 42 | return new Numeric($this->db, "CEIL({$this})"); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param number|ExpressionInterface $arg |
| 49 | 49 | * @return Numeric |
| 50 | 50 | */ |
| 51 | - public function divide ($arg) { |
|
| 51 | + public function divide($arg) { |
|
| 52 | 52 | return new Numeric($this->db, "({$this} / {$arg})"); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return Numeric |
| 59 | 59 | */ |
| 60 | - public function floor () { |
|
| 60 | + public function floor() { |
|
| 61 | 61 | return new Numeric($this->db, "FLOOR({$this})"); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @return Predicate |
| 68 | 68 | */ |
| 69 | - public function isEven () { |
|
| 69 | + public function isEven() { |
|
| 70 | 70 | return new Predicate("({$this} % 2) = 0"); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @return Predicate |
| 77 | 77 | */ |
| 78 | - public function isNegative () { |
|
| 78 | + public function isNegative() { |
|
| 79 | 79 | return new Predicate("{$this} < 0"); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * |
| 85 | 85 | * @return Predicate |
| 86 | 86 | */ |
| 87 | - public function isOdd () { |
|
| 87 | + public function isOdd() { |
|
| 88 | 88 | return new Predicate("({$this} % 2) <> 0"); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * |
| 94 | 94 | * @return Predicate |
| 95 | 95 | */ |
| 96 | - public function isPositive () { |
|
| 96 | + public function isPositive() { |
|
| 97 | 97 | return new Predicate("{$this} > 0"); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @param number|ExpressionInterface $arg |
| 104 | 104 | * @return Numeric |
| 105 | 105 | */ |
| 106 | - public function modulo ($arg) { |
|
| 106 | + public function modulo($arg) { |
|
| 107 | 107 | return new Numeric($this->db, "({$this} % {$arg})"); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * @param number|ExpressionInterface $arg |
| 114 | 114 | * @return Numeric |
| 115 | 115 | */ |
| 116 | - public function multiply ($arg) { |
|
| 116 | + public function multiply($arg) { |
|
| 117 | 117 | return new Numeric($this->db, "({$this} * {$arg})"); |
| 118 | 118 | } |
| 119 | 119 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * @param int $decimals |
| 124 | 124 | * @return Numeric |
| 125 | 125 | */ |
| 126 | - public function round (int $decimals = 0) { |
|
| 126 | + public function round(int $decimals = 0) { |
|
| 127 | 127 | return new Numeric($this->db, "ROUND({$this},{$decimals})"); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | * @param number|ExpressionInterface $arg |
| 134 | 134 | * @return Numeric |
| 135 | 135 | */ |
| 136 | - public function subtract ($arg) { |
|
| 136 | + public function subtract($arg) { |
|
| 137 | 137 | return new Numeric($this->db, "({$this} - {$arg})"); |
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | \ 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 new Predicate("{$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 new Predicate("{$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 new Predicate("{$this} IS NULL"); |
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | \ No newline at end of file |
@@ -15,14 +15,14 @@ |
||
| 15 | 15 | /** |
| 16 | 16 | * @param string $expression |
| 17 | 17 | */ |
| 18 | - public function __construct (string $expression) { |
|
| 18 | + public function __construct(string $expression) { |
|
| 19 | 19 | $this->expression = $expression; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * @return string |
| 24 | 24 | */ |
| 25 | - public function __toString () { |
|
| 25 | + public function __toString() { |
|
| 26 | 26 | return $this->expression; |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | \ No newline at end of file |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @param null|bool|string|Select $arg |
| 27 | 27 | * @return Predicate |
| 28 | 28 | */ |
| 29 | - public function is ($arg): Predicate { |
|
| 29 | + public function is($arg): Predicate { |
|
| 30 | 30 | if ($arg === null or is_bool($arg)) { |
| 31 | 31 | $arg = ['' => 'NULL', 1 => 'TRUE', 0 => 'FALSE'][$arg]; |
| 32 | 32 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * @param string|array|Select $arg |
| 44 | 44 | * @return Predicate |
| 45 | 45 | */ |
| 46 | - public function isEqual ($arg) { |
|
| 46 | + public function isEqual($arg) { |
|
| 47 | 47 | return Predicate::compare($this, $this->db->quoteMixed($arg)); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * @param string|Select $arg |
| 54 | 54 | * @return Predicate |
| 55 | 55 | */ |
| 56 | - public function isGreater ($arg) { |
|
| 56 | + public function isGreater($arg) { |
|
| 57 | 57 | return Predicate::compare($this, $this->db->quote($arg), '>', 'ALL'); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @param string|Select $arg |
| 64 | 64 | * @return Predicate |
| 65 | 65 | */ |
| 66 | - public function isGreaterOrEqual ($arg) { |
|
| 66 | + public function isGreaterOrEqual($arg) { |
|
| 67 | 67 | return Predicate::compare($this, $this->db->quote($arg), '>=', 'ALL'); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * @param string|Select $arg |
| 74 | 74 | * @return Predicate |
| 75 | 75 | */ |
| 76 | - public function isLess ($arg) { |
|
| 76 | + public function isLess($arg) { |
|
| 77 | 77 | return Predicate::compare($this, $this->db->quote($arg), '<', 'ALL'); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * @param string|Select $arg |
| 84 | 84 | * @return Predicate |
| 85 | 85 | */ |
| 86 | - public function isLessOrEqual ($arg) { |
|
| 86 | + public function isLessOrEqual($arg) { |
|
| 87 | 87 | return Predicate::compare($this, $this->db->quote($arg), '<=', 'ALL'); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param string $pattern |
| 94 | 94 | * @return Predicate |
| 95 | 95 | */ |
| 96 | - public function isLike (string $pattern) { |
|
| 96 | + public function isLike(string $pattern) { |
|
| 97 | 97 | return Predicate::compare($this, $this->db->quote($pattern), 'LIKE'); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @param null|bool|string|Select $arg |
| 104 | 104 | * @return Predicate |
| 105 | 105 | */ |
| 106 | - public function isNot ($arg) { |
|
| 106 | + public function isNot($arg) { |
|
| 107 | 107 | return $this->is($arg)->invert(); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * @param string|array|Select $arg |
| 114 | 114 | * @return Predicate |
| 115 | 115 | */ |
| 116 | - public function isNotEqual ($arg) { |
|
| 116 | + public function isNotEqual($arg) { |
|
| 117 | 117 | return Predicate::compare($this, $this->db->quoteMixed($arg), '<>', 'ALL', 'NOT IN'); |
| 118 | 118 | } |
| 119 | 119 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * @param string $pattern |
| 124 | 124 | * @return Predicate |
| 125 | 125 | */ |
| 126 | - public function isNotLike (string $pattern) { |
|
| 126 | + public function isNotLike(string $pattern) { |
|
| 127 | 127 | return Predicate::compare($this, $this->db->quote($pattern), 'NOT LIKE'); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | * @param string $pattern |
| 134 | 134 | * @return Predicate |
| 135 | 135 | */ |
| 136 | - public function isNotRegExp (string $pattern) { |
|
| 136 | + public function isNotRegExp(string $pattern) { |
|
| 137 | 137 | return Predicate::compare($this, $this->db->quote($pattern), 'NOT REGEXP'); |
| 138 | 138 | } |
| 139 | 139 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @param string $pattern |
| 144 | 144 | * @return Predicate |
| 145 | 145 | */ |
| 146 | - public function isRegExp (string $pattern) { |
|
| 146 | + public function isRegExp(string $pattern) { |
|
| 147 | 147 | return Predicate::compare($this, $this->db->quote($pattern), 'REGEXP'); |
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | \ 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 new Text($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->getDriver()) { |
| 33 | 33 | case 'sqlite': |
| 34 | 34 | return new Numeric($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 new Text($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->getDriver()) { |
| 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 new Text($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->getDriver()) { |
| 87 | 87 | case 'sqlite': |
| 88 | 88 | return new Numeric($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 new Text($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 new Text($this->db, "UPPER({$this})"); |
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | \ No newline at end of file |