function register($engine, $extension)
    {
        if (!class_exists($engine)) {
            throw new \InvalidArgumentException("Class $engine is not defined");
        }

        if (!class_implements($engine, "\\MetaTemplate\\Template\\TemplateInterface")) {
            throw new \InvalidArgumentException(
                "An engine must implement \\MetaTemplate\\Template\\TemplateInterface."
            );
        }

        $extensions = (array) $extension;

        foreach ($extensions as $extension) {
            $extension = Template::normalizeExtension($extension);
            $this->engines[$extension] = $engine;
        }

        return $this;
    }