コード例 #1
0
 public function __construct($message = "", $code = 0, $previous = NULL)
 {
     if (version_compare(PHP_VERSION, '5.3.0') < 0) {
         parent::__construct($message, $code);
     } else {
         parent::__construct($message, $code, $previous);
     }
 }
コード例 #2
0
ファイル: HttpException.php プロジェクト: kisma/kisma
 /**
  * @param int             $code
  * @param string|null     $message
  * @param \Exception|null $previous
  * @param mixed|null      $context
  *
  * @throws \InvalidArgumentException
  */
 public function __construct($code, $message = null, $previous = null, $context = null)
 {
     if (!\Kisma\Core\Enums\HttpResponse::contains($code)) {
         throw new \InvalidArgumentException('The code "' . $code . '" is not a valid HTTP response code.');
     }
     if (null === $message) {
         $message = \Kisma\Core\Utility\Inflector::untag(\Kisma\Core\Enums\HttpResponse::nameOf($code));
     }
     parent::__construct($message, $code, $previous, $context);
 }
コード例 #3
0
 /**
  * Initializes a new instance of the EndpointNotFoundException class.
  *
  * @param string $message string-based exception description
  * @param string $code exception code
  */
 public function __construct($message, $code = 0)
 {
     parent::__construct($message, $code);
 }
コード例 #4
0
 public function __toString()
 {
     return parent::__toString();
 }
コード例 #5
0
 function __construct($message)
 {
     parent::__construct($message, 401);
 }
コード例 #6
0
 /**
  * Constructor
  * @param string $msg the error message
  */
 public function __construct($msg)
 {
     parent::__construct($msg);
 }
コード例 #7
0
ファイル: Response.php プロジェクト: jdauie/bramble
 /**
  * Send the contents of a file immediately with the specified content type, with chunking and filename support.
  * @param string $path
  * @param string $content_type
  * @throws ServiceException
  */
 public function fpassthru($path, $content_type = NULL)
 {
     if (!$content_type) {
         $content_type = self::get_content_type($path);
     }
     if (!$content_type) {
         throw ServiceException::create(404, 'Unknown response content type');
     }
     set_time_limit(0);
     ignore_user_abort(false);
     ob_clean();
     ini_set('output_buffering', 0);
     ini_set('zlib.output_compression', 0);
     $this->content_type($content_type);
     $this->content_length(filesize($path));
     $this->content_disposition("attachment; filename*=UTF-8''" . rawurlencode(basename($path)));
     $this->send_headers(true);
     @ob_end_flush();
     flush();
     $fd = fopen($path, 'rb');
     while ($chunk = fread($fd, self::HTTP_DATA_CHUNK_SIZE)) {
         echo $chunk;
         @ob_end_flush();
         flush();
     }
     fclose($fd);
     exit;
 }
コード例 #8
0
 /**
  * @param string $message
  * @param array  $errors
  */
 public function __construct($message, array $errors)
 {
     $this->errors = $errors;
     parent::__construct($message);
 }