|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace GinoPane\PHPolyglot\Supplemental; |
|
4
|
|
|
|
|
5
|
|
|
use GinoPane\PHPolyglot\API\Factory\TTS\TtsApiFactory; |
|
6
|
|
|
use GinoPane\PHPolyglot\API\Implementation\TTS\TtsApiInterface; |
|
7
|
|
|
use GinoPane\PHPolyglot\API\Factory\Translate\TranslateApiFactory; |
|
8
|
|
|
use GinoPane\PHPolyglot\API\Factory\Dictionary\DictionaryApiFactory; |
|
9
|
|
|
use GinoPane\PHPolyglot\API\Factory\SpellCheck\SpellCheckApiFactory; |
|
10
|
|
|
use GinoPane\PHPolyglot\API\Implementation\Translate\TranslateApiInterface; |
|
11
|
|
|
use GinoPane\PHPolyglot\API\Implementation\Dictionary\DictionaryApiInterface; |
|
12
|
|
|
use GinoPane\PHPolyglot\API\Implementation\SpellCheck\SpellCheckApiInterface; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Trait GetApiInstancesTrait |
|
16
|
|
|
* |
|
17
|
|
|
* @author Sergey <Gino Pane> Karavay |
|
18
|
|
|
*/ |
|
19
|
|
|
trait GetApiInstancesTrait |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* @codeCoverageIgnore |
|
23
|
|
|
* |
|
24
|
|
|
* Get Translate API instance |
|
25
|
|
|
* |
|
26
|
|
|
* @param array $parameters |
|
27
|
|
|
* |
|
28
|
|
|
* @return TranslateApiInterface |
|
29
|
|
|
*/ |
|
30
|
|
|
protected function getTranslateApi(array $parameters = []): TranslateApiInterface |
|
31
|
|
|
{ |
|
32
|
|
|
return (new TranslateApiFactory())->getApi($parameters); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @codeCoverageIgnore |
|
37
|
|
|
* |
|
38
|
|
|
* Get Dictionary API instance |
|
39
|
|
|
* |
|
40
|
|
|
* @param array $parameters |
|
41
|
|
|
* |
|
42
|
|
|
* @return DictionaryApiInterface |
|
43
|
|
|
*/ |
|
44
|
|
|
protected function getDictionaryApi(array $parameters = []): DictionaryApiInterface |
|
45
|
|
|
{ |
|
46
|
|
|
return (new DictionaryApiFactory())->getApi($parameters); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @codeCoverageIgnore |
|
51
|
|
|
* |
|
52
|
|
|
* Get Tts API instance |
|
53
|
|
|
* |
|
54
|
|
|
* @param array $parameters |
|
55
|
|
|
* |
|
56
|
|
|
* @return TtsApiInterface |
|
57
|
|
|
*/ |
|
58
|
|
|
protected function getTtsApi(array $parameters = []): TtsApiInterface |
|
59
|
|
|
{ |
|
60
|
|
|
return (new TtsApiFactory())->getApi($parameters); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @codeCoverageIgnore |
|
65
|
|
|
* |
|
66
|
|
|
* Get SpellCheck API instance |
|
67
|
|
|
* |
|
68
|
|
|
* @param array $parameters |
|
69
|
|
|
* |
|
70
|
|
|
* @return SpellCheckApiInterface |
|
71
|
|
|
*/ |
|
72
|
|
|
protected function getSpellCheckApi(array $parameters = []): SpellCheckApiInterface |
|
73
|
|
|
{ |
|
74
|
|
|
return (new SpellCheckApiFactory())->getApi($parameters); |
|
75
|
|
|
} |
|
76
|
|
|
} |