WpOrg\Requests\Exception
Http::__construct
Create a new exception
There is no mechanism to pass in the status code, as this is set by the subclass used. Reason phrases can vary, however.
Method of the class: Http{}
No Hooks.
Returns
null. Nothing (null).
Usage
$Http = new Http(); $Http->__construct( $reason, $data );
- $reason(string|null)
- Reason phrase.
Default:null - $data(mixed)
- Associated data.
Default:null
Http::__construct() Http:: construct code WP 6.9.1
public function __construct($reason = null, $data = null) {
if ($reason !== null) {
$this->reason = $reason;
}
$message = sprintf('%d %s', $this->code, $this->reason);
parent::__construct($message, 'httpresponse', $data, $this->code);
}