Passed
Branch master (2e3595)
by Jakub
02:01
created

MarkdownParser::parse()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 1
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Nexendrie\SiteGenerator;
5
6
/**
7
 * MarkdownParser
8
 *
9
 * @author Jakub Konečný
10
 * @internal
11
 */
12 1
final class MarkdownParser extends \cebe\markdown\GithubMarkdown {
13
  public $html5 = true;
14
  public $keepListStartNumber = true;
15
  public $enableNewlines = true;
16
  
17
  public function parse($text): string {
18 1
    $markup = parent::parse($text);
19 1
    if(substr($markup, -1) === PHP_EOL) {
20 1
      $markup = substr($markup, 0, -1);
21
    }
22 1
    return $markup;
23
  }
24
}
25
?>