/**
  * find the folders in the result set from a RegexIterator
  *
  * @param  RegexIterator $iter
  *         the iterator to filter on
  * @return \Iterator
  */
 public static function fromRegexIterator(RegexIterator $iter)
 {
     foreach ($iter as $match) {
         if (IsFolder::checkString($match[0])) {
             (yield $match[0]);
         }
     }
 }
Пример #2
0
 /**
  * are we looking at a valid Git repo?
  *
  * @param  string $repoDir
  *         path to the git repo to examine
  * @return boolean
  *         TRUE if we are
  *         FALSE otherwise
  */
 public static function check($repoDir)
 {
     // we're going to check for the existence of all of these folders
     $foldersToCheck = [$repoDir, $repoDir . '/.git/refs/heads'];
     foreach ($foldersToCheck as $folderToCheck) {
         if (!IsFolder::checkString($folderToCheck)) {
             return false;
         }
     }
     // if we get here, we've run out of ideas
     return true;
 }