private function getPublicRequireDefinition(ContainerBuilder $container, $id, $type)
    {
        $serviceDefinition = $container->getDefinition($id);

        if (!$serviceDefinition->isPublic()) {
            throw new InvalidArgumentException(sprintf('The service "%s" must be public as block %s are lazy-loaded.', $id, $type));
        }

        return $serviceDefinition;
    }