Skip to content

Commit 7107ce7

Browse files
committed
FileHandler getContent()
1 parent 421a65c commit 7107ce7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/FileSystem/FileHandler.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,16 @@ public function isWritable(): bool {
8989
return \is_writable($this->path);
9090
}
9191

92+
/**
93+
* returns the file content if file is available. Otherwise null
94+
*
95+
* @return null|string
96+
*/
97+
public function getContent(): ?string {
98+
if ($this->isFile()) {
99+
return \file_get_contents($this->path);
100+
}
101+
return null;
102+
}
103+
92104
}

0 commit comments

Comments
 (0)