com phpruntests: phpruntests - alternative parse-method in rtUtil (minor adjustment): src/rtUtil.php

From: Date: Mon, 22 Jun 2009 16:36:26 +0000
Subject: com phpruntests: phpruntests - alternative parse-method in rtUtil (minor adjustment): src/rtUtil.php
Groups: php.qa 
Request: Send a blank email to php-qa+get-66403@lists.php.net to get a copy of this message
Commit: 0c49183de46d6f8a0d909f6ea3231cf025d5da08 Author: Georg Gradwohl <g2@php.net> Mon, 22 Jun 2009 16:36:26 +0000 Parents: 3b914371cdc3f35309fa9f37f549f70ac099b0b8 Branches: master Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=0c49183de46d6f8a0d909f6ea3231cf025d5da08 Log: phpruntests - alternative parse-method in rtUtil (minor adjustment) Changed paths: M src/rtUtil.php Diff: diff --git a/src/rtUtil.php b/src/rtUtil.php index 6be0400...66cc9c1 100644 --- a/src/rtUtil.php +++ b/src/rtUtil.php @@ -50,35 +50,37 @@ class rtUtil } - /** - * 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 */

« previous php.qa (#66403) next »