protected function buildSite($rootPageId)
    {
        $rootPageRecord = (array)BackendUtility::getRecord('pages', $rootPageId);

        $this->validateRootPageRecord($rootPageId, $rootPageRecord);
        $solrConfiguration = Util::getSolrConfigurationFromPageId($rootPageId);
        $domain = $this->getDomainFromConfigurationOrFallbackToDomainRecord($rootPageId);
        $siteHash = $this->getSiteHashForDomain($domain);
        $defaultLanguage = $this->getDefaultLanguage($rootPageId);
        $pageRepository = GeneralUtility::makeInstance(PagesRepository::class);

        return GeneralUtility::makeInstance(
            Site::class,
            /** @scrutinizer ignore-type */ $solrConfiguration,
            /** @scrutinizer ignore-type */ $rootPageRecord,
            /** @scrutinizer ignore-type */ $domain,
            /** @scrutinizer ignore-type */ $siteHash,
            /** @scrutinizer ignore-type */ $pageRepository,
            /** @scrutinizer ignore-type */ $defaultLanguage
        );
    }