Completed
Push — master ( 4059cd...ef58c8 )
by Simonas
84:03 queued 19:25
created

Filter/ViewData.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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\FilterManagerBundle\Filter;
13
14
use ONGR\FilterManagerBundle\SerializableInterface;
15
16
/**
17
 * This class defines data structure passed into view by single filter.
18
 */
19
class ViewData implements SerializableInterface
20
{
21
    /**
22
     * @var FilterState
23
     */
24
    private $state;
25
26
    /**
27
     * @var array
28
     */
29
    private $tags;
30
31
    /**
32
     * @var array Url parameters representing current filter state.
33
     */
34
    private $urlParameters;
35
36
    /**
37
     * @var array Url parameters to reset filter.
38
     */
39
    private $resetUrlParameters;
40
41
    /**
42
     * @var string Filter name.
43
     */
44
    private $name;
45
46
    /**
47
     * @return string
48
     */
49
    public function getName()
50
    {
51
        return $this->name;
52
    }
53
54
    /**
55
     * @param string $name
56
     */
57
    public function setName($name)
58
    {
59
        $this->name = $name;
60
    }
61
62
    /**
63
     * @return array
64
     */
65
    public function getResetUrlParameters()
66
    {
67
        return $this->resetUrlParameters;
68
    }
69
70
    /**
71
     * @param array $resetUrlParameters
72
     */
73
    public function setResetUrlParameters($resetUrlParameters)
74
    {
75
        $this->resetUrlParameters = $resetUrlParameters;
76
    }
77
78
    /**
79
     * @return FilterState
80
     */
81
    public function getState()
82
    {
83
        return $this->state;
84
    }
85
86
    /**
87
     * @param FilterState $state
88
     */
89
    public function setState(FilterState $state)
90
    {
91
        $this->state = $state;
92
    }
93
94
    /**
95
     * @return string
96
     */
97
    public function getTags()
98
    {
99
        return $this->tags;
100
    }
101
102
    /**
103
     * @param string $tag
104
     *
105
     * @return bool
106
     */
107
    public function hasTag($tag)
108
    {
109
        return in_array($tag, $this->tags, true);
110
    }
111
112
    /**
113
     * @param string $tags
114
     */
115
    public function setTags($tags)
116
    {
117
        $this->tags = $tags;
0 ignored issues
show
Documentation Bug introduced by
It seems like $tags of type string is incompatible with the declared type array of property $tags.

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...
118
    }
119
120
    /**
121
     * @return array
122
     */
123
    public function getUrlParameters()
124
    {
125
        return $this->urlParameters;
126
    }
127
128
    /**
129
     * @param array $urlParameters
130
     */
131
    public function setUrlParameters($urlParameters)
132
    {
133
        $this->urlParameters = $urlParameters;
134
    }
135
136
    /**
137
     * {@inheritdoc}
138
     */
139
    public function getSerializableData()
140
    {
141
        return [
142
            'name' => $this->name,
143
            'state' => $this->getState()->getSerializableData(),
144
            'tags' => $this->tags,
145
            'url_params' => $this->urlParameters,
146
            'reset_url_params' => $this->resetUrlParameters,
147
        ];
148
    }
149
}
150