@@ -9,12 +9,12 @@ discard block |
||
| 9 | 9 | /** |
| 10 | 10 | * @var ModelInterface[]|array |
| 11 | 11 | */ |
| 12 | - private $toPersistModels = []; |
|
| 12 | + private $toPersistModels = [ ]; |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * @var ModelInterface[]|array |
| 16 | 16 | */ |
| 17 | - private $toRemoveModels = []; |
|
| 17 | + private $toRemoveModels = [ ]; |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @param ModelInterface[]|array $models |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function addToPersistModel(ModelInterface $model): RelatedModelManipulationStack |
| 39 | 39 | { |
| 40 | - $this->toPersistModels[$model->getId()] = $model; |
|
| 40 | + $this->toPersistModels[ $model->getId() ] = $model; |
|
| 41 | 41 | |
| 42 | 42 | return $this; |
| 43 | 43 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function addToRemoveModel(ModelInterface $model): RelatedModelManipulationStack |
| 65 | 65 | { |
| 66 | - $this->toRemoveModels[$model->getId()] = $model; |
|
| 66 | + $this->toRemoveModels[ $model->getId() ] = $model; |
|
| 67 | 67 | |
| 68 | 68 | return $this; |
| 69 | 69 | } |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | { |
| 84 | 84 | $toRemoveModels = $this->toRemoveModels; |
| 85 | 85 | foreach ($toRemoveModels as $toRemoveModel) { |
| 86 | - if (isset($this->toPersistModels[$toRemoveModel->getId()])) { |
|
| 87 | - unset($toRemoveModels[$toRemoveModel->getId()]); |
|
| 86 | + if (isset($this->toPersistModels[ $toRemoveModel->getId() ])) { |
|
| 87 | + unset($toRemoveModels[ $toRemoveModel->getId() ]); |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
@@ -15,25 +15,25 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | private function sort(string $modelClass, array $models, array $orderBy = null): array |
| 17 | 17 | { |
| 18 | - if ([] === $models) { |
|
| 19 | - return []; |
|
| 18 | + if ([ ] === $models) { |
|
| 19 | + return [ ]; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | if (null === $orderBy) { |
| 23 | 23 | return $models; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - $reflections = []; |
|
| 26 | + $reflections = [ ]; |
|
| 27 | 27 | foreach ($orderBy as $property => $sortingDirection) { |
| 28 | 28 | $reflection = new \ReflectionProperty($modelClass, $property); |
| 29 | 29 | $reflection->setAccessible(true); |
| 30 | 30 | |
| 31 | - $reflections[$property] = $reflection; |
|
| 31 | + $reflections[ $property ] = $reflection; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - usort($models, function (ModelInterface $a, ModelInterface $b) use ($reflections, $orderBy) { |
|
| 34 | + usort($models, function(ModelInterface $a, ModelInterface $b) use ($reflections, $orderBy) { |
|
| 35 | 35 | foreach ($orderBy as $property => $sortingDirection) { |
| 36 | - $reflection = $reflections[$property]; |
|
| 36 | + $reflection = $reflections[ $property ]; |
|
| 37 | 37 | $valueA = $reflection->getValue($a); |
| 38 | 38 | $valueB = $reflection->getValue($b); |
| 39 | 39 | |
@@ -9,12 +9,12 @@ discard block |
||
| 9 | 9 | /** |
| 10 | 10 | * @var array |
| 11 | 11 | */ |
| 12 | - private $cache = []; |
|
| 12 | + private $cache = [ ]; |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * @param array $cache |
| 16 | 16 | */ |
| 17 | - public function __construct(array $cache = []) |
|
| 17 | + public function __construct(array $cache = [ ]) |
|
| 18 | 18 | { |
| 19 | 19 | $this->cache = $cache; |
| 20 | 20 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function set(string $id, array $entry): StorageCacheInterface |
| 29 | 29 | { |
| 30 | - $this->cache[$id] = $entry; |
|
| 30 | + $this->cache[ $id ] = $entry; |
|
| 31 | 31 | |
| 32 | 32 | return $this; |
| 33 | 33 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | throw EntryNotFoundException::fromId($id); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - return $this->cache[$id]; |
|
| 58 | + return $this->cache[ $id ]; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function remove(string $id): StorageCacheInterface |
| 67 | 67 | { |
| 68 | - unset($this->cache[$id]); |
|
| 68 | + unset($this->cache[ $id ]); |
|
| 69 | 69 | |
| 70 | 70 | return $this; |
| 71 | 71 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function clear(): StorageCacheInterface |
| 77 | 77 | { |
| 78 | - $this->cache = []; |
|
| 78 | + $this->cache = [ ]; |
|
| 79 | 79 | |
| 80 | 80 | return $this; |
| 81 | 81 | } |
@@ -89,11 +89,11 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | $this->resolved = true; |
| 91 | 91 | |
| 92 | - $criteria = [$this->foreignField => $this->foreignId]; |
|
| 92 | + $criteria = [ $this->foreignField => $this->foreignId ]; |
|
| 93 | 93 | |
| 94 | - $models = []; |
|
| 94 | + $models = [ ]; |
|
| 95 | 95 | foreach ($this->resolver->findBy($this->modelClass, $criteria, $this->orderBy) as $model) { |
| 96 | - $models[$model->getId()] = $model; |
|
| 96 | + $models[ $model->getId() ] = $model; |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | $this->initialModels = $models; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | $this->propertyReflection->setValue($model, $this->foreignId); |
| 113 | 113 | |
| 114 | - $this->models[$model->getId()] = $model; |
|
| 114 | + $this->models[ $model->getId() ] = $model; |
|
| 115 | 115 | |
| 116 | 116 | return $this; |
| 117 | 117 | } |
@@ -125,10 +125,10 @@ discard block |
||
| 125 | 125 | { |
| 126 | 126 | $this->resolveModels(); |
| 127 | 127 | |
| 128 | - if (isset($this->models[$model->getId()])) { |
|
| 128 | + if (isset($this->models[ $model->getId() ])) { |
|
| 129 | 129 | $this->propertyReflection->setValue($model, null); |
| 130 | 130 | |
| 131 | - unset($this->models[$model->getId()]); |
|
| 131 | + unset($this->models[ $model->getId() ]); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | return $this; |
@@ -202,9 +202,9 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | $this->resolveModels(); |
| 204 | 204 | |
| 205 | - $serializedModels = []; |
|
| 205 | + $serializedModels = [ ]; |
|
| 206 | 206 | foreach ($this->getModels() as $model) { |
| 207 | - $serializedModels[] = $model->jsonSerialize(); |
|
| 207 | + $serializedModels[ ] = $model->jsonSerialize(); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | return $serializedModels; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $this->foreignId = $foreignId; |
| 59 | 59 | $this->orderBy = $orderBy; |
| 60 | 60 | |
| 61 | - $this->models = []; |
|
| 61 | + $this->models = [ ]; |
|
| 62 | 62 | |
| 63 | 63 | $this->propertyReflection = new \ReflectionProperty($this->modelClass, $this->foreignField); |
| 64 | 64 | $this->propertyReflection->setAccessible(true); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | $this->propertyReflection->setValue($model, $this->foreignId); |
| 75 | 75 | |
| 76 | - $this->models[$model->getId()] = $model; |
|
| 76 | + $this->models[ $model->getId() ] = $model; |
|
| 77 | 77 | |
| 78 | 78 | return $this; |
| 79 | 79 | } |
@@ -85,10 +85,10 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function removeModel(ModelInterface $model): ModelCollectionInterface |
| 87 | 87 | { |
| 88 | - if (isset($this->models[$model->getId()])) { |
|
| 88 | + if (isset($this->models[ $model->getId() ])) { |
|
| 89 | 89 | $this->propertyReflection->setValue($model, null); |
| 90 | 90 | |
| 91 | - unset($this->models[$model->getId()]); |
|
| 91 | + unset($this->models[ $model->getId() ]); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | return $this; |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | public function getInitialModels(): array |
| 126 | 126 | { |
| 127 | - return []; |
|
| 127 | + return [ ]; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | { |
| 151 | 151 | $this->jsonSerializableOrException(); |
| 152 | 152 | |
| 153 | - $serializedModels = []; |
|
| 153 | + $serializedModels = [ ]; |
|
| 154 | 154 | foreach ($this->getModels() as $model) { |
| 155 | - $serializedModels[] = $model->jsonSerialize(); |
|
| 155 | + $serializedModels[ ] = $model->jsonSerialize(); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | return $serializedModels; |