2010-07-13 07:53:30 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2011-01-15 13:29:43 +00:00
|
|
|
* This file is part of the Symfony package.
|
2010-07-13 07:53:30 +01:00
|
|
|
*
|
|
|
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
|
|
*
|
2011-01-15 13:29:43 +00:00
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
2010-07-13 07:53:30 +01:00
|
|
|
*/
|
|
|
|
|
2011-01-15 13:29:43 +00:00
|
|
|
namespace Symfony\Component\HttpKernel\Controller;
|
|
|
|
|
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
|
|
2010-07-13 07:53:30 +01:00
|
|
|
/**
|
2010-07-22 18:57:45 +01:00
|
|
|
* A ControllerResolverInterface implementation knows how to determine the
|
2010-07-13 07:53:30 +01:00
|
|
|
* controller to execute based on a Request object.
|
|
|
|
*
|
|
|
|
* It can also determine the arguments to pass to the Controller.
|
|
|
|
*
|
|
|
|
* A Controller can be any valid PHP callable.
|
|
|
|
*
|
2010-10-17 12:45:15 +01:00
|
|
|
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
2010-07-13 07:53:30 +01:00
|
|
|
*/
|
2010-07-22 18:57:45 +01:00
|
|
|
interface ControllerResolverInterface
|
2010-07-13 07:53:30 +01:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Returns the Controller instance associated with a Request.
|
|
|
|
*
|
2010-07-22 18:57:45 +01:00
|
|
|
* As several resolvers can exist for a single application, a resolver must
|
2010-07-13 07:53:30 +01:00
|
|
|
* return false when it is not able to determine the controller.
|
|
|
|
*
|
2010-07-22 18:57:45 +01:00
|
|
|
* The resolver must only throw an exception when it should be able to load
|
2010-07-13 07:53:30 +01:00
|
|
|
* controller but cannot because of some errors made by the developer.
|
|
|
|
*
|
2010-07-27 14:33:28 +01:00
|
|
|
* @param Request $request A Request instance
|
2010-07-13 07:53:30 +01:00
|
|
|
*
|
|
|
|
* @return mixed|Boolean A PHP callable representing the Controller,
|
2010-07-22 18:57:45 +01:00
|
|
|
* or false if this resolver is not able to determine the controller
|
2010-07-13 07:53:30 +01:00
|
|
|
*
|
|
|
|
* @throws \InvalidArgumentException|\LogicException If the controller can't be found
|
|
|
|
*/
|
2010-10-17 12:39:51 +01:00
|
|
|
function getController(Request $request);
|
2010-07-13 07:53:30 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the arguments to pass to the controller.
|
|
|
|
*
|
2010-07-27 14:33:28 +01:00
|
|
|
* @param Request $request A Request instance
|
|
|
|
* @param mixed $controller A PHP callable
|
2010-07-13 07:53:30 +01:00
|
|
|
*
|
|
|
|
* @throws \RuntimeException When value for argument given is not provided
|
|
|
|
*/
|
2010-10-17 12:39:51 +01:00
|
|
|
function getArguments(Request $request, $controller);
|
2010-07-13 07:53:30 +01:00
|
|
|
}
|