public function addExtension(AbstractExtension $extension)
    {
        if (!$extension->isAvailable()) {
            throw new ExtensionException('Extension ' . get_class($extension) . ' is not available', $extension);
        }

        $this->extensions[] = $extension->bind($this);
    }