Passed
Push — main ( 16e3d2...2668c7 )
by Damien
07:42
created

Subsup::getType()   A

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\Mark;
6
7
use DH\Adf\Node\MarkNode;
8
9
/**
10
 * @see https://developer.atlassian.com/cloud/jira/platform/apis/document/marks/subsup
11
 */
12
class Subsup extends MarkNode
13
{
14
    protected string $type = 'subsup';
15
    private string $subType = 'sup';
16
17
    public function __construct(string $subType = 'sup')
18
    {
19
        $this->subType = $subType;
20
    }
21
22
    public static function load(array $data): self
23
    {
24
        self::checkNodeData(static::class, $data, ['attrs']);
25
        self::checkRequiredKeys(['type'], $data['attrs']);
26
27
        return new self($data['attrs']['type'] ?? 'sup');
28
    }
29
30
    public function getType(): string
31
    {
32
        return $this->subType;
33
    }
34
35
    protected function attrs(): array
36
    {
37
        return [
38
            'type' => $this->subType,
39
        ];
40
    }
41
}
42