<?php
/**
* Enlight
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://enlight.de/license
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@shopware.de so we can send you a copy immediately.
*
* @category Enlight
* @package Enlight_Exception
* @copyright Copyright (c) 2011, shopware AG (http://www.shopware.de)
* @license http://enlight.de/license New BSD License
* @version $Id$
* @author Heiner Lohaus
* @author $Author$
*/
/**
* Basic Enlight exception class.
*
* The Enlight_Exception is the basic class for each specified exception class. (Controller_Exception, ...)
* Extends the default exception class with an previous Exception property
*
* @category Enlight
* @package Enlight_Exception
* @copyright Copyright (c) 2011, shopware AG (http://www.shopware.de)
* @license http://enlight.de/license New BSD License
*/
class Enlight_Exception extends Exception
{
/**
* Constant that a class could not be found
*/
const CLASS_NOT_FOUND = 1000;
/**
* Constant that a method could not be found
*/
const METHOD_NOT_FOUND = 1100;
/**
* Constant that a class property could not be found
*/
const PROPERTY_NOT_FOUND = 1200;
/**
* @var Exception|null The previous thrown exception.
*/
protected $previous;
/**
* The class constructor sets the given previous exception into the internal property.
* If the given code is one of the internal constants, it will generate a back trace and iterate
* the returned values to set the line and file property.
*
* @param string $message
* @param int $code
* @param Exception|null $previous
*/
public function __construct($message = '', $code = 0, Exception $previous = null)
{
if ($previous !== null) {
$this->previous = $previous;
}
parent::__construct($message, $code);
if (in_array($code, array(self::CLASS_NOT_FOUND, self::METHOD_NOT_FOUND, self::PROPERTY_NOT_FOUND))) {
$trace = debug_backtrace(false);
foreach ($trace as $i => $var) {
if (!$i || $var['function'] == '__call' || !isset($var['line'])) {
unset($trace[$i]);
continue;
}
$this->file = $var['file'];
$this->line = $var['line'];
break;
}
}
}
/**
* Returns the exception class as string.
* @return string
*/
public function __toString()
{
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
if ($this->previous !== null) {
return $this->previous->__toString() . "\n\nNext " . parent::__toString();
}
}
return parent::__toString();
}
}
| nama | waktu | ukuran | owner | perm | aksi |
|---|---|---|---|---|---|
| .. | |||||
| Collection/ | 2016-11-07 15:58 | 6.7 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Components/ | 2016-11-07 16:04 | 99.29 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Config/ | 2016-11-07 16:00 | 57.36 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Controller/ | 2016-11-07 16:03 | 129.95 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Event/ | 2016-11-07 16:00 | 43.17 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Hook/ | 2016-11-07 15:58 | 21.67 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Plugin/ | 2016-11-07 16:00 | 28.16 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Template/ | 2016-11-07 16:00 | 71.4 KB | 76129f60960:kunden | dxwrx-rx-r | |
| View/ | 2016-11-07 15:58 | 11.41 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Application.php | 2016-11-07 15:58 | 4.72 KB | 76129f60960:kunden | -xw-x----- | |
| Bootstrap.php | 2016-11-07 15:58 | 999 B | 76129f60960:kunden | -xw-x----- | |
| Class.php | 2016-11-07 15:58 | 5.46 KB | 76129f60960:kunden | -xw-x----- | |
| Config.php | 2016-11-07 15:58 | 11.66 KB | 76129f60960:kunden | -xw-x----- | |
| Exception.php | 2016-11-07 15:58 | 3.01 KB | 76129f60960:kunden | -xw-x----- | |
| Hook.php | 2016-11-07 15:58 | 1.07 KB | 76129f60960:kunden | -xw-x----- | |
| Loader.php | 2016-11-07 15:58 | 9.67 KB | 76129f60960:kunden | -xw-x----- | |
| Singleton.php | 2016-11-07 15:58 | 1.15 KB | 76129f60960:kunden | -xw-x----- | |
| View.php | 2016-11-07 15:58 | 3.13 KB | 76129f60960:kunden | -xw-x----- | |