Code Duplication    Length = 11-11 lines in 2 locations

lib/Elastica/Aggregation/AbstractTermsAggregation.php 2 locations

@@ 30-40 (lines=11) @@
27
     *
28
     * @return $this
29
     */
30
    public function setInclude($pattern, $flags = null)
31
    {
32
        if (is_null($flags)) {
33
            return $this->setParam('include', $pattern);
34
        }
35
36
        return $this->setParam('include', [
37
            'pattern' => $pattern,
38
            'flags' => $flags,
39
        ]);
40
    }
41
42
    /**
43
     * Filter documents to exclude based on a regular expression.
@@ 50-60 (lines=11) @@
47
     *
48
     * @return $this
49
     */
50
    public function setExclude($pattern, $flags = null)
51
    {
52
        if (is_null($flags)) {
53
            return $this->setParam('exclude', $pattern);
54
        }
55
56
        return $this->setParam('exclude', [
57
            'pattern' => $pattern,
58
            'flags' => $flags,
59
        ]);
60
    }
61
62
    /**
63
     * Sets the amount of terms to be returned.