Code Duplication    Length = 18-18 lines in 2 locations

src/Aggregation/Metric/PercentileRanksAggregation.php 1 location

@@ 100-117 (lines=18) @@
97
    /**
98
     * {@inheritdoc}
99
     */
100
    public function getArray()
101
    {
102
        $out = array_filter(
103
            [
104
                'field' => $this->getField(),
105
                'script' => $this->getScript(),
106
                'values' => $this->getValues(),
107
                'compression' => $this->getCompression(),
108
            ],
109
            function ($val) {
110
                return ($val || is_numeric($val));
111
            }
112
        );
113
114
        $this->isRequiredParametersSet($out);
115
116
        return $out;
117
    }
118
119
    /**
120
     * @param array $a

src/Aggregation/Metric/PercentilesAggregation.php 1 location

@@ 100-117 (lines=18) @@
97
    /**
98
     * {@inheritdoc}
99
     */
100
    public function getArray()
101
    {
102
        $out = array_filter(
103
            [
104
                'compression' => $this->getCompression(),
105
                'percents' => $this->getPercents(),
106
                'field' => $this->getField(),
107
                'script' => $this->getScript(),
108
            ],
109
            function ($val) {
110
                return ($val || is_numeric($val));
111
            }
112
        );
113
114
        $this->isRequiredParametersSet($out);
115
116
        return $out;
117
    }
118
119
    /**
120
     * @param array $a