public function addBefore($before, $name, SymfonyRoute $route)
    {
        $newRoute = $route;
        foreach ($this->all() as $routeName => $route) {
            if (null !== $newRoute && $before === $routeName) {
                $this->add($name, $newRoute);
                $newRoute = null;
            }

            if (null === $newRoute) {
                // move the existing route onto the end of collection
                $this->add($routeName, $route);
            }
        }

        if (null !== $newRoute) {
            throw new \InvalidArgumentException(sprintf('The route "%s" cannot be added before "%s", because the route "%2$s" was not found.', $name, $before));
        }
    }