WebTemplateBucket::withCommonData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace roxblnfk\SmartStream\Data;
6
7
class WebTemplateBucket extends DataBucket
8
{
9
    private ?string $template = null;
10
    private ?string $layout = null;
11
    private iterable $layoutData = [];
12
    private iterable $commonData = [];
13
14 12
    public function __construct(iterable $templateData, string $format = null, array $params = [])
15
    {
16 12
        parent::__construct($templateData, $format, $params);
17 12
    }
18 2
    public function getTemplate(): ?string
19
    {
20 2
        return $this->template;
21
    }
22 2
    public function getCommonData(): iterable
23
    {
24 2
        return $this->commonData;
25
    }
26 2
    public function getLayout(): ?string
27
    {
28 2
        return $this->layout;
29
    }
30 1
    public function getLayoutData(): iterable
31
    {
32 1
        return $this->layoutData;
33
    }
34 1
    public function getTemplateData(): iterable
35
    {
36 1
        return $this->data;
37
    }
38
39 1
    public function withLayout(string $layout, iterable $layoutData = []): self
40
    {
41 1
        $new = clone $this;
42 1
        $new->layout = $layout;
43 1
        $new->layoutData = $layoutData;
44 1
        return $new;
45
    }
46 1
    public function withTemplate(string $template): self
47
    {
48 1
        $new = clone $this;
49 1
        $new->template = $template;
50 1
        return $new;
51
    }
52 1
    public function withCommonData(iterable $defaultData): self
53
    {
54 1
        $new = clone $this;
55 1
        $new->commonData = $defaultData;
56 1
        return $new;
57
    }
58
}
59