| Total Complexity | 9 |
| Total Lines | 96 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | class HasChild implements Query |
||
| 19 | { |
||
| 20 | use |
||
| 21 | Traits\IgnoreUnmapped, |
||
| 22 | Traits\ScoreMode |
||
| 23 | ; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | private $type; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @var Query |
||
| 32 | */ |
||
| 33 | private $query; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @var int |
||
| 37 | */ |
||
| 38 | private $minChildren; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @var int |
||
| 42 | */ |
||
| 43 | private $maxChildren; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @param string $type |
||
| 47 | * @param Query $query |
||
| 48 | */ |
||
| 49 | public function __construct(string $type, Query $query) |
||
| 50 | { |
||
| 51 | $this->type = $type; |
||
| 52 | $this->query = $query; |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @param int $min |
||
| 57 | * |
||
| 58 | * @return self |
||
| 59 | */ |
||
| 60 | public function minChildren(int $min): self |
||
| 61 | { |
||
| 62 | $this->minChildren = $min; |
||
| 63 | |||
| 64 | return $this; |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @param int $max |
||
| 69 | * |
||
| 70 | * @return self |
||
| 71 | */ |
||
| 72 | public function maxChildren(int $max): self |
||
| 73 | { |
||
| 74 | $this->maxChildren = $max; |
||
| 75 | |||
| 76 | return $this; |
||
| 77 | } |
||
| 78 | |||
| 79 | /** |
||
| 80 | * {@inheritdoc} |
||
| 81 | */ |
||
| 82 | public function name(): string |
||
| 83 | { |
||
| 84 | return 'has_child'; |
||
| 85 | } |
||
| 86 | |||
| 87 | /** |
||
| 88 | * {@inheritdoc} |
||
| 89 | */ |
||
| 90 | public function compile(): array |
||
| 114 | } |
||
| 115 | } |
||
| 116 |