@@ -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; |
@@ -33,6 +33,9 @@ |
||
| 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); |
@@ -89,6 +89,9 @@ |
||
| 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) { |
@@ -41,7 +41,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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); |
@@ -325,6 +325,9 @@ |
||
| 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; |
@@ -199,7 +199,7 @@ discard block |
||
| 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 |
||
| 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; |
@@ -61,7 +61,7 @@ |
||
| 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 |
@@ -15,7 +15,7 @@ |
||
| 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); |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | public function getPlugin($mixed) |
| 23 | 23 | { |
| 24 | 24 | if (!is_subclass_of($mixed, Plugin::class)) { |
| 25 | - throw new Exception("Plugin should extend " . Plugin::class . " class"); |
|
| 25 | + throw new Exception("Plugin should extend ".Plugin::class." class"); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | $plugin = is_object($mixed) ? $mixed : new $mixed($this); |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | if ($plugin == $mixed && array_key_exists($class, $this->plugins)) { |
| 32 | 32 | // overwrite plugin instance |
| 33 | - throw new Exception($class . ' is registered'); |
|
| 33 | + throw new Exception($class.' is registered'); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | if (!array_key_exists($class, $this->plugins)) { |
@@ -505,7 +505,7 @@ discard block |
||
| 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 |
||
| 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', |
@@ -58,7 +58,7 @@ |
||
| 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 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | public function register($class) |
| 36 | 36 | { |
| 37 | 37 | if (!is_subclass_of($class, BaseProcedure::class)) { |
| 38 | - throw new Exception("Procedure should extend " . BaseProcedure::class . ' class'); |
|
| 38 | + throw new Exception("Procedure should extend ".BaseProcedure::class.' class'); |
|
| 39 | 39 | } |
| 40 | 40 | $this->initSchema(); |
| 41 | 41 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | private function initSchema() |
| 71 | 71 | { |
| 72 | - $this->mapper->getSchema()->once(__CLASS__, function ($mapper) { |
|
| 72 | + $this->mapper->getSchema()->once(__CLASS__, function($mapper) { |
|
| 73 | 73 | $mapper->getSchema() |
| 74 | 74 | ->createSpace('_procedure') |
| 75 | 75 | ->addProperties([ |