コード例 #1
0
 /**
  * Handle request in stack
  * 
  * @param   object  $request  Request
  * @return  mixed
  */
 public function handle(Request $request)
 {
     $response = $this->next($request);
     $class = $this->app->get('arguments')->get('class');
     $task = $this->app->get('arguments')->get('task');
     $command = new $class($this->app->get('output'), $this->app->get('arguments'));
     $shortName = strtolower(with(new \ReflectionClass($command))->getShortName());
     // Fire default before event
     Event::fire($shortName . '.' . 'before' . ucfirst($task));
     $command->{$task}();
     // Fire default after event
     Event::fire($shortName . '.' . 'after' . ucfirst($task));
     $this->app->get('output')->render();
     return $response;
 }
コード例 #2
0
 /**
  * Dispatch the application
  *
  * @param  string $component the component to dispatch (does not apply here)
  * @return void
  */
 public function dispatch($component = null)
 {
     $class = App::get('arguments')->get('class');
     $task = App::get('arguments')->get('task');
     $command = new $class(App::get('output'), App::get('arguments'));
     $shortName = strtolower(with(new \ReflectionClass($command))->getShortName());
     // Fire default before event
     Event::fire($shortName . '.' . 'before' . ucfirst($task));
     $command->{$task}();
     // Fire default after event
     Event::fire($shortName . '.' . 'after' . ucfirst($task));
 }