Retrieves the rootPageIds as an array from a set of sites.

@param array $sites
@return array
970958
public static function getRootPageIdsFromSites(array $sites): array
    {
        $rootPageIds = [];
        foreach ($sites as $site) {
            $rootPageIds[] = (int)$site->getRootPageId();
        }

        return $rootPageIds;
    }
1310104
protected function getPages()
    {
        $pages = $this->site->getPages();
        $additionalPageIds = [];
        if (!empty($this->indexingConfiguration['additionalPageIds'])) {
            $additionalPageIds = GeneralUtility::intExplode(',', $this->indexingConfiguration['additionalPageIds']);
        }

        $pages = array_merge($pages, $additionalPageIds);
        sort($pages, SORT_NUMERIC);

        return $pages;
    }
776580
protected function getPreferredSite(array $sites, Request $request)
    {
        if (0 === \count($sites)) {
            return;
        }

        $sitesLocales = array_map(static function (SiteInterface $site) {
            return $site->getLocale();
        }, $sites);

        $language = $request->getPreferredLanguage($sitesLocales);
        $host = $request->getHost();

        foreach ($sites as $site) {
            if (\in_array($site->getHost(), ['localhost', $host], true) && $language === $site->getLocale()) {
                return $site;
            }
        }

        return reset($sites);
    }
620080
public function getRouteRules($siteId = null, $includeGlobal = true): array
    {
        $globalRules = $includeGlobal === true ? $this->getDbRoutes('global') : [];

        $siteRoutes = $this->getDbRoutes($siteId);

        $rules = array_merge(
            Craft::$app->getRoutes()->getConfigFileRoutes(),
            $globalRules,
            $siteRoutes
        );

        return $rules;
    }
303850
public static function getOrderedPages($pageIds)
    {
        $pages = [];
        foreach ($pageIds as $pageId) {
            $pages[$pageId] = static::preload($pageId);
        }
        uasort($pages, ['self', '_orderAsc']);
        return $pages;
    }
279286
public function select(array $connections): array
    {
        $allNum = count($connections);

        if ($this->pointer >= $allNum || $allNum === 1) {
            $this->pointer = 0;
        }

        return $connections[$this->pointer];
    }
1071518
protected function getSiteForRootPageId(int $pageId): array
    {
        return is_array($this->sites[$pageId]) ? $this->sites[$pageId] : [];
    }
1047276
public function getPages(Website $website, $pageIds, $isAdmin, $isAPI)
    {
        if (!is_array($pageIds)) {
            $pageIds = [$pageIds];
        }
        $pages = $this->pageRepository->findPages($website, $pageIds, $isAdmin, $isAPI);

        return $pages;
    }
432035
protected function getPageResources(Page $page, Site $site)
    {
        $primaryDomainName = $site->getDomain()->getDomainName();
        $siteId = $site->getSiteId();
        $pageName = $page->getName();
        $pageType = $page->getPageType();

        $pagesResourceId = $this->resourceName->get(self::RESOURCE_SITES, $siteId, self::RESOURCE_PAGES);
        $pageResourceId = $this->resourceName->get(
            self::RESOURCE_SITES,
            $siteId,
            self::RESOURCE_PAGES,
            $pageType,
            $pageName
        );

        $return[$pageResourceId] = [
            'resourceId' => $pageResourceId,
            'parentResourceId' => $pagesResourceId,
            'name' => $primaryDomainName . ' - pages - ' . $pageName,
            'description' => "Resource for page '{$pageName}'" . " of type '{$pageType}' on site '{$primaryDomainName}'"
        ];

        $return[$pageResourceId] = array_merge(
            $this->resources[self::RESOURCE_PAGES],
            $return[$pageResourceId]
        );

        return $return;
    }
150357
private function getLocationChoices(array $locations): array
    {
        $locationIds = array_column($locations, 'id');

        return array_combine($locationIds, array_fill_keys($locationIds, false));
    }
