public function generateExtension($namespace, $dir, $themeName, array $templates)
    {
        $themeBasename = str_replace('Bundle', '', $themeName);
        $extensionAlias = Container::underscore($themeBasename);

        $templateFiles = array_map(function ($template) { return basename($template["name"], '.html.twig'); }, $templates);

        $parameters = array(
            'namespace' => $namespace,
            'bundle_basename' => $themeBasename,
            'theme_files' => array($extensionAlias),
            'template_files' => $templateFiles,
            "extension_alias" => $extensionAlias,
        );

        $this->setSkeletonDirs($this->themeSkeletonDir);
        $extensionFile = str_replace('Bundle', '', $themeBasename) . 'Extension.php';
        $this->renderFile('Extension.php', $dir . '/' . $extensionFile, $parameters);
        $message = sprintf('The extension file <info>%s</info> has been generated into <info>%s</info>', $extensionFile, $dir);

        return $message;
    }