Extract the PHP symbols from the given files.

@param FileIteratorInterface $files
@param SymbolFilterInterface $filter

@return SymbolIteratorInterface
331539
public function extract(
        FileIteratorInterface $files,
        SymbolFilterInterface $filter
    ): SymbolIteratorInterface {
        $symbols = [];

        foreach ($files as $file) {
            $parser = clone $this->parser;

            try {
                $size     = $file->getSize();
                $handle   = $file->openFile('rb');
                $contents = $size  > 0 ? $handle->fread($size) : '';

                if (empty($contents)) {
                    continue;
                }

                $statements = $parser->parse($contents);
            } catch (Error $e) {
                // Either not a file, file is not readable, not a PHP file or
                // the broken file should be detected by other tooling entirely.
                continue;
            }

            $tracker   = new SymbolTracker($filter);
            $traverser = new NodeTraverser();
            $traverser->addVisitor($tracker);
            $traverser->traverse($statements);

            foreach ($tracker->getSymbols() as $node) {
                $symbols[] = new Symbol($file, $node);
            }
        }

        return new SymbolIterator(...$symbols);
    }
1100359
public function filter($path, $filter, array $runtimeConfig = array())
    {
        if ($path instanceof ImageInterface) {
            $path = $path->getPath();
        }

        if (empty($path)) {
            return $this->imageHolderPath.'/'.$this->getFilterDimension($filter);
        }

        return new \Twig_Markup(
            $this->cacheManager->getBrowserPath($path, $filter, $runtimeConfig),
            'utf8'
        );
    }
367995
public function applyFilterText(Filter\FilterText $filter)
	{
		$exprs = [];

		foreach ($filter->getCondition() as $column => $value) {
			if ($filter->isExactSearch()) {
				$exprs[] = Criteria::expr()->eq($column, $value);
				continue;
			}

			if ($filter->hasSplitWordsSearch() === false) {
				$words = [$value];
			} else {
				$words = explode(' ', $value);
			}

			foreach ($words as $word) {
				$exprs[] = Criteria::expr()->contains($column, $word);
			}
		}

		$expr = call_user_func_array([Criteria::expr(), 'orX'], $exprs);
		$this->criteria->andWhere($expr);
	}
1158404
public function getUrlOfFilteredImageWithRuntimeFilters($path, $filter, array $runtimeFilters = [], $resolver = null)
    {
        $runtimePath = $this->cacheManager->getRuntimePath($path, $runtimeFilters);
        if ($this->cacheManager->isStored($runtimePath, $filter, $resolver)) {
            return $this->cacheManager->resolve($runtimePath, $filter, $resolver);
        }

        $filteredBinary = $this->createFilteredBinary(
            $path,
            $filter,
            $runtimeFilters
        );

        $this->cacheManager->store(
            $filteredBinary,
            $runtimePath,
            $filter,
            $resolver
        );

        return $this->cacheManager->resolve($runtimePath, $filter, $resolver);
    }
136534
private function filterPrefixer(array &$filter)
    {
        foreach ($filter as &$child) {
            if (\array_key_exists('property', $child)
                && (false === \strpos($child['property'], $this->source . '.'))
                && $this->fieldExists($child['property'])
            ) {
                $child['property'] = $this->source . '.' . $child['property'];
            }

            if (\array_key_exists('children', $child)) {
                $this->filterPrefixer($child['children']);
            }
        }
    }
143189
protected function getFilterResolver(string $filter): array
    {
        $class = $filter;
        $method = 'filter';

        $position = \strpos($filter, '@');

        if ($position === 0) {
            $method = 'filter'.\ucwords(\substr($filter, 1));

            return [$this, $method];
        }

        if ($position !== false) {
            list($class, $method) = \explode('@', $filter, 2);
        }

        return $this->makeFilterResolver($class, $method);
    }
1112366
protected function filterSources(array $sources, FilterInterface $filter)
    {
        $filteredSources = [];

        // if the filter supports no extension, there is an error
        if (!is_array($filter->getSupportedExtensions()) || !count($filter->getSupportedExtensions())) {
            throw new Exception('No supported extensions found for the filter '.$filter->getName());
        }

        foreach ($sources as $source) {
            $isExtensionSupported = in_array($source->getExtension(), $filter->getSupportedExtensions());
            $supportAllExtensions = in_array('*', $filter->getSupportedExtensions());

            if ($isExtensionSupported || $supportAllExtensions) {
                $filteredSources[] = $this
                    ->locator
                    ->getNormalizer()
                    ->normalize($source);
            }
        }

        return $filteredSources;
    }
881504
public function listResources($filter)
    {
        $collection = $this->getThisCollection();

        $queryBuilder = $this->filterQueryBuilder($filter, $collection);

        $countQueryBuilder = clone $queryBuilder;
        $countQueryBuilder->orders = null;
        $totalNumberOfRows = $countQueryBuilder->count();

        // Paginate resources
        $this->paginateQueryBuilder($queryBuilder, $filter);

        $returnedResources = $this->loadResourcesFromQueryBuilder($queryBuilder, $this->getThisCollection());

        return ForestResource::formatResourcesJsonApi($returnedResources, $totalNumberOfRows);
    }
