Date::getTimestamp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DH\Adf\Node\Inline;
6
7
use DH\Adf\Node\InlineNode;
8
9
/**
10
 * @see https://developer.atlassian.com/cloud/jira/platform/apis/document/nodes/text
11
 */
12
class Date extends InlineNode
13
{
14
    protected string $type = 'date';
15
    private string $timestamp;
16
17
    public function __construct(string $timestamp)
18
    {
19
        $this->timestamp = $timestamp;
20
    }
21
22
    public static function load(array $data): self
23
    {
24
        self::checkNodeData(static::class, $data, ['attrs']);
25
26
        return new self($data['attrs']['timestamp']);
27
    }
28
29
    public function getTimestamp(): string
30
    {
31
        return $this->timestamp;
32
    }
33
34
    protected function attrs(): array
35
    {
36
        return [
37
            'timestamp' => $this->timestamp,
38
        ];
39
    }
40
}
41