reset() public static method

Setup basic error handling checks/types, as well as register the error and exception handlers and wipes out all configuration and resets the error handler to its initial state when loaded. Mainly used for testing.
public static reset ( )
 public function setUp()
 {
     if (!ErrorHandler::isRunning()) {
         ErrorHandler::run();
     }
     ErrorHandler::reset();
     $this->errors = array();
 }
Beispiel #2
0
 public function testReset()
 {
     ErrorHandler::reset();
     $this->assertEqual(array(), ErrorHandler::handlers());
     $result = ErrorHandler::handlers(array('test' => function ($error) {
         /* Do something */
     }));
     $this->assertEqual(array('test'), array_keys($result));
     $this->assertTrue($result['test'] instanceof Closure);
     $this->assertEqual($result, ErrorHandler::handlers());
     ErrorHandler::reset();
     $this->assertEqual(array(), ErrorHandler::handlers());
 }
Beispiel #3
0
                return false;
            }
        }
        if (isset($config['conditions']) && ($call = $config['conditions']) && !$call($info)) {
            return false;
        }
        return true;
    }
    /**
     * Trim down a typical stack trace to class & method calls.
     *
     * @param array $stack A `debug_backtrace()`-compatible stack trace output.
     * @return array Returns a flat stack array containing class and method references.
     */
    public static function trace(array $stack)
    {
        $result = array();
        foreach ($stack as $frame) {
            if (isset($frame['function'])) {
                if (isset($frame['class'])) {
                    $result[] = trim($frame['class'], '\\') . '::' . $frame['function'];
                } else {
                    $result[] = $frame['function'];
                }
            }
        }
        return $result;
    }
}
ErrorHandler::reset();