Code Duplication    Length = 14-16 lines in 2 locations

src/Bardex/Elastic/Query.php 2 locations

@@ 141-154 (lines=14) @@
138
     * @link https://www.elastic.co/guide/en/elasticsearch/reference/5.0/search-request-script-fields.html
139
     * @return self $this
140
     */
141
    public function addScriptField($fieldName, $script, array $params = null, $lang = 'painless')
142
    {
143
        $item = [
144
            'script' => [
145
                'lang'   => $lang,
146
                'inline' => $script,
147
            ]
148
        ];
149
        if ($params) {
150
            $item['script']['params'] = $params;
151
        }
152
        $this->scriptFields[$fieldName] = $item;
153
        return $this;
154
    }
155
156
    /**
157
     * Удалить из выборки поля.
@@ 258-273 (lines=16) @@
255
     * @link https://www.elastic.co/guide/en/elasticsearch/reference/5.0/query-dsl-script-query.html
256
     * @link https://www.elastic.co/guide/en/elasticsearch/reference/5.0/modules-scripting-painless.html
257
     */
258
    public function whereScript($script, array $params = null, $lang = 'painless')
259
    {
260
        $item = [
261
            'script' => [
262
                'script' => [
263
                    'inline' => $script,
264
                    'lang'   => $lang
265
                ]
266
            ]
267
        ];
268
        if ($params) {
269
            $item['script']['script']['params'] = $params;
270
        }
271
        $this->filters[] = $item;
272
        return $this;
273
    }
274
275
    /**
276
     * добавить фильтр "больше или равно"