1 | <?php |
||
16 | abstract class AbstractConnection implements ConnectionInterface |
||
17 | { |
||
18 | /** |
||
19 | * Default Endpoint. |
||
20 | */ |
||
21 | const DEFAULT_WS_ENDPOINT = 'http://ws.audioscrobbler.com/2.0/'; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $apiKey; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $sharedSecret; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $uri; |
||
37 | |||
38 | /** |
||
39 | * AbstractConnection constructor. |
||
40 | * |
||
41 | * @param string $apikey |
||
42 | * @param string $sharedSecret |
||
43 | * @param string $uri |
||
44 | */ |
||
45 | public function __construct($apikey, $sharedSecret, $uri = null) |
||
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | public function signedCall($method, array $params = array(), SessionInterface $session = null, $requestMethod = 'GET') |
||
81 | |||
82 | /** |
||
83 | * {@inheritdoc} |
||
84 | */ |
||
85 | public function unsignedCall($method, array $params = array(), $requestMethod = 'GET') |
||
99 | |||
100 | /** |
||
101 | * {@inheritdoc} |
||
102 | */ |
||
103 | public function getApiKey() |
||
107 | |||
108 | /** |
||
109 | * {@inheritdoc} |
||
110 | */ |
||
111 | public function getSharedSecret() |
||
115 | |||
116 | /** |
||
117 | * Performs the webservice call. |
||
118 | * |
||
119 | * @param array $params |
||
120 | * @param string $requestMethod |
||
121 | * |
||
122 | * @return array |
||
123 | * |
||
124 | * @throws ApiException |
||
125 | */ |
||
126 | abstract protected function call(array $params, $requestMethod = 'GET'); |
||
127 | |||
128 | /** |
||
129 | * Filter null values. |
||
130 | * |
||
131 | * @param array $object |
||
132 | * |
||
133 | * @return array |
||
134 | */ |
||
135 | private function filterNull($object) |
||
141 | |||
142 | /** Converts any string or array of strings to UTF8. |
||
143 | * @param mixed $object a String or an array |
||
144 | * |
||
145 | * @return mixed uTF8-string or array |
||
146 | */ |
||
147 | private function encodeUTF8($object) |
||
155 | |||
156 | /** |
||
157 | * {@inheritdoc} |
||
158 | */ |
||
159 | private function signParams(array $params) |
||
171 | } |
||
172 |
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.