1 | <?php |
||
23 | class Speak implements \badams\MicrosoftTranslator\ApiMethodInterface |
||
24 | { |
||
25 | const TEXT_MAX_LENGTH = 2000; |
||
26 | |||
27 | const FORMAT_MP3 = 'audio/mp3'; |
||
28 | const FORMAT_WAV = 'audio/wav'; |
||
29 | |||
30 | const OPTION_MAX_QUALITY = 'MaxQuality'; |
||
31 | const OPTION_MIN_SIZE = 'MinSize'; |
||
32 | |||
33 | /** |
||
34 | * @var Language |
||
35 | */ |
||
36 | protected $language; |
||
37 | |||
38 | /** |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $text; |
||
42 | |||
43 | /** |
||
44 | * @var string |
||
45 | */ |
||
46 | protected $format; |
||
47 | |||
48 | /** |
||
49 | * @var string |
||
50 | */ |
||
51 | protected $options; |
||
52 | |||
53 | /** |
||
54 | * Speak constructor. |
||
55 | * @param $text |
||
56 | * @param $language |
||
57 | * @param string $format |
||
58 | * @param string $options |
||
59 | */ |
||
60 | 15 | public function __construct($text, $language, $format = Speak::FORMAT_MP3, $options = Speak::OPTION_MAX_QUALITY) |
|
73 | |||
74 | /** |
||
75 | * @param $format |
||
76 | * @return mixed |
||
77 | * @throws ArgumentException |
||
78 | */ |
||
79 | 9 | public function validateFormat($format) |
|
87 | |||
88 | /** |
||
89 | * @param $options |
||
90 | * @return mixed |
||
91 | * @throws ArgumentException |
||
92 | */ |
||
93 | 6 | public function validateOptions($options) |
|
103 | |||
104 | /** |
||
105 | * @return string |
||
106 | */ |
||
107 | 3 | public function getRequestMethod() |
|
111 | |||
112 | /** |
||
113 | * @return array |
||
114 | */ |
||
115 | 3 | public function getRequestOptions() |
|
124 | |||
125 | /** |
||
126 | * @param \GuzzleHttp\Message\ResponseInterface $response |
||
127 | * @return string |
||
128 | */ |
||
129 | 3 | public function processResponse(\GuzzleHttp\Message\ResponseInterface $response) |
|
133 | } |
||
134 |