@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * @return array |
24 | 24 | */ |
25 | - public function getAttributes (): array { |
|
25 | + public function getAttributes(): array { |
|
26 | 26 | return $this->attributes ?: []; |
27 | 27 | } |
28 | 28 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param mixed $offset |
31 | 31 | * @return bool |
32 | 32 | */ |
33 | - public function offsetExists ($offset): bool { |
|
33 | + public function offsetExists($offset): bool { |
|
34 | 34 | return $this->attributes and array_key_exists($offset, $this->attributes); |
35 | 35 | } |
36 | 36 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param mixed $offset |
39 | 39 | * @return mixed Returns `NULL` for nonexistent attributes. |
40 | 40 | */ |
41 | - public function offsetGet ($offset) { |
|
41 | + public function offsetGet($offset) { |
|
42 | 42 | return $this->attributes[$offset] ?? null; |
43 | 43 | } |
44 | 44 | |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | * @param mixed $offset |
47 | 47 | * @param mixed $value |
48 | 48 | */ |
49 | - public function offsetSet ($offset, $value): void { |
|
49 | + public function offsetSet($offset, $value): void { |
|
50 | 50 | $this->attributes[$offset] = $value; |
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
54 | 54 | * @param mixed $offset |
55 | 55 | */ |
56 | - public function offsetUnset ($offset): void { |
|
56 | + public function offsetUnset($offset): void { |
|
57 | 57 | unset($this->attributes[$offset]); |
58 | 58 | } |
59 | 59 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @param array $attributes |
62 | 62 | * @return $this |
63 | 63 | */ |
64 | - public function setAttributes (array $attributes) { |
|
64 | + public function setAttributes(array $attributes) { |
|
65 | 65 | $this->attributes = $attributes; |
66 | 66 | return $this; |
67 | 67 | } |
@@ -10,5 +10,5 @@ |
||
10 | 10 | /** |
11 | 11 | * @return int |
12 | 12 | */ |
13 | - public function getId (); |
|
13 | + public function getId(); |
|
14 | 14 | } |
15 | 15 | \ No newline at end of file |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * @param DB $db |
27 | 27 | */ |
28 | - public function __construct (DB $db) { |
|
28 | + public function __construct(DB $db) { |
|
29 | 29 | $this->db = $db; |
30 | 30 | } |
31 | 31 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param Closure $prepare `():Statement` |
37 | 37 | * @return Statement |
38 | 38 | */ |
39 | - protected function cache (string $key, Closure $prepare): Statement { |
|
39 | + protected function cache(string $key, Closure $prepare): Statement { |
|
40 | 40 | return $this->_cache[$key] ?? $this->_cache[$key] = $prepare->__invoke(); |
41 | 41 | } |
42 | 42 |
@@ -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 | return $this->cache("count.{$key}", function() use ($key) { |
63 | 63 | return $this->select(['COUNT(*)'])->where("{$key} = ?")->prepare(); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @param string $class |
74 | 74 | * @return Select |
75 | 75 | */ |
76 | - public function getCollection (EntityInterface $owner, string $class): Select { |
|
76 | + public function getCollection(EntityInterface $owner, string $class): Select { |
|
77 | 77 | $record = $this->db->getRecord($class); |
78 | 78 | $select = $record->select(); |
79 | 79 | $select->join($this, $this[$class]->isEqual($record['id'])); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | /** |
85 | 85 | * @return string |
86 | 86 | */ |
87 | - final public function getInterface (): string { |
|
87 | + final public function getInterface(): string { |
|
88 | 88 | return $this->interface; |
89 | 89 | } |
90 | 90 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @param EntityInterface|string $class |
95 | 95 | * @return string |
96 | 96 | */ |
97 | - public function getKey ($class): string { |
|
97 | + public function getKey($class): string { |
|
98 | 98 | if (is_object($class)) { |
99 | 99 | $class = get_class($class); |
100 | 100 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @param EntityInterface[] $entities |
113 | 113 | * @return int Rows affected. |
114 | 114 | */ |
115 | - public function link (array $entities): int { |
|
115 | + public function link(array $entities): int { |
|
116 | 116 | $ids = array_fill_keys($this->keys, null); |
117 | 117 | foreach ($entities as $entity) { |
118 | 118 | $ids[$this->getKey($entity)] = $entity->getId(); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param string $name |
134 | 134 | * @return bool |
135 | 135 | */ |
136 | - public function offsetExists ($name): bool { |
|
136 | + public function offsetExists($name): bool { |
|
137 | 137 | return isset($this->columns[$name]) or isset($this->keys[$name]); |
138 | 138 | } |
139 | 139 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @param string $name |
144 | 144 | * @return Column |
145 | 145 | */ |
146 | - public function offsetGet ($name): Column { |
|
146 | + public function offsetGet($name): Column { |
|
147 | 147 | return $this->columns[$name] ?? $this->columns[$this->keys[$name]]; |
148 | 148 | } |
149 | 149 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * @param EntityInterface[] $entities |
157 | 157 | * @return int Rows affected. |
158 | 158 | */ |
159 | - public function unlink (array $entities): int { |
|
159 | + public function unlink(array $entities): int { |
|
160 | 160 | $ids = array_fill_keys($this->keys, null); |
161 | 161 | foreach ($entities as $entity) { |
162 | 162 | $ids[$this->getKey($entity)] = $entity->getId(); |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @param Record $record The entity's storage access. |
19 | 19 | * @param $name |
20 | 20 | */ |
21 | - public function __construct (Record $record, $name) { |
|
21 | + public function __construct(Record $record, $name) { |
|
22 | 22 | $this->record = $record; |
23 | 23 | parent::__construct($record->db, $name, ['entity', 'attribute', 'value']); |
24 | 24 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param int $id |
30 | 30 | * @return int |
31 | 31 | */ |
32 | - public function count (int $id): int { |
|
32 | + public function count(int $id): int { |
|
33 | 33 | return $this->cache(__FUNCTION__, function() { |
34 | 34 | return $this->select(['COUNT(*)'])->where('entity=?')->prepare(); |
35 | 35 | })->execute([$id])->fetchColumn(); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param string $attribute |
43 | 43 | * @return bool |
44 | 44 | */ |
45 | - public function exists (int $id, string $attribute): bool { |
|
45 | + public function exists(int $id, string $attribute): bool { |
|
46 | 46 | return $this->cache(__FUNCTION__, function() { |
47 | 47 | return $this->select(['COUNT(*) > 0'])->where('entity = ? AND attribute = ?')->prepare(); |
48 | 48 | })->execute([$id, $attribute])->fetchColumn(); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param array $match `[attribute => value]`. If empty, selects all IDs for entities having at least one attribute. |
58 | 58 | * @return Select |
59 | 59 | */ |
60 | - public function find (array $match): Select { |
|
60 | + public function find(array $match): Select { |
|
61 | 61 | $select = $this->select([$this['entity']]); |
62 | 62 | $prior = $this; |
63 | 63 | foreach ($match as $attribute => $value) { |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @param int $id |
80 | 80 | * @return array `[attribute => value]` |
81 | 81 | */ |
82 | - public function load (int $id): array { |
|
82 | + public function load(int $id): array { |
|
83 | 83 | return $this->cache(__FUNCTION__, function() { |
84 | 84 | return $this->select(['attribute', 'value'])->where('entity = ?')->prepare(); |
85 | 85 | })->execute([$id])->fetchAll(DB::FETCH_KEY_PAIR); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @param int[] $ids |
92 | 92 | * @return array[] `[id => attribute => value] |
93 | 93 | */ |
94 | - public function loadAll (array $ids): array { |
|
94 | + public function loadAll(array $ids): array { |
|
95 | 95 | if (count($ids) === 1) { |
96 | 96 | return [current($ids) => $this->load(current($ids))]; |
97 | 97 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @param array $values `[attribute => value]` |
112 | 112 | * @return $this |
113 | 113 | */ |
114 | - public function save (int $id, array $values) { |
|
114 | + public function save(int $id, array $values) { |
|
115 | 115 | $this->delete([ |
116 | 116 | $this['entity']->isEqual($id), |
117 | 117 | $this['attribute']->isNotEqual(array_keys($values)) |
@@ -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('Tables are immutable.'); |
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 |
@@ -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()->where('id = ?')->prepare(); |
183 | 183 | })->execute([$id]); |
@@ -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 | $values = $this->getValues($entity); |
244 | 244 | unset($values['id']); |
245 | 245 | $insert = $this->cache(__FUNCTION__, function() { |
@@ -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::slots(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); |
@@ -7,6 +7,6 @@ |
||
7 | 7 | */ |
8 | 8 | interface ExpressionInterface { |
9 | 9 | |
10 | - public function __toString (); |
|
10 | + public function __toString(); |
|
11 | 11 | |
12 | 12 | } |
13 | 13 | \ No newline at end of file |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @param string|Select $table |
80 | 80 | * @param string[] $columns |
81 | 81 | */ |
82 | - public function __construct (DB $db, $table, array $columns) { |
|
82 | + public function __construct(DB $db, $table, array $columns) { |
|
83 | 83 | parent::__construct($db); |
84 | 84 | if ($table instanceof Select) { |
85 | 85 | $table = $table->toSubquery(); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | /** |
96 | 96 | * Gives the clone a new alias. |
97 | 97 | */ |
98 | - public function __clone () { |
|
98 | + public function __clone() { |
|
99 | 99 | $this->alias = uniqid('_') . "__{$this->table}"; |
100 | 100 | } |
101 | 101 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @param array $args |
104 | 104 | * @return Statement |
105 | 105 | */ |
106 | - public function __invoke (array $args = []): Statement { |
|
106 | + public function __invoke(array $args = []): Statement { |
|
107 | 107 | return $this->execute($args); |
108 | 108 | } |
109 | 109 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @return string |
114 | 114 | */ |
115 | - public function __toString (): string { |
|
115 | + public function __toString(): string { |
|
116 | 116 | return $this->alias; |
117 | 117 | } |
118 | 118 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @param array $args Execution arguments. |
123 | 123 | * @return int |
124 | 124 | */ |
125 | - public function count (array $args = []): int { |
|
125 | + public function count(array $args = []): int { |
|
126 | 126 | $clone = clone $this; |
127 | 127 | $clone->columns = ['COUNT(*)']; |
128 | 128 | return (int)$clone->execute($args)->fetchColumn(); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @param array $args |
135 | 135 | * @return Statement |
136 | 136 | */ |
137 | - public function execute (array $args = []): Statement { |
|
137 | + public function execute(array $args = []): Statement { |
|
138 | 138 | if (!empty($args)) { |
139 | 139 | return $this->prepare()->execute($args); |
140 | 140 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @param array $args Execution arguments. |
150 | 150 | * @return array |
151 | 151 | */ |
152 | - public function fetchAll (array $args = []): array { |
|
152 | + public function fetchAll(array $args = []): array { |
|
153 | 153 | return $this->fetcher->__invoke($this->execute($args)); |
154 | 154 | } |
155 | 155 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * |
161 | 161 | * @return ArrayIterator |
162 | 162 | */ |
163 | - public function getIterator () { |
|
163 | + public function getIterator() { |
|
164 | 164 | return new ArrayIterator($this->fetchAll()); |
165 | 165 | } |
166 | 166 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param string $column |
171 | 171 | * @return $this |
172 | 172 | */ |
173 | - public function group (string $column) { |
|
173 | + public function group(string $column) { |
|
174 | 174 | $this->_group[] = $column; |
175 | 175 | return $this; |
176 | 176 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @param string $condition |
182 | 182 | * @return $this |
183 | 183 | */ |
184 | - public function having (string $condition) { |
|
184 | + public function having(string $condition) { |
|
185 | 185 | $this->_having[] = $condition; |
186 | 186 | return $this; |
187 | 187 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * @param string $type |
195 | 195 | * @return $this |
196 | 196 | */ |
197 | - public function join ($table, string $condition, string $type = 'INNER') { |
|
197 | + public function join($table, string $condition, string $type = 'INNER') { |
|
198 | 198 | if ($table instanceof Select) { |
199 | 199 | $table = $table->toSubquery(); |
200 | 200 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @param int $offset |
210 | 210 | * @return $this |
211 | 211 | */ |
212 | - public function limit (int $limit, int $offset = 0) { |
|
212 | + public function limit(int $limit, int $offset = 0) { |
|
213 | 213 | $this->_limit = $limit; |
214 | 214 | $this->_offset = $offset; |
215 | 215 | return $this; |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @param string $name Name or alias if used. |
222 | 222 | * @return bool |
223 | 223 | */ |
224 | - public function offsetExists ($name): bool { |
|
224 | + public function offsetExists($name): bool { |
|
225 | 225 | return true; |
226 | 226 | } |
227 | 227 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @param string $name Name, or alias if used. |
232 | 232 | * @return Column |
233 | 233 | */ |
234 | - public function offsetGet ($name): Column { |
|
234 | + public function offsetGet($name): Column { |
|
235 | 235 | return new Column($this->db, $name, $this->alias); |
236 | 236 | } |
237 | 237 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @param string $order |
242 | 242 | * @return $this |
243 | 243 | */ |
244 | - public function order (string $order) { |
|
244 | + public function order(string $order) { |
|
245 | 245 | $this->_order = $order; |
246 | 246 | return $this; |
247 | 247 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | /** |
250 | 250 | * @return Statement |
251 | 251 | */ |
252 | - public function prepare (): Statement { |
|
252 | + public function prepare(): Statement { |
|
253 | 253 | return $this->db->prepare($this->toSql()); |
254 | 254 | } |
255 | 255 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @param Closure $fetcher |
258 | 258 | * @return $this |
259 | 259 | */ |
260 | - public function setFetcher (Closure $fetcher) { |
|
260 | + public function setFetcher(Closure $fetcher) { |
|
261 | 261 | $this->fetcher = $fetcher; |
262 | 262 | return $this; |
263 | 263 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | /** |
266 | 266 | * @return string |
267 | 267 | */ |
268 | - public function toSql (): string { |
|
268 | + public function toSql(): string { |
|
269 | 269 | $sql = SQL::select($this->table, $this->columns); |
270 | 270 | foreach ($this->_join as $join) { |
271 | 271 | $sql .= " {$join}"; |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * |
284 | 284 | * @return string |
285 | 285 | */ |
286 | - public function toSubquery (): string { |
|
286 | + public function toSubquery(): string { |
|
287 | 287 | return "({$this->toSql()}) AS {$this->alias}"; |
288 | 288 | } |
289 | 289 | |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | * @param string $condition |
294 | 294 | * @return $this |
295 | 295 | */ |
296 | - public function where (string $condition) { |
|
296 | + public function where(string $condition) { |
|
297 | 297 | $this->_where[] = $condition; |
298 | 298 | return $this; |
299 | 299 | } |