Completed
Push — master ( 6c9334...f3ba17 )
by Simonas
02:26
created

SimpleQueryStringQuery::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 5
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 5
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ONGR\ElasticsearchDSL\Query\FullText;
13
14
use ONGR\ElasticsearchDSL\BuilderInterface;
15
use ONGR\ElasticsearchDSL\ParametersTrait;
16
17
/**
18
 * Represents Elasticsearch "simple_query_string" query.
19
 *
20
 * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html
21
 */
22 View Code Duplication
class SimpleQueryStringQuery implements BuilderInterface
0 ignored issues
show
Duplication introduced by Simonas Šerlinskas
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
23
{
24
    use ParametersTrait;
25
26
    /**
27
     * @var string The actual query to be parsed.
28
     */
29
    private $query;
30
31
    /**
32
     * @param string $query
33
     * @param array  $parameters
34
     */
35
    public function __construct($query, array $parameters = [])
36
    {
37
        $this->query = $query;
38
        $this->setParameters($parameters);
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function getType()
45
    {
46
        return 'simple_query_string';
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function toArray()
53
    {
54
        $query = [
55
            'query' => $this->query,
56
        ];
57
58
        $output = $this->processArray($query);
59
60
        return [$this->getType() => $output];
61
    }
62
}
63