@@ -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(" |