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

Date   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
dl 0
loc 21
c 1
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 5 1
A __construct() 0 3 1
A attrs() 0 4 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
    protected function attrs(): array
30
    {
31
        return [
32
            'timestamp' => $this->timestamp,
33
        ];
34
    }
35
}
36