Code Duplication    Length = 17-17 lines in 2 locations

src/Suggest/ContextSuggest.php 1 location

@@ 75-91 (lines=17) @@
72
    /**
73
     * {@inheritdoc}
74
     */
75
    public function toArray()
76
    {
77
        if (!$this->hasParameter('field')) {
78
            $this->addParameter('field', '_all');
79
        }
80
81
        if (!$this->hasParameter('size')) {
82
            $this->addParameter('size', self::DEFAULT_SIZE);
83
        }
84
85
        $output = [$this->name => [
86
            'text' => $this->text,
87
            'completion' => $this->getParameters(),
88
        ]];
89
90
        return $output;
91
    }
92
93
}
94

src/Suggest/TermSuggest.php 1 location

@@ 63-79 (lines=17) @@
60
    /**
61
     * {@inheritdoc}
62
     */
63
    public function toArray()
64
    {
65
        if (!$this->hasParameter('field')) {
66
            $this->addParameter('field', '_all');
67
        }
68
69
        if (!$this->hasParameter('size')) {
70
            $this->addParameter('size', self::DEFAULT_SIZE);
71
        }
72
73
        $output = [$this->name => [
74
            'text' => $this->text,
75
            'term' => $this->getParameters(),
76
        ]];
77
78
        return $output;
79
    }
80
}
81