| Conditions | 4 |
| Paths | 6 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 39 | protected function handleStaticRoute(): ?Response |
||
| 40 | { |
||
| 41 | $path = $this->path ?? $this->getCurrentPath(); |
||
| 42 | |||
| 43 | $this->partialParse->setFilter($path); |
||
| 44 | |||
| 45 | try { |
||
| 46 | $this->partialParse->execute(); |
||
| 47 | |||
| 48 | $filename = ltrim($path === '/' ? 'index.html' : "{$path}.html", '/'); |
||
| 49 | |||
| 50 | $body = @file_get_contents("{$this->rootDirectory}/{$filename}"); |
||
| 51 | |||
| 52 | return $body ? new Response(200, [], $body) : null; |
||
| 53 | } catch (ResourceNotFoundException $e) { |
||
| 54 | return null; |
||
| 55 | } |
||
| 56 | } |
||
| 57 | } |
||
| 58 |