private readonly FinfoMimeTypeDetector|MimeTypeDetector
$mimeTypeDetector;
public function __construct( private readonly string
$defaultVisibility = Visibility::
PUBLIC,
?MimeTypeDetector
$mimeTypeDetector = null
) { $this->mimeTypeDetector =
$mimeTypeDetector ?:
new FinfoMimeTypeDetector();
} public function fileExists(string
$path): bool
{ return \
array_key_exists($this->
preparePath($path),
$this->files
);
} public function write(string
$path, string
$contents, Config
$config): void
{ $path =
$this->
preparePath($path);
$file =
$this->files
[$path] ??=
new InMemoryFile();
$file->
updateContents($contents,
$config->
get('timestamp'
));
$visibility =
$config->
get(Config::OPTION_VISIBILITY,
$this->defaultVisibility
);
$file->
setVisibility($visibility);
}