1 | <?php |
||
9 | |||
10 | abstract class GrantTypeBase implements GrantTypeInterface |
||
11 | { |
||
12 | const CONFIG_TOKEN_URL = 'token_url'; |
||
13 | const CONFIG_CLIENT_ID = 'client_id'; |
||
14 | const CONFIG_CLIENT_SECRET = 'client_secret'; |
||
15 | const CONFIG_AUTH_LOCATION = 'auth_location'; |
||
16 | |||
17 | const GRANT_TYPE = 'grant_type'; |
||
18 | |||
19 | const MISSING_ARGUMENT = 'The config is missing the following key: "%s"'; |
||
20 | |||
21 | /** |
||
22 | * @var ClientInterface The token endpoint client |
||
23 | */ |
||
24 | protected $client; |
||
25 | |||
26 | /** |
||
27 | * @var array Configuration settings |
||
28 | */ |
||
29 | protected $config; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $grantType = ''; |
||
35 | |||
36 | /** |
||
37 | * @param ClientInterface $client |
||
38 | * @param array $config |
||
39 | */ |
||
40 | 18 | public function __construct(ClientInterface $client, array $config = []) |
|
51 | |||
52 | /** |
||
53 | * Get default configuration items. |
||
54 | * |
||
55 | * @return array |
||
56 | */ |
||
57 | 18 | protected function getDefaults() |
|
65 | |||
66 | /** |
||
67 | * Get required configuration items. |
||
68 | * |
||
69 | * @return string[] |
||
70 | */ |
||
71 | 18 | protected function getRequired() |
|
78 | |||
79 | /** |
||
80 | * Get additional options, if any. |
||
81 | * |
||
82 | * @return array|null |
||
83 | */ |
||
84 | 5 | protected function getAdditionalOptions() |
|
88 | |||
89 | /** |
||
90 | * @return array |
||
91 | */ |
||
92 | public function getConfig() |
||
93 | { |
||
94 | return $this->config; |
||
95 | } |
||
139 |