@@ -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 |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * @param ModelInterface[]|array $models |
26 | 26 | */ |
27 | - public function __construct(array $models = []) |
|
27 | + public function __construct(array $models = [ ]) |
|
28 | 28 | { |
29 | 29 | $this->initialModels = $models; |
30 | 30 | $this->models = $models; |
31 | - $this->toRemoveModels = []; |
|
31 | + $this->toRemoveModels = [ ]; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function add(ModelInterface $model): ModelCollectionInterface |
76 | 76 | { |
77 | - $this->models[$model->getId()] = $model; |
|
77 | + $this->models[ $model->getId() ] = $model; |
|
78 | 78 | |
79 | 79 | return $this; |
80 | 80 | } |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function remove(ModelInterface $model): ModelCollectionInterface |
87 | 87 | { |
88 | - if (isset($this->models[$model->getId()])) { |
|
89 | - unset($this->models[$model->getId()]); |
|
88 | + if (isset($this->models[ $model->getId() ])) { |
|
89 | + unset($this->models[ $model->getId() ]); |
|
90 | 90 | } |
91 | 91 | |
92 | - if (isset($this->initialModels[$model->getId()])) { |
|
93 | - $this->toRemoveModels[$model->getId()] = $model; |
|
92 | + if (isset($this->initialModels[ $model->getId() ])) { |
|
93 | + $this->toRemoveModels[ $model->getId() ] = $model; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | return $this; |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function jsonSerialize(): array |
119 | 119 | { |
120 | - $serialzedModels = []; |
|
120 | + $serialzedModels = [ ]; |
|
121 | 121 | foreach ($this->models as $model) { |
122 | - $serialzedModels[] = $model->jsonSerialize(); |
|
122 | + $serialzedModels[ ] = $model->jsonSerialize(); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | return $serialzedModels; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | public function findResolver(RepositoryInterface $repository, string $id): \Closure |
15 | 15 | { |
16 | - return function () use ($repository, $id) { |
|
16 | + return function() use ($repository, $id) { |
|
17 | 17 | return $repository->find($id); |
18 | 18 | }; |
19 | 19 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function findOneByResolver(RepositoryInterface $repository, array $criteria): \Closure |
27 | 27 | { |
28 | - return function () use ($repository, $criteria) { |
|
28 | + return function() use ($repository, $criteria) { |
|
29 | 29 | return $repository->findOneBy($criteria); |
30 | 30 | }; |
31 | 31 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | int $limit = null, |
46 | 46 | int $offset = null |
47 | 47 | ): ModelCollection { |
48 | - return new LazyModelCollection(function () use ($repository, $criteria, $orderBy, $limit, $offset) { |
|
48 | + return new LazyModelCollection(function() use ($repository, $criteria, $orderBy, $limit, $offset) { |
|
49 | 49 | return $repository->findBy($criteria, $orderBy, $limit, $offset); |
50 | 50 | }); |
51 | 51 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $resolver = $this->resolver; |
45 | 45 | $this->initialModels = (array) $resolver(); |
46 | 46 | $this->models = $this->initialModels; |
47 | - $this->toRemoveModels = []; |
|
47 | + $this->toRemoveModels = [ ]; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | { |
103 | 103 | $this->loadModels(); |
104 | 104 | |
105 | - $this->models[$model->getId()] = $model; |
|
105 | + $this->models[ $model->getId() ] = $model; |
|
106 | 106 | |
107 | 107 | return $this; |
108 | 108 | } |
@@ -115,12 +115,12 @@ discard block |
||
115 | 115 | { |
116 | 116 | $this->loadModels(); |
117 | 117 | |
118 | - if (isset($this->models[$model->getId()])) { |
|
119 | - unset($this->models[$model->getId()]); |
|
118 | + if (isset($this->models[ $model->getId() ])) { |
|
119 | + unset($this->models[ $model->getId() ]); |
|
120 | 120 | } |
121 | 121 | |
122 | - if (isset($this->initialModels[$model->getId()])) { |
|
123 | - $this->toRemoveModels[$model->getId()] = $model; |
|
122 | + if (isset($this->initialModels[ $model->getId() ])) { |
|
123 | + $this->toRemoveModels[ $model->getId() ] = $model; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | return $this; |
@@ -153,9 +153,9 @@ discard block |
||
153 | 153 | { |
154 | 154 | $this->loadModels(); |
155 | 155 | |
156 | - $serialzedModels = []; |
|
156 | + $serialzedModels = [ ]; |
|
157 | 157 | foreach ($this->models as $model) { |
158 | - $serialzedModels[] = $model->jsonSerialize(); |
|
158 | + $serialzedModels[ ] = $model->jsonSerialize(); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | return $serialzedModels; |