1 | <?php |
||
15 | class Yahoo extends AbstractService |
||
16 | { |
||
17 | public function __construct( |
||
18 | CredentialsInterface $credentials, |
||
19 | ClientInterface $httpClient, |
||
20 | TokenStorageInterface $storage, |
||
21 | SignatureInterface $signature, |
||
22 | UriInterface $baseApiUri = null |
||
23 | ) { |
||
24 | parent::__construct($credentials, $httpClient, $storage, $signature, $baseApiUri); |
||
25 | |||
26 | if (null === $baseApiUri) { |
||
27 | $this->baseApiUri = new Uri('https://social.yahooapis.com/v1/'); |
||
28 | } |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * {@inheritDoc} |
||
33 | */ |
||
34 | public function getRequestTokenEndpoint() |
||
35 | { |
||
36 | return new Uri('https://api.login.yahoo.com/oauth/v2/get_request_token'); |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * {@inheritdoc} |
||
41 | */ |
||
42 | public function getAuthorizationEndpoint() |
||
43 | { |
||
44 | return new Uri('https://api.login.yahoo.com/oauth/v2/request_auth'); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * {@inheritdoc} |
||
49 | */ |
||
50 | public function getAccessTokenEndpoint() |
||
51 | { |
||
52 | return new Uri('https://api.login.yahoo.com/oauth/v2/get_token'); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * {@inheritdoc} |
||
57 | */ |
||
58 | public function refreshAccessToken(TokenInterface $token) |
||
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | */ |
||
87 | protected function parseRequestTokenResponse($responseBody) |
||
88 | { |
||
89 | parse_str($responseBody, $data); |
||
90 | |||
91 | if (null === $data || !is_array($data)) { |
||
92 | throw new TokenResponseException('Unable to parse response.'); |
||
93 | } elseif (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] !== 'true') { |
||
94 | throw new TokenResponseException('Error in retrieving token.'); |
||
95 | } |
||
96 | |||
97 | return $this->parseAccessTokenResponse($responseBody); |
||
98 | } |
||
99 | |||
100 | /** |
||
101 | * {@inheritdoc} |
||
102 | */ |
||
103 | protected function parseAccessTokenResponse($responseBody) |
||
131 | } |
||
132 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.