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

ListConverter::toHtml()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 2
eloc 6
nc 2
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