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


PHP JError::addToStack方法代码示例

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


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

示例1: testAddToStack

 /**
  * @covers  JError::addToStack
  */
 public function testAddToStack()
 {
     // Remove the following lines when the framework is fixed.
     //$this->markTestSkipped('The framework is currently broken.  Skipping this test.');
     JErrorInspector::manipulateStack(array('value1', 'value2', 'value3'));
     $exception = new JException('This is the error message', 1056, 'error');
     JError::addToStack($exception);
     $stack = JErrorInspector::inspectStack();
     $this->assertThat($stack[3], $this->identicalTo($exception), 'The exception did not get properly added to the stack');
     JErrorInspector::manipulateStack(array());
 }
开发者ID:rvsjoen,项目名称:joomla-platform,代码行数:14,代码来源:JErrorTest.php

示例2: __construct

 /**
  * Constructor
  * - used to set up the error with all needed error details.
  *
  * @param   string   $msg        The error message
  * @param   string   $code       The error code from the application
  * @param   integer  $level      The error level (use the PHP constants E_ALL, E_NOTICE etc.).
  * @param   string   $info       Optional: The additional error information.
  * @param   boolean  $backtrace  True if backtrace information is to be collected
  *
  * @since   11.1
  *
  * @deprecated  12.1
  */
 public function __construct($msg, $code = 0, $level = null, $info = null, $backtrace = false)
 {
     JLog::add('JException is deprecated.', JLog::WARNING, 'deprecated');
     $this->level = $level;
     $this->code = $code;
     $this->message = $msg;
     if ($info != null) {
         $this->info = $info;
     }
     if ($backtrace && function_exists('debug_backtrace')) {
         $this->backtrace = debug_backtrace();
         for ($i = count($this->backtrace) - 1; $i >= 0; --$i) {
             ++$i;
             if (isset($this->backtrace[$i]['file'])) {
                 $this->file = $this->backtrace[$i]['file'];
             }
             if (isset($this->backtrace[$i]['line'])) {
                 $this->line = $this->backtrace[$i]['line'];
             }
             if (isset($this->backtrace[$i]['class'])) {
                 $this->class = $this->backtrace[$i]['class'];
             }
             if (isset($this->backtrace[$i]['function'])) {
                 $this->function = $this->backtrace[$i]['function'];
             }
             if (isset($this->backtrace[$i]['type'])) {
                 $this->type = $this->backtrace[$i]['type'];
             }
             $this->args = false;
             if (isset($this->backtrace[$i]['args'])) {
                 $this->args = $this->backtrace[$i]['args'];
             }
             break;
         }
     }
     // Store exception for debugging purposes!
     JError::addToStack($this);
     parent::__construct($msg, (int) $code);
 }
开发者ID:01J,项目名称:skazkipronebo,代码行数:53,代码来源:exception.php

示例3: cleanBogusError

 protected function cleanBogusError()
 {
     $errors = array();
     while (($error = JError::getError(true)) !== false) {
         if (!($error->get('code') == 1 && $error->get('level') == 2 && $error->get('message') == JText::_('JLIB_INSTALLER_ERROR_NOTFINDXMLSETUPFILE'))) {
             $errors[] = $error;
         }
     }
     foreach ($errors as $error) {
         JError::addToStack($error);
     }
     $app =& JFactory::getApplication();
     $enqueued_messages = $app->get('_messageQueue');
     $other_messages = array();
     if (!empty($enqueued_messages) && is_array($enqueued_messages)) {
         foreach ($enqueued_messages as $enqueued_message) {
             if (!($enqueued_message['message'] == JText::_('JLIB_INSTALLER_ERROR_NOTFINDXMLSETUPFILE') && $enqueued_message['type']) == 'error') {
                 $other_messages[] = $enqueued_message;
             }
         }
     }
     $app->set('_messageQueue', $other_messages);
 }
开发者ID:resmun,项目名称:template-hawk1-j25,代码行数:23,代码来源:install.script.php


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