22declare(strict_types=1);
27use
function file_exists;
31use
function str_replace;
34use
const DIRECTORY_SEPARATOR;
43 public function __construct(
string $path){
44 $this->file = rtrim(str_replace(DIRECTORY_SEPARATOR,
"/", $path),
"/") .
"/";
54 $filename = rtrim(str_replace(DIRECTORY_SEPARATOR,
"/", $filename),
"/");
55 if(file_exists($this->file . $filename)){
56 $resource = fopen($this->file . $filename,
"rb");
57 if($resource ===
false)
throw new AssumptionFailedError(
"fopen() should not fail on a file which exists");
71 if(is_dir($this->file)){
73 foreach(
new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($this->file)) as $resource){
74 if($resource->isFile()){
75 $path = str_replace(DIRECTORY_SEPARATOR,
"/", substr((
string) $resource, strlen($this->file)));
76 $resources[$path] = $resource;
getResource(string $filename)