1 | <?php namespace Stevenmaguire\OAuth2\Client\Provider; |
||
9 | class Zendesk extends AbstractProvider |
||
10 | { |
||
11 | use BearerAuthorizationTrait; |
||
12 | |||
13 | protected $subdomain; |
||
14 | |||
15 | protected $scopes = []; |
||
16 | |||
17 | /** |
||
18 | * @var string Key used in a token response to identify the resource owner. |
||
19 | */ |
||
20 | const ACCESS_TOKEN_RESOURCE_OWNER_ID = 'id'; |
||
21 | |||
22 | /** |
||
23 | * Constructs an OAuth 2.0 service provider. |
||
24 | * |
||
25 | * @param array $options An array of options to set on this provider. |
||
26 | * Options include `clientId`, `clientSecret`, `redirectUri`, and `state`. |
||
27 | * Individual providers may introduce more options, as needed. |
||
28 | * @param array $collaborators An array of collaborators that may be used to |
||
29 | * override this provider's default behavior. Collaborators include |
||
30 | * `grantFactory`, `requestFactory`, `httpClient`, and `randomFactory`. |
||
31 | * Individual providers may introduce more collaborators, as needed. |
||
32 | */ |
||
33 | 18 | public function __construct(array $options = [], array $collaborators = []) |
|
43 | |||
44 | /** |
||
45 | * Get authorization url to begin OAuth flow |
||
46 | * |
||
47 | * @return string |
||
48 | */ |
||
49 | 6 | public function getBaseAuthorizationUrl() |
|
53 | |||
54 | /** |
||
55 | * Get access token url to retrieve token |
||
56 | * |
||
57 | * @return string |
||
58 | */ |
||
59 | 8 | public function getBaseAccessTokenUrl(array $params) |
|
63 | |||
64 | /** |
||
65 | * Get provider url to fetch user details |
||
66 | * |
||
67 | * @param AccessToken $token |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | 2 | public function getResourceOwnerDetailsUrl(AccessToken $token) |
|
75 | |||
76 | /** |
||
77 | * Get the default scopes used by this provider. |
||
78 | * |
||
79 | * This should not be a complete list of all scopes, but the minimum |
||
80 | * required for the provider user interface! |
||
81 | * |
||
82 | * @return array |
||
83 | */ |
||
84 | 4 | protected function getDefaultScopes() |
|
88 | |||
89 | /** |
||
90 | * Set the default scopes used by this provider. |
||
91 | * |
||
92 | * This should not be a complete list of all scopes, but the minimum |
||
93 | * required for the provider user interface! |
||
94 | * |
||
95 | * @return Zendesk |
||
96 | */ |
||
97 | public function setDefaultScopes(Array $scopes) |
||
105 | |||
106 | /** |
||
107 | * Returns the string that should be used to separate scopes when building |
||
108 | * the URL for requesting an access token. |
||
109 | * |
||
110 | * @return string Scope separator, defaults to ',' |
||
111 | */ |
||
112 | 6 | protected function getScopeSeparator() |
|
116 | |||
117 | /** |
||
118 | * Check a provider response for errors. |
||
119 | * |
||
120 | * @throws IdentityProviderException |
||
121 | * @param ResponseInterface $response |
||
122 | * @param string $data Parsed response data |
||
123 | * @return void |
||
124 | */ |
||
125 | 6 | protected function checkResponse(ResponseInterface $response, $data) |
|
136 | |||
137 | /** |
||
138 | * Generate a user object from a successful user details request. |
||
139 | * |
||
140 | * @param object $response |
||
141 | * @param AccessToken $token |
||
142 | * @return ZendeskResourceOwner |
||
143 | */ |
||
144 | 2 | protected function createResourceOwner(array $response, AccessToken $token) |
|
148 | |||
149 | /** |
||
150 | * Retrieves currently configured subdomain. |
||
151 | * |
||
152 | * @return string |
||
153 | */ |
||
154 | 2 | public function getSubdomain() |
|
158 | |||
159 | /** |
||
160 | * Updates currently configured subdomain. |
||
161 | * |
||
162 | * @param string $subdomain |
||
163 | * |
||
164 | * @return Zendesk |
||
165 | */ |
||
166 | 2 | public function setSubdomain($subdomain) |
|
174 | } |
||
175 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: