Refactoring base functions

Fetch functions, curl and it's parameters now are all in the FetchApi
file, while other Classes will receive them by Dependence Injection
This commit is contained in:
2019-06-21 21:12:00 -03:00
parent 7664bf67a4
commit 460812852e
4 changed files with 160 additions and 77 deletions

View File

@@ -7,7 +7,7 @@
*/
namespace BrunoFontes\Memsource;
class BilingualFile extends \BrunoFontes\Memsource
class BilingualFile extends \BrunoFontes\Memsource\BaseApi
{
private $_url = '/bilingualFiles';
@@ -35,7 +35,7 @@ class BilingualFile extends \BrunoFontes\Memsource
for ($i = 0; $i < count($groupedJobUids); $i++) {
$apiReadyArray = $this->_convertUidArrayToApiRequest($groupedJobUids[$i]);
$filenames[$i] = count($groupedJobUids) > 1?"{$i}_{$filename}":$filename;
$filecontent = $this->fetch('jsonPost', $url, $apiReadyArray);
$filecontent = $this->fetchApi->fetch('jsonPost', $url, $apiReadyArray);
$this->_saveIntoFile($filenames[$i], $filecontent);
}
return $filenames;