Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
ErrorHandler.php
001 <?php
002 /**
003 * Zend Framework (http://framework.zend.com/)
004 *
005 * @link http://github.com/zendframework/zf2 for the canonical source repository
006 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
007 * @license http://framework.zend.com/license/new-bsd New BSD License
008 */
009
010 namespace Zend\Stdlib;
011
012 use ErrorException;
013
014 /**
015 * ErrorHandler that can be used to catch internal PHP errors
016 * and convert to an ErrorException instance.
017 */
018 abstract class ErrorHandler
019 {
020 /**
021 * Active stack
022 *
023 * @var array
024 */
025 protected static $stack = array();
026
027 /**
028 * Check if this error handler is active
029 *
030 * @return bool
031 */
032 public static function started()
033 {
034 return (bool) static::getNestedLevel();
035 }
036
037 /**
038 * Get the current nested level
039 *
040 * @return int
041 */
042 public static function getNestedLevel()
043 {
044 return count(static::$stack);
045 }
046
047 /**
048 * Starting the error handler
049 *
050 * @param int $errorLevel
051 */
052 public static function start($errorLevel = \E_WARNING)
053 {
054 if (!static::$stack) {
055 set_error_handler(array(get_called_class(), 'addError'), $errorLevel);
056 }
057
058 static::$stack[] = null;
059 }
060
061 /**
062 * Stopping the error handler
063 *
064 * @param bool $throw Throw the ErrorException if any
065 * @return null|ErrorException
066 * @throws ErrorException If an error has been catched and $throw is true
067 */
068 public static function stop($throw = false)
069 {
070 $errorException = null;
071
072 if (static::$stack) {
073 $errorException = array_pop(static::$stack);
074
075 if (!static::$stack) {
076 restore_error_handler();
077 }
078
079 if ($errorException && $throw) {
080 throw $errorException;
081 }
082 }
083
084 return $errorException;
085 }
086
087 /**
088 * Stop all active handler
089 *
090 * @return void
091 */
092 public static function clean()
093 {
094 if (static::$stack) {
095 restore_error_handler();
096 }
097
098 static::$stack = array();
099 }
100
101 /**
102 * Add an error to the stack
103 *
104 * @param int $errno
105 * @param string $errstr
106 * @param string $errfile
107 * @param int $errline
108 * @return void
109 */
110 public static function addError($errno, $errstr = '', $errfile = '', $errline = 0)
111 {
112 $stack = & static::$stack[count(static::$stack) - 1];
113 $stack = new ErrorException($errstr, 0, $errno, $errfile, $errline, $stack);
114 }
115 }
116