|
0
|
1 |
<?php |
|
|
2 |
|
|
|
3 |
/* |
|
|
4 |
* This file is part of the Symfony package. |
|
|
5 |
* |
|
|
6 |
* (c) Fabien Potencier <fabien@symfony.com> |
|
|
7 |
* |
|
|
8 |
* For the full copyright and license information, please view the LICENSE |
|
|
9 |
* file that was distributed with this source code. |
|
|
10 |
*/ |
|
|
11 |
|
|
|
12 |
namespace Symfony\Component\HttpKernel\Controller; |
|
|
13 |
|
|
|
14 |
use Symfony\Component\HttpFoundation\Request; |
|
|
15 |
|
|
|
16 |
/** |
|
|
17 |
* A ControllerResolverInterface implementation knows how to determine the |
|
|
18 |
* controller to execute based on a Request object. |
|
|
19 |
* |
|
|
20 |
* It can also determine the arguments to pass to the Controller. |
|
|
21 |
* |
|
|
22 |
* A Controller can be any valid PHP callable. |
|
|
23 |
* |
|
|
24 |
* @author Fabien Potencier <fabien@symfony.com> |
|
|
25 |
* |
|
|
26 |
* @api |
|
|
27 |
*/ |
|
|
28 |
interface ControllerResolverInterface |
|
|
29 |
{ |
|
|
30 |
/** |
|
|
31 |
* Returns the Controller instance associated with a Request. |
|
|
32 |
* |
|
|
33 |
* As several resolvers can exist for a single application, a resolver must |
|
|
34 |
* return false when it is not able to determine the controller. |
|
|
35 |
* |
|
|
36 |
* The resolver must only throw an exception when it should be able to load |
|
|
37 |
* controller but cannot because of some errors made by the developer. |
|
|
38 |
* |
|
|
39 |
* @param Request $request A Request instance |
|
|
40 |
* |
|
|
41 |
* @return mixed|Boolean A PHP callable representing the Controller, |
|
|
42 |
* or false if this resolver is not able to determine the controller |
|
|
43 |
* |
|
|
44 |
* @throws \InvalidArgumentException|\LogicException If the controller can't be found |
|
|
45 |
* |
|
|
46 |
* @api |
|
|
47 |
*/ |
|
|
48 |
function getController(Request $request); |
|
|
49 |
|
|
|
50 |
/** |
|
|
51 |
* Returns the arguments to pass to the controller. |
|
|
52 |
* |
|
|
53 |
* @param Request $request A Request instance |
|
|
54 |
* @param mixed $controller A PHP callable |
|
|
55 |
* |
|
|
56 |
* @return array An array of arguments to pass to the controller |
|
|
57 |
* |
|
|
58 |
* @throws \RuntimeException When value for argument given is not provided |
|
|
59 |
* |
|
|
60 |
* @api |
|
|
61 |
*/ |
|
|
62 |
function getArguments(Request $request, $controller); |
|
|
63 |
} |