Completed
Push — master ( 7fc17a...b4d8e8 )
by Timo
04:56
created

ResponseHelper   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A hasErrorStatusCode() 0 3 1
1
<?php
2
3
namespace hamburgscleanest\GuzzleAdvancedThrottle\Helpers;
4
5
use Psr\Http\Message\ResponseInterface;
6
7
/**
8
 * Class ResponseHelper
9
 * @package hamburgscleanest\GuzzleAdvancedThrottle\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 8
    public static function hasErrorStatusCode(ResponseInterface $response) : bool
21
    {
22 8
        return \in_array(+ \mb_substr($response->getStatusCode(), 0, 1), [4, 5], true);
23
    }
24
}