Aerys\Router::use PHP Method

use() public method

Router imports do *not* import the options
public use ( callable | aerys\Middleware | aerys\Bootable | aerys\Monitor $action ) : self
$action callable | aerys\Middleware | aerys\Bootable | aerys\Monitor
return self
    public function use($action)
    {
        if (!(is_callable($action) || $action instanceof Middleware || $action instanceof Bootable || $action instanceof Monitor)) {
            throw new \InvalidArgumentException(__METHOD__ . " requires a callable action or Middleware instance");
        }
        if ($action instanceof self) {
            /* merge routes in for better performance */
            foreach ($action->routes as $route) {
                $route[2] = array_merge($this->actions, $route[2]);
                $this->routes[] = $route;
            }
        } else {
            $this->actions[] = $action;
            foreach ($this->routes as &$route) {
                $route[2][] = $action;
            }
        }
        return $this;
    }