AbstractApiProblem   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 17
dl 0
loc 69
ccs 12
cts 12
cp 1
rs 10
c 1
b 1
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getStatus() 0 3 1
A __construct() 0 12 1
A getHeaders() 0 3 1
A getInstance() 0 3 1
A getType() 0 3 1
A getTitle() 0 3 1
A getDetail() 0 3 1
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