| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/stirizo/wp-content/plugins/pojo-accessibility/classes/client/ |
Upload File : |
<?php
namespace EA11y\Classes\Client;
use Exception;
use EA11y\Classes\Exceptions\Quota_Exceeded_Error;
use EA11y\Classes\Exceptions\Quota_API_Error;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Client_Response {
private array $known_errors;
/**
* @var mixed
*/
private $response;
/**
* @throws Quota_API_Error|Quota_Exceeded_Error|Exception
*/
public function handle() {
if ( ! is_wp_error( $this->response ) ) {
return $this->response;
}
$message = $this->response->get_error_message();
if ( isset( $this->known_errors[ $message ] ) ) {
throw $this->known_errors[ $message ];
}
throw new Exception( $message );
}
public function __construct( $response ) {
$this->known_errors = [
"Quota Status Guard Request Failed!: plan.features.ai_credits Quota exceeded" => new Quota_Exceeded_Error(),
"Quota Api Request Failed!: Failed checking if allowed to use quota" => new Quota_API_Error(),
];
$this->response = $response;
}
}