Skip to content
This repository was archived by the owner on Apr 12, 2020. It is now read-only.
/ browser Public archive

Commit 7e82134

Browse files
author
alexandresalome
committed
add a maximum depth in repositories finder
1 parent 40cbc5b commit 7e82134

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Gitonomy/Browser/Utils/RepositoriesFinder.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ private function globDirectory($path)
4242
/**
4343
* Ported from https://github.com/klaussilveira/gitter
4444
*/
45-
private function recurseDirectory($path)
45+
private function recurseDirectory($path, $maxDepth = 3)
4646
{
4747
$dirs = new \DirectoryIterator($path);
4848

@@ -66,7 +66,9 @@ private function recurseDirectory($path)
6666
continue;
6767
}
6868

69-
$repositories = array_merge($repositories, $this->recurseDirectory($dir->getPathname()));
69+
if ($maxDepth > 0) {
70+
$repositories = array_merge($repositories, $this->recurseDirectory($dir->getPathname(), $maxDepth - 1));
71+
}
7072
}
7173

7274
return $repositories;

0 commit comments

Comments
 (0)