1 | <?php |
||
27 | class RestRouteLoader extends Loader |
||
28 | { |
||
29 | protected $container; |
||
30 | protected $controllerParser; |
||
31 | protected $controllerReader; |
||
32 | protected $defaultFormat; |
||
33 | protected $locator; |
||
34 | |||
35 | /** |
||
36 | * Initializes loader. |
||
37 | * |
||
38 | * @param ContainerInterface $container |
||
39 | * @param FileLocatorInterface $locator |
||
40 | * @param ControllerNameParser $controllerParser |
||
41 | * @param RestControllerReader $controllerReader |
||
42 | * @param string $defaultFormat |
||
43 | */ |
||
44 | 41 | public function __construct( |
|
45 | ContainerInterface $container, |
||
46 | FileLocatorInterface $locator, |
||
47 | ControllerNameParser $controllerParser, |
||
48 | RestControllerReader $controllerReader, $defaultFormat = 'html' |
||
49 | ) { |
||
50 | 41 | $this->container = $container; |
|
51 | 41 | $this->locator = $locator; |
|
52 | 41 | $this->controllerParser = $controllerParser; |
|
53 | 41 | $this->controllerReader = $controllerReader; |
|
54 | 41 | $this->defaultFormat = $defaultFormat; |
|
55 | 41 | } |
|
56 | |||
57 | /** |
||
58 | * Returns controller reader. |
||
59 | * |
||
60 | * @return RestControllerReader |
||
61 | */ |
||
62 | 24 | public function getControllerReader() |
|
66 | |||
67 | /** |
||
68 | * {@inheritdoc} |
||
69 | */ |
||
70 | 31 | public function load($controller, $type = null) |
|
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | */ |
||
84 | 16 | public function supports($resource, $type = null) |
|
91 | |||
92 | /** |
||
93 | * Returns controller locator by it's id. |
||
94 | * |
||
95 | * @param string $controller |
||
96 | * |
||
97 | * @throws \InvalidArgumentException |
||
98 | * |
||
99 | * @return array |
||
100 | */ |
||
101 | 31 | private function getControllerLocator($controller) |
|
153 | } |
||
154 |
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.