@@ -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 |
@@ -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 | } |
@@ -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 | /** |
@@ -75,10 +75,10 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function add(ModelInterface $model): ModelCollectionInterface |
77 | 77 | { |
78 | - $this->models[$model->getId()] = $model; |
|
78 | + $this->models[ $model->getId() ] = $model; |
|
79 | 79 | |
80 | - if (isset($this->toRemoveModels[$model->getId()])) { |
|
81 | - unset($this->toRemoveModels[$model->getId()]); |
|
80 | + if (isset($this->toRemoveModels[ $model->getId() ])) { |
|
81 | + unset($this->toRemoveModels[ $model->getId() ]); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | return $this; |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function remove(ModelInterface $model): ModelCollectionInterface |
93 | 93 | { |
94 | - if (isset($this->models[$model->getId()])) { |
|
95 | - unset($this->models[$model->getId()]); |
|
94 | + if (isset($this->models[ $model->getId() ])) { |
|
95 | + unset($this->models[ $model->getId() ]); |
|
96 | 96 | } |
97 | 97 | |
98 | - if (isset($this->initialModels[$model->getId()])) { |
|
99 | - $this->toRemoveModels[$model->getId()] = $model; |
|
98 | + if (isset($this->initialModels[ $model->getId() ])) { |
|
99 | + $this->toRemoveModels[ $model->getId() ] = $model; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | return $this; |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function jsonSerialize(): array |
125 | 125 | { |
126 | - $serialzedModels = []; |
|
126 | + $serialzedModels = [ ]; |
|
127 | 127 | foreach ($this->models as $model) { |
128 | - $serialzedModels[] = $model->jsonSerialize(); |
|
128 | + $serialzedModels[ ] = $model->jsonSerialize(); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | return $serialzedModels; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $resolver = $this->resolver; |
46 | 46 | $this->initialModels = (array) $resolver(); |
47 | 47 | $this->models = $this->initialModels; |
48 | - $this->toRemoveModels = []; |
|
48 | + $this->toRemoveModels = [ ]; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | { |
105 | 105 | $this->loadModels(); |
106 | 106 | |
107 | - $this->models[$model->getId()] = $model; |
|
107 | + $this->models[ $model->getId() ] = $model; |
|
108 | 108 | |
109 | - if (isset($this->toRemoveModels[$model->getId()])) { |
|
110 | - unset($this->toRemoveModels[$model->getId()]); |
|
109 | + if (isset($this->toRemoveModels[ $model->getId() ])) { |
|
110 | + unset($this->toRemoveModels[ $model->getId() ]); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $this; |
@@ -122,12 +122,12 @@ discard block |
||
122 | 122 | { |
123 | 123 | $this->loadModels(); |
124 | 124 | |
125 | - if (isset($this->models[$model->getId()])) { |
|
126 | - unset($this->models[$model->getId()]); |
|
125 | + if (isset($this->models[ $model->getId() ])) { |
|
126 | + unset($this->models[ $model->getId() ]); |
|
127 | 127 | } |
128 | 128 | |
129 | - if (isset($this->initialModels[$model->getId()])) { |
|
130 | - $this->toRemoveModels[$model->getId()] = $model; |
|
129 | + if (isset($this->initialModels[ $model->getId() ])) { |
|
130 | + $this->toRemoveModels[ $model->getId() ] = $model; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | return $this; |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | { |
161 | 161 | $this->loadModels(); |
162 | 162 | |
163 | - $serialzedModels = []; |
|
163 | + $serialzedModels = [ ]; |
|
164 | 164 | foreach ($this->models as $model) { |
165 | - $serialzedModels[] = $model->jsonSerialize(); |
|
165 | + $serialzedModels[ ] = $model->jsonSerialize(); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | return $serialzedModels; |