UpgradeRequired   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 18
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 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 '426 Upgrade Required' HTTP status response.
9
 *
10
 * @see https://tools.ietf.org/html/rfc6585#section-4
11
 * @author Nathan Bishop <[email protected]> (https://nathanbishop.name)
12
 * @copyright 2016 Nathan Bishop
13
 * @license The MIT license.
14
 */
15
class UpgradeRequired extends ClientError
16
{
17
    /**
18
     * Construct a new 'Upgrade Required' exception.
19
     *
20
     * @param string[] $protocols A list of supported protocols the client should select from before retrying the request.
21
     * @param string[][] $headers Additional headers associated with the exception.
22
     */
23 5
    public function __construct(array $protocols, array $headers = [])
24
    {
25 5
        $headers = array_merge($headers, [
26 5
            'upgrade' => $protocols,
27
            'connection' => ['upgrade']
28
        ]);
29
30 5
        parent::__construct(426, 'Upgrade Required', $headers);
31 5
    }
32
}
33