Conditions | 1 |
Paths | 1 |
Total Lines | 26 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | public function parse(InlineParserContext $inlineContext): bool |
||
24 | { |
||
25 | $route = $inlineContext->getFullMatch(); |
||
26 | |||
27 | // Push the cursor to the lenght of the full match. |
||
28 | $inlineContext->getCursor()->advanceBy(mb_strlen($route)); |
||
29 | |||
30 | $commit = mb_substr($inlineContext->getMatches()[3], 0, 7); |
||
31 | |||
32 | $content = "{$inlineContext->getMatches()[1]}@{$commit}"; |
||
33 | |||
34 | |||
35 | $inlineContext->getContainer() |
||
36 | ->appendChild(new GithubCommit( |
||
37 | $content, |
||
38 | [ |
||
39 | 'attributes' => [ |
||
40 | 'href' => $route, |
||
41 | 'target' => '_blank', |
||
42 | 'class' => 'link link-hover link-primary', |
||
43 | 'title' => $content |
||
44 | ] |
||
45 | ] |
||
46 | )); |
||
47 | |||
48 | return true; |
||
49 | } |
||
51 |