1 | <?php |
||
9 | trait BaseClientTrait |
||
10 | { |
||
11 | abstract protected function getInternalCredential(); |
||
12 | abstract protected function getInternalOptions(); |
||
13 | abstract protected function getInternalCurl(); |
||
16 | abstract protected function setInternalCurl(CurlInitializer $curl); |
||
17 | |||
18 | 69 | public function __construct(array $credentials, array $options = []) |
|
19 | 69 | { |
|
24 | |||
25 | 10 | public function offsetGet($offset) |
|
29 | |||
30 | public function offsetSet($offset, $value) |
||
31 | { |
||
32 | return $this->getInternalCredential()->offsetSet($offset, $value); |
||
33 | } |
||
34 | |||
35 | public function offsetUnset($offset) |
||
36 | { |
||
37 | return $this->getInternalCredential()->offsetUnset($offset); |
||
38 | } |
||
39 | |||
40 | public function offsetExists($offset) |
||
41 | { |
||
42 | return $this->getInternalCredential()->offsetExists($offset); |
||
43 | } |
||
44 | |||
45 | public function __get($key) |
||
46 | { |
||
47 | return $this->getInternalCredential()->$key; |
||
48 | } |
||
49 | |||
50 | public function __isset($key) |
||
51 | { |
||
52 | return isset($this->getInternalCredential()->$key); |
||
53 | } |
||
54 | |||
55 | 12 | public function withCredentials(array $credentials) |
|
62 | |||
63 | 6 | public function withOptions(array $options) |
|
70 | |||
71 | public function getCredentials($assoc = false) |
||
72 | { |
||
73 | return $this->getInternalCredential()->toArray($assoc); |
||
74 | } |
||
75 | |||
76 | public function getOptions($stringify = false) |
||
77 | { |
||
78 | return $stringify ? CurlOptionNormalizer::stringifyAll($this->getInternalOptions()) : $this->getInternalOptions(); |
||
79 | } |
||
80 | |||
81 | 4 | public function getAuthorizeUrl($force_login = false) |
|
85 | |||
86 | public function getAuthenticateUrl($force_login = false) |
||
87 | { |
||
88 | return $this->getInternalCredential()->getAuthenticateUrl($force_login); |
||
89 | } |
||
90 | } |
||
91 |