g2 Mon Jun 22 16:36:26 2009 UTC Modified files: /phpruntests/src rtUtil.php Log: phpruntests - alternative parse-method in rtUtil (minor adjustment) http://cvs.php.net/viewvc.cgi/phpruntests/src/rtUtil.php?r1=1.6&r2=1.7&diff_format=u Index: phpruntests/src/rtUtil.php diff -u phpruntests/src/rtUtil.php:1.6 phpruntests/src/rtUtil.php:1.7 --- phpruntests/src/rtUtil.php:1.6 Mon Jun 22 07:56:12 2009 +++ phpruntests/src/rtUtil.php Mon Jun 22 16:36:26 2009 @@ -50,35 +50,37 @@ } - /** - * just a test - * + /** + * returns a list of directories containing a phpt-file + * * @param $path * @return array - */ - public static function parseDir($path) { - - $list = array(); - - if (sizeof(glob($path."/*.phpt")) > 0) { - - $list[] = $path.'/'; - } - - foreach (scandir($path) as $file) { - - if (substr($file, 0, 1) != '.' && $file != 'CVS') { - - if (is_dir($path.'/'.$file)) { - - $list = array_merge($list, rtUtil::parseDir($path.'/'.$file)); - } - } - } - - return $list; - } + */ + public static function parseDir($path) + { + $list = array(); + $found = false; + + foreach (scandir($path) as $file) { + + if (substr($file, 0, 1) != '.' && $file != 'CVS') { + + if (is_dir($path.'/'.$file)) { + + $list = array_merge($list, rtUtil::parseDir($path.'/'.$file)); + + } elseif ($found === false && strpos($file, '.phpt') !== false) { + + $list[] = $path.'/'; + $found = true; + } + } + } + + return $list; + } + /** * This is the original version of getDirectoryList which uses PhptFilterIterator */
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php