1 | <?php |
||
15 | use Joomla\Router\RestRouter; |
||
16 | |||
17 | /** |
||
18 | * Stats application router |
||
19 | */ |
||
20 | class Router extends RestRouter implements ContainerAwareInterface |
||
|
|||
21 | { |
||
22 | use ContainerAwareTrait; |
||
23 | |||
24 | /** |
||
25 | * Get a controller object for a given name. |
||
26 | * |
||
27 | * @param string $name The controller name (excluding prefix) for which to fetch and instance. |
||
28 | * |
||
29 | * @return ControllerInterface |
||
30 | * |
||
31 | * @throws \RuntimeException |
||
32 | */ |
||
33 | 1 | protected function fetchController($name) |
|
34 | { |
||
35 | // Derive the controller class name. |
||
36 | 1 | $class = $this->controllerPrefix . ucfirst($name); |
|
37 | |||
38 | // If the controller class does not exist panic. |
||
39 | 1 | if (!class_exists($class)) |
|
40 | { |
||
41 | throw new \RuntimeException(sprintf('Unable to locate controller `%s`.', $class), 404); |
||
42 | } |
||
43 | |||
44 | // If the controller does not follows the implementation. |
||
45 | 1 | if (!is_subclass_of($class, 'Joomla\\Controller\\ControllerInterface')) |
|
46 | { |
||
47 | throw new \RuntimeException( |
||
48 | sprintf('Invalid Controller. Controllers must implement Joomla\Controller\ControllerInterface. `%s`.', $class), 500 |
||
49 | ); |
||
50 | } |
||
51 | |||
52 | // Instantiate the controller. |
||
56 |
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.