ImageConverter::toJson()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 9
rs 9.6666
ccs 5
cts 5
cp 1
cc 1
eloc 5
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Sioen\HtmlToJson;
4
5
use Sioen\SirTrevorBlock;
6
7
final class ImageConverter implements Converter
8
{
9
    use HtmlToMarkdown;
10
11 1
    public function toJson(\DOMElement $node)
12
    {
13 1
        return new SirTrevorBlock(
14 1
            'image',
15
            array(
16 1
                'file' => array('url' => $node->getAttribute('src')),
17
            )
18 1
        );
19
    }
20
21 1
    public function matches(\DomElement $node)
22
    {
23 1
        return $node->nodeName === 'img';
24
    }
25
}
26