From 1788befec6a237160fa5593c80549c7b5a1f3be1 Mon Sep 17 00:00:00 2001 From: Bruno Fontes Date: Fri, 23 Dec 2022 00:25:50 -0300 Subject: [PATCH] refactor: moving saveIntoFile to Helper function --- src/BilingualFile.php | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/BilingualFile.php b/src/BilingualFile.php index d90b4fc..4840d7e 100644 --- a/src/BilingualFile.php +++ b/src/BilingualFile.php @@ -45,7 +45,7 @@ class BilingualFile extends \BrunoFontes\Memsource\BaseApi $errorMsg = $this->getError($filecontent); throw new \Exception("Error downloading file: {$errorMsg}", 1); } - $this->_saveIntoFile($filenames[$i], $filecontent); + Helper::saveIntoFile($filenames[$i], $filecontent); } return $filenames; } @@ -66,17 +66,6 @@ class BilingualFile extends \BrunoFontes\Memsource\BaseApi return ['jobs' => $convertedArray]; } - private 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); - } - } - /** * Upload a bilingual file to Memsource *