Server : Apache System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64 User : palandch ( 1163) PHP Version : 7.1.33 Disable Function : NONE Directory : /home/palandch/Cloudflare-CPanel-7.0.1/vendor/guzzlehttp/guzzle/src/Subscriber/ |
<?php namespace GuzzleHttp\Subscriber; use GuzzleHttp\Event\CompleteEvent; use GuzzleHttp\Event\RequestEvents; use GuzzleHttp\Event\SubscriberInterface; use GuzzleHttp\Exception\RequestException; /** * Throws exceptions when a 4xx or 5xx response is received */ class HttpError implements SubscriberInterface { public function getEvents() { return ['complete' => ['onComplete', RequestEvents::VERIFY_RESPONSE]]; } /** * Throw a RequestException on an HTTP protocol error * * @param CompleteEvent $event Emitted event * @throws RequestException */ public function onComplete(CompleteEvent $event) { $code = (string) $event->getResponse()->getStatusCode(); // Throw an exception for an unsuccessful response if ($code[0] >= 4) { throw RequestException::create( $event->getRequest(), $event->getResponse() ); } } }