add getData method

This commit is contained in:
ghost 2024-02-03 11:05:47 +02:00
parent fbfaed02fc
commit b82a2de231
2 changed files with 24 additions and 0 deletions

View file

@ -163,6 +163,18 @@ class Filesystem
return $path;
}
public function getData(string $path): ?string
{
if (isset($this->_list[$path]) && is_file($path) || is_readable($path))
{
return file_get_contents(
$path
);
}
return null;
}
private function _index(string $path, ?array $blacklist = ['.', '..', 'sidebar.txt', '__template.txt']): void
{
foreach ((array) scandir($path) as $file)