This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\HttpKernel\HttpCache\HttpCache; | |
use Symfony\Component\HttpKernel\HttpCache\Store; | |
$framework = new Simplex\Framework($dispatcher, $matcher, $resolver); | |
$framework = new HttpCache($framework, new Store(__DIR__.'/../cache')); | |
$framework->handle($request)->send(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\HttpKernel\HttpKernelInterface; | |
class Framework implements HttpKernelInterface | |
{ | |
// ... etc | |
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) | |
{ | |
// ... etc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Simplex; | |
// ... etc | |
use Symfony\Component\EventDispatcher\EventDispatcher; | |
class Framework | |
{ | |
// ... etc | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once __DIR__.'/../vendor/.composer/autoload.php'; | |
// ... etc | |
use Symfony\Component\EventDispatcher\EventDispatcher; | |
$dispatcher = new EventDispatcher(); | |
$dispatcher->addListener('response', function (Simplex\ResponseEvent $event) { | |
$response = $event->getResponse(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Simplex\Tests; | |
use Simplex\Framework; | |
class FrameworkTest extends \PHPUnit_Framework_TestCase | |
{ | |
public function testNotFoundHandling() | |
{ | |
$this->assertEquals(/* test condition in here */); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Simplex; | |
use Symfony\Component\Routing\Matcher\UrlMatcherInterface; | |
use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; | |
class Framework | |
{ | |
public function __construct(UrlMatcherInterface $matcher, ControllerResolverInterface $resolver) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Calendar\Model; | |
class LeapYear | |
{ | |
// ... code for function isLeapYear in here | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Calendar\Controller; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Response; | |
use Calendar\Model\LeapYear; | |
class LeapYearController | |
{ | |
// ... controller code in here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Simplex; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Response; | |
use Symfony\Component\Routing\Matcher\UrlMatcher; | |
use Symfony\Component\Routing\Exception\ResourceNotFoundException; | |
use Symfony\Component\HttpKernel\Controller\ControllerResolver; | |
class Framework |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ... | |
$request = Request::createFromGlobals(); | |
$routes->add('leap_year', new Routing\Route('/is_leap_year/{year}', array( | |
'year' => null, | |
'_controller' => 'LeapYearController::indexAction', | |
))); | |