Returns list of analytics filterd by webspace key and environment.

@param string $webspaceKey

@return Analytics[]
778059
public function findByWebspaceKey($webspaceKey)
    {
        $queryBuilder = $this->createQueryBuilder('a')
            ->addSelect('domains')
            ->leftJoin('a.domains', 'domains')
            ->where('a.webspaceKey = :webspaceKey')
            ->andWhere('a.allDomains = TRUE OR domains.environment = :environment')
            ->orderBy('a.id', 'ASC');

        $query = $queryBuilder->getQuery();
        $query->setParameter('webspaceKey', $webspaceKey);
        $query->setParameter('environment', $this->environment);

        return $query->getResult();
    }
292816
public function availableIncludeKeys(): array
    {
        $availableKeys = [];
        if (($transformer = $this->transformer()) !== null && ($transformer instanceof  TransformerInterface)) {
            $availableKeys = $transformer->getAvailableIncludes();
        }

        return $availableKeys;
    }
1028244
public function getFiles( $fieldKey )
	{
		$allFiles = $this->getAllFiles();

		if ( isset($allFiles[ $fieldKey ]) )
		{
			return $allFiles[ $fieldKey ];
		}
		else
		{
			return [ ];
		}
	}
139684
protected function namespaceAndKey($key)
    {
        if ($this->hasNamespace($key)) {
            return explode($this->nsSeparator, $key, 2);
        }
        return ['default', $key];
    }
29039
protected function displaySavedFilters($registryKey) {
		
		if ($this->jsonStorage->getLength($this->registry)) {
			$registry = $this->jsonStorage->getRegistry($this->registry);
			echo '<div class="row">';
			echo '<div class="col-md-6 col-sm-12" >';
			echo '<label class="label label-info">Saved Filters [select and click ok sign button]</label><br/>';
			echo '</div></div>';
			echo '<div class="row" style="margin-top: 5px;">';
			echo '<div class="col-md-6 col-sm-12" >';
			echo '<select class="select-extended-filter">';
			echo '<option value="-1" data-filter="{}" ' . (!$registryKey ? 'selected' : '') . '>No Filters</option>';
			foreach ($registry as $key => $filter) {
				echo CHtml::openTag(
					'option',
					array(
						'data-filter' => CJSON::encode($filter['options']),
						'data-key' => $key,
						'selected' => ($key == $registryKey ? 'selected' : null)
					)
				);
				echo $filter['name'];
				echo '</option>';
			}
			echo '</select>&nbsp;';

			echo CHtml::link(
				'<i class="glyphicon glyphicon-ok glyphicon glyphicon-white"></i>',
				'#',
				array('class' => 'btn btn-primary btn-extended-filter-apply')
			);
			echo '&nbsp;';
			echo CHtml::link('<i class="glyphicon glyphicon-trash"></i>', '#', array('class' => 'btn btn-warning btn-extended-filter-delete'));
			echo '</div></div>';
		}
	}
1290129
private function getLocalesByPortalKey($portalKey)
    {
        $portal = $this->webspaceManager->findPortalByKey($portalKey);

        return array_map(
            function(Localization $localization) {
                return $localization->getLocale();
            },
            $portal->getLocalizations()
        );
    }
88978
public function filterNamespace( $namespaceName) {
        $FilteredClasses = [];
        foreach( $this->loadedClasses as $loadedClass){
            if( 0 == substr_compare( $loadedClass, $namespaceName, 0, strlen( $namespaceName))){
                $FilteredClasses[] = $loadedClass;
            }
        }
        $this->loadedClasses = $FilteredClasses;
    }
633425
public function fetchAll(
        string $cacheKey = '',
        $ttl = 0,
        CacheInterface $cache = null
    ): array {
        return iterator_to_array($this->getIterator($cacheKey, $ttl, $cache));
    }
981126
private function getSearchResult(array $filters, $limit, $page, $pageSize, $locale, $webspaceKey)
    {
        $repository = $this->searchManager->getRepository($this->articleDocumentClass);
        $search = $this->createSearch($repository->createSearch(), $filters, $locale);
        if (!$search) {
            return new \ArrayIterator([]);
        }

        $this->addPagination($search, $pageSize, $page, $limit);

        if (array_key_exists('sortBy', $filters) && is_array($filters['sortBy'])) {
            $sortMethod = array_key_exists('sortMethod', $filters) ? $filters['sortMethod'] : 'asc';
            $this->appendSortBy($filters['sortBy'], $sortMethod, $search);
        }

        if ($webspaceKey) {
            $webspaceQuery = new BoolQuery();

            // check for mainWebspace
            $webspaceQuery->add(new TermQuery('main_webspace', $webspaceKey), BoolQuery::SHOULD);

            // check for additionalWebspaces
            $webspaceQuery->add(new TermQuery('additional_webspaces', $webspaceKey), BoolQuery::SHOULD);

            $search->addQuery($webspaceQuery);
        }

        return $repository->findDocuments($search);
    }
