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 | |
class UserModel | |
{ | |
public static function getUser($id) | |
{ | |
$repository = new UserRepository(); | |
return $repository->find($id); | |
} | |
// 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 | |
class UserModel | |
{ | |
public static function getUser($id) | |
{ | |
$dao = new DataAccessObject(); | |
return $dao->query(' | |
SELECT * FROM users WHERE id = ' . (int)$id | |
); | |
} |
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 | |
class UserModel | |
{ | |
public static function connectDb() | |
{ | |
mysql_connect('localhost', 'username', 'password') | |
or die('some error'); | |
mysql_select_db('someDb') | |
or die('could not select db'); |
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'; | |
use Symfony\Component\HttpKernel; | |
// ... | |
$framework = new Simplex\Framework($dispatcher, $resolver); | |
$response = $framework->handle($request); | |
$response->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 | |
// example.com/src/container.php | |
use Symfony\Component\DependencyInjection; | |
use Symfony\Component\DependencyInjection\Reference; | |
$sc = new DependencyInjection\ContainerBuilder(); | |
$sc->register('context', 'Symfony\Component\Routing\RequestContext'); | |
$sc->register('matcher', 'Symfony\Component\Routing\Matcher\UrlMatcher') |
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; | |
use Symfony\Component\HttpKernel; | |
use Symfony\Component\EventDispatcher\EventDispatcher; | |
class Framework extends HttpKernel\HttpKernel | |
{ | |
public function __construct($routes) |
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'; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Response; | |
use Symfony\Component\Routing; | |
use Symfony\Component\HttpKernel; | |
use Symfony\Component\EventDispatcher\EventDispatcher; | |
$request = Request::createFromGlobals(); |
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'; | |
use Symfony\Component\HttpKernel; | |
// ... | |
$listener = new HttpKernel\EventListener\ExceptionListener('Calendar\\Controller\\ErrorController::exceptionAction'); | |
$dispatcher->addSubscriber($listener); |
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\Response; | |
use Symfony\Component\HttpKernel\Exception\FlattenException; | |
class ErrorController | |
{ | |
public function exceptionAction(FlattenException $exception) | |
{ |
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\HttpKernel\HttpKernel; | |
class Framework extends HttpKernel | |
{ | |
} |