private function getNettePresenterFactory(): Nette\DI\Definitions\ServiceDefinition
    {
        $applicationExtension = $this->compiler->getExtensions(Nette\Bridges\ApplicationDI\ApplicationExtension::class);
        if ($applicationExtension === []) {
            throw new \LogicException('ApplicationExtension not found, did you register it in your configuration?');
        }

        $container = $this->getContainerBuilder();
        $presenterFactory = reset($applicationExtension)->prefix('presenterFactory');
        if (!$container->hasDefinition($presenterFactory)) {
            throw new \LogicException('PresenterFactory service from ApplicationExtension not found. Make sure ApplicationExtension is loaded before PresenterMappingExtension.');
        }

        /** @var Nette\DI\Definitions\ServiceDefinition $serviceDefinition */
        $serviceDefinition = $container->getDefinition($presenterFactory);

        return $serviceDefinition;
    }