add chapter 12 solutions
This commit is contained in:
parent
4ba7b3f1fd
commit
46de287dc7
23 changed files with 1998 additions and 0 deletions
24
implementation/12/src/Action/Other.php
Normal file
24
implementation/12/src/Action/Other.php
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Lubian\NoFramework\Action;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
|
||||
final class Other implements RequestHandlerInterface
|
||||
{
|
||||
public function __construct(private readonly ResponseInterface $response)
|
||||
{
|
||||
}
|
||||
|
||||
public function handle(ServerRequestInterface $request): ResponseInterface
|
||||
{
|
||||
$body = $this->response->getBody();
|
||||
|
||||
$body->write('This works too!');
|
||||
|
||||
return $this->response->withBody($body)
|
||||
->withStatus(200);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue