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