private function getContentType(EzLocation $location): ContentType
    {
        if (method_exists($location, 'getContent') && method_exists($location->getContent(), 'getContentType')) {
            return $location->getContent()->getContentType();
        }

        // @deprecated Remove when support for eZ kernel < 7.4 ends

        return $this->repository->getContentTypeService()->loadContentType(
            $location->contentInfo->contentTypeId
        );
    }