Code Duplication    Length = 18-18 lines in 3 locations

src/Aggregation/Metric/CardinalityAggregation.php 1 location

@@ 41-58 (lines=18) @@
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function getArray()
42
    {
43
        $out = array_filter(
44
            [
45
                'field' => $this->getField(),
46
                'script' => $this->getScript(),
47
                'precision_threshold' => $this->getPrecisionThreshold(),
48
                'rehash' => $this->isRehash(),
49
            ],
50
            function ($val) {
51
                return ($val || is_bool($val));
52
            }
53
        );
54
55
        $this->checkRequiredFields($out);
56
57
        return $out;
58
    }
59
60
    /**
61
     * @param int $precision

src/Aggregation/Metric/PercentileRanksAggregation.php 1 location

@@ 108-125 (lines=18) @@
105
    /**
106
     * {@inheritdoc}
107
     */
108
    public function getArray()
109
    {
110
        $out = array_filter(
111
            [
112
                'field' => $this->getField(),
113
                'script' => $this->getScript(),
114
                'values' => $this->getValues(),
115
                'compression' => $this->getCompression(),
116
            ],
117
            function ($val) {
118
                return ($val || is_numeric($val));
119
            }
120
        );
121
122
        $this->isRequiredParametersSet($out);
123
124
        return $out;
125
    }
126
127
    /**
128
     * @param array $a

src/Aggregation/Metric/PercentilesAggregation.php 1 location

@@ 108-125 (lines=18) @@
105
    /**
106
     * {@inheritdoc}
107
     */
108
    public function getArray()
109
    {
110
        $out = array_filter(
111
            [
112
                'compression' => $this->getCompression(),
113
                'percents' => $this->getPercents(),
114
                'field' => $this->getField(),
115
                'script' => $this->getScript(),
116
            ],
117
            function ($val) {
118
                return ($val || is_numeric($val));
119
            }
120
        );
121
122
        $this->isRequiredParametersSet($out);
123
124
        return $out;
125
    }
126
127
    /**
128
     * @param array $a