private function addManagedExtension(PackageDescriptor $descriptor)
    {
        $className = $descriptor->getClass();
        if ($this->isClassLoadable($className) === false) {
            $this->flashLogger->error(Trans::__(
                'page.extend.error-class-invalid',
                ['%NAME%' => $descriptor->getName(), '%CLASS%' => $className]
            ));

            return;
        }

        /** @var ExtensionInterface $extension */
        $extension = new $className();
        if ($extension instanceof ExtensionInterface) {
            $baseDir = $this->extFs->getDir($descriptor->getPath());
            $webDir = $this->webFs->getDir($descriptor->getWebPath());
            $this->add($extension, $baseDir, $webDir, $descriptor->getName())
                ->setDescriptor($descriptor)
            ;
        } else {
            $this->flashLogger->error(Trans::__(
                'page.extend.error-class-implement',
                ['%NAME%' => $descriptor->getName(), '%CLASS%' => $className, '%TARGET%' => ExtensionInterface::class]
            ));
        }
    }