Autarky\Routing\Route::addHook PHP Method

addHook() public method

Add a before or after hook.
public addHook ( string $when, string $hook )
$when string "before" or "after"
$hook string
    public function addHook($when, $hook)
    {
        $this->{'add' . ucfirst($when) . 'Hook'}($hook);
    }

Usage Example

Example #1
0
 protected function createRoute($methods, $path, $controller, $name, array $options)
 {
     $route = new Route($methods, $path, $controller, $name, $options);
     foreach ($this->currentHooks as $hook) {
         $route->addHook($hook[0], $hook[1]);
     }
     return $route;
 }