Completed
Push — master ( 11031e...5bb37a )
by Dmitry
02:06
created
src/Plugins/Sequence.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
     public function generateKey(Entity $instance, Space $space)
12 12
     {
13 13
         $primary = $space->getPrimaryIndex();
14
-        if(count($primary->parts) == 1) {
14
+        if (count($primary->parts) == 1) {
15 15
             $key = $space->getFormat()[$primary->parts[0][0]]['name'];
16
-            if(!property_exists($instance, $key)) {
16
+            if (!property_exists($instance, $key)) {
17 17
                 $instance->$key = $this->generateValue($space);
18 18
             }
19 19
         }
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     {
24 24
         $spaceId = $space->getId();
25 25
 
26
-        if(!$this->mapper->getSchema()->hasSpace('sequence')) {
26
+        if (!$this->mapper->getSchema()->hasSpace('sequence')) {
27 27
 
28 28
             $sequence = $this->mapper->getSchema()->createSpace('sequence');
29 29
             $sequence->addProperty('space', 'unsigned');
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         }
33 33
 
34 34
         $entity = $this->mapper->findOne('sequence', $space->getId());
35
-        if(!$entity) {
35
+        if (!$entity) {
36 36
 
37 37
             $query = "return box.space.".$space->getName().".index[0]:max()";
38 38
             $data = $this->mapper->getClient()->evaluate($query)->getData();
Please login to merge, or discard this patch.
src/Schema.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
         $this->spaces[$id] = new Space($this->mapper, $id, $space);
30 30
 
31
-        if($properties) {
31
+        if ($properties) {
32 32
             $this->spaces[$id]->addProperties($properties);
33 33
         }
34 34
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
     public function formatValue($type, $value)
39 39
     {
40
-        switch($type) {
40
+        switch ($type) {
41 41
             case 'STR':
42 42
             case 'str':
43 43
                 return (string) $value;
@@ -53,15 +53,15 @@  discard block
 block discarded – undo
53 53
 
54 54
     public function getSpace($id)
55 55
     {
56
-        if(is_string($id)) {
56
+        if (is_string($id)) {
57 57
             return $this->getSpace($this->getSpaceId($id));
58 58
         }
59 59
 
60
-        if(!$id) {
60
+        if (!$id) {
61 61
             throw new Exception("Space id or name not defined");
62 62
         }
63 63
 
64
-        if(!array_key_exists($id, $this->spaces)) {
64
+        if (!array_key_exists($id, $this->spaces)) {
65 65
             $this->spaces[$id] = new Space($this->mapper, $id, array_search($id, $this->names));
66 66
         }
67 67
         return $this->spaces[$id];
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
     public function getSpaceId($name)
71 71
     {
72
-        if(!$this->hasSpace($name)) {
72
+        if (!$this->hasSpace($name)) {
73 73
             throw new Exception("No space $name");
74 74
         }
75 75
         return $this->names[$name];
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
     public function getSpaces()
79 79
     {
80
-        foreach($this->names as $id) {
80
+        foreach ($this->names as $id) {
81 81
             $this->getSpace($id);
82 82
         }
83 83
         return $this->spaces;
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 
91 91
     public function once($name, $callback)
92 92
     {
93
-        $key = 'once' . $name;
93
+        $key = 'once'.$name;
94 94
 
95 95
         $rows = $this->mapper->find('_schema', ['key' => $key]);
96
-        if(!count($rows)) {
96
+        if (!count($rows)) {
97 97
             $this->mapper->create('_schema', ['key' => $key]);
98 98
             return $callback($this->mapper);
99 99
         }
Please login to merge, or discard this patch.