Parsedown   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 24
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getFilters() 0 6 1
A parsedown() 0 4 1
A getName() 0 4 1
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