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; use GuzzleHttp\Client;
class TranslationsController { 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 */ public function importTransifex(string $version, $project = 'mailpoet'): array {
private $httpClient; $httpClient = new Client([
'base_uri' => self::API_IMPORT_BASE_URI . $project . '/',
public function __construct(
$project = 'mailpoet'
) {
$this->httpClient = new Client([
'base_uri' => self::API_BASE_URI . $project . '/',
]); ]);
} $response = $httpClient->post($version);
public function importTransifex(string $version): array {
$response = $this->httpClient->post($version);
$response->getStatusCode(); $response->getStatusCode();
if ($response->getStatusCode() !== 200) { if ($response->getStatusCode() !== 200) {
return [ return [
@@ -36,4 +28,8 @@ class TranslationsController {
} }
return $result; return $result;
} }
public function checkIfTranslationsAreReady(string $version): bool {
return true;
}
} }