Completed
Pull Request — master (#348)
by
unknown
10:14
created

SpanContainingQuery   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 87
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 2
dl 0
loc 87
rs 10
c 0
b 0
f 0
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
declare(strict_types=1);
13
14
namespace ONGR\ElasticsearchDSL\Query\Span;
15
16
use ONGR\ElasticsearchDSL\ParametersTrait;
17
18
/**
19
 * Elasticsearch span containing query.
20
 *
21
 * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-span-containing-query.html
22
 */
23
class SpanContainingQuery implements SpanQueryInterface
24
{
25
    use ParametersTrait;
26
27
    public function __construct(private SpanQueryInterface $little, private SpanQueryInterface $big)
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_PRIVATE, expecting T_VARIABLE
Loading history...
28
    {
29
        $this->setLittle($little);
30
        $this->setBig($big);
31
    }
32
33
    public function getLittle(): SpanQueryInterface
34
    {
35
        return $this->little;
36
    }
37
38
    public function setLittle(SpanQueryInterface $little): static
39
    {
40
        $this->little = $little;
41
42
        return $this;
43
    }
44
45
    public function getBig(): SpanQueryInterface
46
    {
47
        return $this->big;
48
    }
49
50
    public function setBig(SpanQueryInterface $big): static
51
    {
52
        $this->big = $big;
53
54
        return $this;
55
    }
56
57
    public function getType(): string
58
    {
59
        return 'span_containing';
60
    }
61
62
    public function toArray(): array
63
    {
64
        $output = [
65
            'little' => $this->getLittle()->toArray(),
66
            'big' => $this->getBig()->toArray(),
67
        ];
68
69
        $output = $this->processArray($output);
70
71
        return [$this->getType() => $output];
72
    }
73
}
74