Passed
Push — master ( 7640e3...903994 )
by Timo
02:28
created

ResponseHelper   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A hasErrorStatusCode() 0 3 1
1
<?php
2
3
namespace hamburgscleanest\GuzzleAdvancedThrottle\Cache\Helpers;
4
5
use Psr\Http\Message\ResponseInterface;
6
7
/**
8
 * Class ResponseHelper
9
 * @package hamburgscleanest\GuzzleAdvancedThrottle\Cache\Helpers
10
 */
11
class ResponseHelper
12
{
13
14
    /**
15
     * Did the request return a 4xx or 5xx status code?
16
     *
17
     * @param ResponseInterface $response
18
     * @return bool
19
     */
20 3
    public static function hasErrorStatusCode(ResponseInterface $response) : bool
21
    {
22 3
        return \in_array(+ \mb_substr($response->getStatusCode(), 0, 1), [4, 5], true);
23
    }
24
}