public function __construct($status_code, $body) { // NOTE: Avoiding phutil_utf8_shorten() here because this isn't lazy // and responses may be large. if (strlen($body) > 512) { $excerpt = substr($body, 0, 512) . '...'; } else { $excerpt = $body; } $this->excerpt = phutil_utf8ize($excerpt); parent::__construct($status_code); }
public function __construct($status_code, $body, array $headers, $expect = null) { // NOTE: Avoiding PhutilUTF8StringTruncator here because this isn't lazy // and responses may be large. if (strlen($body) > 512) { $excerpt = substr($body, 0, 512) . '...'; } else { $excerpt = $body; } $content_type = BaseHTTPFuture::getHeader($headers, 'Content-Type'); $match = null; if (preg_match('/;\\s*charset=([^;]+)/', $content_type, $match)) { $encoding = trim($match[1], "\"'"); try { $excerpt = phutil_utf8_convert($excerpt, 'UTF-8', $encoding); } catch (Exception $ex) { } } $this->excerpt = phutil_utf8ize($excerpt); $this->expect = $expect; parent::__construct($status_code); }
public function __construct($code, $raw_response) { $this->rawResponse = $raw_response; parent::__construct($code); }