@@ -90,7 +90,7 @@ |
||
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 | 96 | if (!count($rows)) { |
@@ -113,7 +113,7 @@ |
||
113 | 113 | if (!$this->getPropertyType($property)) { |
114 | 114 | throw new Exception("Unknown property $property", 1); |
115 | 115 | } |
116 | - $options['parts'][] = $this->getPropertyIndex($property)+1; |
|
116 | + $options['parts'][] = $this->getPropertyIndex($property) + 1; |
|
117 | 117 | $options['parts'][] = $this->getPropertyType($property); |
118 | 118 | } |
119 | 119 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | public function addPlugin($class) |
21 | 21 | { |
22 | 22 | if (!is_subclass_of($class, Plugin::class)) { |
23 | - throw new Exception("Plugin should extend " . Plugin::class . " class"); |
|
23 | + throw new Exception("Plugin should extend ".Plugin::class." class"); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | $plugin = is_object($class) ? $class : new $class($this); |
@@ -24,7 +24,7 @@ |
||
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 | } |
@@ -36,7 +36,7 @@ discard block |
||
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 |
||
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; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | public function disableRequest($class) |
26 | 26 | { |
27 | 27 | if (!is_subclass_of($class, Request::class)) { |
28 | - throw new Exception("Invalid request type: " . $class); |
|
28 | + throw new Exception("Invalid request type: ".$class); |
|
29 | 29 | } |
30 | 30 | $this->disabledRequests[] = $class; |
31 | 31 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public function sendRequest(Request $request) |
34 | 34 | { |
35 | 35 | if (in_array(get_class($request), $this->disabledRequests)) { |
36 | - throw new Exception(get_class($request) . ' is disabled'); |
|
36 | + throw new Exception(get_class($request).' is disabled'); |
|
37 | 37 | } |
38 | 38 | $start = microtime(1); |
39 | 39 | $response = parent::sendRequest($request); |
@@ -3,11 +3,9 @@ |
||
3 | 3 | namespace Tarantool\Mapper\Plugin; |
4 | 4 | |
5 | 5 | use Exception; |
6 | - |
|
7 | 6 | use phpDocumentor\Reflection\DocBlockFactory; |
8 | 7 | use ReflectionClass; |
9 | 8 | use ReflectionProperty; |
10 | - |
|
11 | 9 | use Tarantool\Mapper\Entity; |
12 | 10 | use Tarantool\Mapper\Plugin; |
13 | 11 | use Tarantool\Mapper\Plugin\NestedSet; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $space->addIndex($index); |
140 | 140 | } catch (Exception $e) { |
141 | 141 | $presentation = json_encode($properties['indexes'][$i]); |
142 | - throw new Exception("Failed to add index $presentation. ". $e->getMessage(), 0, $e); |
|
142 | + throw new Exception("Failed to add index $presentation. ".$e->getMessage(), 0, $e); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | foreach ($schema->getSpaces() as $space) { |
149 | 149 | if (!count($space->getIndexes())) { |
150 | 150 | if (!$space->hasProperty('id')) { |
151 | - throw new Exception("No primary index on ". $space->getName()); |
|
151 | + throw new Exception("No primary index on ".$space->getName()); |
|
152 | 152 | } |
153 | 153 | $space->addIndex(['id']); |
154 | 154 | } |
@@ -51,12 +51,12 @@ |
||
51 | 51 | $old_entity = $repository->getOriginal($entity); |
52 | 52 | |
53 | 53 | foreach (['group'] as $field) { |
54 | - if ($old_entity[$map->$field-1] != $entity->$field) { |
|
54 | + if ($old_entity[$map->$field - 1] != $entity->$field) { |
|
55 | 55 | throw new \Exception(ucfirst($field)." can't be changed"); |
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | - if ($old_entity[$map->parent-1] != $entity->parent) { |
|
59 | + if ($old_entity[$map->parent - 1] != $entity->parent) { |
|
60 | 60 | $leftValue = $entity->left; |
61 | 61 | $rightValue = $entity->right; |
62 | 62 | $toRoot = $entity->parent == 0 ? 1 : 0; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | if (!$this->mapper->getSchema()->hasSpace($override['entity'])) { |
52 | - throw new Exception("invalid entity " . $override['entity']); |
|
52 | + throw new Exception("invalid entity ".$override['entity']); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | $space = $this->mapper->getSchema()->getSpace($override['entity']); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | public function getState($entity, $id, $date) |
75 | 75 | { |
76 | 76 | if (!$this->mapper->getSchema()->hasSpace($entity)) { |
77 | - throw new Exception("invalid entity: " . $entity); |
|
77 | + throw new Exception("invalid entity: ".$entity); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | $entity = $this->mapper->getSchema()->getSpace($entity)->getId(); |
@@ -168,11 +168,11 @@ discard block |
||
168 | 168 | while (!$clean) { |
169 | 169 | $clean = true; |
170 | 170 | foreach ($states as $i => $state) { |
171 | - if (array_key_exists($i+1, $states)) { |
|
172 | - $next = $states[$i+1]; |
|
171 | + if (array_key_exists($i + 1, $states)) { |
|
172 | + $next = $states[$i + 1]; |
|
173 | 173 | if (!count(array_diff_assoc($state['data'], $next['data']))) { |
174 | 174 | $states[$i]['end'] = $next['end']; |
175 | - unset($states[$i+1]); |
|
175 | + unset($states[$i + 1]); |
|
176 | 176 | $states = array_values($states); |
177 | 177 | $clean = false; |
178 | 178 | break; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | { |
191 | 191 | switch ($name) { |
192 | 192 | case 'override': |
193 | - return $this->mapper->getSchema()->once(__CLASS__.'_states', function (Mapper $mapper) { |
|
193 | + return $this->mapper->getSchema()->once(__CLASS__.'_states', function(Mapper $mapper) { |
|
194 | 194 | $mapper->getSchema() |
195 | 195 | ->createSpace('_override', [ |
196 | 196 | 'entity' => 'unsigned', |