CoreFiles by mySites.guru
StatusUnknown.php49 lines, 970 bytes, from wordpress-7.2-beta3.zip
Raw History Compare with 7.2-beta2
md5
8c4d25bb7da4d2857028f2a6dcec0cc3
sha1
578ced81c43b7b33019f5b00d16504155742a7c3
sha256
19864167b648019581dd7906046f6dcce64dd87c09f0fb5d60016348db954eb1
<?php
/**
 * Exception for unknown status responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;
use WpOrg\Requests\Response;

/**
 * Exception for unknown status responses
 *
 * @package Requests\Exceptions
 */
final class StatusUnknown extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer|bool Code if available, false if an error occurred
	 */
	protected $code = 0;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Unknown';

	/**
	 * Create a new exception
	 *
	 * If `$data` is an instance of {@see \WpOrg\Requests\Response}, uses the status
	 * code from it. Otherwise, sets as 0
	 *
	 * @param string|null $reason Reason phrase
	 * @param mixed $data Associated data
	 */
	public function __construct($reason = null, $data = null) {
		if ($data instanceof Response) {
			$this->code = (int) $data->status_code;
		}

		parent::__construct($reason, $data);
	}
}

The same content is in 229 releases, WordPress 6.2-beta1 to 7.2-beta5. See them all, or every version of this file.