/** * construct exception with http reponse code and url * @param int $code * @param string $url */ public function __construct($code, $url) { // safe url and strip apikey for security reasons $this->url = preg_replace('/(apikey=)[a-z0-9]*/i', '\\1...', $url); // build error message $message = isset(self::$codes[$code]) ? self::$codes[$code] : 'Unknown HTTP Code'; parent::__construct($message, $code); }
/** * construct exception with EVE API errorcode, and message * @param int $code * @param string $message * @param \SimpleXMLElement $xml */ public function __construct($code, $message, $xml) { $this->code = (int) $code; // switch to UTC $oldtz = date_default_timezone_get(); date_default_timezone_set('UTC'); // save request/cache timers (if ccp provides them) if ($xml->currentTime) { $this->request_time = (string) $xml->currentTime; $this->request_time_unixtime = (int) strtotime($xml->currentTime); } if ($xml->cachedUntil) { $this->cached_until = (string) $xml->cachedUntil; $this->cached_until_unixtime = (int) strtotime($xml->cachedUntil); } // switch back to normal time date_default_timezone_set($oldtz); parent::__construct($message); }