Passed
Push — master ( ba71ff...07eab0 )
by y
01:13
created
src/DB/EntityInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,5 +10,5 @@
 block discarded – undo
10 10
     /**
11 11
      * @return int
12 12
      */
13
-    public function getId (): int;
13
+    public function getId(): int;
14 14
 }
15 15
\ No newline at end of file
Please login to merge, or discard this patch.
src/DB/AbstractAccess.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     /**
27 27
      * @param DB $db
28 28
      */
29
-    public function __construct (DB $db) {
29
+    public function __construct(DB $db) {
30 30
         $this->db = $db;
31 31
     }
32 32
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      * @param Closure $prepare `():PDOStatement`
38 38
      * @return PDOStatement
39 39
      */
40
-    protected function cache (string $key, Closure $prepare): PDOStatement {
40
+    protected function cache(string $key, Closure $prepare): PDOStatement {
41 41
         return $this->_cache[$key] ?? $this->_cache[$key] = $prepare->__invoke();
42 42
     }
43 43
 
Please login to merge, or discard this patch.
src/DB/Record.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      * @param DB $db
64 64
      * @param string $class
65 65
      */
66
-    public function __construct (DB $db, string $class) {
66
+    public function __construct(DB $db, string $class) {
67 67
         $this->db = $db;
68 68
         $this->class = $class;
69 69
         try {
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      * @param PDOStatement $statement
110 110
      * @return EntityInterface[] Enumerated
111 111
      */
112
-    public function fetchAll (PDOStatement $statement): array {
112
+    public function fetchAll(PDOStatement $statement): array {
113 113
         $entities = [];
114 114
         foreach ($statement->fetchAll() as $row) {
115 115
             $clone = clone $this->proto;
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      * @param array[] $eavMatch Additional `[eav property => attribute => mixed]`
130 130
      * @return Select
131 131
      */
132
-    public function find (array $match, array $eavMatch = []): Select {
132
+    public function find(array $match, array $eavMatch = []): Select {
133 133
         $select = $this->select();
134 134
         foreach ($match as $column => $value) {
135 135
             $select->where($this->db->match($column, $value));
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     /**
145 145
      * @return string
146 146
      */
147
-    final public function getClass (): string {
147
+    final public function getClass(): string {
148 148
         return $this->class;
149 149
     }
150 150
 
@@ -152,14 +152,14 @@  discard block
 block discarded – undo
152 152
      * @param string $property
153 153
      * @return EAV
154 154
      */
155
-    final public function getEav ($property): EAV {
155
+    final public function getEav($property): EAV {
156 156
         return $this->eav[$property];
157 157
     }
158 158
 
159 159
     /**
160 160
      * @return EntityInterface
161 161
      */
162
-    public function getProto (): EntityInterface {
162
+    public function getProto(): EntityInterface {
163 163
         return $this->proto;
164 164
     }
165 165
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
      * @param EntityInterface $entity
168 168
      * @return array
169 169
      */
170
-    protected function getValues (EntityInterface $entity): array {
170
+    protected function getValues(EntityInterface $entity): array {
171 171
         $values = [];
172 172
         foreach (array_keys($this->columns) as $name) {
173 173
             $values[$name] = $this->properties[$name]->getValue($entity);
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
      * @param int $id
182 182
      * @return null|EntityInterface
183 183
      */
184
-    public function load ($id): ?EntityInterface {
184
+    public function load($id): ?EntityInterface {
185 185
         $load = $this->cache(__FUNCTION__, function() {
186 186
             return $this->select()->where('id=:id')->prepare();
187 187
         });
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      *
201 201
      * @param EntityInterface[] $entities
202 202
      */
203
-    protected function loadEav (array $entities): void {
203
+    protected function loadEav(array $entities): void {
204 204
         $ids = array_keys($entities);
205 205
         foreach ($this->eav as $name => $eav) {
206 206
             foreach ($eav->loadAll($ids) as $id => $values) {
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
      * @param EntityInterface $entity
216 216
      * @return int ID
217 217
      */
218
-    public function save (EntityInterface $entity): int {
218
+    public function save(EntityInterface $entity): int {
219 219
         if (!$entity->getId()) {
220 220
             $this->saveInsert($entity);
221 221
         }
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
     /**
230 230
      * @param EntityInterface $entity
231 231
      */
232
-    protected function saveEav (EntityInterface $entity): void {
232
+    protected function saveEav(EntityInterface $entity): void {
233 233
         $id = $entity->getId();
234 234
         foreach ($this->eav as $name => $eav) {
235 235
             $values = $this->properties[$name]->getValue($entity);
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
      *
245 245
      * @param EntityInterface $entity
246 246
      */
247
-    protected function saveInsert (EntityInterface $entity): void {
247
+    protected function saveInsert(EntityInterface $entity): void {
248 248
         $insert = $this->cache(__FUNCTION__, function() {
249 249
             $slots = SQL::slots(array_keys($this->columns));
250 250
             unset($slots['id']);
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
      *
264 264
      * @param EntityInterface $entity
265 265
      */
266
-    protected function saveUpdate (EntityInterface $entity): void {
266
+    protected function saveUpdate(EntityInterface $entity): void {
267 267
         $this->cache(__FUNCTION__, function() {
268 268
             $slots = SQL::slots(array_keys($this->columns));
269 269
             unset($slots['id']);
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
      * @param array $columns Defaults to all columns.
279 279
      * @return Select
280 280
      */
281
-    public function select (array $columns = []): Select {
281
+    public function select(array $columns = []): Select {
282 282
         $select = parent::select($columns);
283 283
         $select->setFetcher(function(PDOStatement $statement) {
284 284
             return $this->fetchAll($statement);
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
      * @param EntityInterface $proto
291 291
      * @return $this
292 292
      */
293
-    public function setProto (EntityInterface $proto) {
293
+    public function setProto(EntityInterface $proto) {
294 294
         $this->proto = $proto;
295 295
         return $this;
296 296
     }
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
      * @param EntityInterface $entity
300 300
      * @param array $values
301 301
      */
302
-    protected function setValues (EntityInterface $entity, array $values): void {
302
+    protected function setValues(EntityInterface $entity, array $values): void {
303 303
         foreach ($values as $name => $value) {
304 304
             settype($value, $this->types[$name]);
305 305
             $this->properties[$name]->setValue($entity, $value);
Please login to merge, or discard this patch.
src/DB/AttributesTrait.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
30 30
      * @param $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
 block discarded – undo
38 38
      * @param $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
 block discarded – undo
46 46
      * @param $offset
47 47
      * @param $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 $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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/DB/Statement.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     /**
14 14
      * Required by PDO, and must be protected.
15 15
      */
16
-    protected function __construct () { }
16
+    protected function __construct() { }
17 17
 
18 18
     /**
19 19
      * PHP returns `false` instead of throwing if too many arguments were given.
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      * @return bool
24 24
      * @throws PDOException
25 25
      */
26
-    public function execute ($args = null) {
26
+    public function execute($args = null) {
27 27
         if ($result = !parent::execute($args)) {
28 28
             $info = $this->errorInfo();
29 29
             if ($info[0] == 0) {
Please login to merge, or discard this patch.
src/DB.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      * @param string $passwd
48 48
      * @param array $options
49 49
      */
50
-    public function __construct ($dsn, $username = null, $passwd = null, $options = null) {
50
+    public function __construct($dsn, $username = null, $passwd = null, $options = null) {
51 51
         parent::__construct(...func_get_args());
52 52
         $this->setAttribute(self::ATTR_ERRMODE, self::ERRMODE_EXCEPTION);
53 53
         $this->setAttribute(self::ATTR_DEFAULT_FETCH_MODE, self::FETCH_ASSOC);
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      * @param string $sql
64 64
      * @return int
65 65
      */
66
-    public function exec ($sql) {
66
+    public function exec($sql) {
67 67
         $this->logger->__invoke($sql);
68 68
         return parent::exec($sql);
69 69
     }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      *
74 74
      * @return string
75 75
      */
76
-    final public function getDriver () {
76
+    final public function getDriver() {
77 77
         return $this->getAttribute(self::ATTR_DRIVER_NAME);
78 78
     }
79 79
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      * @param string $interface
84 84
      * @return Junction
85 85
      */
86
-    public function getJunction ($interface) {
86
+    public function getJunction($interface) {
87 87
         if (!isset($this->junctions[$interface])) {
88 88
             $this->junctions[$interface] = new Junction($this, $interface);
89 89
         }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      * @param string|EntityInterface $class
97 97
      * @return Record
98 98
      */
99
-    public function getRecord ($class) {
99
+    public function getRecord($class) {
100 100
         if (is_object($class)) {
101 101
             $class = get_class($class);
102 102
         }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      * @param string|array|Select|Closure $b
129 129
      * @return string|string[] Same type as `$a`, keys are not preserved.
130 130
      */
131
-    public function match ($a, $b = null) {
131
+    public function match($a, $b = null) {
132 132
         if (is_array($a)) {
133 133
             return array_map([$this, __FUNCTION__], array_keys($a), $a);
134 134
         }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      * @param string $access Class or interface name.
146 146
      * @return bool
147 147
      */
148
-    public function offsetExists ($access) {
148
+    public function offsetExists($access) {
149 149
         return (bool)$this->offsetGet($access);
150 150
     }
151 151
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
      * @param string $access Class or interface name.
154 154
      * @return Record|Junction|null
155 155
      */
156
-    public function offsetGet ($access) {
156
+    public function offsetGet($access) {
157 157
         if (class_exists($access)) {
158 158
             return $this->getRecord($access);
159 159
         }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      * @param void $value
171 171
      * @throws LogicException
172 172
      */
173
-    final public function offsetSet ($access, $value) {
173
+    final public function offsetSet($access, $value) {
174 174
         throw new LogicException('The schema cannot be altered by ArrayAccess.');
175 175
     }
176 176
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
      * @param void $access
181 181
      * @throws LogicException
182 182
      */
183
-    final public function offsetUnset ($access) {
183
+    final public function offsetUnset($access) {
184 184
         $this->offsetSet($access, null);
185 185
     }
186 186
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      * @param array $options
192 192
      * @return PDOStatement
193 193
      */
194
-    public function prepare ($sql, $options = null) {
194
+    public function prepare($sql, $options = null) {
195 195
         $this->logger->__invoke($sql);
196 196
         return parent::prepare(...func_get_args());
197 197
     }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      * @param array $ctorargs
206 206
      * @return PDOStatement
207 207
      */
208
-    public function query ($sql, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []) {
208
+    public function query($sql, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []) {
209 209
         $this->logger->__invoke($sql);
210 210
         return parent::query(...func_get_args());
211 211
     }
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
      * @param int $type Ignored.
229 229
      * @return mixed
230 230
      */
231
-    public function quote ($value, $type = null) {
231
+    public function quote($value, $type = null) {
232 232
         if ($value instanceof Column) {
233 233
             return (string)$value;
234 234
         }
@@ -253,14 +253,14 @@  discard block
 block discarded – undo
253 253
      * @param EntityInterface $entity
254 254
      * @return int ID
255 255
      */
256
-    public function save (EntityInterface $entity) {
256
+    public function save(EntityInterface $entity) {
257 257
         return $this->getRecord($entity)->save($entity);
258 258
     }
259 259
 
260 260
     /**
261 261
      * @param Closure $logger
262 262
      */
263
-    public function setLogger (Closure $logger) {
263
+    public function setLogger(Closure $logger) {
264 264
         $this->logger = $logger;
265 265
     }
266 266
 }
267 267
\ No newline at end of file
Please login to merge, or discard this patch.
src/DB/Table.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      * @param string $name
31 31
      * @param string[] $columns
32 32
      */
33
-    public function __construct (DB $db, $name, array $columns) {
33
+    public function __construct(DB $db, $name, array $columns) {
34 34
         parent::__construct($db);
35 35
         $this->name = $name;
36 36
         foreach ($columns as $column) {
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      *
44 44
      * @return string
45 45
      */
46
-    final public function __toString (): string {
46
+    final public function __toString(): string {
47 47
         return $this->name;
48 48
     }
49 49
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * @param array $values
54 54
      * @return int Rows affected.
55 55
      */
56
-    public function apply (array $values): int {
56
+    public function apply(array $values): int {
57 57
         $columns = implode(',', array_keys($values));
58 58
         $values = implode(',', $this->db->quote($values));
59 59
         switch ($this->db->getDriver()) {
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      * @param array $match
73 73
      * @return int Rows affected.
74 74
      */
75
-    public function delete (array $match): int {
75
+    public function delete(array $match): int {
76 76
         $match = SQL::all($this->db->match($match));
77 77
         return $this->db->exec("DELETE FROM {$this} WHERE {$match}");
78 78
     }
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
     /**
81 81
      * @return Column[]
82 82
      */
83
-    final public function getColumns (): array {
83
+    final public function getColumns(): array {
84 84
         return $this->columns;
85 85
     }
86 86
 
87 87
     /**
88 88
      * @return string
89 89
      */
90
-    final public function getName (): string {
90
+    final public function getName(): string {
91 91
         return $this->name;
92 92
     }
93 93
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      * @param array $values
98 98
      * @return int Insertion ID.
99 99
      */
100
-    public function insert (array $values): int {
100
+    public function insert(array $values): int {
101 101
         $columns = implode(',', array_keys($values));
102 102
         $values = implode(',', $this->db->quote($values));
103 103
         $this->db->exec("INSERT INTO {$this} ($columns) VALUES ($values)");
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      * @param string $name
109 109
      * @return bool
110 110
      */
111
-    public function offsetExists ($name): bool {
111
+    public function offsetExists($name): bool {
112 112
         return isset($this->columns[$name]);
113 113
     }
114 114
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      * @param string $name
117 117
      * @return Column
118 118
      */
119
-    public function offsetGet ($name): Column {
119
+    public function offsetGet($name): Column {
120 120
         return $this->columns[$name];
121 121
     }
122 122
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      * @param string[] $columns Defaults to all columns.
127 127
      * @return Select
128 128
      */
129
-    public function select (array $columns = []): Select {
129
+    public function select(array $columns = []): Select {
130 130
         if (!$columns) {
131 131
             $columns = $this->columns;
132 132
         }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      * @param string $name
140 140
      * @return Table
141 141
      */
142
-    public function setName (string $name) {
142
+    public function setName(string $name) {
143 143
         $clone = clone $this;
144 144
         $clone->name = $name;
145 145
         foreach ($this->columns as $name => $column) {
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      * @param array $match
158 158
      * @return int Rows affected.
159 159
      */
160
-    public function update (array $values, array $match): int {
160
+    public function update(array $values, array $match): int {
161 161
         $values = implode(', ', SQL::isEqual($this->db->quote($values)));
162 162
         $match = SQL::all($this->db->match($match));
163 163
         return $this->db->exec("UPDATE {$this} SET {$values} WHERE {$match}");
Please login to merge, or discard this patch.
src/DB/Select.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      * @param string|Select $table
76 76
      * @param array $columns Strings or {@link Column}. Keys are used for aliasing.
77 77
      */
78
-    public function __construct (DB $db, $table, array $columns) {
78
+    public function __construct(DB $db, $table, array $columns) {
79 79
         parent::__construct($db);
80 80
         if ($table instanceof Select) {
81 81
             $table = $table->toSubquery();
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     /**
92 92
      * Gives the clone a new alias.
93 93
      */
94
-    public function __clone () {
94
+    public function __clone() {
95 95
         $this->alias = uniqid('_') . "__{$this->table}";
96 96
     }
97 97
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      * @param array $args
100 100
      * @return PDOStatement
101 101
      */
102
-    public function __invoke (array $args = []) {
102
+    public function __invoke(array $args = []) {
103 103
         return $this->execute($args);
104 104
     }
105 105
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      *
109 109
      * @return string
110 110
      */
111
-    public function __toString (): string {
111
+    public function __toString(): string {
112 112
         return $this->alias;
113 113
     }
114 114
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
      * @param array $args Execution arguments.
119 119
      * @return int
120 120
      */
121
-    public function count (array $args = []): int {
121
+    public function count(array $args = []): int {
122 122
         $clone = clone $this;
123 123
         $clone->setColumns(['COUNT(*)']);
124 124
         return (int)$clone->execute($args)->fetchColumn();
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      * @param array $args
131 131
      * @return PDOStatement
132 132
      */
133
-    public function execute (array $args = []): PDOStatement {
133
+    public function execute(array $args = []): PDOStatement {
134 134
         $statement = $this->prepare();
135 135
         $statement->execute($args);
136 136
         return $statement;
@@ -144,21 +144,21 @@  discard block
 block discarded – undo
144 144
      * @param array $args Execution arguments.
145 145
      * @return array
146 146
      */
147
-    public function fetchAll (array $args = []): array {
147
+    public function fetchAll(array $args = []): array {
148 148
         return $this->fetcher->__invoke($this->execute($args));
149 149
     }
150 150
 
151 151
     /**
152 152
      * @return string
153 153
      */
154
-    final public function getAlias (): string {
154
+    final public function getAlias(): string {
155 155
         return $this->alias;
156 156
     }
157 157
 
158 158
     /**
159 159
      * @return Closure
160 160
      */
161
-    public function getFetcher (): Closure {
161
+    public function getFetcher(): Closure {
162 162
         return $this->fetcher;
163 163
     }
164 164
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      *
170 170
      * @return ArrayIterator
171 171
      */
172
-    public function getIterator () {
172
+    public function getIterator() {
173 173
         return new ArrayIterator($this->fetchAll());
174 174
     }
175 175
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
      * @param string $column
180 180
      * @return $this
181 181
      */
182
-    public function group ($column) {
182
+    public function group($column) {
183 183
         $this->_group[] = $column;
184 184
         return $this;
185 185
     }
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
      * @param string $condition
191 191
      * @return $this
192 192
      */
193
-    public function having ($condition) {
193
+    public function having($condition) {
194 194
         $this->_having[] = $condition;
195 195
         return $this;
196 196
     }
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      * @param string $type
204 204
      * @return $this
205 205
      */
206
-    public function join ($table, $condition, $type = 'INNER') {
206
+    public function join($table, $condition, $type = 'INNER') {
207 207
         if ($table instanceof Select) {
208 208
             $table = $table->toSubquery();
209 209
         }
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
      * @param int $offset
219 219
      * @return $this
220 220
      */
221
-    public function limit ($limit, $offset = 0) {
221
+    public function limit($limit, $offset = 0) {
222 222
         $this->_limit = " LIMIT {$limit}";
223 223
         if ($offset) {
224 224
             $this->_limit .= " OFFSET {$offset}";
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      * @param string $name Name or alias if used.
233 233
      * @return bool
234 234
      */
235
-    public function offsetExists ($name): bool {
235
+    public function offsetExists($name): bool {
236 236
         return isset($this->columns[$name]);
237 237
     }
238 238
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
      * @param string $name Name or alias if used.
243 243
      * @return Column
244 244
      */
245
-    public function offsetGet ($name): Column {
245
+    public function offsetGet($name): Column {
246 246
         return new Column($this->db, $name, $this->alias);
247 247
     }
248 248
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
      * @param string $order
253 253
      * @return $this
254 254
      */
255
-    public function order ($order) {
255
+    public function order($order) {
256 256
         $this->_order = " ORDER BY {$order}";
257 257
         return $this;
258 258
     }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
     /**
261 261
      * @return PDOStatement
262 262
      */
263
-    public function prepare (): PDOStatement {
263
+    public function prepare(): PDOStatement {
264 264
         return $this->db->prepare($this->toSql());
265 265
     }
266 266
 
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
      * @param array $columns Strings or {@link Column}. Keys are used for aliasing.
271 271
      * @return $this
272 272
      */
273
-    public function setColumns (array $columns) {
273
+    public function setColumns(array $columns) {
274 274
         $this->columns = [];
275 275
         foreach ($columns as $alias => $column) {
276 276
             if ($column instanceof Column) {
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
      * @param Closure $fetcher
295 295
      * @return $this
296 296
      */
297
-    public function setFetcher (Closure $fetcher) {
297
+    public function setFetcher(Closure $fetcher) {
298 298
         $this->fetcher = $fetcher;
299 299
         return $this;
300 300
     }
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
     /**
303 303
      * @return string
304 304
      */
305
-    public function toSql (): string {
305
+    public function toSql(): string {
306 306
         $columns = [];
307 307
         foreach ($this->columns as $alias => $column) {
308 308
             if ($alias !== $column) {
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
      *
337 337
      * @return string
338 338
      */
339
-    public function toSubquery (): string {
339
+    public function toSubquery(): string {
340 340
         return "({$this->toSql()}) AS {$this->getAlias()}";
341 341
     }
342 342
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
      * @param string $condition
347 347
      * @return $this
348 348
      */
349
-    public function where ($condition) {
349
+    public function where($condition) {
350 350
         $this->_where[] = $condition;
351 351
         return $this;
352 352
     }
Please login to merge, or discard this patch.
src/DB/EAV.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         $count = $this->cache(__FUNCTION__, function() {
34 34
             return $this->select(['COUNT(*)'])->where('entity=?')->prepare();
35 35
         });
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      * @param string $attribute
45 45
      * @return bool
46 46
      */
47
-    public function exists (int $id, string $attribute): bool {
47
+    public function exists(int $id, string $attribute): bool {
48 48
         $exists = $this->cache(__FUNCTION__, function() {
49 49
             return $this->select(['COUNT(*) > 0'])->where('entity=:e AND attribute=:a')->prepare();
50 50
         });
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      * @param array $match `[attribute => value]`. If empty, selects all IDs for entities having at least one attribute.
62 62
      * @return Select
63 63
      */
64
-    public function find (array $match): Select {
64
+    public function find(array $match): Select {
65 65
         $select = $this->select([$this['entity']]);
66 66
         $prior = $this;
67 67
         foreach ($match as $attribute => $value) {
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      * @param int $id
84 84
      * @return array `[attribute => value]`
85 85
      */
86
-    public function load (int $id): array {
86
+    public function load(int $id): array {
87 87
         $load = $this->cache(__FUNCTION__, function() {
88 88
             return $this->select(['attribute', 'value'])->where('entity=?')->prepare();
89 89
         });
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      * @param int[] $ids
98 98
      * @return array[] `[id => attribute => value]
99 99
      */
100
-    public function loadAll (array $ids): array {
100
+    public function loadAll(array $ids): array {
101 101
         if (count($ids) === 1) {
102 102
             return [current($ids) => $this->load(current($ids))];
103 103
         }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
      * @param array $values `[attribute => value]`
119 119
      * @return $this
120 120
      */
121
-    public function save (int $id, array $values) {
121
+    public function save(int $id, array $values) {
122 122
         $this->delete([
123 123
             $this['entity']->isEqual($id),
124 124
             $this['attribute']->isNotEqual(array_keys($values))
Please login to merge, or discard this patch.