mirror of
https://github.com/YGGverse/gemini-php.git
synced 2025-09-11 13:42:12 +00:00
add getData method
This commit is contained in:
parent
fbfaed02fc
commit
b82a2de231
12
README.md
12
README.md
@ -174,6 +174,18 @@ var_dump (
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Filesystem::getData
|
||||||
|
|
||||||
|
Return file content if path match storage item
|
||||||
|
|
||||||
|
```
|
||||||
|
var_dump (
|
||||||
|
$filesystem->getData(
|
||||||
|
'/full/path/to/page.txt'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
### Helper
|
### Helper
|
||||||
|
|
||||||
Useful methods to minify controller codebase
|
Useful methods to minify controller codebase
|
||||||
|
@ -163,6 +163,18 @@ class Filesystem
|
|||||||
return $path;
|
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
|
private function _index(string $path, ?array $blacklist = ['.', '..', 'sidebar.txt', '__template.txt']): void
|
||||||
{
|
{
|
||||||
foreach ((array) scandir($path) as $file)
|
foreach ((array) scandir($path) as $file)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user