mirror of
https://github.com/brunofontes/Memsource-API.git
synced 2024-11-23 19:00:50 +00:00
refactor: creating Helper class and moving saveIntoFile function
This commit is contained in:
parent
1a3c690138
commit
aab66427a8
19
src/Helper.php
Normal file
19
src/Helper.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace BrunoFontes\Memsource;
|
||||
|
||||
class Helper
|
||||
{
|
||||
|
||||
public static function saveIntoFile(string $filename, string $filecontent): void
|
||||
{
|
||||
try {
|
||||
$f = fopen($filename, 'w+');
|
||||
fwrite($f, $filecontent);
|
||||
fclose($f);
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception("File could not be saved: {$e->error}", 1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user