當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。