GuzzleHttp\Psr7\Response::getStatusCode PHP Метод

getStatusCode() публичный Метод

public getStatusCode ( )
    public function getStatusCode()
    {
        return $this->statusCode;
    }

Usage Example

 static function retryDecider($retries, Request $request, Response $response = null, RequestException $exception = null)
 {
     // Limit the number of retries to 5
     if ($retries >= 5) {
         return false;
     }
     // Retry connection exceptions
     if ($exception instanceof ConnectException) {
         return true;
     }
     if ($response) {
         // Retry on server errors
         if ($response->getStatusCode() >= 500) {
             return true;
         }
         // Retry on rate limits
         if ($response->getStatusCode() == 429) {
             $retryDelay = $response->getHeaderLine('Retry-After');
             if (strlen($retryDelay)) {
                 printf(" retry delay: %d secs\n", (int) $retryDelay);
                 sleep((int) $retryDelay);
                 return true;
             }
         }
     }
     return false;
 }
All Usage Examples Of GuzzleHttp\Psr7\Response::getStatusCode