@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | ]; |
41 | 41 | |
42 | 42 | $changes = $mapper->find('_temporal_reference', $params); |
43 | - $states = $this->generateStates($changes, function ($state, $change) { |
|
43 | + $states = $this->generateStates($changes, function($state, $change) { |
|
44 | 44 | $state->data = $change->targetId; |
45 | 45 | }); |
46 | 46 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | 'targetId' => $entityId, |
67 | 67 | 'entity' => $params['entity'], |
68 | 68 | ]); |
69 | - $aggregates = $this->generateStates($changes, function ($state, $change) { |
|
69 | + $aggregates = $this->generateStates($changes, function($state, $change) { |
|
70 | 70 | if (!in_array($change->id, $state->data)) { |
71 | 71 | $state->data[] = $change->id; |
72 | 72 | } |
@@ -214,11 +214,11 @@ discard block |
||
214 | 214 | while (!$clean) { |
215 | 215 | $clean = true; |
216 | 216 | foreach ($states as $i => $state) { |
217 | - if (array_key_exists($i+1, $states)) { |
|
218 | - $next = $states[$i+1]; |
|
217 | + if (array_key_exists($i + 1, $states)) { |
|
218 | + $next = $states[$i + 1]; |
|
219 | 219 | if (json_encode($state->data) == json_encode($next->data)) { |
220 | 220 | $states[$i]->end = $next->end; |
221 | - unset($states[$i+1]); |
|
221 | + unset($states[$i + 1]); |
|
222 | 222 | $states = array_values($states); |
223 | 223 | $clean = false; |
224 | 224 | break; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | ]; |
243 | 243 | |
244 | 244 | $changes = $mapper->find('_temporal_override', $params); |
245 | - $states = $this->generateStates($changes, function ($state, $change) { |
|
245 | + $states = $this->generateStates($changes, function($state, $change) { |
|
246 | 246 | $state->data = array_merge($state->data, $change->data); |
247 | 247 | }); |
248 | 248 | foreach ($mapper->find('_temporal_override_aggregate', $params) as $aggregate) { |
@@ -340,11 +340,11 @@ discard block |
||
340 | 340 | while (!$clean) { |
341 | 341 | $clean = true; |
342 | 342 | foreach ($states as $i => $state) { |
343 | - if (array_key_exists($i+1, $states)) { |
|
344 | - $next = $states[$i+1]; |
|
343 | + if (array_key_exists($i + 1, $states)) { |
|
344 | + $next = $states[$i + 1]; |
|
345 | 345 | if (json_encode($state->data) == json_encode($next->data)) { |
346 | 346 | $state->end = $next->end; |
347 | - unset($states[$i+1]); |
|
347 | + unset($states[$i + 1]); |
|
348 | 348 | $states = array_values($states); |
349 | 349 | $clean = false; |
350 | 350 | break; |
@@ -258,6 +258,9 @@ |
||
258 | 258 | } |
259 | 259 | } |
260 | 260 | |
261 | + /** |
|
262 | + * @param \Closure $callback |
|
263 | + */ |
|
261 | 264 | private function generateStates($changes, $callback) |
262 | 265 | { |
263 | 266 | $slices = []; |
@@ -114,6 +114,9 @@ |
||
114 | 114 | return $this->spaces[$id]; |
115 | 115 | } |
116 | 116 | |
117 | + /** |
|
118 | + * @param string $name |
|
119 | + */ |
|
117 | 120 | public function getSpaceId($name) |
118 | 121 | { |
119 | 122 | if (!$this->hasSpace($name)) { |
@@ -137,7 +137,7 @@ |
||
137 | 137 | |
138 | 138 | public function once($name, $callback) |
139 | 139 | { |
140 | - $key = 'mapper-once' . $name; |
|
140 | + $key = 'mapper-once'.$name; |
|
141 | 141 | |
142 | 142 | $rows = $this->mapper->find('_schema', ['key' => $key]); |
143 | 143 | if (!count($rows)) { |
@@ -54,7 +54,7 @@ |
||
54 | 54 | |
55 | 55 | private function initSchema() |
56 | 56 | { |
57 | - $this->mapper->getSchema()->once(__CLASS__, function ($mapper) { |
|
57 | + $this->mapper->getSchema()->once(__CLASS__, function($mapper) { |
|
58 | 58 | $mapper->getSchema() |
59 | 59 | ->createSpace('_procedure') |
60 | 60 | ->addProperties([ |
@@ -145,7 +145,7 @@ |
||
145 | 145 | if (!$this->getPropertyType($property)) { |
146 | 146 | throw new Exception("Unknown property $property", 1); |
147 | 147 | } |
148 | - $options['parts'][] = $this->getPropertyIndex($property)+1; |
|
148 | + $options['parts'][] = $this->getPropertyIndex($property) + 1; |
|
149 | 149 | $options['parts'][] = $this->getPropertyType($property); |
150 | 150 | $this->setPropertyNullable($property, false); |
151 | 151 | } |
@@ -274,6 +274,9 @@ |
||
274 | 274 | return $this->formatNamesHash[$name]; |
275 | 275 | } |
276 | 276 | |
277 | + /** |
|
278 | + * @param string $name |
|
279 | + */ |
|
277 | 280 | public function getReference($name) |
278 | 281 | { |
279 | 282 | return $this->isReference($name) ? $this->formatReferences[$name] : null; |