public function export(RouteCollection $routes)
    {
        // Create the output directory.
        if (!is_dir($this->outputDir)) {
            mkdir($this->outputDir, 0777, true);
        }

        // Check if it is writable.
        if (!is_writable($this->outputDir)) {
            throw new \InvalidArgumentException(sprintf('The output directory "%s" is not writable.', $this->outputDir));
        }

        $this->exportRoutes($routes);
    }