1015895
public function filterKeys(array $filteredKeys = [])
    {
        $this->items = array_filter($this->items, function ($key) use ($filteredKeys) {
            return ! isset($filteredKeys[$key]);
        }, ARRAY_FILTER_USE_KEY);
    }
109096
protected function getAvailableExportStrategyKeys()
    {
        if (empty($this->getModelInformation()->export->strategies)) {
            return [];
        }

        $keys = array_keys($this->getModelInformation()->export->strategies);

        return array_filter($keys, [ $this, 'isExportStrategyAvailable']);
    }
1232232
private static function getFilteredQueryString(UriInterface $uri, array $keys)
    {
        $current = $uri->getQuery();

        if ($current === '') {
            return [];
        }

        $decodedKeys = array_map('rawurldecode', $keys);

        return array_filter(explode('&', $current), function ($part) use ($decodedKeys) {
            return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true);
        });
    }
374610
public function getQueryMapping($schemaKey = 'default')
    {
        /** @noinspection PhpUndefinedFieldInspection */
        /** @noinspection StaticInvocationViaThisInspection */
        $mappingWithKey = $this->getSchemaMapping();
        if (!isset($mappingWithKey[$schemaKey])) {
            return [];
        }

        $mapping = $mappingWithKey[$schemaKey];
        $result = json_decode($mapping, true);
        if (!is_array($result)) {
            return [];
        }

        return $result;
    }
69829
protected function buildWhere($webspaceKey, $locale)
    {
        $where = [];
        if (null !== $this->context) {
            $where[] = sprintf("page.[i18n:%s-navContexts] = '%s'", $locale, $this->context);
        }
        if (null !== $this->parent) {
            $where[] = sprintf("ISDESCENDANTNODE(page, '%s')", $this->parent);
        } else {
            $where[] = sprintf("ISDESCENDANTNODE(page, '%s')", '/cmf/' . $webspaceKey . '/contents');
        }

        return implode(' AND ', $where);
    }
135791
protected function getAliasesByExtendsNamespace()
    {
        $aliases = $this->getValidAliases();

        $aliases = $aliases->filter(function (Alias $item) {
            return ! collect([
                'MessageStack',
                'AdminSection',
                'AdminTemplate',
                'AdminNavigation',
                'AdminColumn',
                'AdminColumnEditable',
                'AdminColumnFilter',
                'AdminDisplayFilter',
                'AdminForm',
                'AdminFormElement',
                'AdminDisplay',
            ])->search($item->getAlias());
        });

        return $aliases->groupBy(function (Alias $alias) {
            return $alias->getExtendsNamespace();
        });
    }
1029674
public function getFilters(): array
    {
        return [
            new TwigFilter('substr', 'substr'),
            new TwigFilter('tokenize', 'Cake\Utility\Text::tokenize'),
            new TwigFilter('insert', 'Cake\Utility\Text::insert'),
            new TwigFilter('cleanInsert', 'Cake\Utility\Text::cleanInsert'),
            new TwigFilter('wrap', 'Cake\Utility\Text::wrap'),
            new TwigFilter('wrapBlock', 'Cake\Utility\Text::wrapBlock'),
            new TwigFilter('wordWrap', 'Cake\Utility\Text::wordWrap'),
            new TwigFilter('highlight', 'Cake\Utility\Text::highlight'),
            new TwigFilter('tail', 'Cake\Utility\Text::tail'),
            new TwigFilter('truncate', 'Cake\Utility\Text::truncate'),
            new TwigFilter('excerpt', 'Cake\Utility\Text::excerpt'),
            new TwigFilter('toList', 'Cake\Utility\Text::toList'),
            new TwigFilter('isMultibyte', 'Cake\Utility\Text::isMultibyte'),
            new TwigFilter('utf8', 'Cake\Utility\Text::utf8'),
            new TwigFilter('ascii', 'Cake\Utility\Text::ascii'),
            new TwigFilter('parseFileSize', 'Cake\Utility\Text::parseFileSize'),
            new TwigFilter('none', function ($string) {
                return;
            }),
        ];
    }
1041503
private function _getSecondaryKeys($data, $key = null)
    {
        if ($key) {
            $data = ArrayHelper::getValue($data, $key, []);
        }

        return ArrayHelper::getColumn($data, $this->relSecondaryKey);
    }