| Conditions | 6 |
| Paths | 20 |
| Total Lines | 22 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 22 | protected function getFilename(RequestInterface $request) |
||
| 23 | { |
||
| 24 | $path = $this->getBasePath($request->getUri()->getPath()); |
||
| 25 | |||
| 26 | $parts = pathinfo($path); |
||
| 27 | $path = '/'.(isset($parts['dirname']) ? $parts['dirname'] : ''); |
||
| 28 | $filename = isset($parts['basename']) ? $parts['basename'] : ''; |
||
| 29 | |||
| 30 | //if it's a directory, append "/index.html" |
||
| 31 | if (empty($parts['extension'])) { |
||
| 32 | if ($path === '/') { |
||
| 33 | $path .= $filename; |
||
| 34 | } else { |
||
| 35 | $path .= "/{$filename}"; |
||
| 36 | } |
||
| 37 | |||
| 38 | $extension = strtolower(pathinfo($request->getUri()->getPath(), PATHINFO_EXTENSION)) ?: 'html'; |
||
| 39 | $filename = "index.{$extension}"; |
||
| 40 | } |
||
| 41 | |||
| 42 | return "{$this->storage}{$path}/{$filename}"; |
||
| 43 | } |
||
| 44 | } |
||
| 45 |