1 | <?php |
||
27 | class GetTranslationsArray implements \badams\MicrosoftTranslator\ApiMethodInterface |
||
28 | { |
||
29 | const MAX_TEXTS = 10; |
||
30 | |||
31 | /** |
||
32 | * @const Maximum allowable length of text |
||
33 | */ |
||
34 | const TEXT_MAX_LENGTH = 10000; |
||
35 | |||
36 | /** |
||
37 | * @var array |
||
38 | */ |
||
39 | protected $texts; |
||
40 | |||
41 | /** |
||
42 | * @var Language |
||
43 | */ |
||
44 | protected $to; |
||
45 | |||
46 | /** |
||
47 | * @var Language|null |
||
48 | */ |
||
49 | protected $from; |
||
50 | |||
51 | /** |
||
52 | * @var int |
||
53 | */ |
||
54 | protected $maxTranslations; |
||
55 | |||
56 | /** |
||
57 | * @var TranslateOptions |
||
58 | */ |
||
59 | protected $options; |
||
60 | |||
61 | /** |
||
62 | * GetTranslationsArray constructor. |
||
63 | * @param $texts |
||
64 | * @param $to |
||
65 | * @param $from |
||
66 | * @param int $maxTranslations |
||
67 | * @param TranslateOptions|null $options |
||
68 | * @throws ArgumentException |
||
69 | * @throws UnsupportedLanguageException |
||
70 | */ |
||
71 | 15 | public function __construct($texts, $to, $from, $maxTranslations = 5, TranslateOptions $options = null) |
|
93 | |||
94 | /** |
||
95 | * @return string |
||
96 | */ |
||
97 | 3 | public function getRequestMethod() |
|
101 | |||
102 | /** |
||
103 | * @return array |
||
104 | */ |
||
105 | 3 | public function getRequestOptions() |
|
109 | |||
110 | /** |
||
111 | * @return string |
||
112 | */ |
||
113 | 6 | protected function createBodyXml() |
|
142 | |||
143 | /** |
||
144 | * @param \GuzzleHttp\Message\ResponseInterface $response |
||
145 | * @return GetTranslationsResponse[] |
||
146 | */ |
||
147 | 3 | public function processResponse(\GuzzleHttp\Message\ResponseInterface $response) |
|
159 | |||
160 | } |