예제 #1
0
 public static function handle(\Exception $ex)
 {
     if ($ex->getPrevious() instanceof ConsoleException) {
         Console::error($ex->getMessage());
         return;
     }
     $handles = Settings::load('exception');
     if (isset($handles) && !empty($handles)) {
         foreach ($handles as $key => $value) {
             if (self::recursive($ex, $key)) {
                 if (is_callable($value)) {
                     call_user_func($value, $ex);
                     return;
                 } else {
                     /** @var ExceptionHandle $handle */
                     $handle = DI::get($value);
                     if (isset($handle)) {
                         $handle->handle();
                         return;
                     }
                 }
             }
         }
     }
     throw $ex;
 }
예제 #2
0
 public function appStart()
 {
     Command::bind('model', ModelCommand::class);
     Command::bind('migrate', MigrateCommand::class);
     Command::bind('migration', MigrationCommand::class);
     Command::bind('daemon', DaemonCommand::class);
     Command::bind('service', ServiceCommand::class);
     Daemon::bind('idle', IdleDaemon::class);
     Daemon::bind('schedule', ScheduleDaemon::class);
     Settings::load('commands');
     Settings::load('daemons');
     DI::bindSingleton(AuthStorage::class, CacheAuthStorage::class);
 }
예제 #3
0
 public function appStart()
 {
     $this->classLoader = new ClassLoader();
     $paths = Settings::load('autoload');
     if (!isset($paths)) {
         $paths = array();
     }
     $paths[] = '/service';
     $paths[] = '/job';
     $paths[] = '/command';
     $paths[] = '/daemon';
     $paths[] = '/module';
     $paths[] = '/models';
     $paths[] = '/test';
     $paths[] = '/database/migration';
     foreach ($paths as $item) {
         $this->classLoader->addPath(App::path('app') . $item);
     }
 }
예제 #4
0
 public function appStart()
 {
     Settings::load('inject');
 }
예제 #5
0
 public function appStart()
 {
     Settings::load('module');
 }