Total Complexity | 5 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
20 | final class Yandex extends OAuth2 |
||
21 | { |
||
22 | protected string $authUrl = 'https://oauth.yandex.ru/authorize'; |
||
23 | protected string $tokenUrl = 'https://oauth.yandex.ru/token'; |
||
24 | protected string $endpoint = 'https://login.yandex.ru'; |
||
25 | |||
26 | public function applyAccessTokenToRequest(RequestInterface $request, OAuthToken $accessToken): RequestInterface |
||
27 | { |
||
28 | $params = RequestUtil::getParams($request); |
||
29 | |||
30 | $paramsToAdd = []; |
||
31 | if (!isset($params['format'])) { |
||
32 | $paramsToAdd['format'] = 'json'; |
||
33 | } |
||
34 | $paramsToAdd['oauth_token'] = $accessToken->getToken(); |
||
35 | return RequestUtil::addParams($request, $paramsToAdd); |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * @return string service name. |
||
40 | */ |
||
41 | public function getName(): string |
||
42 | { |
||
43 | return 'yandex'; |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * @return string service title. |
||
48 | */ |
||
49 | public function getTitle(): string |
||
50 | { |
||
51 | return 'Yandex'; |
||
52 | } |
||
53 | |||
54 | protected function initUserAttributes(): array |
||
57 | } |
||
58 | } |
||
59 |