1331089
private function findRootPages(): array
    {
        $result = [
            'source' => null,
            'target' => null,
            'main'   => null,
        ];

        $this->logger->debug(
            'Searching root pages for source "{source}" and target "{target}"',
            ['source' => $this->sourceLanguage, 'target' => $this->targetLanguage]
        );
        foreach ($this->database->getRootPages() as $root) {
            $language = $root['language'];

            if ('1' === $root['fallback']) {
                $this->mainLanguage = $language;
                $result['main']     = (int) $root['id'];
            }

            if ($language === $this->sourceLanguage) {
                $result['source'] = (int) $root['id'];
            }
            if ($language === $this->targetLanguage) {
                $result['target'] = (int) $root['id'];
            }

            // Keep type for being able to filter unknown pages in i.e. articles.
            $this->types[(int) $root['id']] = 'root';
        }

        $this->logger->debug(
            'Found root pages: source: {source}; target: {target}; main: {main}',
            $result
        );

        if (null === $result['source'] || null === $result['target'] || null === $result['main']) {
            throw new \RuntimeException('Not all root pages could be found: ' . var_export($result, true));
        }

        return $result;
    }
431970
protected function getRolesFromSite($site)
	{
		$newDataSet = new AnyDataset();
		$it = $this->user->getRolesIterator($site);
		while ($it->hasNext()) {
			$sr = $it->moveNext();
			$dataArray = $sr->getFieldArray($this->user->getRolesTable()->Role);
			if (sizeof($dataArray) > 0) {
				foreach ($dataArray as $roles) {
					$siteName = $sr->getField($this->user->getRolesTable()->Site);
					if ($siteName == "_all") {
						$siteName = $this->myWords->Value("TEXT_ALLSITES");
					}
					$newDataSet->appendRow();
					$newDataSet->addField($this->user->getRolesTable()->Site, $siteName);
					$newDataSet->addField($this->user->getRolesTable()->Role, $roles);
				}	
			}
		}
		return $newDataSet;
	}
611531
public function getSettingList(Site $site)
    {
        $settingList = [];
        $items       = $this->getSettingBySiteId($site->getId());
        /** @var $setting \PageBuilder\Entity\Setting */
        foreach ($items as $setting) {
            $code               = $setting->getSettingKey()->getCode();
            $value              = $setting->getSettingValue() ?: $setting->getSettingKey()->getDefaultValue();
            $settingList[$code] = $value;
        }

        $locale                = $site->getLocale() ?: 'en_GB';
        $settingList           = array_merge($settingList, \Locale::parseLocale($locale));
        $settingList['locale'] = $locale;

        return $settingList;
    }
1225909
public static function getRootPageSettingList()
    {
        static $cache = null;

        if ($cache === null) {
            $query = 'SELECT seosr.*
                        FROM tx_metaseo_setting_root seosr
                             INNER JOIN pages p
                                 ON p.uid = seosr.pid
                                AND p.is_siteroot = 1
                                AND p.deleted = 0
                       WHERE seosr.deleted = 0';
            $cache = DatabaseUtility::getAllWithIndex($query, 'pid');
        }

        return $cache;
    }
803227
public function getAllSites()
    {
        Piwik::checkUserHasSuperUserAccess();

        $sites  = $this->getModel()->getAllSites();
        $return = array();
        foreach ($sites as $site) {
            $this->enrichSite($site);
            $return[$site['idsite']] = $site;
        }

        $return = Site::setSitesFromArray($return);

        return $return;
    }
595837
public function many( array $ids = [] ) {
        if( count( $ids ) === 0 ) {
            return [];
        }

        $pages = array_chunk( $ids, $this->maxPageSize() );

        $requests = [];
        foreach( $pages as $page ) {
            $requests[] = [ 'ids' => implode( ',', $page ) ];
        }

        $responses = $this->requestMany( $requests );

        $result = [];
        foreach( $responses as $response ) {
            $result = array_merge( $result, $response->json() );
        }

        return $result;
    }
1057180
private function getSessionIdsByStore($events)
    {
        $sessionIdsByStore = [];

        foreach ($events as $event) {
            if (isset($event['page']['store_id']) && isset($event['session']['uid'])) {
                $sessionIdsByStore[$event['page']['store_id']][] = $event['session']['uid'] ?? 0;
            }
        }

        return $sessionIdsByStore;
    }