@@ -53,7 +53,7 @@ |
||
53 | 53 | */ |
54 | 54 | public function getAccessByRefreshToken(string $refreshAccessToken) : string |
55 | 55 | { |
56 | - if( $this->session->refreshAccessToken($refreshAccessToken) !== true ) { |
|
56 | + if ($this->session->refreshAccessToken($refreshAccessToken) !== true) { |
|
57 | 57 | throw new \RuntimeException(Message::ERROR_GET_REFRESH_TOKEN_BY_CODE); |
58 | 58 | } |
59 | 59 | return $this->session->getAccessToken(); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | * @param array $options |
27 | 27 | * @return string |
28 | 28 | */ |
29 | - public function getAuthorizeUrl(array $options = []) : string |
|
29 | + public function getAuthorizeUrl(array $options = [ ]) : string |
|
30 | 30 | { |
31 | 31 | return $this->baseSession->getAuthorizeUrl($options); |
32 | 32 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | * @param array $options |
10 | 10 | * @return string |
11 | 11 | */ |
12 | - public function getAuthorizeUrl(array $options = []): string; |
|
12 | + public function getAuthorizeUrl(array $options = [ ]): string; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * @param string $authorizationCode |
@@ -2,10 +2,10 @@ |
||
2 | 2 | |
3 | 3 | use \Xervice\DataProvider\DataProviderConfig; |
4 | 4 | |
5 | -$config[DataProviderConfig::DATA_PROVIDER_GENERATED_PATH] = dirname(__DIR__) . '/src/Domain/DataTransferObject'; |
|
5 | +$config[ DataProviderConfig::DATA_PROVIDER_GENERATED_PATH ] = dirname(__DIR__).'/src/Domain/DataTransferObject'; |
|
6 | 6 | |
7 | -$config[DataProviderConfig::DATA_PROVIDER_PATHS] = [ |
|
8 | - __DIR__ . '/xervice/schema' |
|
7 | +$config[ DataProviderConfig::DATA_PROVIDER_PATHS ] = [ |
|
8 | + __DIR__.'/xervice/schema' |
|
9 | 9 | ]; |
10 | 10 | |
11 | -$config[DataProviderConfig::DATA_PROVIDER_NAMESPACE] = 'SpotifyApiConnect\\Domain\\DataTransferObject'; |
|
12 | 11 | \ No newline at end of file |
12 | +$config[ DataProviderConfig::DATA_PROVIDER_NAMESPACE ] = 'SpotifyApiConnect\\Domain\\DataTransferObject'; |
|
13 | 13 | \ No newline at end of file |
@@ -34,17 +34,17 @@ |
||
34 | 34 | |
35 | 35 | $this->assertNotEmpty($redirectUrl, 'authorize url from spotify is empty'); |
36 | 36 | $parseRedirectUrl = parse_url($redirectUrl); |
37 | - $this->assertSame('accounts.spotify.com', $parseRedirectUrl['host']); |
|
38 | - $this->assertSame('/authorize', $parseRedirectUrl['path']); |
|
37 | + $this->assertSame('accounts.spotify.com', $parseRedirectUrl[ 'host' ]); |
|
38 | + $this->assertSame('/authorize', $parseRedirectUrl[ 'path' ]); |
|
39 | 39 | |
40 | - $this->assertNotEmpty($parseRedirectUrl['query']); |
|
40 | + $this->assertNotEmpty($parseRedirectUrl[ 'query' ]); |
|
41 | 41 | |
42 | - $info = []; |
|
43 | - parse_str($parseRedirectUrl['query'], $info); |
|
42 | + $info = [ ]; |
|
43 | + parse_str($parseRedirectUrl[ 'query' ], $info); |
|
44 | 44 | |
45 | - $this->assertSame('code', $info['response_type']); |
|
46 | - $this->assertSame('http://localhost/', $info['redirect_uri']); |
|
47 | - $this->assertTrue(isset($info['client_id'])); |
|
45 | + $this->assertSame('code', $info[ 'response_type' ]); |
|
46 | + $this->assertSame('http://localhost/', $info[ 'redirect_uri' ]); |
|
47 | + $this->assertTrue(isset($info[ 'client_id' ])); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | public function testRefreshAccessToken() |
@@ -1,3 +1,3 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require __DIR__ . '/../vendor/autoload.php'; |
|
3 | +require __DIR__.'/../vendor/autoload.php'; |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | public function getClientId(): string |
14 | 14 | { |
15 | - $clientId = (string)getenv('CLIENT_ID'); |
|
15 | + $clientId = (string) getenv('CLIENT_ID'); |
|
16 | 16 | if (empty($clientId)) { |
17 | 17 | throw new RuntimeException( |
18 | 18 | sprintf(Message::ERROR_GET_ENV_VARIABLE, 'CLIENT_ID') |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function getClientSecret(): string |
29 | 29 | { |
30 | - $clientSecret = (string)getenv('CLIENT_SECRET'); |
|
30 | + $clientSecret = (string) getenv('CLIENT_SECRET'); |
|
31 | 31 | if (empty($clientSecret)) { |
32 | 32 | throw new RuntimeException( |
33 | 33 | sprintf(Message::ERROR_GET_ENV_VARIABLE, 'CLIENT_SECRET') |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function getRedirectUri(): string |
44 | 44 | { |
45 | - $redirectUri = (string)getenv('REDIRECT_URI'); |
|
45 | + $redirectUri = (string) getenv('REDIRECT_URI'); |
|
46 | 46 | if (empty($redirectUri)) { |
47 | 47 | throw new RuntimeException( |
48 | 48 | sprintf(Message::ERROR_GET_ENV_VARIABLE, 'REDIRECT_URI') |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function getSpotifyUsername(): string |
59 | 59 | { |
60 | - $spotifyUsername = (string)getenv('SPOTIFY_USERNAME'); |
|
60 | + $spotifyUsername = (string) getenv('SPOTIFY_USERNAME'); |
|
61 | 61 | if (empty($spotifyUsername)) { |
62 | 62 | throw new RuntimeException( |
63 | 63 | sprintf(Message::ERROR_GET_ENV_VARIABLE, 'SPOTIFY_USERNAME') |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @param array $options |
51 | 51 | * @return bool |
52 | 52 | */ |
53 | - public function addPlaylistTracks($playlistId, array $tracks, array $options = []): bool |
|
53 | + public function addPlaylistTracks($playlistId, array $tracks, array $options = [ ]): bool |
|
54 | 54 | { |
55 | 55 | return $this->baseSpotifyWebAPI->addPlaylistTracks($playlistId, $tracks, $options); |
56 | 56 | } |
@@ -62,18 +62,18 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function deletePlaylistTracks(string $playlistId, array $tracksInfo): bool |
64 | 64 | { |
65 | - $tracksToDelete = []; |
|
65 | + $tracksToDelete = [ ]; |
|
66 | 66 | foreach ($tracksInfo as $deleteTrackInfoDataProvider) { |
67 | 67 | if (!$deleteTrackInfoDataProvider instanceof DeleteTrackInfoDataProvider) { |
68 | 68 | throw new RuntimeException( |
69 | 69 | sprintf(Message::ERROR_DELETE_PLAYLIST_TRACKS, DeleteTrackInfoDataProvider::class) |
70 | 70 | ); |
71 | 71 | } |
72 | - $tracksToDelete[] = $deleteTrackInfoDataProvider->toArray(); |
|
72 | + $tracksToDelete[ ] = $deleteTrackInfoDataProvider->toArray(); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | $this->baseSpotifyWebAPI->setReturnType(Request::RETURN_OBJECT); |
76 | - $delete = (bool)$this->baseSpotifyWebAPI->deletePlaylistTracks($playlistId, $tracksToDelete); |
|
76 | + $delete = (bool) $this->baseSpotifyWebAPI->deletePlaylistTracks($playlistId, $tracksToDelete); |
|
77 | 77 | $this->baseSpotifyWebAPI->setReturnType(Request::RETURN_ASSOC); |
78 | 78 | |
79 | 79 | return $delete; |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | * @param array $options |
85 | 85 | * @return PlaylistDataProvider |
86 | 86 | */ |
87 | - public function getPlaylist(string $playlistId, array $options = []): PlaylistDataProvider |
|
87 | + public function getPlaylist(string $playlistId, array $options = [ ]): PlaylistDataProvider |
|
88 | 88 | { |
89 | - $jsonObjectResult = (array)$this->baseSpotifyWebAPI->getPlaylist($playlistId, $options); |
|
89 | + $jsonObjectResult = (array) $this->baseSpotifyWebAPI->getPlaylist($playlistId, $options); |
|
90 | 90 | |
91 | 91 | $playlistDataProvider = new PlaylistDataProvider(); |
92 | 92 | $playlistDataProvider->fromArray($jsonObjectResult); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @return PlaylistDataProvider |
101 | 101 | * @throws PlaylistNotFound |
102 | 102 | */ |
103 | - public function getUserPlaylistByName(string $playlistName, array $options = []): PlaylistDataProvider |
|
103 | + public function getUserPlaylistByName(string $playlistName, array $options = [ ]): PlaylistDataProvider |
|
104 | 104 | { |
105 | 105 | $userPlaylistsDataProvider = $this->getUserPlaylists($options); |
106 | 106 | $playlists = $userPlaylistsDataProvider->getItems(); |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | * @param array $options |
119 | 119 | * @return PlaylistTracksDataProvider |
120 | 120 | */ |
121 | - public function getPlaylistTracks(string $playlistId, array $options = []): PlaylistTracksDataProvider |
|
121 | + public function getPlaylistTracks(string $playlistId, array $options = [ ]): PlaylistTracksDataProvider |
|
122 | 122 | { |
123 | - $jsonObjectResult = (array)$this->baseSpotifyWebAPI->getPlaylistTracks($playlistId, $options); |
|
123 | + $jsonObjectResult = (array) $this->baseSpotifyWebAPI->getPlaylistTracks($playlistId, $options); |
|
124 | 124 | |
125 | 125 | $playlistTracksDataProvider = new PlaylistTracksDataProvider(); |
126 | 126 | $playlistTracksDataProvider->fromArray($jsonObjectResult); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param array $options |
134 | 134 | * @return TracksSearchDataProvider |
135 | 135 | */ |
136 | - public function searchTrack(TrackSearchRequestDataProvider $trackSearchRequest, array $options = []): TracksSearchDataProvider |
|
136 | + public function searchTrack(TrackSearchRequestDataProvider $trackSearchRequest, array $options = [ ]): TracksSearchDataProvider |
|
137 | 137 | { |
138 | 138 | $jsonObjectResult = $this->search( |
139 | 139 | sprintf( |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | ); |
148 | 148 | |
149 | 149 | $tracksSearchDataProvider = new TracksSearchDataProvider(); |
150 | - $tracksSearchDataProvider->fromArray($jsonObjectResult[$trackSearchRequest->getResultType()]); |
|
150 | + $tracksSearchDataProvider->fromArray($jsonObjectResult[ $trackSearchRequest->getResultType() ]); |
|
151 | 151 | |
152 | 152 | return $tracksSearchDataProvider; |
153 | 153 | } |
@@ -158,18 +158,18 @@ discard block |
||
158 | 158 | * @param array $options |
159 | 159 | * @return array |
160 | 160 | */ |
161 | - private function search(string $query, array $type, array $options = []): array |
|
161 | + private function search(string $query, array $type, array $options = [ ]): array |
|
162 | 162 | { |
163 | - return (array)$this->baseSpotifyWebAPI->search($query, $type, $options); |
|
163 | + return (array) $this->baseSpotifyWebAPI->search($query, $type, $options); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
167 | 167 | * @param array $options |
168 | 168 | * @return UserPlaylistsDataProvider |
169 | 169 | */ |
170 | - private function getUserPlaylists(array $options = []): UserPlaylistsDataProvider |
|
170 | + private function getUserPlaylists(array $options = [ ]): UserPlaylistsDataProvider |
|
171 | 171 | { |
172 | - $userPlaylistInfo = (array)$this->baseSpotifyWebAPI->getUserPlaylists($this->spotifyUsername, $options); |
|
172 | + $userPlaylistInfo = (array) $this->baseSpotifyWebAPI->getUserPlaylists($this->spotifyUsername, $options); |
|
173 | 173 | |
174 | 174 | $userPlaylistsDataProvider = new UserPlaylistsDataProvider(); |
175 | 175 | $userPlaylistsDataProvider->fromArray($userPlaylistInfo); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | { |
27 | 27 | $this->config = new Config(); |
28 | 28 | foreach ($this->env as $envName => $envValue) { |
29 | - $this->env[$envName] = getenv($envName); |
|
29 | + $this->env[ $envName ] = getenv($envName); |
|
30 | 30 | putenv($envName.'=0'); |
31 | 31 | } |
32 | 32 | parent::setUp(); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | { |
45 | 45 | $envValue = 'UnitSecret'; |
46 | 46 | putenv('CLIENT_SECRET='.$envValue); |
47 | - $this->assertSame($envValue,$this->config->getClientSecret()); |
|
47 | + $this->assertSame($envValue, $this->config->getClientSecret()); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | public function testGetClientSecretException() |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | { |
58 | 58 | $envValue = 'UnitId'; |
59 | 59 | putenv('CLIENT_ID='.$envValue); |
60 | - $this->assertSame($envValue,$this->config->getClientId()); |
|
60 | + $this->assertSame($envValue, $this->config->getClientId()); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | public function testGetClientIdException() |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | $envValue = 'UnitRedirectUri'; |
72 | 72 | putenv('REDIRECT_URI='.$envValue); |
73 | - $this->assertSame($envValue,$this->config->getRedirectUri()); |
|
73 | + $this->assertSame($envValue, $this->config->getRedirectUri()); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | public function testGetRedirectUriException() |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | { |
84 | 84 | $envValue = 'UnitSpotifyUserName'; |
85 | 85 | putenv('SPOTIFY_USERNAME='.$envValue); |
86 | - $this->assertSame($envValue,$this->config->getSpotifyUsername()); |
|
86 | + $this->assertSame($envValue, $this->config->getSpotifyUsername()); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | public function testGetSpotifyUsernameException() |