@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param string $interface |
32 | 32 | * @return Junction |
33 | 33 | */ |
34 | - public static function fromInterface (DB $db, string $interface) { |
|
34 | + public static function fromInterface(DB $db, string $interface) { |
|
35 | 35 | try { |
36 | 36 | $ref = new ReflectionClass($interface); |
37 | 37 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param string $table |
55 | 55 | * @param string[] $classes |
56 | 56 | */ |
57 | - public function __construct (DB $db, string $table, array $classes) { |
|
57 | + public function __construct(DB $db, string $table, array $classes) { |
|
58 | 58 | parent::__construct($db, $table, array_keys($classes)); |
59 | 59 | $this->classes = $classes; |
60 | 60 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param array $match Keyed by junction column. |
69 | 69 | * @return Select|EntityInterface[] |
70 | 70 | */ |
71 | - public function find (string $key, array $match = []) { |
|
71 | + public function find(string $key, array $match = []) { |
|
72 | 72 | $record = $this->db->getRecord($this->classes[$key]); |
73 | 73 | $select = $record->loadAll(); |
74 | 74 | $select->join($this, $this[$key]->isEqual($record['id'])); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @param int[] $ids Keyed by column. |
85 | 85 | * @return int Rows affected. |
86 | 86 | */ |
87 | - public function link (array $ids): int { |
|
87 | + public function link(array $ids): int { |
|
88 | 88 | $statement = $this->cache(__FUNCTION__, function() { |
89 | 89 | $columns = implode(',', array_keys($this->columns)); |
90 | 90 | $slots = implode(',', SQL::slots(array_keys($this->columns))); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param array $ids Keyed by Column |
109 | 109 | * @return int Rows affected |
110 | 110 | */ |
111 | - public function unlink (array $ids): int { |
|
111 | + public function unlink(array $ids): int { |
|
112 | 112 | return $this->delete($ids); |
113 | 113 | } |
114 | 114 | } |
115 | 115 | \ No newline at end of file |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @param string|EntityInterface $class |
67 | 67 | * @return Record |
68 | 68 | */ |
69 | - public static function fromClass (DB $db, $class) { |
|
69 | + public static function fromClass(DB $db, $class) { |
|
70 | 70 | return (function() use ($db, $class) { |
71 | 71 | $rClass = new ReflectionClass($class); |
72 | 72 | $columns = []; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param string[] $columns Property names. |
96 | 96 | * @param EAV[] $eav Keyed by property name. |
97 | 97 | */ |
98 | - public function __construct (DB $db, EntityInterface $proto, string $table, array $columns, array $eav = []) { |
|
98 | + public function __construct(DB $db, EntityInterface $proto, string $table, array $columns, array $eav = []) { |
|
99 | 99 | parent::__construct($db, $table, $columns); |
100 | 100 | $this->proto = $proto; |
101 | 101 | (function() use ($proto, $columns, $eav) { |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @param array[] $eavMatch `[eav property => attribute => mixed]` |
133 | 133 | * @return Select|EntityInterface[] |
134 | 134 | */ |
135 | - public function find (array $match, array $eavMatch = []) { |
|
135 | + public function find(array $match, array $eavMatch = []) { |
|
136 | 136 | $select = $this->loadAll(); |
137 | 137 | foreach ($match as $a => $b) { |
138 | 138 | $select->where($this->db->match($this[$a] ?? $a, $b)); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @param Statement $statement |
151 | 151 | * @return EntityInterface[] Keyed by ID |
152 | 152 | */ |
153 | - public function getAll (Statement $statement): array { |
|
153 | + public function getAll(Statement $statement): array { |
|
154 | 154 | return iterator_to_array($this->getEach($statement)); |
155 | 155 | } |
156 | 156 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @param Statement $statement |
162 | 162 | * @return Generator|EntityInterface[] Keyed by ID |
163 | 163 | */ |
164 | - public function getEach (Statement $statement) { |
|
164 | + public function getEach(Statement $statement) { |
|
165 | 165 | do { |
166 | 166 | $entities = []; |
167 | 167 | for ($i = 0; $i < 256 and false !== $row = $statement->fetch(); $i++) { |
@@ -178,14 +178,14 @@ discard block |
||
178 | 178 | * @param string $property |
179 | 179 | * @return EAV |
180 | 180 | */ |
181 | - final public function getEav (string $property) { |
|
181 | + final public function getEav(string $property) { |
|
182 | 182 | return $this->eav[$property]; |
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
186 | 186 | * @return EntityInterface |
187 | 187 | */ |
188 | - public function getProto () { |
|
188 | + public function getProto() { |
|
189 | 189 | return $this->proto; |
190 | 190 | } |
191 | 191 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * @param EntityInterface $entity |
194 | 194 | * @return array |
195 | 195 | */ |
196 | - protected function getValues (EntityInterface $entity): array { |
|
196 | + protected function getValues(EntityInterface $entity): array { |
|
197 | 197 | $values = []; |
198 | 198 | foreach (array_keys($this->columns) as $name) { |
199 | 199 | $values[$name] = $this->properties[$name]->getValue($entity); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @param int $id |
208 | 208 | * @return null|EntityInterface |
209 | 209 | */ |
210 | - public function load (int $id) { |
|
210 | + public function load(int $id) { |
|
211 | 211 | $statement = $this->cache(__FUNCTION__, function() { |
212 | 212 | return $this->select(array_keys($this->columns))->where('id = ?')->prepare(); |
213 | 213 | }); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * |
228 | 228 | * @return Select|EntityInterface[] |
229 | 229 | */ |
230 | - public function loadAll () { |
|
230 | + public function loadAll() { |
|
231 | 231 | return $this->select()->setFetcher(function(Statement $statement) { |
232 | 232 | yield from $this->getEach($statement); |
233 | 233 | }); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @param EntityInterface[] $entities |
240 | 240 | */ |
241 | - protected function loadEav (array $entities): void { |
|
241 | + protected function loadEav(array $entities): void { |
|
242 | 242 | $ids = array_keys($entities); |
243 | 243 | foreach ($this->eav as $name => $eav) { |
244 | 244 | foreach ($eav->loadAll($ids) as $id => $values) { |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @param EntityInterface $entity |
254 | 254 | * @return int ID |
255 | 255 | */ |
256 | - public function save (EntityInterface $entity): int { |
|
256 | + public function save(EntityInterface $entity): int { |
|
257 | 257 | if (!$entity->getId()) { |
258 | 258 | $this->saveInsert($entity); |
259 | 259 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | /** |
268 | 268 | * @param EntityInterface $entity |
269 | 269 | */ |
270 | - protected function saveEav (EntityInterface $entity): void { |
|
270 | + protected function saveEav(EntityInterface $entity): void { |
|
271 | 271 | $id = $entity->getId(); |
272 | 272 | foreach ($this->eav as $name => $eav) { |
273 | 273 | // may be null to skip |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * |
284 | 284 | * @param EntityInterface $entity |
285 | 285 | */ |
286 | - protected function saveInsert (EntityInterface $entity): void { |
|
286 | + protected function saveInsert(EntityInterface $entity): void { |
|
287 | 287 | $statement = $this->cache(__FUNCTION__, function() { |
288 | 288 | $slots = SQL::slots(array_keys($this->columns)); |
289 | 289 | unset($slots['id']); |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | * |
303 | 303 | * @param EntityInterface $entity |
304 | 304 | */ |
305 | - protected function saveUpdate (EntityInterface $entity): void { |
|
305 | + protected function saveUpdate(EntityInterface $entity): void { |
|
306 | 306 | $statement = $this->cache(__FUNCTION__, function() { |
307 | 307 | $slots = SQL::slotsEqual(array_keys($this->columns)); |
308 | 308 | unset($slots['id']); |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | * @param EntityInterface $proto |
318 | 318 | * @return $this |
319 | 319 | */ |
320 | - public function setProto (EntityInterface $proto) { |
|
320 | + public function setProto(EntityInterface $proto) { |
|
321 | 321 | $this->proto = $proto; |
322 | 322 | return $this; |
323 | 323 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * @param EntityInterface $entity |
327 | 327 | * @param array $values |
328 | 328 | */ |
329 | - protected function setValues (EntityInterface $entity, array $values): void { |
|
329 | + protected function setValues(EntityInterface $entity, array $values): void { |
|
330 | 330 | foreach ($values as $name => $value) { |
331 | 331 | if (isset($this->properties[$name])) { |
332 | 332 | settype($value, $this->types[$name]); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param string $name |
44 | 44 | * @param string $qualifier |
45 | 45 | */ |
46 | - public function __construct (DB $db, string $name, string $qualifier = '') { |
|
46 | + public function __construct(DB $db, string $name, string $qualifier = '') { |
|
47 | 47 | $this->db = $db; |
48 | 48 | $this->name = $name; |
49 | 49 | $this->qualifier = $qualifier; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return string |
56 | 56 | */ |
57 | - public function __toString () { |
|
57 | + public function __toString() { |
|
58 | 58 | if (strlen($this->qualifier)) { |
59 | 59 | return "{$this->qualifier}.{$this->name}"; |
60 | 60 | } |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * @return string |
66 | 66 | */ |
67 | - final public function getName (): string { |
|
67 | + final public function getName(): string { |
|
68 | 68 | return $this->name; |
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
72 | 72 | * @return string |
73 | 73 | */ |
74 | - final public function getQualifier (): string { |
|
74 | + final public function getQualifier(): string { |
|
75 | 75 | return $this->qualifier; |
76 | 76 | } |
77 | 77 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return Select|scalar[] |
82 | 82 | */ |
83 | - public function select () { |
|
83 | + public function select() { |
|
84 | 84 | return Select::factory($this->db, $this->qualifier, [$this->name]) |
85 | 85 | ->setFetcher(function(Statement $statement) { |
86 | 86 | while (false !== $value = $statement->fetchColumn()) { |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param string $name |
94 | 94 | * @return $this |
95 | 95 | */ |
96 | - public function setName (string $name) { |
|
96 | + public function setName(string $name) { |
|
97 | 97 | $clone = clone $this; |
98 | 98 | $clone->name = $name; |
99 | 99 | return $clone; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @param string $qualifier |
104 | 104 | * @return $this |
105 | 105 | */ |
106 | - public function setQualifier (string $qualifier) { |
|
106 | + public function setQualifier(string $qualifier) { |
|
107 | 107 | $clone = clone $this; |
108 | 108 | $clone->qualifier = $qualifier; |
109 | 109 | return $clone; |
@@ -14,7 +14,7 @@ |
||
14 | 14 | /** |
15 | 15 | * @return string |
16 | 16 | */ |
17 | - abstract public function __toString (); |
|
17 | + abstract public function __toString(); |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * @var DB |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @return Text |
21 | 21 | */ |
22 | - public function date () { |
|
22 | + public function date() { |
|
23 | 23 | return Text::factory($this->db, $this->dateFormat('%Y-%m-%d')); |
24 | 24 | } |
25 | 25 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param string|string[] $format Format, or formats keyed by driver name. |
30 | 30 | * @return Text |
31 | 31 | */ |
32 | - public function dateFormat ($format) { |
|
32 | + public function dateFormat($format) { |
|
33 | 33 | if (is_array($format)) { |
34 | 34 | $format = $format[$this->db->getDriver()]; |
35 | 35 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @return Text |
47 | 47 | */ |
48 | - public function datetime () { |
|
48 | + public function datetime() { |
|
49 | 49 | return Text::factory($this->db, $this->dateFormat([ |
50 | 50 | 'mysql' => '%Y-%m-%d %H:%i:%S', |
51 | 51 | 'sqlite' => '%Y-%m-%d %H:%M:%S' |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @return Num |
59 | 59 | */ |
60 | - public function day () { |
|
60 | + public function day() { |
|
61 | 61 | return Num::factory($this->db, $this->dateFormat('%d')); |
62 | 62 | } |
63 | 63 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return Num |
68 | 68 | */ |
69 | - public function dayOfWeek () { |
|
69 | + public function dayOfWeek() { |
|
70 | 70 | return Num::factory($this->db, $this->dateFormat('%w')); |
71 | 71 | } |
72 | 72 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @return Num |
77 | 77 | */ |
78 | - public function dayOfYear () { |
|
78 | + public function dayOfYear() { |
|
79 | 79 | return Num::factory($this->db, $this->dateFormat('%j')); |
80 | 80 | } |
81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @return Num |
86 | 86 | */ |
87 | - public function hours () { |
|
87 | + public function hours() { |
|
88 | 88 | return Num::factory($this->db, $this->dateFormat('%H')); |
89 | 89 | } |
90 | 90 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @return Num |
95 | 95 | */ |
96 | - public function minutes () { |
|
96 | + public function minutes() { |
|
97 | 97 | return Num::factory($this->db, $this->dateFormat([ |
98 | 98 | 'mysql' => '%i', |
99 | 99 | 'sqlite' => '%M' |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return Num |
107 | 107 | */ |
108 | - public function month () { |
|
108 | + public function month() { |
|
109 | 109 | return Num::factory($this->db, $this->dateFormat('%m')); |
110 | 110 | } |
111 | 111 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @return Num |
116 | 116 | */ |
117 | - public function seconds () { |
|
117 | + public function seconds() { |
|
118 | 118 | return Num::factory($this->db, $this->dateFormat('%S')); |
119 | 119 | } |
120 | 120 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return Text |
125 | 125 | */ |
126 | - public function time () { |
|
126 | + public function time() { |
|
127 | 127 | return Text::factory($this->db, $this->dateFormat([ |
128 | 128 | 'mysql' => '%H:%i:%S', |
129 | 129 | 'sqlite' => '%H:%M:%S' |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return Num |
137 | 137 | */ |
138 | - public function timestamp () { |
|
138 | + public function timestamp() { |
|
139 | 139 | if ($this->db->isSQLite()) { |
140 | 140 | return Num::factory($this->db, "STRFTIME('%s',{$this})"); |
141 | 141 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * |
148 | 148 | * @return Num |
149 | 149 | */ |
150 | - public function weekOfYear () { |
|
150 | + public function weekOfYear() { |
|
151 | 151 | return Num::factory($this->db, $this->dateFormat([ |
152 | 152 | 'mysql' => '%U', |
153 | 153 | 'sqlite' => '%W' |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @return Num |
161 | 161 | */ |
162 | - public function year () { |
|
162 | + public function year() { |
|
163 | 163 | return Num::factory($this->db, $this->dateFormat('%Y')); |
164 | 164 | } |
165 | 165 | } |
166 | 166 | \ No newline at end of file |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @return Num |
16 | 16 | */ |
17 | - public function avg () { |
|
17 | + public function avg() { |
|
18 | 18 | return Num::factory($this->db, "AVG({$this})"); |
19 | 19 | } |
20 | 20 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return Num |
25 | 25 | */ |
26 | - public function avgDistinct () { |
|
26 | + public function avgDistinct() { |
|
27 | 27 | return Num::factory($this->db, "AVG(DISTINCT {$this})"); |
28 | 28 | } |
29 | 29 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @return Num |
34 | 34 | */ |
35 | - public function count () { |
|
35 | + public function count() { |
|
36 | 36 | return Num::factory($this->db, "COUNT({$this})"); |
37 | 37 | } |
38 | 38 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return Num |
43 | 43 | */ |
44 | - public function countDistinct () { |
|
44 | + public function countDistinct() { |
|
45 | 45 | return Num::factory($this->db, "COUNT(DISTINCT {$this})"); |
46 | 46 | } |
47 | 47 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @param string $delimiter |
52 | 52 | * @return Text |
53 | 53 | */ |
54 | - public function groupConcat (string $delimiter = ',') { |
|
54 | + public function groupConcat(string $delimiter = ',') { |
|
55 | 55 | $delimiter = $this->db->quote($delimiter); |
56 | 56 | if ($this->db->isSQLite()) { |
57 | 57 | return Text::factory($this->db, "GROUP_CONCAT({$this},{$delimiter})"); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return Num |
66 | 66 | */ |
67 | - public function max () { |
|
67 | + public function max() { |
|
68 | 68 | return Num::factory($this->db, "MAX({$this})"); |
69 | 69 | } |
70 | 70 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return Num |
75 | 75 | */ |
76 | - public function min () { |
|
76 | + public function min() { |
|
77 | 77 | return Num::factory($this->db, "MIN({$this})"); |
78 | 78 | } |
79 | 79 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @return Num |
84 | 84 | */ |
85 | - public function sum () { |
|
85 | + public function sum() { |
|
86 | 86 | return Num::factory($this->db, "SUM({$this})"); |
87 | 87 | } |
88 | 88 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return Num |
93 | 93 | */ |
94 | - public function sumDistinct () { |
|
94 | + public function sumDistinct() { |
|
95 | 95 | return Num::factory($this->db, "SUM(DISTINCT {$this})"); |
96 | 96 | } |
97 | 97 | } |
98 | 98 | \ No newline at end of file |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @param null|string $subject |
60 | 60 | * @param array $values `[when => then]` for the subject. |
61 | 61 | */ |
62 | - public function __construct (DB $db, string $subject = null, array $values = []) { |
|
62 | + public function __construct(DB $db, string $subject = null, array $values = []) { |
|
63 | 63 | parent::__construct($db, ''); |
64 | 64 | $this->subject = $subject; |
65 | 65 | $this->whenValues($values); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | /** |
69 | 69 | * @return string |
70 | 70 | */ |
71 | - public function __toString (): string { |
|
71 | + public function __toString(): string { |
|
72 | 72 | $sql = 'CASE'; |
73 | 73 | if (isset($this->subject)) { |
74 | 74 | $sql .= " {$this->subject}"; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param string|ValueInterface $then |
100 | 100 | * @return $this |
101 | 101 | */ |
102 | - public function when ($expression, $then) { |
|
102 | + public function when($expression, $then) { |
|
103 | 103 | $this->values[$this->db->quote($expression)] = $this->db->quote($then); |
104 | 104 | return $this; |
105 | 105 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @param array $values `[when => then]` |
114 | 114 | * @return $this |
115 | 115 | */ |
116 | - public function whenValues (array $values) { |
|
116 | + public function whenValues(array $values) { |
|
117 | 117 | foreach ($values as $when => $then) { |
118 | 118 | $this->when($when, $then); |
119 | 119 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @return Num |
16 | 16 | */ |
17 | - public function abs () { |
|
17 | + public function abs() { |
|
18 | 18 | return Num::factory($this->db, "ABS({$this})"); |
19 | 19 | } |
20 | 20 | |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @param number|ValueInterface $arg |
25 | 25 | * @return Num |
26 | 26 | */ |
27 | - public function add ($arg) { |
|
27 | + public function add($arg) { |
|
28 | 28 | return Num::factory($this->db, "({$this} + {$arg})"); |
29 | 29 | } |
30 | 30 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @return Num |
35 | 35 | */ |
36 | - public function ceil () { |
|
36 | + public function ceil() { |
|
37 | 37 | return Num::factory($this->db, "CEIL({$this})"); |
38 | 38 | } |
39 | 39 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param number|ValueInterface $arg |
44 | 44 | * @return Num |
45 | 45 | */ |
46 | - public function divide ($arg) { |
|
46 | + public function divide($arg) { |
|
47 | 47 | return Num::factory($this->db, "({$this} / {$arg})"); |
48 | 48 | } |
49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return Num |
54 | 54 | */ |
55 | - public function floor () { |
|
55 | + public function floor() { |
|
56 | 56 | return Num::factory($this->db, "FLOOR({$this})"); |
57 | 57 | } |
58 | 58 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return Predicate |
63 | 63 | */ |
64 | - public function isEven () { |
|
64 | + public function isEven() { |
|
65 | 65 | return Predicate::factory($this->db, "({$this} % 2) = 0"); |
66 | 66 | } |
67 | 67 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @return Predicate |
72 | 72 | */ |
73 | - public function isNegative () { |
|
73 | + public function isNegative() { |
|
74 | 74 | return Predicate::factory($this->db, "{$this} < 0"); |
75 | 75 | } |
76 | 76 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @return Predicate |
81 | 81 | */ |
82 | - public function isOdd () { |
|
82 | + public function isOdd() { |
|
83 | 83 | return Predicate::factory($this->db, "({$this} % 2) <> 0"); |
84 | 84 | } |
85 | 85 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return Predicate |
90 | 90 | */ |
91 | - public function isPositive () { |
|
91 | + public function isPositive() { |
|
92 | 92 | return Predicate::factory($this->db, "{$this} > 0"); |
93 | 93 | } |
94 | 94 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param number|ValueInterface $arg |
99 | 99 | * @return Num |
100 | 100 | */ |
101 | - public function mod ($arg) { |
|
101 | + public function mod($arg) { |
|
102 | 102 | return Num::factory($this->db, "({$this} % {$arg})"); |
103 | 103 | } |
104 | 104 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param number|ValueInterface $arg |
109 | 109 | * @return Num |
110 | 110 | */ |
111 | - public function multiply ($arg) { |
|
111 | + public function multiply($arg) { |
|
112 | 112 | return Num::factory($this->db, "({$this} * {$arg})"); |
113 | 113 | } |
114 | 114 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @param number|ValueInterface $exponent |
119 | 119 | * @return Num |
120 | 120 | */ |
121 | - public function pow ($exponent) { |
|
121 | + public function pow($exponent) { |
|
122 | 122 | return Num::factory($this->db, "POW({$this},{$exponent})"); |
123 | 123 | } |
124 | 124 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @param int $decimals |
129 | 129 | * @return Num |
130 | 130 | */ |
131 | - public function round (int $decimals = 0) { |
|
131 | + public function round(int $decimals = 0) { |
|
132 | 132 | return Num::factory($this->db, "ROUND({$this},{$decimals})"); |
133 | 133 | } |
134 | 134 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @param number|ValueInterface $arg |
139 | 139 | * @return Num |
140 | 140 | */ |
141 | - public function subtract (ValueInterface $arg) { |
|
141 | + public function subtract(ValueInterface $arg) { |
|
142 | 142 | return Num::factory($this->db, "({$this} - {$arg})"); |
143 | 143 | } |
144 | 144 | } |
145 | 145 | \ No newline at end of file |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @param null|scalar|Select $arg |
26 | 26 | * @return Predicate |
27 | 27 | */ |
28 | - public function is ($arg): Predicate { |
|
28 | + public function is($arg): Predicate { |
|
29 | 29 | if ($arg instanceof Select) { |
30 | 30 | if ($this->db->isSQLite()) { |
31 | 31 | return Select::factory($this->db, $arg, [$arg[0]]) |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param number $max |
54 | 54 | * @return Predicate |
55 | 55 | */ |
56 | - public function isBetween ($min, $max) { |
|
56 | + public function isBetween($min, $max) { |
|
57 | 57 | $min = $this->db->quote($min); |
58 | 58 | $max = $this->db->quote($max); |
59 | 59 | return Predicate::factory($this->db, "{$this} BETWEEN {$min} AND {$max}"); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param scalar|array|Select $arg |
66 | 66 | * @return Predicate |
67 | 67 | */ |
68 | - public function isEqual ($arg) { |
|
68 | + public function isEqual($arg) { |
|
69 | 69 | return $this->db->match($this, $arg); |
70 | 70 | } |
71 | 71 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return Predicate |
76 | 76 | */ |
77 | - public function isFalse () { |
|
77 | + public function isFalse() { |
|
78 | 78 | return Predicate::factory($this->db, "{$this} IS FALSE"); |
79 | 79 | } |
80 | 80 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param string $multi `ALL|ANY` |
91 | 91 | * @return Predicate |
92 | 92 | */ |
93 | - public function isGreater ($arg, string $multi = 'ALL') { |
|
93 | + public function isGreater($arg, string $multi = 'ALL') { |
|
94 | 94 | if ($arg instanceof Select) { |
95 | 95 | if ($this->db->isSQLite()) { |
96 | 96 | $sub = Select::factory($this->db, $arg, [$arg[0]]); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @param string $multi `ALL|ANY` |
117 | 117 | * @return Predicate |
118 | 118 | */ |
119 | - public function isGreaterOrEqual ($arg, string $multi = 'ALL') { |
|
119 | + public function isGreaterOrEqual($arg, string $multi = 'ALL') { |
|
120 | 120 | if ($arg instanceof Select) { |
121 | 121 | if ($this->db->isSQLite()) { |
122 | 122 | $sub = Select::factory($this->db, $arg, [$arg[0]]); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @param string $multi `ALL|ANY` |
143 | 143 | * @return Predicate |
144 | 144 | */ |
145 | - public function isLess ($arg, string $multi = 'ALL') { |
|
145 | + public function isLess($arg, string $multi = 'ALL') { |
|
146 | 146 | if ($arg instanceof Select) { |
147 | 147 | if ($this->db->isSQLite()) { |
148 | 148 | $sub = Select::factory($this->db, $arg, [$arg[0]]); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * @param string $multi `ALL|ANY` |
169 | 169 | * @return Predicate |
170 | 170 | */ |
171 | - public function isLessOrEqual ($arg, string $multi = 'ALL') { |
|
171 | + public function isLessOrEqual($arg, string $multi = 'ALL') { |
|
172 | 172 | if ($arg instanceof Select) { |
173 | 173 | if ($this->db->isSQLite()) { |
174 | 174 | $sub = Select::factory($this->db, $arg, [$arg[0]]); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * @param string $pattern |
189 | 189 | * @return Predicate |
190 | 190 | */ |
191 | - public function isLike (string $pattern) { |
|
191 | + public function isLike(string $pattern) { |
|
192 | 192 | $pattern = $this->db->quote($pattern); |
193 | 193 | return Predicate::factory($this->db, "{$this} LIKE {$pattern}"); |
194 | 194 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * @param null|scalar|Select $arg |
200 | 200 | * @return Predicate |
201 | 201 | */ |
202 | - public function isNot ($arg) { |
|
202 | + public function isNot($arg) { |
|
203 | 203 | return $this->is($arg)->not(); |
204 | 204 | } |
205 | 205 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @param number $max |
211 | 211 | * @return Predicate |
212 | 212 | */ |
213 | - public function isNotBetween ($min, $max) { |
|
213 | + public function isNotBetween($min, $max) { |
|
214 | 214 | $min = $this->db->quote($min); |
215 | 215 | $max = $this->db->quote($max); |
216 | 216 | return Predicate::factory($this->db, "{$this} NOT BETWEEN {$min} AND {$max}"); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * @param scalar|array|Select $arg |
223 | 223 | * @return Predicate |
224 | 224 | */ |
225 | - public function isNotEqual ($arg) { |
|
225 | + public function isNotEqual($arg) { |
|
226 | 226 | if ($arg instanceof Select) { |
227 | 227 | return Predicate::factory($this->db, "{$this} NOT IN ({$arg->toSql()})"); |
228 | 228 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * @param string $pattern |
239 | 239 | * @return Predicate |
240 | 240 | */ |
241 | - public function isNotLike (string $pattern) { |
|
241 | + public function isNotLike(string $pattern) { |
|
242 | 242 | $pattern = $this->db->quote($pattern); |
243 | 243 | return Predicate::factory($this->db, "{$this} NOT LIKE {$pattern}"); |
244 | 244 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * |
249 | 249 | * @return Predicate |
250 | 250 | */ |
251 | - public function isNotNull () { |
|
251 | + public function isNotNull() { |
|
252 | 252 | return Predicate::factory($this->db, "{$this} IS NOT NULL"); |
253 | 253 | } |
254 | 254 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * @param string $pattern |
259 | 259 | * @return Predicate |
260 | 260 | */ |
261 | - public function isNotRegExp (string $pattern) { |
|
261 | + public function isNotRegExp(string $pattern) { |
|
262 | 262 | $pattern = $this->db->quote($pattern); |
263 | 263 | return Predicate::factory($this->db, "{$this} NOT REGEXP {$pattern}"); |
264 | 264 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * |
269 | 269 | * @return Predicate |
270 | 270 | */ |
271 | - public function isNull () { |
|
271 | + public function isNull() { |
|
272 | 272 | return Predicate::factory($this->db, "{$this} IS NULL"); |
273 | 273 | } |
274 | 274 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * @param string $pattern |
279 | 279 | * @return Predicate |
280 | 280 | */ |
281 | - public function isRegExp (string $pattern) { |
|
281 | + public function isRegExp(string $pattern) { |
|
282 | 282 | $pattern = $this->db->quote($pattern); |
283 | 283 | return Predicate::factory($this->db, "{$this} REGEXP {$pattern}"); |
284 | 284 | } |