@@ -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 |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | { |
| 16 | 16 | public function __construct() |
| 17 | 17 | { |
| 18 | - $envFile = __DIR__ . '/../.env'; |
|
| 18 | + $envFile = __DIR__.'/../.env'; |
|
| 19 | 19 | if (!file_exists($envFile)) { |
| 20 | 20 | throw new \RuntimeException('Pleas create ".env"-File and fill this file with info'); |
| 21 | 21 | } |
@@ -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 |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @param array $options |
| 17 | 17 | * @return bool |
| 18 | 18 | */ |
| 19 | - public function addUserPlaylistTracks(string $userId, string $playlistId, array $tracks, array $options = []); |
|
| 19 | + public function addUserPlaylistTracks(string $userId, string $playlistId, array $tracks, array $options = [ ]); |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * @param string $userId |
@@ -32,14 +32,14 @@ discard block |
||
| 32 | 32 | * @param array $options |
| 33 | 33 | * @return PlaylistDataProvider |
| 34 | 34 | */ |
| 35 | - public function getPlaylist(string $playlistId, array $options = []) : PlaylistDataProvider; |
|
| 35 | + public function getPlaylist(string $playlistId, array $options = [ ]) : PlaylistDataProvider; |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @param string $userId |
| 39 | 39 | * @param array $options |
| 40 | 40 | * @return object |
| 41 | 41 | */ |
| 42 | - public function getUserPlaylists(string $userId, array $options = []); |
|
| 42 | + public function getUserPlaylists(string $userId, array $options = [ ]); |
|
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * @param string $userId |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * @param array $options |
| 48 | 48 | * @return object |
| 49 | 49 | */ |
| 50 | - public function getPlaylistTracks(string $playlistId, array $options = []); |
|
| 50 | + public function getPlaylistTracks(string $playlistId, array $options = [ ]); |
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * @param string $query |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @param array $options |
| 56 | 56 | * @return object |
| 57 | 57 | */ |
| 58 | - public function search(string $query, array $type, array $options = []); |
|
| 58 | + public function search(string $query, array $type, array $options = [ ]); |
|
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * @param string $accessToken |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * @param array $options |
| 29 | 29 | * @return bool |
| 30 | 30 | */ |
| 31 | - public function addUserPlaylistTracks(string $userId, string $playlistId, array $tracks, array $options = []) |
|
| 31 | + public function addUserPlaylistTracks(string $userId, string $playlistId, array $tracks, array $options = [ ]) |
|
| 32 | 32 | { |
| 33 | 33 | return $this->baseSpotifyWebAPI->addUserPlaylistTracks($userId, $playlistId, $tracks, $options); |
| 34 | 34 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @param array $options |
| 51 | 51 | * @return PlaylistDataProvider |
| 52 | 52 | */ |
| 53 | - public function getPlaylist(string $playlistId, array $options = []): PlaylistDataProvider |
|
| 53 | + public function getPlaylist(string $playlistId, array $options = [ ]): PlaylistDataProvider |
|
| 54 | 54 | { |
| 55 | 55 | $this->baseSpotifyWebAPI->setReturnType(Request::RETURN_ASSOC); |
| 56 | 56 | $jsonObjectResult = $this->baseSpotifyWebAPI->getPlaylist($playlistId, $options); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @param array $options |
| 69 | 69 | * @return array|object |
| 70 | 70 | */ |
| 71 | - public function getUserPlaylists(string $userId, array $options = []) |
|
| 71 | + public function getUserPlaylists(string $userId, array $options = [ ]) |
|
| 72 | 72 | { |
| 73 | 73 | return $this->baseSpotifyWebAPI->getUserPlaylists($userId, $options); |
| 74 | 74 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @param array $options |
| 79 | 79 | * @return PlaylistTracksDataProvider |
| 80 | 80 | */ |
| 81 | - public function getPlaylistTracks(string $playlistId, array $options = []) : PlaylistTracksDataProvider |
|
| 81 | + public function getPlaylistTracks(string $playlistId, array $options = [ ]) : PlaylistTracksDataProvider |
|
| 82 | 82 | { |
| 83 | 83 | $this->baseSpotifyWebAPI->setReturnType(Request::RETURN_ASSOC); |
| 84 | 84 | $jsonObjectResult = $this->baseSpotifyWebAPI->getPlaylistTracks($playlistId, $options); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @param array $options |
| 97 | 97 | * @return array|object |
| 98 | 98 | */ |
| 99 | - public function search(string $query, array $type, array $options = []) |
|
| 99 | + public function search(string $query, array $type, array $options = [ ]) |
|
| 100 | 100 | { |
| 101 | 101 | return $this->baseSpotifyWebAPI->search($query, $type, $options); |
| 102 | 102 | } |
@@ -59,18 +59,18 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | public function testGetUserPlaylists(): void |
| 61 | 61 | { |
| 62 | - $spotifyPlayLists = $this->spotifyWebApi->getUserPlaylists(static::spotifyInfo['user']); |
|
| 62 | + $spotifyPlayLists = $this->spotifyWebApi->getUserPlaylists(static::spotifyInfo[ 'user' ]); |
|
| 63 | 63 | $playlistId = false; |
| 64 | - $items = (array)$spotifyPlayLists->items; |
|
| 64 | + $items = (array) $spotifyPlayLists->items; |
|
| 65 | 65 | foreach ($items as $item) { |
| 66 | 66 | |
| 67 | - if (trim($item->name) === static::spotifyInfo['playlistName']) { |
|
| 67 | + if (trim($item->name) === static::spotifyInfo[ 'playlistName' ]) { |
|
| 68 | 68 | $playlistId = $item->id; |
| 69 | 69 | break; |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - $this->assertSame(static::spotifyInfo['playlistId'], $playlistId); |
|
| 73 | + $this->assertSame(static::spotifyInfo[ 'playlistId' ], $playlistId); |
|
| 74 | 74 | $this->assertTrue($items > 5); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -85,12 +85,12 @@ discard block |
||
| 85 | 85 | public function testGetPlaylist(): void |
| 86 | 86 | { |
| 87 | 87 | $spotifyPlayList = $this->spotifyWebApi->getPlaylist( |
| 88 | - static::spotifyInfo['playlistId'] |
|
| 88 | + static::spotifyInfo[ 'playlistId' ] |
|
| 89 | 89 | ); |
| 90 | - $this->assertSame(static::spotifyInfo['playlistId'], $spotifyPlayList->getId()); |
|
| 91 | - $this->assertSame(static::spotifyInfo['playlistName'], $spotifyPlayList->getName()); |
|
| 90 | + $this->assertSame(static::spotifyInfo[ 'playlistId' ], $spotifyPlayList->getId()); |
|
| 91 | + $this->assertSame(static::spotifyInfo[ 'playlistName' ], $spotifyPlayList->getName()); |
|
| 92 | 92 | $this->assertTrue($spotifyPlayList->getPublic()); |
| 93 | - $this->assertSame('U2', $spotifyPlayList->getTracks()->getItems()[0]->getTrack()->getArtists()[0]->getName()); |
|
| 93 | + $this->assertSame('U2', $spotifyPlayList->getTracks()->getItems()[ 0 ]->getTrack()->getArtists()[ 0 ]->getName()); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | public function testGetNoExistUserPlaylist(): void |
@@ -112,16 +112,16 @@ discard block |
||
| 112 | 112 | public function testSearch() |
| 113 | 113 | { |
| 114 | 114 | $searchResult = $this->spotifyWebApi->search( |
| 115 | - sprintf('track:%s artist:%s', static::spotifySong['track'], static::spotifySong['artist']), ['track'] |
|
| 115 | + sprintf('track:%s artist:%s', static::spotifySong[ 'track' ], static::spotifySong[ 'artist' ]), [ 'track' ] |
|
| 116 | 116 | ); |
| 117 | 117 | |
| 118 | - $this->assertSame(strtolower(static::spotifySong['track']), strtolower($searchResult->tracks->items[0]->name)); |
|
| 118 | + $this->assertSame(strtolower(static::spotifySong[ 'track' ]), strtolower($searchResult->tracks->items[ 0 ]->name)); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | public function testSearchNotFound() |
| 122 | 122 | { |
| 123 | 123 | $searchNoResult = $this->spotifyWebApi->search( |
| 124 | - sprintf('track:%s artist:%s', 'NotFound-Track-For_UNITtest', 'NotFOundArtistForUnitTest'), ['track'] |
|
| 124 | + sprintf('track:%s artist:%s', 'NotFound-Track-For_UNITtest', 'NotFOundArtistForUnitTest'), [ 'track' ] |
|
| 125 | 125 | ); |
| 126 | 126 | $this->assertSame(0, $searchNoResult->tracks->total); |
| 127 | 127 | $this->assertEmpty($searchNoResult->tracks->items); |
@@ -130,29 +130,29 @@ discard block |
||
| 130 | 130 | public function testAddUserPlaylistTracks() |
| 131 | 131 | { |
| 132 | 132 | $addResult = $this->spotifyWebApi->addUserPlaylistTracks( |
| 133 | - static::spotifyInfo['user'], |
|
| 134 | - static::spotifyInfo['playlistId'], |
|
| 133 | + static::spotifyInfo[ 'user' ], |
|
| 134 | + static::spotifyInfo[ 'playlistId' ], |
|
| 135 | 135 | [ |
| 136 | - static::spotifySong['trackId'] |
|
| 136 | + static::spotifySong[ 'trackId' ] |
|
| 137 | 137 | ] |
| 138 | 138 | ); |
| 139 | 139 | $this->assertTrue($addResult); |
| 140 | 140 | |
| 141 | 141 | $spotifyPlayList = $this->spotifyWebApi->getPlaylistTracks( |
| 142 | - static::spotifyInfo['playlistId'] |
|
| 142 | + static::spotifyInfo[ 'playlistId' ] |
|
| 143 | 143 | ); |
| 144 | 144 | |
| 145 | 145 | $this->assertNotEmpty($spotifyPlayList->getItems()); |
| 146 | 146 | $this->assertNotEmpty($spotifyPlayList->getTotal()); |
| 147 | - $this->assertSame(static::spotifySong['trackId'], $spotifyPlayList->getItems()[1]->getTrack()->getId()); |
|
| 147 | + $this->assertSame(static::spotifySong[ 'trackId' ], $spotifyPlayList->getItems()[ 1 ]->getTrack()->getId()); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | public function testAddUserPlaylistTracksNotExistTrackId() |
| 151 | 151 | { |
| 152 | 152 | try { |
| 153 | 153 | $this->spotifyWebApi->addUserPlaylistTracks( |
| 154 | - static::spotifyInfo['user'], |
|
| 155 | - static::spotifyInfo['playlistId'], |
|
| 154 | + static::spotifyInfo[ 'user' ], |
|
| 155 | + static::spotifyInfo[ 'playlistId' ], |
|
| 156 | 156 | [ |
| 157 | 157 | 'uniTest-Not_FOUND--ID' |
| 158 | 158 | ] |
@@ -171,24 +171,24 @@ discard block |
||
| 171 | 171 | public function testDeleteUserPlaylistTracks() |
| 172 | 172 | { |
| 173 | 173 | $spotifyPlayList = $this->spotifyWebApi->getPlaylistTracks( |
| 174 | - static::spotifyInfo['playlistId'] |
|
| 174 | + static::spotifyInfo[ 'playlistId' ] |
|
| 175 | 175 | ); |
| 176 | 176 | |
| 177 | 177 | $this->assertCount(2, $spotifyPlayList->getItems()); |
| 178 | 178 | $this->assertSame(2, $spotifyPlayList->getTotal()); |
| 179 | 179 | |
| 180 | 180 | $this->spotifyWebApi->deleteUserPlaylistTracks( |
| 181 | - static::spotifyInfo['user'], |
|
| 182 | - static::spotifyInfo['playlistId'], |
|
| 181 | + static::spotifyInfo[ 'user' ], |
|
| 182 | + static::spotifyInfo[ 'playlistId' ], |
|
| 183 | 183 | [ |
| 184 | 184 | [ |
| 185 | - 'id' => static::spotifySong['trackId'] |
|
| 185 | + 'id' => static::spotifySong[ 'trackId' ] |
|
| 186 | 186 | ] |
| 187 | 187 | ] |
| 188 | 188 | ); |
| 189 | 189 | |
| 190 | 190 | $spotifyPlayList = $this->spotifyWebApi->getPlaylistTracks( |
| 191 | - static::spotifyInfo['playlistId'] |
|
| 191 | + static::spotifyInfo[ 'playlistId' ] |
|
| 192 | 192 | ); |
| 193 | 193 | |
| 194 | 194 | $this->assertCount(1, $spotifyPlayList->getItems()); |
@@ -199,8 +199,8 @@ discard block |
||
| 199 | 199 | { |
| 200 | 200 | try { |
| 201 | 201 | $this->spotifyWebApi->deleteUserPlaylistTracks( |
| 202 | - static::spotifyInfo['user'], |
|
| 203 | - static::spotifyInfo['playlistId'], |
|
| 202 | + static::spotifyInfo[ 'user' ], |
|
| 203 | + static::spotifyInfo[ 'playlistId' ], |
|
| 204 | 204 | [ |
| 205 | 205 | [ |
| 206 | 206 | 'id' => 'uniTest-Not_FOUND--ID' |
@@ -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() |