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

Converter::htmlToMarkdown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
ccs 8
cts 8
cp 1
rs 9.4285
cc 1
eloc 8
nc 1
nop 1
crap 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