Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

Commit 0388800

Browse files
committed
:octocat: LastFM: removes superfluous method requestParams()
1 parent 062acd9 commit 0388800

File tree

2 files changed

+9
-33
lines changed

2 files changed

+9
-33
lines changed

src/LastFM/LastFM.php

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -186,27 +186,6 @@ protected function parseTokenResponse(ResponseInterface $response):AccessToken{
186186
return $token;
187187
}
188188

189-
/**
190-
* @param string $apiMethod
191-
* @param array $params
192-
* @param array $body
193-
*
194-
* @return array
195-
*/
196-
protected function requestParams(string $apiMethod, array $params, array $body):array{
197-
198-
$params = array_merge($params, $body, [
199-
'method' => $apiMethod,
200-
'format' => 'json',
201-
'api_key' => $this->options->key,
202-
'sk' => $this->storage->getAccessToken($this->serviceName)->accessToken,
203-
]);
204-
205-
$params['api_sig'] = $this->getSignature($params);
206-
207-
return $params;
208-
}
209-
210189
/**
211190
* @inheritDoc
212191
*/
@@ -218,7 +197,15 @@ public function request(
218197
array $headers = null
219198
):ResponseInterface{
220199
$method ??= 'GET';
221-
$params = $this->requestParams($path, $params ?? [], $body ?? []);
200+
201+
$params = array_merge(($params ?? []), ($body ?? []), [
202+
'method' => $path,
203+
'format' => 'json',
204+
'api_key' => $this->options->key,
205+
'sk' => $this->storage->getAccessToken($this->serviceName)->accessToken,
206+
]);
207+
208+
$params['api_sig'] = $this->getSignature($params);
222209

223210
if($method === 'POST'){
224211
$body = $params;

tests/LastFM/LastFMTest.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,6 @@ public function testParseTokenResponseNoToken():void{
9191
->invokeArgs($this->provider, [$r]);
9292
}
9393

94-
public function testRequestParams():void{
95-
$params = $this
96-
->getMethod('requestParams')
97-
->invokeArgs($this->provider, ['whatever', ['foo' => 'bar'], []]);
98-
99-
$this::assertSame('310be19b3ff6967ca8425666753019fb', $params['api_sig']);
100-
$this::assertSame($this->options->key, $params['api_key']);
101-
$this::assertSame('whatever', $params['method']);
102-
$this::assertSame('bar', $params['foo']);
103-
}
104-
10594
public function testGetAccessToken():void{
10695
$this->setProperty($this->provider, 'apiURL', '/lastfm/auth');
10796

0 commit comments

Comments
 (0)