Code Duplication    Length = 13-13 lines in 2 locations

src/Aggregation/Bucketing/DateRangeAggregation.php 1 location

@@ 45-57 (lines=13) @@
42
     * @param string $format
43
     * @param array  $ranges
44
     */
45
    public function __construct($name, $field = null, $format = null, array $ranges = [])
46
    {
47
        parent::__construct($name);
48
49
        $this->setField($field);
50
        $this->setFormat($format);
51
        foreach ($ranges as $range) {
52
            $from = isset($range['from']) ? $range['from'] : null;
53
            $to = isset($range['to']) ? $range['to'] : null;
54
            $key = isset($range['key']) ? $range['key'] : null;
55
            $this->addRange($from, $to, $key);
56
        }
57
    }
58
59
    /**
60
     * @param string $format

src/Aggregation/Bucketing/RangeAggregation.php 1 location

@@ 44-56 (lines=13) @@
41
     * @param array  $ranges
42
     * @param bool   $keyed
43
     */
44
    public function __construct($name, $field = null, $ranges = [], $keyed = false)
45
    {
46
        parent::__construct($name);
47
48
        $this->setField($field);
49
        $this->setKeyed($keyed);
50
        foreach ($ranges as $range) {
51
            $from = isset($range['from']) ? $range['from'] : null;
52
            $to = isset($range['to']) ? $range['to'] : null;
53
            $key = isset($range['key']) ? $range['key'] : null;
54
            $this->addRange($from, $to, $key);
55
        }
56
    }
57
58
    /**
59
     * Sets if result buckets should be keyed.