Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
6 / 6 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
HttpClientStatus | |
100.00% |
6 / 6 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
create | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
isError | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace PeServer\Core\Http\Client; |
6 | |
7 | use CurlHandle; |
8 | use PeServer\Core\Binary; |
9 | use PeServer\Core\Collection\Dictionary; |
10 | use PeServer\Core\Encoding; |
11 | use PeServer\Core\Http\HttpHeader; |
12 | use PeServer\Core\Text; |
13 | use PeServer\Core\TypeUtility; |
14 | |
15 | readonly class HttpClientStatus |
16 | { |
17 | public function __construct( |
18 | public int $number, |
19 | public string $message |
20 | ) { |
21 | } |
22 | |
23 | #region function |
24 | |
25 | public static function create(CurlHandle $curlHandle): self |
26 | { |
27 | return new self( |
28 | curl_errno($curlHandle), |
29 | curl_error($curlHandle) |
30 | ); |
31 | } |
32 | |
33 | public function isError(): bool |
34 | { |
35 | return $this->number !== 0; |
36 | } |
37 | |
38 | #endregion |
39 | } |