@@ -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; |
6 | 6 | |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | */ |
15 | 15 | public function find(RepositoryInterface $repository, string $id): \Closure |
16 | 16 | { |
17 | - return function () use ($repository, $id) { |
|
17 | + return function() use ($repository, $id) { |
|
18 | 18 | return $repository->find($id); |
19 | 19 | }; |
20 | 20 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function findOneBy(RepositoryInterface $repository, array $criteria): \Closure |
29 | 29 | { |
30 | - return function () use ($repository, $criteria) { |
|
30 | + return function() use ($repository, $criteria) { |
|
31 | 31 | return $repository->findOneBy($criteria); |
32 | 32 | }; |
33 | 33 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | int $limit = null, |
49 | 49 | int $offset = null |
50 | 50 | ): \Closure { |
51 | - return function () use ($repository, $criteria, $orderBy, $limit, $offset) { |
|
51 | + return function() use ($repository, $criteria, $orderBy, $limit, $offset) { |
|
52 | 52 | return $repository->findBy($criteria, $orderBy, $limit, $offset); |
53 | 53 | }; |
54 | 54 | } |
@@ -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 | |
@@ -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 removeFromPersistence(): array |
110 | 110 | { |
111 | - $removeFromPersistenceModels = []; |
|
111 | + $removeFromPersistenceModels = [ ]; |
|
112 | 112 | foreach ($this->initialModels as $initialModel) { |
113 | - if (!isset($this->models[$initialModel->getId()])) { |
|
114 | - $removeFromPersistenceModels[$initialModel->getId()] = $initialModel; |
|
113 | + if (!isset($this->models[ $initialModel->getId() ])) { |
|
114 | + $removeFromPersistenceModels[ $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; |