Parsedown::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Dothiv\Bundle\ParsedownBundle\Twig\Extension;
4
5
class Parsedown extends \Twig_Extension
6
{
7
    public function __construct()
8
    {
9
        $this->markdownParser = new \Parsedown();
10
    }
11
12
    public function getFilters()
13
    {
14
        return array(
15
            'markdown' => new \Twig_SimpleFilter('markdown',array($this, 'parsedown'), array('is_safe' => array('html')))
16
        );
17
    }
18
19
    public function parsedown($str)
20
    {
21
        return $this->markdownParser->text($str);
22
    }
23
24
    public function getName()
25
    {
26
        return 'parsedown';
27
    }
28
}
29