diff --git a/src/Symfony/Components/RequestHandler/Request.php b/src/Symfony/Components/RequestHandler/Request.php index 507dc89990..cbde801bf3 100644 --- a/src/Symfony/Components/RequestHandler/Request.php +++ b/src/Symfony/Components/RequestHandler/Request.php @@ -23,7 +23,7 @@ namespace Symfony\Components\RequestHandler; * @subpackage Components_RequestHandler * @author Fabien Potencier */ -class Request implements RequestInterface +class Request { public $path; public $request; diff --git a/src/Symfony/Components/RequestHandler/RequestHandler.php b/src/Symfony/Components/RequestHandler/RequestHandler.php index 3f917bb801..23482c21c6 100644 --- a/src/Symfony/Components/RequestHandler/RequestHandler.php +++ b/src/Symfony/Components/RequestHandler/RequestHandler.php @@ -22,7 +22,7 @@ use Symfony\Components\RequestHandler\Exception\NotFoundHttpException; * @subpackage Components_RequestHandler * @author Fabien Potencier */ -class RequestHandler +class RequestHandler implements RequestHandlerInterface { protected $dispatcher; @@ -42,14 +42,14 @@ class RequestHandler * All exceptions are caught, and a core.exception event is notified * for user management. * - * @param RequestInterface $request A Request instance - * @param Boolean $main Whether this is the main request or not + * @param Request $request A Request instance + * @param Boolean $main Whether this is the main request or not * - * @return ResponseInterface $response A Response instance + * @return Response $response A Response instance * - * @throws \Exception When Exception couldn't be catch by event processing + * @throws \Exception When Exception couldn't be caught by event processing */ - public function handle(RequestInterface $request, $main = true) + public function handle(Request $request, $main = true) { $main = (Boolean) $main; @@ -75,15 +75,15 @@ class RequestHandler * * Exceptions are not caught. * - * @param RequestInterface $request A Request instance - * @param Boolean $main Whether this is the main request or not + * @param Request $request A Request instance + * @param Boolean $main Whether this is the main request or not * - * @return ResponseInterface $response A Response instance + * @return Response $response A Response instance * * @throws \LogicException If one of the listener does not behave as expected * @throws NotFoundHttpException When controller cannot be found */ - public function handleRaw(RequestInterface $request, $main = true) + public function handleRaw(Request $request, $main = true) { $main = (Boolean) $main; @@ -146,7 +146,7 @@ class RequestHandler */ protected function filterResponse($response, $message, $main) { - if (!$response instanceof ResponseInterface) + if (!$response instanceof Response) { throw new \RuntimeException($message); } @@ -154,7 +154,7 @@ class RequestHandler $event = $this->dispatcher->filter(new Event($this, 'core.response', array('main_request' => $main)), $response); $response = $event->getReturnValue(); - if (!$response instanceof ResponseInterface) + if (!$response instanceof Response) { throw new \RuntimeException('A "core.response" listener returned a non response object.'); } diff --git a/src/Symfony/Components/RequestHandler/RequestInterface.php b/src/Symfony/Components/RequestHandler/RequestInterface.php deleted file mode 100644 index 6e445d2031..0000000000 --- a/src/Symfony/Components/RequestHandler/RequestInterface.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * RequestInterface is the interface that all client request classes must implement. - * - * @package Symfony - * @subpackage Components_RequestHandler - * @author Fabien Potencier - */ -interface RequestInterface -{ -} diff --git a/src/Symfony/Components/RequestHandler/Response.php b/src/Symfony/Components/RequestHandler/Response.php index 8f88a4ad83..1886cfea66 100644 --- a/src/Symfony/Components/RequestHandler/Response.php +++ b/src/Symfony/Components/RequestHandler/Response.php @@ -18,7 +18,7 @@ namespace Symfony\Components\RequestHandler; * @subpackage Components_RequestHandler * @author Fabien Potencier */ -class Response implements ResponseInterface +class Response { protected $content; protected $version; diff --git a/src/Symfony/Components/RequestHandler/ResponseInterface.php b/src/Symfony/Components/RequestHandler/ResponseInterface.php deleted file mode 100644 index 0fa110dffc..0000000000 --- a/src/Symfony/Components/RequestHandler/ResponseInterface.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * ResponseInterface is the interface that all server response classes must implement. - * - * @package Symfony - * @subpackage Components_RequestHandler - * @author Fabien Potencier - */ -interface ResponseInterface -{ - function send(); -} diff --git a/src/Symfony/Foundation/Bundle/KernelExtension.php b/src/Symfony/Foundation/Bundle/KernelExtension.php index 3b985c5151..d7bf830ae8 100644 --- a/src/Symfony/Foundation/Bundle/KernelExtension.php +++ b/src/Symfony/Foundation/Bundle/KernelExtension.php @@ -52,10 +52,8 @@ class KernelExtension extends LoaderExtension 'Symfony\\Components\\EventDispatcher\\Event', 'Symfony\\Components\\Routing\\Matcher\\UrlMatcherInterface', 'Symfony\\Components\\Routing\\Matcher\\UrlMatcher', - 'Symfony\\Components\\RequestHandler\\RequestInterface', - 'Symfony\\Components\\RequestHandler\\Request', 'Symfony\\Components\\RequestHandler\\RequestHandler', - 'Symfony\\Components\\RequestHandler\\ResponseInterface', + 'Symfony\\Components\\RequestHandler\\Request', 'Symfony\\Components\\RequestHandler\\Response', 'Symfony\\Components\\Templating\\Loader\\LoaderInterface', 'Symfony\\Components\\Templating\\Loader\\Loader', diff --git a/src/Symfony/Foundation/Kernel.php b/src/Symfony/Foundation/Kernel.php index 4eefa342c6..be2a9c99fa 100644 --- a/src/Symfony/Foundation/Kernel.php +++ b/src/Symfony/Foundation/Kernel.php @@ -7,7 +7,8 @@ use Symfony\Components\DependencyInjection\Builder; use Symfony\Components\DependencyInjection\BuilderConfiguration; use Symfony\Components\DependencyInjection\Dumper\PhpDumper; use Symfony\Components\DependencyInjection\FileResource; -use Symfony\Components\RequestHandler\RequestInterface; +use Symfony\Components\RequestHandler\Request; +use Symfony\Components\RequestHandler\RequestHandlerInterface; /* * This file is part of the Symfony package. @@ -26,7 +27,7 @@ use Symfony\Components\RequestHandler\RequestInterface; * @subpackage Foundation * @author Fabien Potencier */ -abstract class Kernel implements \Serializable +abstract class Kernel implements RequestHandlerInterface, \Serializable { protected $bundles; protected $bundleDirs; @@ -154,12 +155,7 @@ abstract class Kernel implements \Serializable $this->boot(); } - public function run() - { - $this->handle()->send(); - } - - public function handle(RequestInterface $request = null) + public function handle(Request $request = null, $main = true) { if (false === $this->booted) { diff --git a/src/Symfony/Foundation/bootstrap.php b/src/Symfony/Foundation/bootstrap.php index 7e7bc6a43e..8f9ea44769 100644 --- a/src/Symfony/Foundation/bootstrap.php +++ b/src/Symfony/Foundation/bootstrap.php @@ -154,10 +154,8 @@ class KernelExtension extends LoaderExtension 'Symfony\\Components\\EventDispatcher\\Event', 'Symfony\\Components\\Routing\\Matcher\\UrlMatcherInterface', 'Symfony\\Components\\Routing\\Matcher\\UrlMatcher', - 'Symfony\\Components\\RequestHandler\\RequestInterface', - 'Symfony\\Components\\RequestHandler\\Request', 'Symfony\\Components\\RequestHandler\\RequestHandler', - 'Symfony\\Components\\RequestHandler\\ResponseInterface', + 'Symfony\\Components\\RequestHandler\\Request', 'Symfony\\Components\\RequestHandler\\Response', 'Symfony\\Components\\Templating\\Loader\\LoaderInterface', 'Symfony\\Components\\Templating\\Loader\\Loader', @@ -368,12 +366,13 @@ use Symfony\Components\DependencyInjection\Builder; use Symfony\Components\DependencyInjection\BuilderConfiguration; use Symfony\Components\DependencyInjection\Dumper\PhpDumper; use Symfony\Components\DependencyInjection\FileResource; -use Symfony\Components\RequestHandler\RequestInterface; +use Symfony\Components\RequestHandler\Request; +use Symfony\Components\RequestHandler\RequestHandlerInterface; -abstract class Kernel implements \Serializable +abstract class Kernel implements RequestHandlerInterface, \Serializable { protected $bundles; protected $bundleDirs; @@ -471,12 +470,7 @@ abstract class Kernel implements \Serializable $this->boot(); } - public function run() - { - $this->handle()->send(); - } - - public function handle(RequestInterface $request = null) + public function handle(Request $request = null, $main = true) { if (false === $this->booted) { diff --git a/src/Symfony/Framework/WebBundle/Listener/ResponseFilter.php b/src/Symfony/Framework/WebBundle/Listener/ResponseFilter.php index e0f0138f67..c06696bebd 100644 --- a/src/Symfony/Framework/WebBundle/Listener/ResponseFilter.php +++ b/src/Symfony/Framework/WebBundle/Listener/ResponseFilter.php @@ -4,8 +4,8 @@ namespace Symfony\Framework\WebBundle\Listener; use Symfony\Components\EventDispatcher\EventDispatcher; use Symfony\Components\EventDispatcher\Event; -use Symfony\Components\RequestHandler\RequestInterface; -use Symfony\Components\RequestHandler\ResponseInterface; +use Symfony\Components\RequestHandler\Request; +use Symfony\Components\RequestHandler\Response; /* * This file is part of the Symfony framework. @@ -28,7 +28,7 @@ class ResponseFilter protected $dispatcher; protected $request; - public function __construct(EventDispatcher $dispatcher, RequestInterface $request) + public function __construct(EventDispatcher $dispatcher, Request $request) { $this->dispatcher = $dispatcher; $this->request = $request; @@ -39,7 +39,7 @@ class ResponseFilter $this->dispatcher->connect('core.response', array($this, 'filter')); } - public function filter(Event $event, ResponseInterface $response) + public function filter(Event $event, Response $response) { if (!$event->getParameter('main_request') || $response->hasHeader('Content-Type')) { diff --git a/src/Symfony/Framework/WebBundle/Resources/skeleton/web/front_controller.php b/src/Symfony/Framework/WebBundle/Resources/skeleton/web/front_controller.php index 8d896596c8..c22c86626f 100644 --- a/src/Symfony/Framework/WebBundle/Resources/skeleton/web/front_controller.php +++ b/src/Symfony/Framework/WebBundle/Resources/skeleton/web/front_controller.php @@ -3,4 +3,4 @@ require_once __DIR__.'/../{{ application }}/{{ class }}Kernel.php'; $kernel = new {{ class }}Kernel('prod', false); -$kernel->run(); +$kernel->handler()->send(); diff --git a/src/Symfony/Framework/WebBundle/Resources/skeleton/web/front_controller_debug.php b/src/Symfony/Framework/WebBundle/Resources/skeleton/web/front_controller_debug.php index f34a4f045f..c2a220df0e 100644 --- a/src/Symfony/Framework/WebBundle/Resources/skeleton/web/front_controller_debug.php +++ b/src/Symfony/Framework/WebBundle/Resources/skeleton/web/front_controller_debug.php @@ -10,4 +10,4 @@ if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1'))) require_once __DIR__.'/../{{ application }}/{{ class }}Kernel.php'; $kernel = new {{ class }}Kernel('dev', true); -$kernel->run(); +$kernel->handler()->send();