InvalidResponseException.php 1.24 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
<?php
/**
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */

namespace yii\authclient;

use yii\base\Exception;

/**
 * InvalidResponseException represents an exception caused by invalid remote server response.
 *
 * @author Paul Klimov <klimov.paul@gmail.com>
 * @since 2.0
 */
class InvalidResponseException extends Exception
{
    /**
     * @var array response headers.
     */
    public $responseHeaders = [];
    /**
     * @var string response body.
     */
    public $responseBody = '';

29

30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
    /**
     * Constructor.
     * @param array $responseHeaders response headers
     * @param string $responseBody response body
     * @param string $message error message
     * @param integer $code error code
     * @param \Exception $previous The previous exception used for the exception chaining.
     * @internal param int $status HTTP status code, such as 404, 500, etc.
     */
    public function __construct($responseHeaders, $responseBody, $message = null, $code = 0, \Exception $previous = null)
    {
        $this->responseBody = $responseBody;
        $this->responseHeaders = $responseHeaders;
        parent::__construct($message, $code, $previous);
    }
}