Exemplo n.º 1
0
 /**
  * @param string $serviceid
  * @param \Silex\Controller $controller
  * @param \Silex\Application $app
  * @param \ReflectionClass $class
  * @param \ReflectionMethod $method
  * @return mixed|void
  */
 public function modify($serviceid, Controller $controller, Application $app, \ReflectionClass $class, \ReflectionMethod $method)
 {
     $callback = $this->callback;
     if (!is_callable($callback)) {
         if ($class->hasMethod($callback)) {
             $callback = [$app[$serviceid], $callback];
         }
     }
     $controller->after($callback);
 }
 private function configureController(Controller $controller, $route_name = null, $before = null, $after = null)
 {
     if ($route_name) {
         $controller->bind($route_name);
     }
     if ($before) {
         $controller->before($this->callback_prefix . ":" . $before);
     }
     if ($after) {
         $controller->after($this->callback_prefix . ":" . $after);
     }
 }