| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | 4 | public function __construct( HttpRequest $httpRequest ) { |
|
| 21 | |||
| 22 | 4 | $errorCode = $httpRequest->getLastErrorCode(); |
|
| 23 | |||
| 24 | switch ( $errorCode ) { |
||
| 25 | 4 | case 22: // equals CURLE_HTTP_RETURNED_ERROR but this constant is not defined in PHP |
|
| 26 | 1 | $httpCode = $httpRequest->getLastTransferInfo( CURLINFO_HTTP_CODE ); |
|
| 27 | 1 | $message = "HTTP request ended with $httpCode code\n"; |
|
| 28 | 1 | break; |
|
| 29 | 3 | default: |
|
| 30 | 3 | $message = $httpRequest->getLastError(); |
|
| 31 | 3 | } |
|
| 32 | |||
| 33 | 4 | parent::__construct( $message, $errorCode ); |
|
| 34 | 4 | } |
|
| 35 | |||
| 37 |