Date   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 26
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 5 1
A __construct() 0 3 1
A attrs() 0 4 1
A getTimestamp() 0 3 1
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