@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Chubbyphp\Model; |
6 | 6 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Chubbyphp\Model; |
6 | 6 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Chubbyphp\Model; |
6 | 6 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Chubbyphp\Model; |
6 | 6 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Chubbyphp\Model\Cache; |
6 | 6 | |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | /** |
10 | 10 | * @var array |
11 | 11 | */ |
12 | - private $cache = []; |
|
12 | + private $cache = [ ]; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * @param string $id |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public function set(string $id, array $row): ModelCacheInterface |
21 | 21 | { |
22 | - $this->cache[$id] = $row; |
|
22 | + $this->cache[ $id ] = $row; |
|
23 | 23 | |
24 | 24 | return $this; |
25 | 25 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | throw RowNotFoundException::fromId($id); |
48 | 48 | } |
49 | 49 | |
50 | - return $this->cache[$id]; |
|
50 | + return $this->cache[ $id ]; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function remove(string $id): ModelCacheInterface |
59 | 59 | { |
60 | - unset($this->cache[$id]); |
|
60 | + unset($this->cache[ $id ]); |
|
61 | 61 | |
62 | 62 | return $this; |
63 | 63 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Chubbyphp\Model; |
6 | 6 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Chubbyphp\Model; |
6 | 6 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Chubbyphp\Model\Collection; |
6 | 6 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | private function modelsWithIdKey(array $models): array |
54 | 54 | { |
55 | - $modelsWithIdKey = []; |
|
55 | + $modelsWithIdKey = [ ]; |
|
56 | 56 | foreach ($models as $model) { |
57 | 57 | if (!$model instanceof ModelInterface) { |
58 | 58 | throw new \InvalidArgumentException( |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | ); |
61 | 61 | } |
62 | 62 | |
63 | - $modelsWithIdKey[$model->getId()] = $model; |
|
63 | + $modelsWithIdKey[ $model->getId() ] = $model; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | return $modelsWithIdKey; |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | { |
141 | 141 | $this->loadModels(); |
142 | 142 | |
143 | - $toRemoveModels = []; |
|
143 | + $toRemoveModels = [ ]; |
|
144 | 144 | foreach ($this->initialModels as $initialModel) { |
145 | - if (!isset($this->models[$initialModel->getId()])) { |
|
146 | - $toRemoveModels[$initialModel->getId()] = $initialModel; |
|
145 | + if (!isset($this->models[ $initialModel->getId() ])) { |
|
146 | + $toRemoveModels[ $initialModel->getId() ] = $initialModel; |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | { |
158 | 158 | $this->loadModels(); |
159 | 159 | |
160 | - $serializedModels = []; |
|
160 | + $serializedModels = [ ]; |
|
161 | 161 | foreach ($this->models as $model) { |
162 | - $serializedModels[] = $model->jsonSerialize(); |
|
162 | + $serializedModels[ ] = $model->jsonSerialize(); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | return $serializedModels; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Chubbyphp\Model\Collection; |
6 | 6 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * @param ModelInterface[]|array $models |
23 | 23 | */ |
24 | - public function __construct(array $models = []) |
|
24 | + public function __construct(array $models = [ ]) |
|
25 | 25 | { |
26 | 26 | $models = $this->modelsWithIdKey($models); |
27 | 27 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | private function modelsWithIdKey(array $models): array |
38 | 38 | { |
39 | - $modelsWithIdKey = []; |
|
39 | + $modelsWithIdKey = [ ]; |
|
40 | 40 | foreach ($models as $model) { |
41 | 41 | if (!$model instanceof ModelInterface) { |
42 | 42 | throw new \InvalidArgumentException( |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | ); |
45 | 45 | } |
46 | 46 | |
47 | - $modelsWithIdKey[$model->getId()] = $model; |
|
47 | + $modelsWithIdKey[ $model->getId() ] = $model; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return $modelsWithIdKey; |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function toRemove(): array |
110 | 110 | { |
111 | - $toRemoveModels = []; |
|
111 | + $toRemoveModels = [ ]; |
|
112 | 112 | foreach ($this->initialModels as $initialModel) { |
113 | - if (!isset($this->models[$initialModel->getId()])) { |
|
114 | - $toRemoveModels[$initialModel->getId()] = $initialModel; |
|
113 | + if (!isset($this->models[ $initialModel->getId() ])) { |
|
114 | + $toRemoveModels[ $initialModel->getId() ] = $initialModel; |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function jsonSerialize(): array |
125 | 125 | { |
126 | - $serializedModels = []; |
|
126 | + $serializedModels = [ ]; |
|
127 | 127 | foreach ($this->models as $model) { |
128 | - $serializedModels[] = $model->jsonSerialize(); |
|
128 | + $serializedModels[ ] = $model->jsonSerialize(); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | return $serializedModels; |