798276
private function doFilter(TokenFilterInterface $filter, array $tokens): array
    {
        $result = [];
        foreach ($tokens as $token) {
            $result = array_merge($result, $filter->filter($token));
        }

        return $result;
    }
594513
public function create(Composer $composer): SymbolFilterInterface
    {
        /** @var SymbolFilterInterface[] $filters */
        $filters = array_map(
            function (string $exclusion) : SymbolFilterInterface {
                $filters = [
                    new ExactSymbolFilter($exclusion),
                    new PatternSymbolFilter($exclusion)
                ];

                if (preg_match('#\\\\$#', $exclusion)) {
                    $filters[] = new NamespaceSymbolFilter($exclusion);
                }

                return new SymbolFilterChain(...$filters);
            },
            $this->getExclusions($composer)
        );

        $filters[] = new UserDefinedSymbolFilter();

        return new SymbolFilterChain(...$filters);
    }
356862
public function getTranslations(
        array $domains = [],
        array $languages = [],
        callable $filter = null
    ) : array {
        return $this
            ->repositoryCollection
            ->getTranslations(
                $domains,
                $languages,
                $filter
            );
    }
644005
protected function convertToFilterFormat($filter)
    {
        $filter = trim($filter);
        if (substr($filter, 0, 1) != '(') {
            $filter = '(' . $filter;
        }
        if (substr($filter, -1) != ')') {
            $filter = $filter . ')';
        }
        return $filter;
    }
397915
protected function filterFilename($name)
    {
        // Fix illegal characters
        $filter = FileNameFilter::create();
        $parts = array_filter(preg_split("#[/\\\\]+#", $name));
        return implode('/', array_map(function ($part) use ($filter) {
            return $filter->filter($part);
        }, $parts));
    }
973452
public function getChildrenRecursively (ContextSpecificationInterface $filter = null)
	{
		$list = $this->getChildren($filter);

		foreach ($this->getChildren() as $child)
		{
			if ($child->hasChildren())
			{
				$list = array_merge ($list, $child->getChildrenRecursively($filter));
			}
		}

		return $list;
	}
346059
public static function filterByString($filter)
    {
        $operator = Arr::get($filter, 'operator');
        $method = Arr::get($filter, 'method');
        $arguments = Arr::get($filter, 'arguments');
        $value_one = Arr::get($filter, 'value_one');
        $value_two = Arr::get($filter, 'value_two');
        $settings = Arr::get($filter, 'settings');
        $positive = Arr::get($filter, 'positive');

        switch ($operator) {
            case '=':
            case '!=':
                $arguments = [$operator, $value_one];
                break;
            case '*=*':
            case '*!=*':
                $operator = (stripos($operator, '!') !== false) ? 'not ' : '';
                $operator .= 'like';
                $arguments = [$operator, '%'.$value_one.'%'];
                break;
            case '*=':
            case '*!=':
                $operator = (stripos($operator, '!') !== false) ? 'not ' : '';
                $operator .= 'like';
                $arguments = [$operator, '%'.$value_one];
                break;
            case '=*':
            case '!=*':
                $operator = (stripos($operator, '!') !== false) ? 'not ' : '';
                $operator .= 'like';
                $arguments = [$operator, $value_one.'%'];
                break;
            case 'EMPTY':
                $method = 'whereRaw';
                $arguments = "%s = ''";
                break;
            case 'NOT_EMPTY':
                $method = 'whereRaw';
                $arguments = "%s != ''";
                break;
            case 'IN':
                $method = 'whereIn';
                $arguments = [static::getListFromString($value_one)];
                break;
            case 'NOT_IN':
                $method = 'whereNotIn';
                $arguments = [static::getListFromString($value_one)];
                break;
            case 'NULL':
                $method = 'whereNull';
                break;
            case 'NOT_NULL':
                $method = 'whereNotNull';
                break;
        }

        return [
            'operator'  => $operator,
            'method'    => $method,
            'arguments' => $arguments,
            'value_one' => $value_one,
            'value_two' => $value_two,
            'settings'  => $settings,
            'positive'  => $positive,
        ];
    }
286548
protected static function parseParameterFilter($filter)
	{
		list($name, $parameters) = explode(':', $filter, 2);

		return array($name, explode(',', $parameters));
	}
1206391
public function attachmentUrlFilter($key, $filter = null)
    {
        if (empty($key))
        {
            return '';
        }

        try
        {
            $url = $this->attachmentHandler->getFileUrl($key);
        }
        catch (AttachmentException $e)
        {
            return '';
        }

        if (null === $filter)
        {
            return $url;
        }

        return $this->cacheManager->getBrowserPath($url, $filter);
    }