Completed
Pull Request — master (#115)
by
unknown
03:38
created

HardBreakConverter   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 33
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setConfig() 0 4 1
A convert() 0 4 2
A getSupportedTags() 0 4 1
1
<?php
2
3
namespace League\HTMLToMarkdown\Converter;
4
5
use League\HTMLToMarkdown\Configuration;
6
use League\HTMLToMarkdown\ConfigurationAwareInterface;
7
use League\HTMLToMarkdown\ElementInterface;
8
9
class HardBreakConverter implements ConverterInterface, ConfigurationAwareInterface
10
{
11
    /**
12
     * @var Configuration
13
     */
14
    protected $config;
15
16
    /**
17
     * @param Configuration $config
18
     */
19 78
    public function setConfig(Configuration $config)
20
    {
21 78
        $this->config = $config;
22 78
    }
23
24
    /**
25
     * @param ElementInterface $element
26
     *
27
     * @return string
28
     */
29 6
    public function convert(ElementInterface $element)
30
    {
31 6
        return $this->config->getOption('hard_break') ? "\n" : "  \n";
32
    }
33
34
    /**
35
     * @return string[]
36
     */
37 78
    public function getSupportedTags()
38
    {
39 78
        return array('br');
40
    }
41
}
42