Conditions | 2 |
Paths | 2 |
Total Lines | 26 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
21 | public function handle( Parser $parser, ProcessingResult $result ): string { |
||
22 | $params = $result->getParameters(); |
||
23 | |||
24 | $content = $this->gitHubFetcher->getFileContent( |
||
25 | $params['repo']->getValue(), |
||
26 | $params['branch']->getValue(), |
||
27 | $params['file']->getValue() |
||
28 | ); |
||
29 | |||
30 | if ( $params['lang']->getValue() === '' ) { |
||
31 | return ( new NormalRenderer() )->getRenderedContent( $content, $params['file']->getValue() ); |
||
32 | } |
||
33 | |||
34 | $syntaxRenderer = new SyntaxRenderer( |
||
35 | function( string $syntaxContent ) use ( $parser ) { |
||
36 | return $parser->recursiveTagParse( $syntaxContent, null ); |
||
37 | }, |
||
38 | $params['lang']->getValue(), |
||
39 | $params['line']->getValue(), |
||
40 | $params['start']->getValue(), |
||
41 | $params['highlight']->getValue(), |
||
42 | $params['inline']->getValue() |
||
43 | ); |
||
44 | |||
45 | return $syntaxRenderer->getRenderedContent( $content ); |
||
46 | } |
||
47 | |||
49 |