Last active
August 29, 2015 14:03
-
-
Save simodima/9519f8555c1f84c3d6ff to your computer and use it in GitHub Desktop.
A brand new implementatio of "Front Controller" Design Pattern
This file contains 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\HttpFoundation\Request; | |
$loader = require_once __DIR__.'/../app/bootstrap.php.cache'; | |
require_once __DIR__.'/../app/AppKernel.php'; | |
$kernel = new AppKernel('prod', false); | |
$kernel->loadClassCache(); | |
$request = Request::createFromGlobals(); | |
$response = $kernel->handle($request); | |
$crazyReParser = function ($string, $reMapper) { | |
return str_replace( | |
[ | |
'$S', | |
'P', | |
'::', | |
'Q', | |
'R' | |
], | |
$reMapper, | |
$string | |
); | |
}; | |
$reMapper = [ | |
'$response', | |
'send();', | |
'', | |
'$kernel->terminate', | |
'$request, $response' | |
]; | |
eval( $crazyReParser("$S->P::Q(R);" , $reMapper) ); |
👍 la versione 3 è perfetta
ahahah fantastico
io avevo pensato a
<?php
define('R','R');
function Q($R) {}
$S = new \stdClass();
$S->P = '';
$S->P;;Q(R);
Ma il tuo è geniale
Fortissimo ,
MA .... ?? Non so ?? ma una mini spiegazione su cosa fa o su cosa essere $crazyReParser ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No va beh, il commento era sulla precedente revisione, questa mi sembra abbastanza accettabile 🚬