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


PHP LogicException类代码示例

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


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

示例1: handler

 /**
  * 显示exception错误信息
  * @param LogicException $e 
  */
 function handler($e)
 {
     if ($e->getCode() == 404 && !DEBUG) {
         header("HTTP/1.0 404 Not Found");
         exit;
     }
     // 正式情况下
     $this->out['_msg'] = $e->getMessage();
     $this->out['_code'] = $e->getCode();
     // 只有LogicException才需要显示详细,记录日志
     if ($e instanceof LogicException) {
         // DEBUG时显示调试详细信息
         if (DEBUG) {
             $this->out['_exception_detail']['trace'] = $this->getTraceDesc($e->getTrace());
             $this->out['_exception_detail']['file'] = $e->getFile();
             $this->out['_exception_detail']['line'] = $e->getLine();
         } else {
             $this->out['_msg'] = '系统错误';
         }
     }
     if (!$this->tpl) {
         $this->tpl = PATH_APP . '/template/msg.tpl';
     }
     $this->display();
 }
开发者ID:qcind,项目名称:Frame1.1,代码行数:29,代码来源:ExceptionHandler.php

示例2: __construct

 /**
  * Constructor
  *
  * @param string $errorCode status error code.
  * @param string $error     string value of the error code.
  * @param string $reason    detailed message for the error.
  * 
  * @return WindowsAzure\Common\ServiceException
  */
 public function __construct($errorCode, $error = null, $reason = null)
 {
     parent::__construct(sprintf(Resources::AZURE_ERROR_MSG, $errorCode, $error, $reason));
     $this->code = $errorCode;
     $this->_error = $error;
     $this->_reason = $reason;
 }
开发者ID:leotaillard,项目名称:btws2016,代码行数:16,代码来源:ServiceException.php

示例3: __construct

 public function __construct($message = '', $code = 0, \Exception $previous = null)
 {
     if (__CLASS__ === get_class($this)) {
         trigger_error('The ' . __CLASS__ . ' class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\\Component\\Form\\Exception\\AlreadySubmittedException class instead.', E_USER_DEPRECATED);
     }
     parent::__construct($message, $code, $previous);
 }
开发者ID:RuntyCybin,项目名称:csymfony,代码行数:7,代码来源:AlreadyBoundException.php

示例4: __construct

 /**
  * @param string                              $name
  * @param \Gnugat\Redaktilo\Command\Command[] $commands
  */
 public function __construct($name, array $commands)
 {
     $this->name = $name;
     $this->commands = $commands;
     $message = sprintf('The command "%s" was not found in CommandInvoker', $name);
     parent::__construct($message);
 }
开发者ID:lead-worker,项目名称:redaktilo,代码行数:11,代码来源:CommandNotFoundException.php

示例5: __construct

 /**
  * @param string $message
  * @param string $templateName
  * @param int $line
  * @param int $column
  */
 public function __construct($message, $templateName, $line, $column)
 {
     parent::__construct($message);
     $this->templateName = $templateName;
     $this->templateLine = $line;
     $this->templateColumn = $column;
 }
开发者ID:mcuelenaere,项目名称:plitz,代码行数:13,代码来源:LexException.php

