Remove the http client from constructor

[MAILPOET-3807]
This commit is contained in:
Pavel Dohnal
2021-11-08 14:38:32 +01:00
committed by Veljko V
parent 274abc09fc
commit eda7a74f25

View File

@ -5,21 +5,13 @@ namespace MailPoetTasks\Release;
use GuzzleHttp\Client;
class TranslationsController {
private const API_BASE_URI = 'https://translate.wordpress.com/api/import-transifex/';
private const API_IMPORT_BASE_URI = 'https://translate.wordpress.com/api/import-transifex/';
/** @var Client */
private $httpClient;
public function __construct(
$project = 'mailpoet'
) {
$this->httpClient = new Client([
'base_uri' => self::API_BASE_URI . $project . '/',
public function importTransifex(string $version, $project = 'mailpoet'): array {
$httpClient = new Client([
'base_uri' => self::API_IMPORT_BASE_URI . $project . '/',
]);
}
public function importTransifex(string $version): array {
$response = $this->httpClient->post($version);
$response = $httpClient->post($version);
$response->getStatusCode();
if ($response->getStatusCode() !== 200) {
return [
@ -36,4 +28,8 @@ class TranslationsController {
}
return $result;
}
public function checkIfTranslationsAreReady(string $version): bool {
return true;
}
}