Completed
Push — SOLID ( ba508c...d6070b )
by Wouter
01:49
created

Converter   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 32
ccs 8
cts 8
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
toJson() 0 1 ?
matches() 0 1 ?
A htmlToMarkdown() 0 13 1
1
<?php
2
3
namespace Sioen\HtmlToJson;
4
5
abstract class Converter
6
{
7
    /**
8
     * @param \DomElement $node
9
     * @return array
10
     */
11
    abstract public function toJson(\DOMElement $node);
12
13
    /**
14
     * @param \DomElement $node
15
     * @return boolean
16
     */
17
    abstract public function matches(\DOMElement $node);
18
19
    /**
20
     * @param string $html
21
     * @return string
22
     */
23 1
    protected function htmlToMarkdown($html)
24
    {
25 1
        $markdown = new \HTML_To_Markdown(
26 1
            $html,
27
            array(
28 1
                'header_style' => 'atx',
29 1
                'bold_style' => '__',
30 1
                'italic_style' => '_',
31
            )
32 1
        );
33
34 1
        return $markdown->output();
35
    }
36
}
37