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

Natural   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 30
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getIdentifier() 0 3 1
A build() 0 8 1
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 Natural implements IBuilder
15
{
16
    use ItemTrait;
17
18
    const IDENTIFIER = 'natural';
19
20
    /**
21
     * @return string
22
     */
23
    public function getIdentifier(): string
24
    {
25
        return static::IDENTIFIER;
26
    }
27
28
    /**
29
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
30
     *
31
     * @param Entity              $list
32
     * @param ParsedTemplate|null $template
33
     *
34
     * @return Data
35
     */
36
    public function build($list, ?ParsedTemplate $template = null): IData
37
    {
38
        $html = $this->buildItems($list, Html5::TAG_DIV, Html5::TAG_DIV);
39
40
        return new Data(
41
            $list->getIdentifier(),
42
            [],
43
            ['body' => $html]
44
        );
45
    }
46
}
47