2010-07-13 07:53:30 +01:00
|
|
|
<?php
|
|
|
|
|
2010-08-20 22:09:55 +01:00
|
|
|
namespace Symfony\Component\HttpKernel\Controller;
|
2010-07-13 07:53:30 +01:00
|
|
|
|
2010-08-20 22:09:55 +01:00
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
2010-07-13 07:53:30 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This file is part of the Symfony framework.
|
|
|
|
*
|
|
|
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
|
|
*
|
|
|
|
* This source file is subject to the MIT license that is bundled
|
|
|
|
* with this source code in the file LICENSE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
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.
|
|
|
|
*
|
|
|
|
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
|
|
*/
|
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
|
|
|
}
|