Skip to content

Commit 4d46dd3

Browse files
committed
Switched to using proper callables in Views controller
When just passing method name, it is not immediately obvious that it will be used as a method call later on. Using a callable we also make it easier for tools to pick up that it actually is a callable.
1 parent 3a1dc42 commit 4d46dd3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/lib/Server/Controller/Views.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public function __construct(SearchService $searchService)
3737
*/
3838
public function createView(Request $request)
3939
{
40+
/** @var \Ibexa\Rest\Server\Values\RestViewInput $viewInput */
4041
$viewInput = $this->inputDispatcher->parse(
4142
new Message(
4243
['Content-Type' => $request->headers->get('Content-Type')],
@@ -45,9 +46,9 @@ public function createView(Request $request)
4546
);
4647

4748
if ($viewInput->query instanceof LocationQuery) {
48-
$method = 'findLocations';
49+
$method = [$this->searchService, 'findLocations'];
4950
} else {
50-
$method = 'findContent';
51+
$method = [$this->searchService, 'findContent'];
5152
}
5253

5354
$languageFilter = [
@@ -62,7 +63,7 @@ public function createView(Request $request)
6263
return new Values\RestExecutedView(
6364
[
6465
'identifier' => $viewInput->identifier,
65-
'searchResults' => $this->searchService->$method(
66+
'searchResults' => $method(
6667
$viewInput->query,
6768
$languageFilter
6869
),

0 commit comments

Comments
 (0)