Completed
Push — master ( 4d255d...d14d6a )
by Dmitry
01:33
created
src/Bootstrap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
             if (!is_object($migration)) {
25 25
                 $migration = new $migration;
26 26
             }
27
-            $schema->once(get_class($migration), function () use ($migration) {
27
+            $schema->once(get_class($migration), function() use ($migration) {
28 28
                 $migration->migrate($this->mapper);
29 29
             });
30 30
         }
Please login to merge, or discard this patch.
src/Plugin/Temporal/Schema.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
     private function initLink()
33 33
     {
34
-        $this->mapper->getSchema()->once(__CLASS__.'@link', function (Mapper $mapper) {
34
+        $this->mapper->getSchema()->once(__CLASS__.'@link', function(Mapper $mapper) {
35 35
             $mapper->getSchema()
36 36
                 ->createSpace('_temporal_link', [
37 37
                     'id'        => 'unsigned',
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
                 ->addIndex(['entity', 'id', 'begin']);
63 63
         });
64 64
 
65
-        $this->mapper->getSchema()->once(__CLASS__.'@link-idle', function (Mapper $mapper) {
65
+        $this->mapper->getSchema()->once(__CLASS__.'@link-idle', function(Mapper $mapper) {
66 66
             $mapper->getSchema()->getSpace('_temporal_link')->addProperty('idle', 'unsigned');
67 67
         });
68 68
     }
69 69
 
70 70
     private function initOverride()
71 71
     {
72
-        $this->mapper->getSchema()->once(__CLASS__.'@states', function (Mapper $mapper) {
72
+        $this->mapper->getSchema()->once(__CLASS__.'@states', function(Mapper $mapper) {
73 73
             $mapper->getSchema()
74 74
                 ->createSpace('_temporal_override', [
75 75
                     'entity'     => 'unsigned',
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
                 ->addIndex(['entity', 'id', 'begin']);
94 94
         });
95 95
 
96
-        $this->mapper->getSchema()->once(__CLASS__.'@override-idle', function (Mapper $mapper) {
96
+        $this->mapper->getSchema()->once(__CLASS__.'@override-idle', function(Mapper $mapper) {
97 97
             $mapper->getSchema()->getSpace('_temporal_override')->addProperty('idle', 'unsigned');
98 98
         });
99 99
     }
100 100
 
101 101
     private function initReference()
102 102
     {
103
-        $this->mapper->getSchema()->once(__CLASS__.'@reference', function (Mapper $mapper) {
103
+        $this->mapper->getSchema()->once(__CLASS__.'@reference', function(Mapper $mapper) {
104 104
             $mapper->getSchema()
105 105
                 ->createSpace('_temporal_reference', [
106 106
                     'idle'       => 'unsigned',
Please login to merge, or discard this patch.
src/Plugin/Temporal/Aggregator.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -258,6 +258,9 @@
 block discarded – undo
258 258
         }
259 259
     }
260 260
 
261
+    /**
262
+     * @param \Closure $callback
263
+     */
261 264
     private function generateStates($changes, $callback)
262 265
     {
263 266
         $slices = [];
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         ];
47 47
 
48 48
         $changes = $mapper->find('_temporal_reference', $params);
49
-        $states = $this->generateStates($changes, function ($state, $change) {
49
+        $states = $this->generateStates($changes, function($state, $change) {
50 50
             $state->data = $change->targetId;
51 51
         });
52 52
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
                 'targetId' => $entityId,
78 78
                 'entity' => $params['entity'],
79 79
             ]);
80
-            $aggregates = $this->generateStates($changes, function ($state, $change) {
80
+            $aggregates = $this->generateStates($changes, function($state, $change) {
81 81
                 if (!in_array($change->id, $state->data)) {
82 82
                     $state->data[] = $change->id;
83 83
                 }
@@ -232,11 +232,11 @@  discard block
 block discarded – undo
232 232
             while (!$clean) {
233 233
                 $clean = true;
234 234
                 foreach ($states as $i => $state) {
235
-                    if (array_key_exists($i+1, $states)) {
236
-                        $next = $states[$i+1];
235
+                    if (array_key_exists($i + 1, $states)) {
236
+                        $next = $states[$i + 1];
237 237
                         if (json_encode($state->data) == json_encode($next->data)) {
238 238
                             $states[$i]->end = $next->end;
239
-                            unset($states[$i+1]);
239
+                            unset($states[$i + 1]);
240 240
                             $states = array_values($states);
241 241
                             $clean = false;
242 242
                             break;
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
         ];
265 265
 
266 266
         $changes = $mapper->find('_temporal_override', $params);
267
-        $states = $this->generateStates($changes, function ($state, $change) {
267
+        $states = $this->generateStates($changes, function($state, $change) {
268 268
             $state->data = array_merge($state->data, $change->data);
269 269
             $state->exists = false;
270 270
         });
@@ -344,15 +344,15 @@  discard block
 block discarded – undo
344 344
         while (!$clean) {
345 345
             $clean = true;
346 346
             foreach ($states as $i => $state) {
347
-                if (array_key_exists($i+1, $states)) {
348
-                    $next = $states[$i+1];
347
+                if (array_key_exists($i + 1, $states)) {
348
+                    $next = $states[$i + 1];
349 349
                     if ($state->end && $state->end < $next->begin) {
350 350
                         // unmergable
351 351
                         continue;
352 352
                     }
353 353
                     if (json_encode($state->data) == json_encode($next->data)) {
354 354
                         $state->end = $next->end;
355
-                        unset($states[$i+1]);
355
+                        unset($states[$i + 1]);
356 356
                         $states = array_values($states);
357 357
                         $clean = false;
358 358
                         break;
Please login to merge, or discard this patch.
src/Plugin/Procedure.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
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([
Please login to merge, or discard this patch.
src/Plugin/Temporal.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
                 'entityId' => $id,
383 383
                 'parent'   => $node ? $node->id : 0,
384 384
             ];
385
-            if (count($config) == $i+1) {
385
+            if (count($config) == $i + 1) {
386 386
                 $params['begin'] = $link['begin'];
387 387
                 $params['timestamp'] = 0;
388 388
             }
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
             $this->mapper->getPlugin(Sequence::class);
462 462
         }
463 463
 
464
-        $this->mapper->getSchema()->once(__CLASS__.'@entity', function (Mapper $mapper) {
464
+        $this->mapper->getSchema()->once(__CLASS__.'@entity', function(Mapper $mapper) {
465 465
             $this->mapper->getSchema()
466 466
                 ->createSpace('_temporal_entity', [
467 467
                     'id'   => 'unsigned',
Please login to merge, or discard this patch.
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -250,6 +250,9 @@  discard block
 block discarded – undo
250 250
         return $this->getData($entity, $id, $date, '_temporal_override_aggregate');
251 251
     }
252 252
 
253
+    /**
254
+     * @param string $space
255
+     */
253 256
     private function getData($entity, $id, $date, $space)
254 257
     {
255 258
         $entity = $this->entityNameToId($entity);
@@ -468,6 +471,9 @@  discard block
 block discarded – undo
468 471
         return $this;
469 472
     }
470 473
 
474
+    /**
475
+     * @return string
476
+     */
471 477
     private function getTimestamp($string)
472 478
     {
473 479
         if (Carbon::hasTestNow() || !array_key_exists($string, $this->timestamps)) {
Please login to merge, or discard this patch.
src/Entity.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use BadMethodCallException;
6 6
 use Exception;
7
-use Tarantool\Mapper\Plugin\Annotation;
8 7
 
9 8
 class Entity
10 9
 {
Please login to merge, or discard this patch.
src/Plugin/UserClasses.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -33,6 +33,9 @@
 block discarded – undo
33 33
         return null;
34 34
     }
35 35
 
36
+    /**
37
+     * @param string $space
38
+     */
36 39
     public function mapEntity($space, $class) : self
37 40
     {
38 41
         $this->validateSpace($space);
Please login to merge, or discard this patch.
src/Space.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -325,6 +325,9 @@
 block discarded – undo
325 325
         return $this->formatNamesHash[$name];
326 326
     }
327 327
 
328
+    /**
329
+     * @return string
330
+     */
328 331
     public function getReference(string $name) : ?string
329 332
     {
330 333
         return $this->isReference($name) ? $this->formatReferences[$name] : null;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
             if (!$this->getPropertyType($property)) {
167 167
                 throw new Exception("Unknown property $property", 1);
168 168
             }
169
-            $options['parts'][] = $this->getPropertyIndex($property)+1;
169
+            $options['parts'][] = $this->getPropertyIndex($property) + 1;
170 170
             $options['parts'][] = $this->getPropertyType($property);
171 171
             $this->setPropertyNullable($property, false);
172 172
         }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 
200 200
     public function isSpecial() : bool
201 201
     {
202
-        return in_array($this->id, [ ClientSpace::VSPACE_ID, ClientSpace::VINDEX_ID ]);
202
+        return in_array($this->id, [ClientSpace::VSPACE_ID, ClientSpace::VINDEX_ID]);
203 203
     }
204 204
 
205 205
     public function isSystem() : bool
Please login to merge, or discard this patch.
src/Plugin/Sequence.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
             $this->mapper
47 47
                 ->getPlugin(Procedure::class)
48 48
                 ->get(CreateSequence::class)
49
-                ->execute($name, $primaryIndex['name'], $primaryIndex['parts'][0][0]+1);
49
+                ->execute($name, $primaryIndex['name'], $primaryIndex['parts'][0][0] + 1);
50 50
 
51 51
             $this->mapper->getRepository('_vsequence')->flushCache();
52 52
 
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,6 @@
 block discarded – undo
5 5
 namespace Tarantool\Mapper\Plugin;
6 6
 
7 7
 use Exception;
8
-use Tarantool\Client\Schema\Operations;
9 8
 use Tarantool\Mapper\Entity;
10 9
 use Tarantool\Mapper\Plugin;
11 10
 use Tarantool\Mapper\Procedure\CreateSequence;
Please login to merge, or discard this patch.