@@ -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 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | public function find(RepositoryInterface $repository, string $id): \Closure |
| 14 | 14 | { |
| 15 | - return function () use ($repository, $id) { |
|
| 15 | + return function() use ($repository, $id) { |
|
| 16 | 16 | return $repository->find($id); |
| 17 | 17 | }; |
| 18 | 18 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function findOneBy(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 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | int $offset = null |
| 45 | 45 | ) { |
| 46 | 46 | $this->repository = $repository; |
| 47 | - $this->resolver = function () use ($repository, $criteria, $orderBy, $limit, $offset) { |
|
| 47 | + $this->resolver = function() use ($repository, $criteria, $orderBy, $limit, $offset) { |
|
| 48 | 48 | return $repository->findBy($criteria, $orderBy, $limit, $offset); |
| 49 | 49 | }; |
| 50 | 50 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | private function modelsWithIdKey(array $models): array |
| 72 | 72 | { |
| 73 | - $modelsWithIdKey = []; |
|
| 73 | + $modelsWithIdKey = [ ]; |
|
| 74 | 74 | foreach ($models as $model) { |
| 75 | 75 | if (!$model instanceof ModelInterface) { |
| 76 | 76 | throw new \InvalidArgumentException( |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | ); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - $modelsWithIdKey[$model->getId()] = $model; |
|
| 81 | + $modelsWithIdKey[ $model->getId() ] = $model; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | return $modelsWithIdKey; |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $this->loadModels(); |
| 156 | 156 | |
| 157 | 157 | foreach ($this->initialModels as $initialModel) { |
| 158 | - if (!isset($this->models[$initialModel->getId()])) { |
|
| 158 | + if (!isset($this->models[ $initialModel->getId() ])) { |
|
| 159 | 159 | $this->repository->remove($initialModel); |
| 160 | 160 | } |
| 161 | 161 | } |
@@ -168,9 +168,9 @@ discard block |
||
| 168 | 168 | { |
| 169 | 169 | $this->loadModels(); |
| 170 | 170 | |
| 171 | - $serializedModels = []; |
|
| 171 | + $serializedModels = [ ]; |
|
| 172 | 172 | foreach ($this->models as $model) { |
| 173 | - $serializedModels[] = $model->jsonSerialize(); |
|
| 173 | + $serializedModels[ ] = $model->jsonSerialize(); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | return $serializedModels; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | private function modelsWithIdKey(array $models): array |
| 44 | 44 | { |
| 45 | - $modelsWithIdKey = []; |
|
| 45 | + $modelsWithIdKey = [ ]; |
|
| 46 | 46 | foreach ($models as $model) { |
| 47 | 47 | if (!$model instanceof ModelInterface) { |
| 48 | 48 | throw new \InvalidArgumentException( |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | ); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - $modelsWithIdKey[$model->getId()] = $model; |
|
| 53 | + $modelsWithIdKey[ $model->getId() ] = $model; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | return $modelsWithIdKey; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | public function remove() |
| 112 | 112 | { |
| 113 | 113 | foreach ($this->initialModels as $initialModel) { |
| 114 | - if (!isset($this->models[$initialModel->getId()])) { |
|
| 114 | + if (!isset($this->models[ $initialModel->getId() ])) { |
|
| 115 | 115 | $this->repository->remove($initialModel); |
| 116 | 116 | } |
| 117 | 117 | } |
@@ -122,9 +122,9 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function jsonSerialize(): array |
| 124 | 124 | { |
| 125 | - $serializedModels = []; |
|
| 125 | + $serializedModels = [ ]; |
|
| 126 | 126 | foreach ($this->models as $model) { |
| 127 | - $serializedModels[] = $model->jsonSerialize(); |
|
| 127 | + $serializedModels[ ] = $model->jsonSerialize(); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | return $serializedModels; |