bearsunday /
BEAR.QueryRepository
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace BEAR\QueryRepository; |
||
| 6 | |||
| 7 | use BEAR\Resource\AbstractRequest; |
||
| 8 | use Override; |
||
| 9 | use Stringable; |
||
| 10 | |||
| 11 | use function sprintf; |
||
| 12 | |||
| 13 | final readonly class DonutRequest implements Stringable |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 14 | { |
||
| 15 | public function __construct( |
||
| 16 | private AbstractRequest $request, |
||
| 17 | private DonutRendererInterface $donutStorage, |
||
| 18 | private SurrogateKeys $etags, |
||
| 19 | ) { |
||
| 20 | } |
||
| 21 | |||
| 22 | #[Override] |
||
| 23 | public function __toString(): string |
||
| 24 | { |
||
| 25 | $view = (string) ($this->request)(); |
||
| 26 | $uri = (string) $this->request->resourceObject->uri; |
||
| 27 | $this->etags->addTag($this->request->resourceObject); |
||
| 28 | $this->donutStorage->setView($uri, $view); |
||
| 29 | |||
| 30 | return sprintf(ResourceDonut::FOMRAT, $uri); |
||
| 31 | } |
||
| 32 | } |
||
| 33 |