| Conditions | 5 |
| Paths | 3 |
| Total Lines | 25 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 22 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 28 | protected function makeBreadcrumbs(): array |
||
| 29 | { |
||
| 30 | $identifier = Hyde::currentRoute()->getPage()->getIdentifier(); |
||
| 31 | $breadcrumbs = [(Route::get('index')?->getLink() ?? '/') => 'Home']; |
||
| 32 | |||
| 33 | if ($identifier === 'index') { |
||
| 34 | return $breadcrumbs; |
||
| 35 | } |
||
| 36 | |||
| 37 | $previous = ''; |
||
| 38 | $fields = explode('/', $identifier); |
||
| 39 | foreach ($fields as $index => $basename) { |
||
| 40 | if ($basename === 'index') { |
||
| 41 | break; |
||
| 42 | } |
||
| 43 | |||
| 44 | // if it's not the last basename, add index.html (since it must be a directory) otherwise add .html |
||
| 45 | $path = $previous.$basename.($index < count($fields) - 1 ? '/index.html' : '.html'); |
||
| 46 | |||
| 47 | $breadcrumbs[Hyde::relativeLink($path)] = Hyde::makeTitle($basename); |
||
| 48 | |||
| 49 | $previous .= $basename.'/'; |
||
| 50 | } |
||
| 51 | |||
| 52 | return $breadcrumbs; |
||
| 53 | } |
||
| 55 |