Conditions | 5 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
12 | public function render(array $parameters, HTMLNode $previous): HTMLNode |
||
13 | { |
||
14 | // convert to vue router |
||
15 | $href = $previous->getAttribute('href'); // array? |
||
16 | $href = $href[0] ?? ''; |
||
17 | if ($previous->getTag() === 'a' && $href && !Str::startsWith('http', $href) && !Str::startsWith('#', $href)) { |
||
18 | $previous->setTag('router-link'); |
||
19 | $previous->removeAttribute('href'); |
||
20 | $previous->addAttribute(':to', "'" . $href . "'"); |
||
21 | } |
||
22 | |||
23 | return $previous; |
||
24 | } |
||
26 |