@@ -1,4 +1,4 @@ |
||
1 | -<?php echo '<?php' , PHP_EOL; ?> |
|
1 | +<?php echo '<?php', PHP_EOL; ?> |
|
2 | 2 | |
3 | 3 | use Tarantool\Mapper\Contracts\Manager; |
4 | 4 | use Tarantool\Mapper\Contracts\Migration; |
@@ -139,6 +139,9 @@ |
||
139 | 139 | return $this; |
140 | 140 | } |
141 | 141 | |
142 | + /** |
|
143 | + * @param string $property |
|
144 | + */ |
|
142 | 145 | public function reference(Contracts\Type $foreign, $property = null) |
143 | 146 | { |
144 | 147 | if (!$property) { |
@@ -31,6 +31,9 @@ |
||
31 | 31 | return $response; |
32 | 32 | } |
33 | 33 | |
34 | + /** |
|
35 | + * @param double $start |
|
36 | + */ |
|
34 | 37 | private function log($start, $class, $request = [], $response = []) |
35 | 38 | { |
36 | 39 | if ($this->logging) { |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
208 | - * @return Entity |
|
208 | + * @return boolean |
|
209 | 209 | */ |
210 | 210 | public function knows(Contracts\Entity $entity) |
211 | 211 | { |
@@ -340,6 +340,9 @@ discard block |
||
340 | 340 | return $this->type; |
341 | 341 | } |
342 | 342 | |
343 | + /** |
|
344 | + * @param string $query |
|
345 | + */ |
|
343 | 346 | public function evaluate($query) |
344 | 347 | { |
345 | 348 | $result = []; |
@@ -125,14 +125,14 @@ discard block |
||
125 | 125 | $reject = []; |
126 | 126 | if (is_array($params)) { |
127 | 127 | |
128 | - foreach($params as $key => $value) { |
|
129 | - if(is_string($value)) { |
|
130 | - if(substr($value, 0, 1) == '!') { |
|
128 | + foreach ($params as $key => $value) { |
|
129 | + if (is_string($value)) { |
|
130 | + if (substr($value, 0, 1) == '!') { |
|
131 | 131 | $reject[$key] = substr($value, 1); |
132 | 132 | } |
133 | 133 | } |
134 | 134 | } |
135 | - foreach(array_keys($reject) as $key) { |
|
135 | + foreach (array_keys($reject) as $key) { |
|
136 | 136 | unset($params[$key]); |
137 | 137 | } |
138 | 138 | |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | $properties = $this->type->getProperties(); |
168 | 168 | foreach ($reject as $key => $value) { |
169 | 169 | $num = array_search($key, $properties) + 1; |
170 | - if(!$num) { |
|
170 | + if (!$num) { |
|
171 | 171 | throw new Exception("Unknown property $key"); |
172 | 172 | } |
173 | - $if[] = "tuple[".$num.'] ~= '.(is_numeric($value) ? intval($value):"'$value'"); |
|
173 | + $if[] = "tuple[".$num.'] ~= '.(is_numeric($value) ? intval($value) : "'$value'"); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | return $this->evaluate(" |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | public function removeAll() |
225 | 225 | { |
226 | 226 | $space = $this->type->getSpace(); |
227 | - foreach($space->select([])->getData() as $row) { |
|
227 | + foreach ($space->select([])->getData() as $row) { |
|
228 | 228 | $space->delete([$row[0]]); |
229 | 229 | } |
230 | 230 | $this->flushCache(); |
@@ -22,6 +22,9 @@ discard block |
||
22 | 22 | } |
23 | 23 | } |
24 | 24 | |
25 | + /** |
|
26 | + * @param string $key |
|
27 | + */ |
|
25 | 28 | public function __set($key, $value) |
26 | 29 | { |
27 | 30 | if ($key == 'id' && $this->getId()) { |
@@ -31,6 +34,9 @@ discard block |
||
31 | 34 | $this->$key = $value; |
32 | 35 | } |
33 | 36 | |
37 | + /** |
|
38 | + * @param string $key |
|
39 | + */ |
|
34 | 40 | public function __get($key) |
35 | 41 | { |
36 | 42 | if (property_exists($this, $key)) { |
@@ -74,13 +74,13 @@ |
||
74 | 74 | |
75 | 75 | public function __call($name, $params) |
76 | 76 | { |
77 | - if(strlen($name) > 3) { |
|
77 | + if (strlen($name) > 3) { |
|
78 | 78 | $property = substr($name, 3); |
79 | 79 | $property[0] = strtolower($property[0]); |
80 | - if(strpos($name, 'get') === 0) { |
|
80 | + if (strpos($name, 'get') === 0) { |
|
81 | 81 | return $this->__get($property); |
82 | 82 | } |
83 | - if(strpos($name, 'set') === 0) { |
|
83 | + if (strpos($name, 'set') === 0) { |
|
84 | 84 | return $this->__set($property, $params[0]); |
85 | 85 | } |
86 | 86 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | $this->spaceSpace = $client->getSpace(Space::VSPACE); |
21 | 21 | $this->indexSpace = $client->getSpace(Space::VINDEX); |
22 | 22 | |
23 | - if($data) { |
|
23 | + if ($data) { |
|
24 | 24 | $this->spaceId = $data; |
25 | 25 | |
26 | 26 | } else { |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $this->spaceSpace = $client->getSpace(Space::VSPACE); |
22 | 22 | $this->indexSpace = $client->getSpace(Space::VINDEX); |
23 | 23 | |
24 | - if($data) { |
|
24 | + if ($data) { |
|
25 | 25 | $this->spaceId = $data[0]; |
26 | 26 | $this->numberType = $data[1]; |
27 | 27 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | public function getNumberType() |
35 | 35 | { |
36 | - if(!$this->numberType) { |
|
36 | + if (!$this->numberType) { |
|
37 | 37 | $version = $this->client->evaluate('return box.info.version')->getData()[0]; |
38 | 38 | $this->numberType = $version >= '1.7' ? 'UNSIGNED' : 'NUM'; |
39 | 39 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | return 'STR'; |
33 | 33 | } |
34 | 34 | |
35 | - if(!$this->numberType) { |
|
35 | + if (!$this->numberType) { |
|
36 | 36 | throw new Exception("numberType property is null", 1); |
37 | 37 | } |
38 | 38 | return $this->numberType; |