HTML::reformat()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 16
rs 9.4285
cc 3
eloc 8
nc 3
nop 1
1
<?php
2
3
namespace TheSupportGroup\Common\Validator\Format;
4
5
use TheSupportGroup\Common\Validator\Contracts\Format\FormatInterface;
6
7
class HTML implements FormatInterface
8
{
9
    public function reformat($messages)
10
    {
11
        $li_lists = '';
12
13
        $ul = "<ul>\n%s</ul>";
14
15
        foreach ($messages as $message) {
16
            foreach ($message as $content) {
17
                $li = "<li>%s</li>\n";
18
19
                $li_lists .= sprintf($li, $content);
20
            }
21
        }
22
23
        return sprintf($ul, $li_lists);
24
    }
25
}
26