:octocat: proper cache file saving

This commit is contained in:
smiley
2017-10-25 00:01:06 +02:00
parent 6c00acfc84
commit 3cb3b5b9db
3 changed files with 65 additions and 9 deletions
+17
View File
@@ -81,4 +81,21 @@ abstract class QROutputAbstract implements QROutputInterface{
return $this;
}
/**
* @param string $data
*
* @return bool
* @throws \chillerlan\QRCode\Output\QRCodeOutputException
*/
protected function saveToFile(string $data):bool {
try{
return (bool)file_put_contents($this->options->cachefile, $data);
}
catch(\Exception $e){
throw new QRCodeOutputException('Could not write to cache file: '.$e->getMessage());
}
}
}