Passed
Push — master ( a17aed...1a067b )
by Dominik
01:57
created

NotAcceptable::getHeaders()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 8
loc 8
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\ApiHttp\ApiProblem\ClientError;
6
7
use Chubbyphp\ApiHttp\ApiProblem\AbstractApiProblem;
8
9
final class NotAcceptable extends AbstractApiProblem
10
{
11
    /**
12
     * @var string
13
     */
14
    private $accept;
15
16
    /**
17
     * @var string[]
18
     */
19
    private $acceptables = [];
20
21
    /**
22
     * @param string      $accept
23
     * @param string[]    $acceptables
24
     * @param string|null $detail
25
     * @param string|null $instance
26
     */
27 2
    public function __construct(
28
        string $accept,
29
        array $acceptables,
30
        string $detail = null,
31
        string $instance = null
32
    ) {
33 2
        parent::__construct(
34 2
            'https://tools.ietf.org/html/rfc2616#section-10.4.7',
35 2
            406,
36 2
            'Not Acceptable',
37
            $detail,
38
            $instance
39
        );
40
41 2
        $this->accept = $accept;
42 2
        $this->acceptables = $acceptables;
43 2
    }
44
45
    /**
46
     * @return string
47
     */
48 2
    public function getAccept(): string
49
    {
50 2
        return $this->accept;
51
    }
52
53
    /**
54
     * @return string[]
55
     */
56 2
    public function getAcceptables(): array
57
    {
58 2
        return $this->acceptables;
59
    }
60
}
61