Passed
Push — master ( 748bbc...6ff058 )
by Dominik
02:33
created

AbstractApiProblem   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 96
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 0
dl 0
loc 96
ccs 19
cts 19
cp 1
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getInstance() 0 4 1
A __construct() 0 13 1
A getType() 0 4 1
A getStatus() 0 4 1
A getTitle() 0 4 1
A getDetail() 0 4 1
A getHeaders() 0 4 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
    private $type;
13
14
    /**
15
     * @var int
16
     */
17
    private $status;
18
19
    /**
20
     * @var string
21
     */
22
    private $title;
23
24
    /**
25
     * @var string
26
     */
27
    private $detail;
28
29
    /**
30
     * @var string|null
31
     */
32
    private $instance;
33
34
    /**
35
     * @param string      $type
36
     * @param int         $status
37
     * @param string      $title
38
     * @param string|null $detail
39
     * @param string|null $instance
40
     */
41 2
    public function __construct(
42
        string $type,
43
        int $status,
44
        string $title,
45
        string $detail = null,
46
        string $instance = null
47
    ) {
48 2
        $this->type = $type;
49 2
        $this->status = $status;
50 2
        $this->title = $title;
51 2
        $this->detail = $detail;
52 2
        $this->instance = $instance;
53 2
    }
54
55
    /**
56
     * @return string
57
     */
58 2
    public function getType(): string
59
    {
60 2
        return $this->type;
61
    }
62
63
    /**
64
     * @return int
65
     */
66 2
    public function getStatus(): int
67
    {
68 2
        return $this->status;
69
    }
70
71
    /**
72
     * @return string
73
     */
74 2
    public function getTitle(): string
75
    {
76 2
        return $this->title;
77
    }
78
79
    /**
80
     * @return string|null
81
     */
82 2
    public function getDetail()
83
    {
84 2
        return $this->detail;
85
    }
86
87
    /**
88
     * @return string|null
89
     */
90 2
    public function getInstance()
91
    {
92 2
        return $this->instance;
93
    }
94
95
    /**
96
     * @return array
97
     */
98 2
    public function getHeaders(): array
99
    {
100 2
        return [];
101
    }
102
}
103