-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
I think the file system calls in Vault should be abstracted into an interface so the vault could be stored in other locations and someone could leverage packages like flysystem.
Of course default it with the file system for ease of use.
namespace starekrow\lockbox;
interface FileSystemInterface {
/**
* gets the content of a file
* @param string $file
* @return string
*/
public function get($file);
/**
* puts content into a file
* @param string $file
* @param string $content
* @return bool if it was successful
*/
public function put($file, $content);
/**
* checks if the file exists
* @param string $file
* @return bool if it exists
*/
public function has($file);
}namespace starekrow\lockbox;
class LocalFileSystem implements FileSystemInterface {
/**
* @inheritdoc
*/
public function get($file)
{
return @file_get_contents($file);
}
/**
* @inheritdoc
*/
public function put($file, $content)
{
return @file_put_contents($file, $content);
}
/**
* @inheritdoc
*/
public function has($file)
{
return file_exists($file);
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels