PatrickLouys / no-framework-tutorial

A small tutorial to show how to create a PHP application without a framework.
MIT License
1.53k stars 186 forks source link

Dependency injector page #35

Closed michaelGregoire closed 8 years ago

michaelGregoire commented 8 years ago

This has been bugging me:

$injector = new \Auryn\Injector;

$injector->alias('Http\Response', 'Http\HttpResponse');
$injector->share('Http\HttpRequest');
$injector->define('Http\HttpRequest', [
    ':get' => $_GET,
    ':post' => $_POST,
    ':cookies' => $_COOKIE,
    ':files' => $_FILES,
    ':server' => $_SERVER,
]);

$injector->alias('Http\Request', 'Http\HttpRequest');
$injector->share('Http\HttpResponse');

return $injector;

Shouldn't...

$injector->share('Http\HttpRequest');

...and

$injector->share('Http\HttpResponse');

be switched? If not, can you explain why that order? Thanks.