File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace Spameri \ElasticQuery \Query ;
4+
5+ class Nested implements \Spameri \ElasticQuery \Query \LeafQueryInterface
6+ {
7+
8+ private string $ path ;
9+
10+ private \Spameri \ElasticQuery \Query \QueryCollection $ query ;
11+
12+
13+ public function __construct (
14+ string $ path ,
15+ ?\Spameri \ElasticQuery \Query \QueryCollection $ query = NULL
16+ ) {
17+ $ this ->path = $ path ;
18+
19+ if ($ query === NULL ) {
20+ $ query = new \Spameri \ElasticQuery \Query \QueryCollection ();
21+ }
22+
23+ $ this ->query = $ query ;
24+ }
25+
26+
27+ public function key (): string
28+ {
29+ return 'nested_ ' . $ this ->path ;
30+ }
31+
32+
33+ public function toArray (): array
34+ {
35+ return [
36+ 'nested ' => [
37+ 'path ' => $ this ->path ,
38+ 'query ' => [
39+ 'bool ' => $ this ->query ->toArray (),
40+ ],
41+ ],
42+ ];
43+ }
44+
45+
46+ public function getQuery (): \Spameri \ElasticQuery \Query \QueryCollection
47+ {
48+ return $ this ->query ;
49+ }
50+
51+ }
You can’t perform that action at this time.
0 commit comments