StartMigration.php
1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace WPML\ICLToATEMigration\Endpoints\TranslationMemory;
use WPML\Ajax\IHandler;
use WPML\Collect\Support\Collection;
use WPML\FP\Either;
use WPML_TM_ATE_API;
class StartMigration implements IHandler {
/**
* @var WPML_TM_ATE_API
*/
private $apiClient;
/**
* @param WPML_TM_ATE_API $apiClient
*/
public function __construct( WPML_TM_ATE_API $apiClient ) {
$this->apiClient = $apiClient;
}
public function run( Collection $data ) {
// call ATE endpoint to trigger translation memory migration
// This should be the final version I comment out because the api is not working as expected
/*$responde = $this->apiClient->start_translation_memory_migration();
return Either::of( $responde );*/
// I have mocked the return of the APi for now, will be removed for the final version
return Either::of( [
'started_at' => null,
'finished_at' => null,
'status' => 'in_progress',
'last_imported_icl_id' => 15,
'imported_count' => 4
] );
}
}