PaymentRequired::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

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