@param $gitignorePath

@return array
328006
private function getGitignoreLinesButComposerLock($gitignorePath)
    {
        $data = file($gitignorePath);
        $out = [];
        foreach ($data as $line) {
            if (trim($line) !== self::COMPOSER_LOCK) {
                $out[] = $line;
            }
        }

        return $out;
    }
1092325
private function getInPaths(): array
    {
        $inPaths = [];

        foreach ($this->includePaths as $path) {
            if (strpos($path, $this->rootDirectory, 0) === false) {
                throw new UnexpectedValueException(sprintf('Path %s is not in %s', $path, $this->rootDirectory));
            }

            $path = str_replace('*', '', $path);
            $inPaths[] = $path;
        }

        if (empty($inPaths)) {
            $inPaths[] = $this->rootDirectory;
        }

        return $inPaths;
    }
461918
protected function loadPath($path) {
        if (directory_exists($path)) {
            return $this->loadDirectory($path);
        } else if (file_exists($path)) {
            return $this->loadFile($path);
        }

        return [];
    }
947487
public function scanDirectory(string $path): array
    {
        $files = [];

        $rdi = new \RecursiveDirectoryIterator(
            $path,
            \FilesystemIterator::SKIP_DOTS |
            \FilesystemIterator::KEY_AS_FILENAME |
            \FilesystemIterator::CURRENT_AS_FILEINFO
        );

        $rii = new \RecursiveIteratorIterator($rdi);

        foreach ($rii as $fileInfo) {
            $files[] = $fileInfo;
        }

        return $files;
    }
843425
private function fetchCommitCollectionByPath($path, GitRepository $git)
    {
        // git log --follow --name-status --format='%H' -- $path
        $log = $git->log()->follow()->revisionRange('--name-status')->revisionRange('--format=%H')->execute($path);

        \preg_match_all(
            "/^(?'commit'.*)\n+(?'criteria'[RC])(?'index'[\d]{3})\t(?'from'.+)\t(?'to'.+)\n/m",
            $log,
            $matches,
            PREG_SET_ORDER
        );
        if (!\count($matches)) {
            return [];
        }

        $logCollection = [];
        foreach ((array) $matches as $match) {
            $logCollection[] = \array_filter($match, 'is_string', ARRAY_FILTER_USE_KEY);
        }

        return $logCollection;
    }
161893
private function findGitDirectories() : array
    {
        $finderGit = $this->finderFactory->build();
        $finderGit->in($this->environment->getRootDirectory())->depth('> 0')->path('/.git$/');
        $rawExcludePathsByFileByGit = $this->finderToRealPathConverter->finderToArrayOfPaths($finderGit);
        return array_map('dirname', $rawExcludePathsByFileByGit);
    }
901318
public function getValidComposerInstallPaths($base_path = null)
    {
        $filepaths = [];

        /** @var ComposerConfig $composer */
        $composer = $this->getComposer();
        $composer_extra = $composer->getExtra();

        $base_path = isset($base_path) && file_exists($base_path)
            ? $base_path
            : ProjectX::projectRoot();

        $installed_paths = isset($composer_extra['installer-paths'])
            ? array_keys($composer_extra['installer-paths'])
            : [];

        $installed_directory = substr(static::getInstallPath(), strrpos(static::getInstallPath(), '/'));

        foreach ($installed_paths as $installed_path) {
            $path_info = pathinfo($installed_path);
            $directory = "/{$path_info['dirname']}";
            if (strpos($directory, $installed_directory) === false) {
                continue;
            }
            $filename = $path_info['filename'] !== '{$name}'
                ? "/{$path_info['filename']}"
                : null;
            $filepath = $base_path . $directory . $filename;

            if (!file_exists($filepath)) {
                continue;
            }

            $filepaths[] = $filepath;
        }

        return $filepaths;
    }
57536
protected function parse($coverallsYmlPath)
    {
        $file = new Path();
        $path = realpath($coverallsYmlPath);

        if ($file->isRealFileReadable($path)) {
            $parser = new Parser();
            $yml = $parser->parse(file_get_contents($path));

            return empty($yml) ? [] : $yml;
        }

        return [];
    }
40217
public function getData(string $filePath): array
    {
        if (!is_readable($filePath) || is_dir($filePath)) {
            throw new \InvalidArgumentException('File ' . $filePath . ' is not a readable or not even a file');
        }
        $this->filePath = $filePath;
        $normalizedMetaData = $this->getNormalizedMetaDataFileContent();
        $normalizedMetaData = $this->addPathToData($normalizedMetaData);
        $normalizedMetaData = $this->addFilePathToData($normalizedMetaData);
        $normalizedMetaData = $this->addCheckSumToData($normalizedMetaData);

        return $normalizedMetaData;
    }
999093
def gitignore_templates(self):
        
        url = self._build_url('gitignore', 'templates')
        return self._json(self._get(url), 200) or []
1021491
public function match(string $path): array
    {
        $path = $path === '/' ? $path : \rtrim($path, '/ ');

        if (!isset($this->routes[$path])) {
            return [self::NOT_FOUND, $path];
        }

        return [self::FOUND, $this->routes[$path]];
    }
1259721
protected function doExtract($path)
    {
        $git = $this->getGitRepositoryFor($path);

        $authors = $this->convertAuthorList($this->getAuthorListFrom($git));

        // Check if repository has uncommitted changes, so that someone is currently working on it.
        if ($this->hasUncommittedChanges($git)) {
            $authors[] = $this->getCurrentUserInfo($git);
        }

        return $authors;
    }
1165632
private function getModules(string $path) : array
    {
        $result = [];
        foreach (Utility::findDirs($path) as $module) {
            if (! $this->isModule($module)) {
                continue;
            }

            $result[] = $module;
        }

        return $result;
    }
158481
private function _getScenarios($featurePath)
    {
        $scenarios = [];
        /* @var $featureNodes \Behat\Gherkin\Node\FeatureNode[] */
        $featureNodes = $this->container->get('gherkin')->load($featurePath);
        foreach ($featureNodes as $featureNode) {
            /* @var $scenario \Behat\Gherkin\Node\ScenarioNode */
            foreach ($featureNode->getScenarios() as $scenario) {
                $file = $scenario->getFile();
                $lines = [$scenario->getLine()];

                if ($scenario instanceof OutlineNode) {
                    $lines = $scenario->getExamples()->getRowLines();
                    array_shift($lines);
                }

                foreach ($lines as $line) {
                    $scenarios[] = "$file:$line";
                }
            }
        }

        return $scenarios;
    }
334108
public function lsFiles(string $path = '') : array
    {
        return array_filter(
            $this->ls($path),
            function(File $file) {
                return $file->isFile();
            }
        );
    }
567176
private static function getPathFiles(array $path): array
    {
        // load external files
        $result = [];
        $pathFinder = Finder::findFiles('*')->in($path);
        foreach ($pathFinder as $file) {
            $result[$file->getRealPath()] = $file->getBaseName();
        }
        return $result;
    }
1239233
def get_repository_names(path):
    
    return [subdir
            for subdir in os.listdir(path)
            if os.path.isdir(os.path.join(path, subdir, '.git'))]