Passed
Push — main ( 3c0f49...2c259b )
by Peter
04:10
created

CacheData::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Framework\Template;
6
7
class CacheData
8
{
9
    public const PAYLOAD_KEY_DATE         = 'date';
10
    public const PAYLOAD_KEY_SUBTEMPLATES = 'subTemplates';
11
12
    protected string $date = '';
13
14
    /** @var string[][] */
15
    protected array $subTemplates = [];
16
17
    /**
18
     * @param string $date
19
     *
20
     * @return $this
21
     */
22
    public function setDate(string $date): CacheData
23
    {
24
        $this->date = $date;
25
26
        return $this;
27
    }
28
29
    /**
30
     * @param array $subTemplates
31
     *
32
     * @return $this
33
     */
34
    public function setSubTemplates(array $subTemplates): CacheData
35
    {
36
        $this->subTemplates = $subTemplates;
37
38
        return $this;
39
    }
40
41
    /**
42
     * @return string
43
     */
44
    public function getDate(): string
45
    {
46
        if ($this->date === '') {
47
            $this->date = date('Y-m-d H:i:s');
48
        }
49
50
        return $this->date;
51
    }
52
53
    /**
54
     * @return string[][]
55
     */
56
    public function getSubTemplates(): array
57
    {
58
        return $this->subTemplates;
59
    }
60
}
61