public function __construct(array $sources) { foreach ($sources as $source) { if ($source instanceof \SplFileInfo) { $this->children[] = $source; } elseif (is_string($source) && ($source = realpath($source))) { if (is_file($source)) { $child = new SourceFileInfo($source); $child->setInfoClass(SourceFileInfo::class); $this->children[] = $child; } elseif (is_dir($source)) { $child = new \RecursiveDirectoryIterator($source); $child->setInfoClass(SourceFileInfo::class); $this->children[] = $child; } } } }
public function getPath() { $path = parent::getPath(); // special case when dealing with root dir of reference if ($path === '') { $pathname = $this->getPathname(); if (($pos = strpos($pathname, ':')) !== false) { $path = substr($pathname, 0, $pos + 1); } } return $path; }