1 | <?php |
||
14 | class Etsy extends AbstractService |
||
15 | { |
||
16 | |||
17 | protected $scopes = array(); |
||
18 | |||
19 | public function __construct( |
||
20 | CredentialsInterface $credentials, |
||
21 | ClientInterface $httpClient, |
||
22 | TokenStorageInterface $storage, |
||
23 | SignatureInterface $signature, |
||
24 | UriInterface $baseApiUri = null |
||
25 | ) { |
||
26 | parent::__construct($credentials, $httpClient, $storage, $signature, $baseApiUri); |
||
27 | |||
28 | if (null === $baseApiUri) { |
||
29 | $this->baseApiUri = new Uri('https://openapi.etsy.com/v2/'); |
||
30 | } |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * {@inheritdoc} |
||
35 | */ |
||
36 | public function getRequestTokenEndpoint() |
||
37 | { |
||
38 | $uri = new Uri($this->baseApiUri . 'oauth/request_token'); |
||
39 | $scopes = $this->getScopes(); |
||
40 | |||
41 | if (count($scopes)) { |
||
42 | $uri->setQuery('scope=' . implode('%20', $scopes)); |
||
43 | } |
||
44 | |||
45 | return $uri; |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | */ |
||
51 | public function getAuthorizationEndpoint() |
||
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | public function getAccessTokenEndpoint() |
||
63 | |||
64 | /** |
||
65 | * Set the scopes for permissions |
||
66 | * @see https://www.etsy.com/developers/documentation/getting_started/oauth#section_permission_scopes |
||
67 | * @param array $scopes |
||
68 | * |
||
69 | * @return $this |
||
70 | */ |
||
71 | public function setScopes(array $scopes) |
||
80 | |||
81 | /** |
||
82 | * Return the defined scopes |
||
83 | * @return array |
||
84 | */ |
||
85 | public function getScopes() |
||
89 | } |
||
90 |
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.