PreconditionFailed   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 10
dl 0
loc 29
ccs 8
cts 8
cp 1
rs 10
c 1
b 0
f 1
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A getFailedPreconditions() 0 3 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
     */
19
    public function __construct(array $failedPreconditions, string $detail = null, string $instance = null)
20
    {
21 2
        parent::__construct(
22
            'https://tools.ietf.org/html/rfc2616#section-10.4.13',
23 2
            412,
24 2
            'Precondition Failed',
25 2
            $detail,
26 2
            $instance
27
        );
28
29
        $this->failedPreconditions = $failedPreconditions;
30
    }
31 2
32 2
    /**
33
     * @return string[]
34
     */
35
    public function getFailedPreconditions(): array
36
    {
37 2
        return $this->failedPreconditions;
38
    }
39
}
40