示例6: __construct

 public function __construct($message, $op1 = null, $op2 = null, $result = null)
 {
     $this->op1 = $op1;
     $this->op2 = $op2;
     $this->result = $result;
     parent::__construct($message);
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:7,代码来源:MathException.php

示例7: __construct

 /**
  * @param string   $message            The failure reason
  * @param array    $failedActions      The list of failed action
  * @param callable $actionArgsToString The callback function to be used to convert an action arguments to a string
  *                                     function ($action) returns string
  */
 public function __construct($message, array $failedActions, $actionArgsToString = null)
 {
     $this->failedActions = $failedActions;
     parent::__construct(sprintf('%s Actions: %s.', $message, implode(', ', array_map(function (array $action) use($actionArgsToString) {
         $args = is_callable($actionArgsToString) ? call_user_func($actionArgsToString, $action) : null;
         return $args !== null && empty($args) || $args === null && empty($action['args']) ? sprintf('%s()', $action['name']) : sprintf('%s(%s)', $action['name'], is_string($args) ? $args : $action['args'][0]);
     }, $failedActions))));
 }
开发者ID:Maksold,项目名称:platform,代码行数:14,代码来源:DeferredUpdateFailureException.php

示例8: __construct

 /**
  * {@inheritDoc}
  */
 public function __construct($message = "", $translation = null, $params = [], $code = 0, \Exception $previous = null)
 {
     if (null !== $translation) {
         $this->setTranslation($translation);
     }
     $this->setParams($params);
     parent::__construct($message, $code, $previous);
 }
开发者ID:mothership-ec,项目名称:cog,代码行数:11,代码来源:TranslationLogicException.php

示例9: __construct

 public function __construct($message = null, $code = 0, \Exception $previous = null, $httpStatus = 500, $details = null)
 {
     $this->_httpStatus = $httpStatus;
     if ($details !== null) {
         $this->_details = $details;
     }
     parent::__construct($message, $code, $previous);
 }
开发者ID:shinymayhem,项目名称:shiny-rest,代码行数:8,代码来源:LogicException.php

示例10: __construct

 public function __construct($bundle, $usage, $template, array $enabled, $code = 0, \Exception $previous = null)
 {
     $message = sprintf('You must add %s to the assetic.bundle config to use %s in %s.', $bundle, $usage, $template);
     if ($enabled) {
         $message .= sprintf(' (currently enabled: %s)', implode(', ', $enabled));
     }
     parent::__construct($message, $code, $previous);
 }
开发者ID:BusinessCookies,项目名称:CoffeeMachineProject,代码行数:8,代码来源:InvalidBundleException.php

示例11: __construct

 /**
  * @param string    $msg
  * @param array     $token
  * @param Exception $previous
  */
 public function __construct($msg, array $token, Exception $previous = null)
 {
     $this->token = $token;
     if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
         parent::__construct($msg, 0, $previous);
     } else {
         parent::__construct($msg);
     }
 }
开发者ID:janeklb,项目名称:moodle,代码行数:14,代码来源:SyntaxException.php

示例12: __construct

 /**
  * @param string         $from
  * @param int            $to
  * @param string         $message
  * @param int            $code
  * @param Exception|null $previous
  */
 public function __construct($from, $to, $message = '', $code = 0, Exception $previous = null)
 {
     $this->from = $from;
     $this->to = $to;
     if (empty($message)) {
         $message = sprintf('Invalid type cast: %s to %s.', $this->from, $this->to);
     }
     parent::__construct($message, $code, $previous);
 }
开发者ID:krixon,项目名称:exceptions,代码行数:16,代码来源:InvalidCastException.php

示例13: __construct

 /**
  * @param Mixin $mixin
  * @param Schema[] $schemas
  */
 public function __construct(Mixin $mixin, array $schemas)
 {
     $this->mixin = $mixin;
     $this->schemas = $schemas;
     $ids = array_map(function (Schema $schema) {
         return $schema->getId()->toString() . ' => ' . $schema->getClassName();
     }, $schemas);
     parent::__construct(sprintf('MessageResolver returned multiple messages using [%s] when one was expected.  ' . 'Messages found:' . PHP_EOL . '%s', $mixin->getId()->getCurieMajor(), implode(PHP_EOL, $ids)));
 }
开发者ID:gdbots,项目名称:pbj-php,代码行数:13,代码来源:MoreThanOneMessageForMixin.php

示例14: __construct

 public function __construct($type, $code = 0, Exception $previous = null)
 {
     $this->type = $type;
     $err = "No Permission:{$type}";
     if ($previous instanceof Exception) {
         parent::__construct($err, $code, $previous);
     } else {
         parent::__construct($err, $code);
     }
 }
开发者ID:arieh,项目名称:PHPancake_TreeForum,代码行数:10,代码来源:PancakeTF_NoPermissionException.class.php

示例15: __construct

 /**
  * @param mixed $pattern
  * @param array $searchStrategies
  */
 public function __construct($pattern, array $searchStrategies)
 {
     $this->pattern = $pattern;
     $this->searchStrategies = $searchStrategies;
     $patternMessage = 'given pattern';
     if (is_string($pattern) || is_int($pattern)) {
         $patternMessage .= ' "' . strval($pattern) . '"';
     }
     $message = sprintf('The %s isn\'t supported by the Search Strategies registered in SearchEngine', $patternMessage);
     parent::__construct($message);
 }
开发者ID:lead-worker,项目名称:redaktilo,代码行数:15,代码来源:NotSupportedException.php


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