bubble() public static méthode

Bubbles up a path until $comparator returns true
public static bubble ( string $path, Closure $comparator ) : string | null
$path string The path
$comparator Closure The callback used inside when bubbling to determine a finding
Résultat string | null The path that is found or NULL otherwise
 /**
  * Tries to find the root directory for a given repository path
  *
  * @param   string      $path       The file system path
  * @return  string|null             NULL if the root cannot be found, the root path otherwise
  */
 public static function findRepositoryRoot($path)
 {
     return FileSystem::bubble($path, function ($p) {
         $gitDir = $p . '/' . '.git';
         return file_exists($gitDir) && is_dir($gitDir);
     });
 }
 /**
  * Tries to find the root directory for a given repository path
  *
  * @param   Binary      $svn        The SVN binary
  * @param   string      $path       The file system path
  * @return  string|null             NULL if the root cannot be found, the root path otherwise
  */
 public static function findRepositoryRoot(Binary $svn, $path)
 {
     $hasSvnDir = function ($path) {
         $svnDir = $path . '/' . '.svn';
         return file_exists($svnDir) && is_dir($svnDir);
     };
     $pathWithSvnDir = FileSystem::bubble($path, $hasSvnDir);
     $root = $pathWithSvnDir;
     $parentDir = dirname($pathWithSvnDir);
     while ($hasSvnDir($parentDir) && strlen($root) > 1) {
         $root = dirname($root);
         $parentDir = dirname($parentDir);
     }
     return $root;
 }