Completed
Pull Request — master (#100)
by
unknown
03:36
created

SpanWithinQuery::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 9
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 9
loc 9
rs 9.6666
cc 1
eloc 5
nc 1
nop 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
namespace ONGR\ElasticsearchDSL\Query\Span;
13
14
/**
15
 * Elasticsearch span within query.
16
 *
17
 * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-span-within-query.html
18
 */
19 View Code Duplication
class SpanWithinQuery 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...
20
{
21
    /**
22
     * @param SpanQueryInterface
23
     */
24
    private $big;
25
26
    /**
27
     * @param SpanQueryInterface
28
     */
29
    private $little;
30
31
    /**
32
     * @param SpanQueryInterface $big
33
     * @param SpanQueryInterface $little
34
     */
35
    public function __construct(SpanQueryInterface $big, SpanQueryInterface $little)
36
    {
37
        $this->big = $big;
38
        $this->little = $little;
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function getType()
45
    {
46
        return 'span_within';
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function toArray()
53
    {
54
        $out = [
55
            'little' => $this->little->toArray(),
56
            'big' => $this->big->toArray(),
57
        ];
58
59
        return [$this->getType() => $out];
60
    }
61
}
62