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