private function searchInPath(FileSystem\Iterator\IteratorAggregate $iterator, $path, FileSystem\Directory $parent = null, $depth = 0)
    {
        // when exists.
        if (file_exists($path)) {
            if(is_dir($path)) {
                $dir = new FileSystem\Directory($path);
                if ($parent) $dir->setParent($parent);
                if ($this->validate($dir)) $iterator->add($dir);
                if ($this->recursive || $depth < 1) {
                    $this->searchInPath($iterator, "{$dir}/*", $dir, $depth + 1);
                }
            } else {
                $file = new FileSystem\File($path);
                if ($parent) $file->setParent($parent);
                if ($this->validate($file)) $iterator->add($file);
            }
        }
        // when not exists, then glob.
        else {
            foreach (glob($path) as $file) {
                $this->searchInPath($iterator, $file, $parent, $depth);
            }
        }
    }