SpanNotQuery::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
dl 6
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
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\Span;
13
14
use ONGR\ElasticsearchDSL\ParametersTrait;
15
16
/**
17
 * Elasticsearch Span not query.
18
 *
19
 * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-span-not-query.html
20
 */
21 View Code Duplication
class SpanNotQuery implements SpanQueryInterface
0 ignored issues
show
Duplication introduced by
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...
22
{
23
    use ParametersTrait;
24
25
    /**
26
     * @var SpanQueryInterface
27
     */
28
    private $include;
29
30
    /**
31
     * @var SpanQueryInterface
32
     */
33
    private $exclude;
34
35
    /**
36
     * @param SpanQueryInterface $include
37
     * @param SpanQueryInterface $exclude
38
     * @param array              $parameters
39
     */
40
    public function __construct(SpanQueryInterface $include, SpanQueryInterface $exclude, array $parameters = [])
41
    {
42
        $this->include = $include;
43
        $this->exclude = $exclude;
44
        $this->setParameters($parameters);
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function getType()
51
    {
52
        return 'span_not';
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58
    public function toArray()
59
    {
60
        $query = [
61
            'include' => $this->include->toArray(),
62
            'exclude' => $this->exclude->toArray(),
63
        ];
64
65
        return [$this->getType() => $this->processArray($query)];
66
    }
67
}
68