Conditions | 3 |
Paths | 2 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
22 | protected function handleStaticRoute(): ?Response |
||
23 | { |
||
24 | $path = $this->getCurrentPath(); |
||
25 | |||
26 | $filename = ltrim($path === '/' ? 'index.html' : "{$path}.html", '/'); |
||
27 | |||
28 | $body = @file_get_contents("{$this->rootDirectory}/{$filename}"); |
||
29 | |||
30 | if (!$body) { |
||
31 | return null; |
||
32 | } |
||
33 | |||
34 | return new Response(200, [], $body); |
||
35 | } |
||
36 | } |
||
37 |