Css   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 33
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
A process() 0 7 1
1
<?php
2
3
namespace Knp\MegaMAN\Markdown\Processor;
4
5
use Knp\MegaMAN\Markdown\Processor;
6
use TijsVerkoyen\CssToInlineStyles\CssToInlineStyles;
7
8
class Css implements Processor
9
{
10
    /**
11
     * @var CssToInlineStyles
12
     */
13
    private $inliner;
14
15
    /**
16
     * @var string
17
     */
18
    private $css;
19
20
    /**
21
     * @param CssToInlineStyles $inliner
22
     * @param string|null       $css
23
     */
24
    public function __construct(CssToInlineStyles $inliner, $css = null)
25
    {
26
        $this->inliner = $inliner;
27
        $this->css     = null !== $css ? $css : sprintf('%s/../../Resources/front/style.css', __DIR__);
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function process($html)
34
    {
35
        $this->inliner->setHTML($html);
36
        $this->inliner->setCSS(file_get_contents($this->css));
37
38
        return $this->inliner->convert();
39
    }
40
}
41