1 | <?php |
||
11 | class NextEngineProvider extends AbstractProvider |
||
12 | { |
||
13 | /** |
||
14 | * @var string Key used in a token response to identify the resource owner. |
||
15 | */ |
||
16 | const ACCESS_TOKEN_RESOURCE_OWNER_ID = 'uid'; |
||
17 | |||
18 | /** |
||
19 | * Returns the base URL for authorizing a client. |
||
20 | * |
||
21 | * @return string |
||
22 | */ |
||
23 | 1 | public function getBaseAuthorizationUrl() |
|
24 | { |
||
25 | 1 | return 'https://base.next-engine.org/users/sign_in/'; |
|
26 | } |
||
27 | |||
28 | /** |
||
29 | * Returns the base URL for requesting an access token. |
||
30 | * |
||
31 | * Eg. https://oauth.service.com/token |
||
32 | * |
||
33 | * @param array $params |
||
34 | * @return string |
||
35 | */ |
||
36 | 2 | public function getBaseAccessTokenUrl(array $params) |
|
37 | { |
||
38 | 2 | return 'https://api.next-engine.org/api_neauth/'; |
|
39 | } |
||
40 | |||
41 | /** |
||
42 | * Returns the URL for requesting the resource owner's details. |
||
43 | * |
||
44 | * @param AccessToken $token |
||
45 | * @return string |
||
46 | */ |
||
47 | 1 | public function getResourceOwnerDetailsUrl(AccessToken $token) |
|
51 | |||
52 | /** |
||
53 | * Returns the default scopes used by this provider. |
||
54 | * |
||
55 | * This should only be the scopes that are required to request the details |
||
56 | * of the resource owner, rather than all the available scopes. |
||
57 | * |
||
58 | * @return string[] |
||
59 | */ |
||
60 | protected function getDefaultScopes() |
||
64 | |||
65 | /** |
||
66 | * Checks a provider response for errors. |
||
67 | * |
||
68 | * @throws IdentityProviderException |
||
69 | * @param ResponseInterface $response |
||
70 | * @param array|string $data Parsed response data |
||
71 | * @return void |
||
72 | */ |
||
73 | 2 | protected function checkResponse(ResponseInterface $response, $data) |
|
83 | |||
84 | /** |
||
85 | * Returns authorization parameters based on provided options. |
||
86 | * |
||
87 | * @param array $options |
||
88 | * @return array Authorization parameters |
||
89 | */ |
||
90 | 1 | protected function getAuthorizationParameters(array $options) |
|
101 | |||
102 | /** |
||
103 | * Requests an access token using a specified grant and option set. |
||
104 | * |
||
105 | * @param mixed $grant |
||
106 | * @param array $options |
||
107 | * @return AccessToken |
||
108 | */ |
||
109 | 2 | public function getAccessToken($grant, array $options = []) |
|
120 | |||
121 | /** |
||
122 | * Generates a resource owner object from a successful resource owner |
||
123 | * details request. |
||
124 | * |
||
125 | * @param array $response |
||
126 | * @param AccessToken $token |
||
127 | * @return ResourceOwnerInterface |
||
128 | */ |
||
129 | protected function createResourceOwner(array $response, AccessToken $token) |
||
133 | |||
134 | /** |
||
135 | * Requests and returns the resource owner of given access token. |
||
136 | * |
||
137 | * @param AccessToken $token |
||
138 | * @return ResourceOwnerInterface |
||
139 | */ |
||
140 | public function getResourceOwner(AccessToken $token) |
||
144 | } |
||
145 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.