Ergo::application PHP Метод

application() публичный статический Метод

Gets the current application instance
public static application ( )
    public static function application()
    {
        if (!isset(self::$_application)) {
            if (!empty(self::$_autostart)) {
                self::start(self::$_autostart);
            } else {
                throw new Exception('No application initialized');
            }
        }
        return self::$_application;
    }

Usage Example

Пример #1
0
 /**
  * Executes a worker
  */
 private function _executeWorker($worker)
 {
     // use a custom error handler, chain to the existing loggers
     $errorHandler = $worker->getErrorHandler();
     $errorHandler->logger()->addLoggers(Ergo::application()->errorHandler()->logger());
     Ergo::application()->setErrorHandler($errorHandler);
     return $worker->execute();
 }