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

PreconditionFailed::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 7
cts 7
cp 1
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 1
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 PreconditionFailed extends AbstractApiProblem
10
{
11
    /**
12
     * @var string[]
13
     */
14
    private $failedPreconditions = [];
15
16
    /**
17
     * @param string[]    $failedPreconditions
18
     * @param string|null $detail
19
     * @param string|null $instance
20
     */
21 2
    public function __construct(array $failedPreconditions, string $detail = null, string $instance = null)
22
    {
23 2
        parent::__construct(
24 2
            'https://tools.ietf.org/html/rfc2616#section-10.4.13',
25 2
            412,
26 2
            'Precondition Failed',
27
            $detail,
28
            $instance
29
        );
30
31 2
        $this->failedPreconditions = $failedPreconditions;
32 2
    }
33
34
    /**
35
     * @return string[]
36
     */
37 2
    public function getFailedPreconditions(): array
38
    {
39 2
        return $this->failedPreconditions;
40
    }
41
}
42