/** * Search all entries for given regex pattern * * @param string $pattern * @param string $path [optional] * @return string[] */ public function search($pattern, $path = null) { if ($path) { $absolutePath = $this->driver->getAbsolutePath($this->path, $this->getRelativePath($path)); } else { $absolutePath = $this->path; } $files = $this->driver->search($pattern, $absolutePath); $result = []; foreach ($files as $file) { $result[] = $this->getRelativePath($file); } return $result; }