AbstractApiProblem::getInstance()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 1
cts 1
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\ApiHttp\ApiProblem;
6
7
abstract class AbstractApiProblem implements ApiProblemInterface
8
{
9
    /**
10
     * @var string
11
     */
12
    protected $type;
13
14
    /**
15
     * @var int
16
     */
17
    protected $status;
18
19
    /**
20
     * @var string
21
     */
22
    protected $title;
23
24
    /**
25
     * @var string|null
26
     */
27
    protected $detail;
28
29
    /**
30
     * @var string|null
31
     */
32
    protected $instance;
33
34
    public function __construct(
35
        string $type,
36
        int $status,
37
        string $title,
38
        string $detail = null,
39
        string $instance = null
40
    ) {
41 2
        $this->type = $type;
42
        $this->status = $status;
43
        $this->title = $title;
44
        $this->detail = $detail;
45
        $this->instance = $instance;
46
    }
47
48 2
    public function getType(): string
49 2
    {
50 2
        return $this->type;
51 2
    }
52 2
53 2
    public function getStatus(): int
54
    {
55
        return $this->status;
56
    }
57
58 2
    public function getTitle(): string
59
    {
60 2
        return $this->title;
61
    }
62
63
    public function getDetail(): ?string
64
    {
65
        return $this->detail;
66 2
    }
67
68 2
    public function getInstance(): ?string
69
    {
70
        return $this->instance;
71
    }
72
73
    public function getHeaders(): array
74 2
    {
75
        return [];
76 2
    }
77
}
78