Passed
Push — main ( e16d46...16e3d2 )
by Damien
07:21
created

Date::attrs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
dl 0
loc 4
c 1
b 0
f 0
rs 10
cc 1
nc 1
nop 0
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
    protected function attrs(): array
30
    {
31
        return [
32
            'timestamp' => $this->timestamp,
33
        ];
34
    }
35
}
36