QueryCreateEvent::getLocale()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of Sulu.
5
 *
6
 * (c) MASSIVE ART WebServices GmbH
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Sulu\Component\DocumentManager\Event;
13
14
use Sulu\Component\DocumentManager\Exception\DocumentManagerException;
15
use Sulu\Component\DocumentManager\Query\Query;
16
17
class QueryCreateEvent extends AbstractEvent
18
{
19
    use EventOptionsTrait;
20
21
    /**
22
     * @var string
23
     */
24
    private $innerQuery;
25
26
    /**
27
     * @var Query
28
     */
29
    private $query;
30
31
    /**
32
     * @var string
33
     */
34
    private $locale;
35
36
    /**
37
     * @var null|string
38
     */
39
    private $primarySelector;
40
41
    /**
42
     * @param string $innerQuery
43
     * @param string $locale
44
     * @param array $options
45
     * @param null|string $primarySelector
46
     */
47
    public function __construct($innerQuery, $locale, array $options = [], $primarySelector = null)
48
    {
49
        $this->innerQuery = $innerQuery;
50
        $this->locale = $locale;
51
        $this->options = $options;
0 ignored issues
show
Documentation Bug introduced by
It seems like $options of type array is incompatible with the declared type object<Symfony\Component...solver\OptionsResolver> of property $options.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
52
        $this->primarySelector = $primarySelector;
53
    }
54
55
    /**
56
     * @return string
57
     */
58
    public function getInnerQuery()
59
    {
60
        return $this->innerQuery;
61
    }
62
63
    /**
64
     * @param Query $query
65
     */
66
    public function setQuery(Query $query)
67
    {
68
        $this->query = $query;
69
    }
70
71
    /**
72
     * @return string
73
     */
74
    public function getLocale()
75
    {
76
        return $this->locale;
77
    }
78
79
    /**
80
     * @return null|string
81
     */
82
    public function getPrimarySelector()
83
    {
84
        return $this->primarySelector;
85
    }
86
87
    /**
88
     * @return mixed
89
     *
90
     * @throws DocumentManagerException
91
     */
92
    public function getQuery()
93
    {
94
        if (!$this->query) {
95
            throw new DocumentManagerException(
96
                'No query has been set in listener. A listener should have set the query'
97
            );
98
        }
99
100
        return $this->query;
101
    }
102
}
103