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