public function addRoute($method, $uri, $action)
{
$action = $this->parseAction($action);
if (isset($this->groupAttributes)) {
if (isset($this->groupAttributes['prefix'])) {
$uri = trim($this->groupAttributes['prefix'], '/') . '/' . trim($uri, '/');
}
if (isset($this->groupAttributes['suffix'])) {
$uri = trim($uri, '/') . rtrim($this->groupAttributes['suffix'], '/');
}
$action = $this->mergeGroupAttributes($action);
}
$uri = '/' . trim($uri, '/');
if (isset($action['as'])) {
$this->namedRoutes[$action['as']] = $uri;
}
if (is_array($method)) {
foreach ($method as $verb) {
$this->routes[$verb . $uri] = ['method' => $verb, 'uri' => $uri, 'action' => $action];
}
} else {
$this->routes[$method . $uri] = ['method' => $method, 'uri' => $uri, 'action' => $action];
}
}