Total Complexity | 4 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
9 | class InnerHit extends AbstractQuery |
||
10 | { |
||
11 | /** |
||
12 | * Nested inner hit |
||
13 | * |
||
14 | * @param string $name |
||
15 | * @param string $path |
||
16 | * @param \Closure|null $search |
||
17 | * @return InnerHit |
||
18 | */ |
||
19 | 2 | public function nestedInnerHit(string $name, string $path, ?\Closure $search = null) : InnerHit |
|
20 | { |
||
21 | 2 | $searchForNested = null; |
|
22 | |||
23 | 2 | if ($search) { |
|
24 | 2 | $searchBuilder = app()->make(Search::class); |
|
25 | 2 | $search($searchBuilder); |
|
26 | |||
27 | 2 | $searchForNested = $searchBuilder->getSearch(); |
|
28 | } |
||
29 | |||
30 | 2 | $this->search->addInnerHit(new NestedInnerHit($name, $path, $searchForNested)); |
|
31 | 2 | return $this; |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * Parent inner hits |
||
36 | * |
||
37 | * @param string $name |
||
38 | * @param string $path |
||
39 | * @param \Closure|null $search |
||
40 | * @return InnerHit |
||
41 | */ |
||
42 | 1 | public function parentInnerHit(string $name, string $path, ?\Closure $search = null) : InnerHit |
|
55 | } |
||
56 | } |
||
57 |