1 | <?php |
||
26 | class FilterContainer extends ParameterBag |
||
27 | { |
||
28 | /** |
||
29 | * @var Cache |
||
30 | */ |
||
31 | private $cache = null; |
||
32 | |||
33 | /** |
||
34 | * @var int |
||
35 | */ |
||
36 | private $lifeTime; |
||
37 | |||
38 | /** |
||
39 | * @var array |
||
40 | */ |
||
41 | private $exclude = []; |
||
42 | |||
43 | /** |
||
44 | * {@inheritdoc} |
||
45 | */ |
||
46 | public function add(array $parameters = []) |
||
52 | |||
53 | /** |
||
54 | * {@inheritdoc} |
||
55 | */ |
||
56 | public function set($key, $value) |
||
62 | |||
63 | /** |
||
64 | * Sets cache engine |
||
65 | * |
||
66 | * @param Cache|null $cache |
||
67 | */ |
||
68 | public function setCache(Cache $cache = null) |
||
72 | |||
73 | /** |
||
74 | * Sets cached search life time |
||
75 | * |
||
76 | * @param $lifeTime |
||
77 | */ |
||
78 | public function setLifeTime($lifeTime) |
||
82 | |||
83 | /** |
||
84 | * Sets array of filter names not to be cached |
||
85 | * |
||
86 | * @param array $exclude |
||
87 | */ |
||
88 | public function setExclude(array $exclude) |
||
92 | |||
93 | /** |
||
94 | * Filters accepted. |
||
95 | * |
||
96 | * @param RelationInterface $relation |
||
97 | * |
||
98 | * @return FilterInterface[] |
||
99 | */ |
||
100 | public function getFiltersByRelation(RelationInterface $relation) |
||
104 | |||
105 | /** |
||
106 | * Builds search request according to given filters. |
||
107 | * |
||
108 | * @param Request $request |
||
109 | * |
||
110 | * @return SearchRequest |
||
111 | */ |
||
112 | public function buildSearchRequest(Request $request) |
||
126 | |||
127 | /** |
||
128 | * Builds elastic search query by given SearchRequest and filters. |
||
129 | * |
||
130 | * @param SearchRequest $request |
||
131 | * @param FilterInterface[]|null $filters |
||
132 | * |
||
133 | * @return Search |
||
134 | */ |
||
135 | public function buildSearch(SearchRequest $request, $filters = null) |
||
172 | } |
||
173 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.