ProxyAuthenticationRequired::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php declare(strict_types=1);
2
3
namespace Meek\Http\ClientError;
4
5
use Meek\Http\ClientError;
6
7
/**
8
 * Exception modeling the '407 Proxy Authentication Required' HTTP status response.
9
 *
10
 * @see https://tools.ietf.org/html/rfc7235#section-3.2
11
 * @author Nathan Bishop <[email protected]> (https://nathanbishop.name)
12
 * @copyright 2016 Nathan Bishop
13
 * @license The MIT license.
14
 */
15
class ProxyAuthenticationRequired extends ClientError
16
{
17
    /**
18
     * Construct a new 'Proxy Authentication Required' exception.
19
     *
20
     * @param string $challenge The challenge for the target resource.
21
     * @param string[][] $headers Additional headers associated with the exception.
22
     */
23 4
    public function __construct(string $challenge, array $headers = [])
24
    {
25 4
        $headers = array_merge($headers, ['proxy-authenticate' => [$challenge]]);
26 4
        parent::__construct(407, 'Proxy Authentication Required', $headers);
27 4
    }
28
}
29