| Conditions | 3 |
| Paths | 5 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3.0987 |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | 2 | protected function handleStaticRoute(): ?Response |
|
| 35 | { |
||
| 36 | 2 | $path = $this->path ?? $this->getCurrentPath(); |
|
| 37 | |||
| 38 | 2 | $this->partialParse->setFilter($path); |
|
| 39 | |||
| 40 | try { |
||
| 41 | 2 | $this->partialParse->execute(); |
|
| 42 | |||
| 43 | 2 | $filename = ltrim($path === '/' ? 'index.html' : "{$path}.html", '/'); |
|
| 44 | |||
| 45 | 2 | $body = @file_get_contents("{$this->rootDirectory}/{$filename}"); |
|
| 46 | |||
| 47 | 2 | return new Response(200, [], $body); |
|
| 48 | } catch (ResourceNotFoundException $e) { |
||
| 49 | return null; |
||
| 50 | } |
||
| 51 | } |
||
| 52 | } |
||
| 53 |