{@inheritdoc}

@param Finder $finder Pre-configured Finder.
423806
public function getFiles(string $location, string $pattern = null, Finder $finder = null): array
    {
        $finder = $finder ?? new Finder();
        $finder->files()->in($location);

        if (!empty($pattern)) {
            $finder->name($pattern);
        }

        $result = [];
        foreach ($finder->getIterator() as $file) {
            $result[] = $this->normalizePath((string)$file);
        }

        return $result;
    }
192605
public function filter($matcher) {
        $filtered = array();
        foreach ($this as $key => $element) {
            if (call_user_func($matcher, $element, $key)) {
                $filtered[$key] = $element;
            }
        }

        return new static($filtered);
    }
183618
public function removeFinder(FormatFinder ...$finder) {
        foreach ($finder as $f) {
            if (false !== $offset = array_search($f, $this->finders, true)) {
                unset($this->finders[$offset]);
            }
        }
    }
187331
public function index (GluggiFinder $finder, GluggiConfig $config)
    {
        return $this->render("@Gluggi/Gluggi/index.html.twig", [
            "types" => $finder->getAllTypes(),
            "pageTitle" => "Index",
            "infoAction" => $config->getInfoAction(),
            "customTitle" => $config->getTitle(),
        ]);
    }
768652
protected function instantiate($file, $parser, $resolver)
    {
        $this->instantiateClass($file, 'file', File::class);

        $this->instantiateClass($parser, 'parser', Parser::class);

        $this->instantiateClass($resolver, 'resolver', Resolver::class);
    }
1170328
public static function finders($finders = null)
    {
        if (func_num_args()) {
            static::$_finders[static::class] = $finders;
            return;
        }
        $self = static::class;
        if (isset(static::$_finders[$self])) {
            return static::$_finders[$self];
        }
        $class = static::$_classes['finders'];
        $finders = static::$_finders[$self] = new $class();
        static::_finders($finders);
        return $finders;
    }
485622
public function set_sortorder($sortorder) {
        if ($this->sortorder == $sortorder) {
            return;
        }
        $this->sortorder = $sortorder;
        $this->update();
    }
1048389
public function parse(Parser $parser)
    {
        $parser->match(Lexer::T_IDENTIFIER);
        $parser->match(Lexer::T_OPEN_PARENTHESIS);

        $this->maskField = $parser->ArithmeticPrimary();
        $this->deleteDeferredPath($parser, $this->maskField);

        $parser->match(Lexer::T_COMMA);
        $this->findValue = $parser->ArithmeticPrimary();

        $parser->match(Lexer::T_CLOSE_PARENTHESIS);
        $this->parserResult = $parser->getParserResult();
    }
278153
public function getCheckers($checker)
    {
        switch ($checker) {
            case static::FILE_EXISTS:
                return [$this->buildFileExistsChecker()];
            case static::FILE_DOES_NOT_EXISTS:
                return [$this->buildFileDoesNotExistsChecker()];
            case static::DIRECTORY_EXISTS:
                return [
                    $this->buildFileExistsChecker(),
                    $this->buildIsDirectoryChecker(),
                ];
            case static::DIRECTORY_DOES_NOT_EXISTS:
                return [
                    $this->buildFileDoesNotExistsChecker(),
                    $this->buildIsDirectoryChecker(),
                ];
        }

        return [];
    }
852356
public function setFormatter(Formatter $formatter)
    {
        $this->output->setFormatter($formatter);
        $this->errorOutput->setFormatter($formatter);
    }
799921
public function applyOrdering($finder, $fieldName = 'ordering')
    {
        $orderCol  = $this->state->get('list.ordering', $fieldName);
        $orderDirn = $this->state->get('list.direction', 'asc');

        if (!empty($orderCol)) {
            $finder = $finder->orderBy($orderCol, $orderDirn);
        }

        return $finder;
    }
1053791
public function postFind(Event $event, array &$results, $finder) {
        if (!in_array($finder, ['first', 'all'])) {
            return;
        }

        $repo = $this->getRepository();
        $converters = $this->getConverters();

        foreach ($results as $i => $result) {
            foreach ($result as $key => $value) {
                if (empty($converters[$key])) {
                    continue;
                }

                $converter = $converters[$key];

                // Exit if decoding should not happen
                if (!$converter['decode']) {
                    continue;
                }

                switch ($converter['type']) {
                    case self::SERIALIZE:   $value = $this->fromSerialize($value, $converter); break;
                    case self::JSON:        $value = $this->fromJson($value, $converter); break;
                    case self::BASE64:      $value = $this->fromBase64($value, $converter); break;
                    case self::CUSTOM:
                        if (method_exists($repo, $converter['decode'])) {
                            $value = call_user_func_array([$repo, $converter['decode']], [$value, $converter]);
                        }
                    break;
                }

                $results[$i][$key] = $value;
            }
        }
    }
1047135
public function generate(Finder $finder): Result
    {
        $parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7);

        $traverser = new NodeTraverser();
        $visitor = new NodeVisitor($this->symbols, $this->config);
        $traverser->addVisitor(new NameResolver());
        $traverser->addVisitor($visitor);

        $unparsed = [];
        foreach ($finder as $file) {
            $stmts = null;
            try {
                $stmts = $parser->parse($file->getContents());
            } catch (Error|RuntimeException $e) {
                $unparsed[$file->getPathname()] = $e;
            }

            if ($stmts) {
                $traverser->traverse($stmts);
            }
        }

        return new Result($visitor, $unparsed);
    }
115279
public function finder()
    {
        if (class_exists($file = $this->getQualifiedClassNameOfType('Finders'))) {
            return $file;
        }

        if (list(/*$flag*/, $value) = $this->hasCommentFlag('finder')) {
            return $value;
        }

        return $this->finder;
    }
103910
public function setAdapter($adapter)
    {
        if ($adapter == null) {
            $this->adapter = $adapter;
        } else {
              parent::setAdapter($adapter);
        }
    }
1273491
public function initializeLocator(UniformResourceLocator $locator)
    {
        $locator->reset();

        $schemes = (array) $this->get('streams.schemes', []);

        foreach ($schemes as $scheme => $config) {
            if (isset($config['paths'])) {
                $locator->addPath($scheme, '', $config['paths']);
            }

            $override = $config['override'] ?? false;
            $force = $config['force'] ?? false;

            if (isset($config['prefixes'])) {
                foreach ((array)$config['prefixes'] as $prefix => $paths) {
                    $locator->addPath($scheme, $prefix, $paths, $override, $force);
                }
            }
        }
    }
773734
protected function buildFinder()
    {
        $finder = new Finder();
        $finder->files()
            ->name('/(\.php|composer\.json)$/')
            ->in($this->path)
            ->exclude($this->excludeDirs);

        return $finder;
    }