This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Components/HttpKernel/Controller/ControllerResolverInterface.php

56 lines
1.8 KiB
PHP
Raw Normal View History

<?php
namespace Symfony\Components\HttpKernel\Controller;
use Symfony\Components\HttpFoundation\Request;
/*
* 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.
*/
/**
* A ControllerResolverInterface implementation knows how to determine the
* 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>
*/
interface ControllerResolverInterface
{
/**
* Returns the Controller instance associated with a Request.
*
* As several resolvers can exist for a single application, a resolver must
* return false when it is not able to determine the controller.
*
* The resolver must only throw an exception when it should be able to load
* controller but cannot because of some errors made by the developer.
*
* @param Request $request A Request instance
*
* @return mixed|Boolean A PHP callable representing the Controller,
* or false if this resolver is not able to determine the controller
*
* @throws \InvalidArgumentException|\LogicException If the controller can't be found
*/
public function getController(Request $request);
/**
* Returns the arguments to pass to the controller.
*
* @param Request $request A Request instance
* @param mixed $controller A PHP callable
*
* @throws \RuntimeException When value for argument given is not provided
*/
public function getArguments(Request $request, $controller);
}