[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/Requests/src/Exception/Http/ -> StatusUnknown.php (source)

   1  <?php
   2  /**
   3   * Exception for unknown status responses
   4   *
   5   * @package Requests\Exceptions
   6   */
   7  
   8  namespace WpOrg\Requests\Exception\Http;
   9  
  10  use WpOrg\Requests\Exception\Http;
  11  use WpOrg\Requests\Response;
  12  
  13  /**
  14   * Exception for unknown status responses
  15   *
  16   * @package Requests\Exceptions
  17   */
  18  final class StatusUnknown extends Http {
  19      /**
  20       * HTTP status code
  21       *
  22       * @var integer|bool Code if available, false if an error occurred
  23       */
  24      protected $code = 0;
  25  
  26      /**
  27       * Reason phrase
  28       *
  29       * @var string
  30       */
  31      protected $reason = 'Unknown';
  32  
  33      /**
  34       * Create a new exception
  35       *
  36       * If `$data` is an instance of {@see \WpOrg\Requests\Response}, uses the status
  37       * code from it. Otherwise, sets as 0
  38       *
  39       * @param string|null $reason Reason phrase
  40       * @param mixed $data Associated data
  41       */
  42  	public function __construct($reason = null, $data = null) {
  43          if ($data instanceof Response) {
  44              $this->code = (int) $data->status_code;
  45          }
  46  
  47          parent::__construct($reason, $data);
  48      }
  49  }


Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref