add solutions for chapter 9 and fix urltypos

This commit is contained in:
lubiana 2022-05-23 14:45:47 +02:00 committed by Andre Lubian
parent 0b1fa54d49
commit 6920ea390d
5 changed files with 17 additions and 19 deletions

View file

@ -11,7 +11,7 @@ final class Hello implements RequestHandlerInterface
{
public function __construct(
private readonly ResponseInterface $response,
private readonly Clock $clock
private readonly Clock $clock,
) {
}
@ -20,11 +20,8 @@ final class Hello implements RequestHandlerInterface
$name = $request->getAttribute('name', 'Stranger');
$body = $this->response->getBody();
$time = $this->clock->now()
->format('H:i:s');
$body->write('Hello ' . $name . '!<br />');
$body->write('The Time is: ' . $time);
$body->write('The time is: ' . $this->clock->now()->format('H:i:s'));
return $this->response->withBody($body)
->withStatus(200);

View file

@ -52,7 +52,6 @@ assert($request instanceof ServerRequestInterface);
$dispatcher = $container->get(Dispatcher::class);
assert($dispatcher instanceof Dispatcher);
$routeInfo = $dispatcher->dispatch($request->getMethod(), $request->getUri() ->getPath(),);
try {