if (strrpos($file->getFilename(), '.') === 0) {
continue;
}
if (!$file->isReadable()) {
continue;
}
if ($file->isDir()) {
$isBare = file_exists($file->getPathname() . '/HEAD');
$isRepository = file_exists($file->getPathname() . '/.git/HEAD');
if ($isRepository || $isBare) {
$hidden = function ($path, $hide) {
$return = false;
array_walk($hide, function ($value, $key) use ($path, &$return) {
if (($path === $value) || (1 === preg_match($value, $path))) {
$return = true;
}
});
return $return;
};
if ($hidden($file->getPathname(), $this->getHidden())) {
continue;
}
if ($isBare) {
$description = $file->getPathname() . '/description';
} else {
$description = $file->getPathname() . '/.git/description';
}
if (file_exists($description)) {
$description = file_get_contents($description);
} else {
$description = null;
}
if (!$topLevel) {
$repoName = $file->getPathInfo()->getFilename() . '/' . $file->getFilename();
} else {
$repoName = $file->getFilename();
}
if (is_array($this->getProjects()) && !in_array($repoName, $this->getProjects())) {
continue;
}