1 | <?php |
||
23 | private ?int $sigma = null, |
||
24 | private ?string $script = null |
||
25 | ) { |
||
26 | parent::__construct($name); |
||
27 | |||
28 | $this->setField($field); |
||
29 | } |
||
30 | |||
31 | public function getSigma(): ?int |
||
32 | { |
||
33 | return $this->sigma; |
||
34 | } |
||
35 | |||
36 | public function setSigma(?int $sigma): static |
||
37 | { |
||
38 | $this->sigma = $sigma; |
||
39 | |||
40 | return $this; |
||
41 | } |
||
42 | |||
43 | public function getType(): string |
||
44 | { |
||
45 | return 'extended_stats'; |
||
46 | } |
||
47 | |||
48 | public function getArray(): array |
||
49 | { |
||
50 | return array_filter( |
||
51 | [ |
||
52 | 'field' => $this->getField(), |
||
53 | 'script' => $this->getScript(), |
||
54 | 'sigma' => $this->getSigma(), |
||
55 | ], |
||
56 | fn(mixed $val): bool => $val || is_numeric($val) |
||
57 | ); |
||
58 | } |
||
59 | } |
||
60 |