Skip to content

Instantly share code, notes, and snippets.

@coreymcmahon
Created June 14, 2012 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coreymcmahon/2929949 to your computer and use it in GitHub Desktop.
Save coreymcmahon/2929949 to your computer and use it in GitHub Desktop.
Shifting code to the framework core to manage dependencies - http://www.symfonycentral.com
<?php
namespace Simplex;
use Symfony\Component\Routing;
use Symfony\Component\HttpKernel;
use Symfony\Component\EventDispatcher\EventDispatcher;
class Framework extends HttpKernel\HttpKernel
{
public function __construct($routes)
{
$context = new Routing\RequestContext();
$matcher = new Routing\Matcher\UrlMatcher($routes, $context);
$resolver = new HttpKernel\Controller\ControllerResolver();
$dispatcher = new EventDispatcher();
$dispatcher->addSubscriber(new HttpKernel\EventListener\RouterListener($matcher));
$dispatcher->addSubscriber(new HttpKernel\EventListener\ResponseListener('UTF-8'));
parent::__construct($dispatcher, $resolver);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment