public function extension($extension)
    {
        if (is_string($extension)) {
            $extension = new $extension;
        } elseif (!$extension instanceof AbstractExtension) {
            throw new \LogicException('Not an extension object or an extension class name.');
        }

        $this->addExtension($extension);
    }