add @todo note
[phpt.git] / src / PHPT / Suite / Factory.php
blobc28dae4333a799c0b50ba2808ba36e20949c0f49
1 <?php
3 class PHPT_Suite_Factory
5 public function __construct()
10 public function factory($path, $recursive = false)
12 return new PHPT_Suite($this->_locateFiles($path, $recursive));
16 /**
17 * @todo refactor collection/recursion through directory into a generic PatternCollector
19 private function _locateFiles($path, $recursive = false)
21 $return = array();
23 $dir = scandir($path);
24 foreach ($dir as $file) {
25 if (substr($file, 0, 1) == '.') {
26 continue;
28 $full_file = "{$path}/{$file}";
29 if ($recursive && is_dir($full_file)) {
30 $return = array_merge($return, $this->_locateFiles($full_file, $recursive));
31 } elseif (substr($file, -5) == '.phpt') {
32 $return[] = "{$path}/{$file}";
35 return $return;