Completed
Push — master ( e16320...ed483f )
by Dmitry
01:36
created
src/Plugin/UserClasses.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         }
37 37
 
38 38
         if (!is_subclass_of($class, Entity::class)) {
39
-            throw new Exception("Entity should extend " . Entity::class . " class");
39
+            throw new Exception("Entity should extend ".Entity::class." class");
40 40
         }
41 41
 
42 42
         $this->entityMapping[$space] = $class;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         }
52 52
 
53 53
         if (!is_subclass_of($class, Repository::class)) {
54
-            throw new Exception("Repository should extend " . Repository::class . " class");
54
+            throw new Exception("Repository should extend ".Repository::class." class");
55 55
         }
56 56
 
57 57
         $this->repositoryMapping[$space] = $class;
Please login to merge, or discard this 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/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   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         ];
50 50
 
51 51
         $changes = $mapper->find('_temporal_reference', $params);
52
-        $states = $this->generateStates($changes, function ($state, $change) {
52
+        $states = $this->generateStates($changes, function($state, $change) {
53 53
             $state->data = $change->targetId;
54 54
         });
55 55
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
                 'targetId' => $entityId,
81 81
                 'entity' => $params['entity'],
82 82
             ]);
83
-            $aggregates = $this->generateStates($changes, function ($state, $change) {
83
+            $aggregates = $this->generateStates($changes, function($state, $change) {
84 84
                 if (!in_array($change->id, $state->data)) {
85 85
                     $state->data[] = $change->id;
86 86
                 }
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
         ];
270 270
 
271 271
         $changes = $mapper->find('_temporal_override', $params);
272
-        $states = $this->generateStates($changes, function ($state, $change) {
272
+        $states = $this->generateStates($changes, function($state, $change) {
273 273
             $state->data = array_merge($state->data, $change->data);
274 274
             $state->exists = false;
275 275
         });
Please login to merge, or discard this patch.
src/Entity.php 2 patches
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.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
                 }
62 62
             }
63 63
         }
64
-        throw new BadMethodCallException("Call to undefined method " . get_class($this) . '::' . $name);
64
+        throw new BadMethodCallException("Call to undefined method ".get_class($this).'::'.$name);
65 65
     }
66 66
 
67 67
     public function sync(): Entity
Please login to merge, or discard this patch.
src/Plugin/Temporal.php 2 patches
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.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
     private function getTimestamp($string)
506 506
     {
507 507
         if (Carbon::hasTestNow() || !array_key_exists($string, $this->timestamps)) {
508
-            if (strlen('' . $string) == 8 && is_numeric($string)) {
508
+            if (strlen(''.$string) == 8 && is_numeric($string)) {
509 509
                 $value = Carbon::createFromFormat('Ymd', $string)->setTime(0, 0, 0)->timestamp;
510 510
             } else {
511 511
                 $value = Carbon::parse($string)->timestamp;
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
             $this->mapper->getPlugin(Sequence::class);
550 550
         }
551 551
 
552
-        $this->mapper->getSchema()->once(__CLASS__ . '@entity', function (Mapper $mapper) {
552
+        $this->mapper->getSchema()->once(__CLASS__.'@entity', function(Mapper $mapper) {
553 553
             $this->mapper->getSchema()
554 554
                 ->createSpace('_temporal_entity', [
555 555
                     'id'   => 'unsigned',
Please login to merge, or discard this patch.
src/Plugin/Sequence.php 2 patches
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.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
         $this->initializeSequence($space);
59 59
 
60 60
         $next = $this->mapper->getClient()
61
-            ->call('box.sequence.' . $space->getName() . ':next');
61
+            ->call('box.sequence.'.$space->getName().':next');
62 62
 
63 63
         return $next[0];
64 64
     }
Please login to merge, or discard this patch.
src/Schema.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,6 @@
 block discarded – undo
7 7
 use Closure;
8 8
 use Exception;
9 9
 use Tarantool\Client\Schema\Criteria;
10
-use Tarantool\Client\Schema\Space as ClientSpace;
11 10
 
12 11
 class Schema
13 12
 {
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -89,6 +89,9 @@
 block discarded – undo
89 89
         throw new Exception("Invalid type $type");
90 90
     }
91 91
 
92
+    /**
93
+     * @return string
94
+     */
92 95
     public function formatValue(string $type, $value)
93 96
     {
94 97
         if ($value === null) {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         }
42 42
 
43 43
         if (!in_array($options['engine'], ['memtx', 'vinyl'])) {
44
-            throw new Exception("Invalid engine " . $options['engine']);
44
+            throw new Exception("Invalid engine ".$options['engine']);
45 45
         }
46 46
 
47 47
         [$id] = $this->mapper->getClient()->evaluate("
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
     public function once(string $name, Closure $callback)
163 163
     {
164
-        $key = 'mapper-once' . $name;
164
+        $key = 'mapper-once'.$name;
165 165
         $row = $this->mapper->findOne('_schema', ['key' => $key]);
166 166
         if (!$row) {
167 167
             $this->mapper->create('_schema', ['key' => $key]);
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
     public function forgetOnce(string $name)
173 173
     {
174
-        $key = 'mapper-once' . $name;
174
+        $key = 'mapper-once'.$name;
175 175
         $row = $this->mapper->findOne('_schema', ['key' => $key]);
176 176
         if ($row) {
177 177
             $this->mapper->remove($row);
Please login to merge, or discard this patch.
src/Pool.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
             unset($this->mappers[$name]);
51 51
         }
52 52
         foreach ($this->repositories as $space => $repository) {
53
-            if (strpos($space, $name . '.') !== false) {
53
+            if (strpos($space, $name.'.') !== false) {
54 54
                 unset($this->repositories[$space]);
55 55
             }
56 56
         }
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
@@ -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
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
         }
419 419
 
420 420
         if (!$suppressException) {
421
-            throw new Exception("No index on " . $this->name . ' for [' . implode(', ', array_keys($params)) . ']');
421
+            throw new Exception("No index on ".$this->name.' for ['.implode(', ', array_keys($params)).']');
422 422
         }
423 423
 
424 424
         return null;
Please login to merge, or discard this patch.
src/Procedure/FindOrCreate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     {
16 16
         $index = $space->castIndex($query ?: $params);
17 17
         if ($index === null) {
18
-            throw new Exception("No valid index for " . json_encode($params));
18
+            throw new Exception("No valid index for ".json_encode($params));
19 19
         }
20 20
 
21 21
         $values = $space->getIndexValues($index, $params);
Please login to merge, or discard this patch.