N98\Util\Console\Helper\MagentoHelper::checkModman PHP Method

checkModman() protected method

Check for modman file and .basedir
protected checkModman ( array $folders ) : array
$folders array
return array
    protected function checkModman(array $folders)
    {
        foreach (array_reverse($folders) as $searchFolder) {
            if (!is_readable($searchFolder)) {
                if (OutputInterface::VERBOSITY_DEBUG <= $this->output->getVerbosity()) {
                    $this->output->writeln('<debug>Folder <info>' . $searchFolder . '</info> is not readable. Skip.</debug>');
                }
                continue;
            }
            $finder = Finder::create();
            $finder->files()->ignoreUnreadableDirs(true)->depth(0)->followLinks()->ignoreDotFiles(false)->name('.basedir')->in($searchFolder);
            $count = $finder->count();
            if ($count > 0) {
                $baseFolderContent = trim(file_get_contents($searchFolder . DIRECTORY_SEPARATOR . '.basedir'));
                if (OutputInterface::VERBOSITY_DEBUG <= $this->output->getVerbosity()) {
                    $this->output->writeln('<debug>Found modman .basedir file with content <info>' . $baseFolderContent . '</info></debug>');
                }
                if (!empty($baseFolderContent)) {
                    array_push($folders, $searchFolder . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $baseFolderContent);
                }
            }
        }
        return $folders;
    }