| Conditions | 3 |
| Paths | 3 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php namespace Nord\Lumen\Elasticsearch\Search\Query\Joining; |
||
| 21 | public function toArray() |
||
| 22 | { |
||
| 23 | $query = $this->getQuery(); |
||
| 24 | |||
| 25 | if ($query === null) { |
||
| 26 | throw new InvalidArgument('Query must be set'); |
||
| 27 | } |
||
| 28 | |||
| 29 | $hasParent = [ |
||
| 30 | 'parent_type' => $this->getType(), |
||
| 31 | 'query' => $query->toArray(), |
||
| 32 | ]; |
||
| 33 | |||
| 34 | $scoreMode = $this->getScoreMode(); |
||
| 35 | if (null !== $scoreMode) { |
||
| 36 | $hasParent['score_mode'] = $scoreMode; |
||
| 37 | } |
||
| 38 | |||
| 39 | return ['has_parent' => $hasParent]; |
||
| 40 | } |
||
| 42 |