1 | <?php |
||
16 | class MicrosoftTranslator |
||
17 | { |
||
18 | /** |
||
19 | * |
||
20 | */ |
||
21 | const AUTH_URL = 'https://datamarket.accesscontrol.windows.net/v2/OAuth2-13'; |
||
22 | |||
23 | /** |
||
24 | * |
||
25 | */ |
||
26 | const BASE_URL = 'http://api.microsofttranslator.com/V2/Http.svc/'; |
||
27 | |||
28 | /** |
||
29 | * @var Client |
||
30 | */ |
||
31 | private $http; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | private $scope = 'http://api.microsofttranslator.com'; |
||
37 | |||
38 | /** |
||
39 | * @var string |
||
40 | */ |
||
41 | private $grantType = 'client_credentials'; |
||
42 | |||
43 | /** |
||
44 | * @var string |
||
45 | */ |
||
46 | private $clientId; |
||
47 | |||
48 | /** |
||
49 | * @var string |
||
50 | */ |
||
51 | private $clientSecret; |
||
52 | |||
53 | /** |
||
54 | * @var string |
||
55 | */ |
||
56 | private $accessToken; |
||
57 | |||
58 | /** |
||
59 | * MicrosoftTranslator constructor. |
||
60 | */ |
||
61 | public function __construct(\GuzzleHttp\ClientInterface $httpClient = null) |
||
69 | |||
70 | /** |
||
71 | * @param $id |
||
72 | * @param $secret |
||
73 | */ |
||
74 | public function setClient($id, $secret) |
||
79 | |||
80 | /** |
||
81 | * @return mixed |
||
82 | * @throws AuthException |
||
83 | */ |
||
84 | private function updateAccessToken() |
||
103 | |||
104 | /** |
||
105 | * @param $action |
||
106 | * @param $params |
||
107 | * @param string $method |
||
108 | * @return null|string |
||
109 | * @throws ArgumentException |
||
110 | * @throws AuthException |
||
111 | */ |
||
112 | private function request($action, $params, $method = 'GET') |
||
144 | |||
145 | /** |
||
146 | * @param string $message |
||
147 | * @throws ArgumentException |
||
148 | * @throws QuotaExceededException |
||
149 | * @throws TokenExpiredException |
||
150 | * @throws TranslatorException |
||
151 | */ |
||
152 | private function processError($message) |
||
166 | |||
167 | /** |
||
168 | * @param $text |
||
169 | * @param $to |
||
170 | * @param $from |
||
171 | * @return mixed |
||
172 | */ |
||
173 | public function translate($text, $to, $from) |
||
181 | } |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..