public function addRoutes(array $routes, $globalMiddlewares = array())
    {
        if (!is_array($globalMiddlewares)) {
            if (func_num_args() > 2) {
                $args = func_get_args();
                $globalMiddlewares = array_slice($args, 1);
            } else {
                $globalMiddlewares = array($globalMiddlewares);
            }
        }

        foreach ($routes as $path => $routeArgs) {
            // create array for simple request
            $routeArgs = (is_array($routeArgs)) ? $routeArgs : array('any' => $routeArgs);

            if (array_keys($routeArgs) === range(0, count($routeArgs) - 1)) {
                // route args is a sequential array not associative
                $routeArgs = array('any' => array($routeArgs[0],
                    isset($routeArgs[1]) && is_array($routeArgs[1]) ? $routeArgs[1] : array_slice($routeArgs, 1))
                );
            }

            foreach ($routeArgs as $httpMethod => $classArgs) {
                // assign vars if middleware callback exists
                if (is_array($classArgs)) {
                    $classRoute       = $classArgs[0];
                    $localMiddlewares = is_array($classArgs[1]) ? $classArgs[1] : array_slice($classArgs, 1);
                } else {
                    $classRoute       = $classArgs;
                    $localMiddlewares = array();
                }

                // specific HTTP method
                $httpMethod = strtoupper($httpMethod);
                if (!in_array($httpMethod, static::$ALLOWED_HTTP_METHODS)) {
                    throw new \InvalidArgumentException("Http method '$httpMethod' is not supported.");
                }

                $routeMiddlewares = array_merge($localMiddlewares, $globalMiddlewares);
                $route = $this->addControllerRoute($path, $classRoute, $routeMiddlewares);

                if (!isset($this->routeNames[$classRoute])) {
                    $route->name($classRoute);
                    $this->routeNames[$classRoute] = 1;
                }

                if ('any' === $httpMethod) {
                    call_user_func_array(array($route, 'via'), static::$ALLOWED_HTTP_METHODS);
                } else {
                    $route->via($httpMethod);
                }
            }
        }

        return $this;
    }