ServerError::assertStatusCodeIsInRange()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 3
nc 2
nop 1
crap 3
1
<?php declare(strict_types=1);
2
3
namespace Meek\Http;
4
5
use InvalidArgumentException;
6
7
/**
8
 * Exception class modeling the 5xx (Server Error) class of HTTP status codes.
9
 *
10
 * @see https://tools.ietf.org/html/rfc7231#section-6.6
11
 * @author Nathan Bishop <[email protected]> (https://nathanbishop.name)
12
 * @copyright 2016 Nathan Bishop
13
 * @license The MIT license.
14
 */
15
class ServerError extends Exception
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20 3
    public function assertStatusCodeIsInRange(int $statusCode): void
21
    {
22 3
        if ($statusCode < 500 || $statusCode > 599) {
23 2
            throw new InvalidArgumentException('A server error status code ("5xx") was not provided');
24
        }
25 1
    }
26
}
27