1 | <?php |
||
20 | class SearchService |
||
21 | { |
||
22 | /** |
||
23 | * @var RenderContext |
||
24 | */ |
||
25 | protected $renderContext; |
||
26 | |||
27 | /** |
||
28 | * @var Container |
||
29 | */ |
||
30 | protected $container; |
||
31 | |||
32 | /** |
||
33 | * @var RequestStack |
||
34 | */ |
||
35 | protected $requestStack; |
||
36 | |||
37 | /** |
||
38 | * @var int |
||
39 | */ |
||
40 | protected $defaultPerPage; |
||
41 | |||
42 | /** |
||
43 | * @var array |
||
44 | */ |
||
45 | private $searchers; |
||
46 | |||
47 | /** |
||
48 | * @param ContainerInterface $container |
||
49 | * @param RequestStack $requestStack |
||
50 | * @param int $defaultPerPage |
||
51 | * @param array $searchers |
||
52 | */ |
||
53 | 2 | public function __construct(ContainerInterface $container, RequestStack $requestStack, $defaultPerPage = 10, array $searchers = []) |
|
61 | |||
62 | /** |
||
63 | * @param int $defaultPerPage |
||
64 | */ |
||
65 | public function setDefaultPerPage($defaultPerPage) |
||
69 | |||
70 | /** |
||
71 | * @return RenderContext |
||
72 | */ |
||
73 | public function getRenderContext() |
||
77 | |||
78 | /** |
||
79 | * @param RenderContext $renderContext |
||
80 | */ |
||
81 | public function setRenderContext($renderContext) |
||
85 | |||
86 | /** |
||
87 | * @return int |
||
88 | */ |
||
89 | 1 | public function getDefaultPerPage() |
|
93 | |||
94 | /** |
||
95 | * @return Container |
||
96 | */ |
||
97 | public function getContainer() |
||
101 | |||
102 | /** |
||
103 | * @param Container $container |
||
104 | */ |
||
105 | public function setContainer($container) |
||
109 | |||
110 | /** |
||
111 | * @return Request |
||
112 | */ |
||
113 | public function getRequest() |
||
117 | |||
118 | /** |
||
119 | * @return Pagerfanta |
||
120 | */ |
||
121 | 2 | public function search() |
|
158 | |||
159 | /** |
||
160 | * @param AbstractElasticaSearcher $searcher |
||
161 | * @param Request $request |
||
162 | * @param RenderContext $context |
||
163 | */ |
||
164 | 1 | protected function applySearchParams(AbstractElasticaSearcher $searcher, Request $request, RenderContext $context) |
|
187 | |||
188 | /** |
||
189 | * Currently we just search for a complete match... |
||
190 | * |
||
191 | * @param string $query |
||
192 | * |
||
193 | * @return string |
||
194 | */ |
||
195 | 1 | protected function sanitizeSearchQuery($query) |
|
199 | |||
200 | /** |
||
201 | * @param Request $request |
||
202 | * |
||
203 | * @return int |
||
204 | */ |
||
205 | 2 | private function getRequestedPage(Request $request) |
|
214 | } |
||
215 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.