当前位置: 首页>>代码示例>>PHP>>正文


PHP Error::exception方法代码示例

本文整理汇总了PHP中Error::exception方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::exception方法的具体用法?PHP Error::exception怎么用?PHP Error::exception使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Error的用法示例。


在下文中一共展示了Error::exception方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validateResponse

 /**
  * @param $response
  * @param $expectProperty
  * @return mixed
  * @throws \ErrorException
  */
 protected function validateResponse($response, $expectProperty)
 {
     if (!is_object($response) || !property_exists($response, $expectProperty)) {
         return Error::exception('Authorization error');
     }
     return $response->{$expectProperty};
 }
开发者ID:pshon,项目名称:vcapi,代码行数:13,代码来源:Model.php

示例2: sort

 /**
  * Sorting collection by key
  * 
  * @param string $key - element key
  * @param string $direction - sorting direction (SQL style)
  * @return Collection <\VCAPI\Common\Collection>
  */
 public function sort($key, $direction = 'ASC')
 {
     $keys = array();
     foreach ($this->collection as $item) {
         if (is_array($item)) {
             if (!isset($item[$key])) {
                 continue;
             }
             $keys[] = $item[$key];
         } elseif (is_object($item)) {
             if (!property_exists($item, $key)) {
                 continue;
             }
             $keys[] = $item->{$key};
         }
     }
     if (empty($keys)) {
         Error::exception('No valid data to sort');
         return $this->collection;
     }
     $sorted = $this->collection;
     $direction = $direction == 'DESC' ? SORT_DESC : SORT_ASC;
     array_multisort($keys, $direction, $sorted);
     return $sorted;
 }
开发者ID:pshon,项目名称:vcapi,代码行数:32,代码来源:Collection.php

示例3: __toString

 /**
  * Return the view's HTML
  *
  * @return string
  */
 public function __toString()
 {
     try {
         ob_start();
         extract((array) $this);
         require SP . "View/" . $this->__view . EXT;
         return ob_get_clean();
     } catch (\Exception $e) {
         Error::exception($e);
         return '';
     }
 }
开发者ID:Robert-Xie,项目名称:php-framework-benchmark,代码行数:17,代码来源:View.php

示例4: set_exception_handler

| may be used by the developer.
|
*/
require 'core.php';
/*
|--------------------------------------------------------------------------
| Setup Error & Exception Handling
|--------------------------------------------------------------------------
|
| Next we'll register custom handlers for all errors and exceptions so we
| can display a clean error message for all errors, as well as do any
| custom error logging that may be setup by the developer.
|
*/
set_exception_handler(function ($e) {
    Error::exception($e);
});
set_error_handler(function ($code, $error, $file, $line) {
    Error::native($code, $error, $file, $line);
});
register_shutdown_function(function () {
    Error::shutdown();
});
/*
|--------------------------------------------------------------------------
| Report All Errors
|--------------------------------------------------------------------------
|
| By setting error reporting to -1, we essentially force PHP to report
| every error, and this is guranteed to show every error on future
| releases of PHP. This allows everything to be fixed early!
开发者ID:victoroliveira1605,项目名称:Laravel-Bootstrap,代码行数:31,代码来源:laravel.php

示例5: __toString

 /**
  * alias for render()
  *
  * @return string
  */
 public function __toString()
 {
     try {
         return $this->render();
     } catch (\Exception $e) {
         Error::exception($e);
         return '';
     }
 }
开发者ID:PermeAgility,项目名称:FrameworkBenchmarks,代码行数:14,代码来源:Table.php

示例6: fatal

 public static function fatal()
 {
     if ($e = error_get_last()) {
         Error::exception(new \ErrorException($e['message'], $e['type'], 0, $e['file'], $e['line']));
     }
 }
开发者ID:Robert-Xie,项目名称:php-framework-benchmark,代码行数:6,代码来源:Error.php

示例7: __toString

 /**
  * Return an HTML pagination string
  *
  * @return string
  */
 public function __toString()
 {
     try {
         // Start and end must be valid integers
         $start = $this->current - $this->links > 0 ? $this->current - $this->links : 1;
         $end = $this->current + $this->links < $this->total ? $this->current + $this->links : $this->total;
         $html = $this->previous();
         for ($i = $start; $i <= $end; ++$i) {
             // Current link is "active"
             $attributes = $this->current == $i ? array('class' => 'active') : array();
             // Wrap the link in a list item
             $html .= HTML::tag('li', HTML::link($this->url($i), $i), $attributes);
         }
         $html .= $this->next();
         return HTML::tag('div', "<ul>\n" . $html . "</ul>\n", $this->attributes);
     } catch (\Exception $e) {
         Error::exception($e);
         return '';
     }
 }
开发者ID:PermeAgility,项目名称:FrameworkBenchmarks,代码行数:25,代码来源:Pagination.php

示例8: __toString

 /**
  * Return the current HTML form as a string
  */
 public function __toString()
 {
     try {
         if ($this->field) {
             return $this->render_field();
         }
         if (!$this->fields) {
             return '';
         }
         $output = '';
         foreach ($this->fields as $field) {
             $output .= $field;
         }
         return $output;
     } catch (\Exception $e) {
         Error::exception($e);
         return '';
     }
 }
开发者ID:Robert-Xie,项目名称:php-framework-benchmark,代码行数:22,代码来源:Form.php

示例9: __construct

 /**
  * Inject logging logic
  * @see Exception
  */
 public function __construct($message = '', $code = 0, Exception $previous = null)
 {
     parent::__construct((string) $message, (int) $code, $previous);
     Error::exception($this);
 }
开发者ID:tashik,项目名称:phalcon_core,代码行数:9,代码来源:Exception.php


注:本文中的Error::exception方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。