Code Duplication    Length = 13-17 lines in 3 locations

src/Aggregation/Bucketing/DateRangeAggregation.php 1 location

@@ 81-97 (lines=17) @@
78
     *
79
     * @throws \LogicException
80
     */
81
    public function addRange($from = null, $to = null)
82
    {
83
        $range = array_filter(
84
            [
85
                'from' => $from,
86
                'to' => $to,
87
            ]
88
        );
89
90
        if (empty($range)) {
91
            throw new \LogicException('Either from or to must be set. Both cannot be null.');
92
        }
93
94
        $this->ranges[] = $range;
95
96
        return $this;
97
    }
98
99
    /**
100
     * {@inheritdoc}

src/Aggregation/Bucketing/GeoDistanceAggregation.php 1 location

@@ 129-145 (lines=17) @@
126
     *
127
     * @return GeoDistanceAggregation
128
     */
129
    public function addRange($from = null, $to = null)
130
    {
131
        $range = array_filter(
132
            [
133
                'from' => $from,
134
                'to' => $to,
135
            ]
136
        );
137
138
        if (empty($range)) {
139
            throw new \LogicException('Either from or to must be set. Both cannot be null.');
140
        }
141
142
        $this->ranges[] = $range;
143
144
        return $this;
145
    }
146
147
    /**
148
     * {@inheritdoc}

src/Aggregation/Bucketing/Ipv4RangeAggregation.php 1 location

@@ 62-74 (lines=13) @@
59
     *
60
     * @return Ipv4RangeAggregation
61
     */
62
    public function addRange($from = null, $to = null)
63
    {
64
        $range = array_filter(
65
            [
66
                'from' => $from,
67
                'to' => $to,
68
            ]
69
        );
70
71
        $this->ranges[] = $range;
72
73
        return $this;
74
    }
75
76
    /**
77
     * Add ip mask to aggregation.