Completed
Pull Request — master (#7)
by
unknown
05:22
created

ListConverter::matches()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Sioen\JsonToHtml;
4
5
final class ListConverter implements Converter
6
{
7
    public function toHtml(array $data)
8
    {
9
        $html = '<ul>';
10
        foreach ($data['listItems'] as $listItem) {
11
            $html .= '<li>'.$listItem['content'].'</li>';
12
        }
13
        $html .= '</ul>';
14
        return $html;
15
    }
16
17
    public function matches($type)
18
    {
19
        return $type === 'list';
20
    }
21
}
22