explain implementation of ad-hoc depencency container

This commit is contained in:
lubiana 2022-05-21 00:21:15 +02:00
parent 3f74779176
commit 7dd6b2dab5
Signed by: lubiana
SSH key fingerprint: SHA256:vW1EA0fRR3Fw+dD/sM0K+x3Il2gSry6YRYHqOeQwrfk
3 changed files with 197 additions and 4 deletions

View file

@ -59,7 +59,7 @@ try {
switch ($routeInfo[0]) {
case Dispatcher::FOUND:
$className = $routeInfo[1];
$handler = $container->get($className);
$handler = new $className($response);
assert($handler instanceof RequestHandlerInterface);
foreach ($routeInfo[2] as $attributeName => $attributeValue) {
$request = $request->withAttribute($attributeName, $attributeValue);