Passed
Push — master ( 281f71...cbbb2e )
by Peter
03:08
created

Hollow::build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 8
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Website\Template\Builder\ContentList;
6
7
use AbterPhp\Framework\Constant\Html5;
8
use AbterPhp\Framework\Template\Data;
9
use AbterPhp\Framework\Template\IBuilder;
10
use AbterPhp\Framework\Template\IData;
11
use AbterPhp\Framework\Template\ParsedTemplate;
12
use AbterPhp\Website\Domain\Entities\ContentList as Entity;
13
14
class Hollow implements IBuilder
15
{
16
    use ItemTrait;
17
18
    const IDENTIFIER = 'hollow';
19
20
    public function __construct()
21
    {
22
        $this->withName = false;
23
    }
24
25
    /**
26
     * @return string
27
     */
28
    public function getIdentifier(): string
29
    {
30
        return static::IDENTIFIER;
31
    }
32
33
    /**
34
     * @return string[]
35
     */
36
    public function wrapperTags(): array
37
    {
38
        return [];
39
    }
40
41
    /**
42
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
43
     *
44
     * @param Entity              $list
45
     * @param ParsedTemplate|null $template
46
     *
47
     * @return Data
48
     */
49
    public function build($list, ?ParsedTemplate $template = null): IData
50
    {
51
        $html = $this->buildItems($list, Html5::TAG_DIV, '');
52
53
        return new Data(
54
            $list->getIdentifier(),
55
            [],
56
            ['body' => $html]
57
        );
58
    }
59
}
60