@@ -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 |
@@ -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'; |
|
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @param array $options |
| 17 | 17 | * @return bool |
| 18 | 18 | */ |
| 19 | - public function addPlaylistTracks($playlistId, array $tracks, array $options = []) : bool; |
|
| 19 | + public function addPlaylistTracks($playlistId, array $tracks, array $options = [ ]) : bool; |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * @param string $playlistId |
@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | * @param array $options |
| 31 | 31 | * @return PlaylistDataProvider |
| 32 | 32 | */ |
| 33 | - public function getPlaylist(string $playlistId, array $options = []) : PlaylistDataProvider; |
|
| 33 | + public function getPlaylist(string $playlistId, array $options = [ ]) : PlaylistDataProvider; |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * @param $playlistId |
| 37 | 37 | * @param array $options |
| 38 | 38 | * @return object |
| 39 | 39 | */ |
| 40 | - public function getPlaylistTracks(string $playlistId, array $options = []); |
|
| 40 | + public function getPlaylistTracks(string $playlistId, array $options = [ ]); |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * @param string $userId |
@@ -46,12 +46,12 @@ discard block |
||
| 46 | 46 | * @return PlaylistDataProvider |
| 47 | 47 | * @throws PlaylistNotFound |
| 48 | 48 | */ |
| 49 | - public function getUserPlaylistByName(string $userId, string $playlistName, array $options = []): PlaylistDataProvider; |
|
| 49 | + public function getUserPlaylistByName(string $userId, string $playlistName, array $options = [ ]): PlaylistDataProvider; |
|
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * @param TrackSearchRequestDataProvider $trackSearchRequest |
| 53 | 53 | * @param array $options |
| 54 | 54 | * @return TracksSearchDataProvider |
| 55 | 55 | */ |
| 56 | - public function searchTrack(TrackSearchRequestDataProvider $trackSearchRequest, array $options = []): TracksSearchDataProvider; |
|
| 56 | + public function searchTrack(TrackSearchRequestDataProvider $trackSearchRequest, array $options = [ ]): TracksSearchDataProvider; |
|
| 57 | 57 | } |
| 58 | 58 | \ No newline at end of file |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @param array $options |
| 37 | 37 | * @return bool |
| 38 | 38 | */ |
| 39 | - public function addPlaylistTracks($playlistId, array $tracks, array $options = []): bool |
|
| 39 | + public function addPlaylistTracks($playlistId, array $tracks, array $options = [ ]): bool |
|
| 40 | 40 | { |
| 41 | 41 | return $this->baseSpotifyWebAPI->addPlaylistTracks($playlistId, $tracks, $options); |
| 42 | 42 | } |
@@ -48,18 +48,18 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function deletePlaylistTracks(string $playlistId, array $tracksInfo): bool |
| 50 | 50 | { |
| 51 | - $tracksToDelete = []; |
|
| 51 | + $tracksToDelete = [ ]; |
|
| 52 | 52 | foreach ($tracksInfo as $deleteTrackInfoDataProvider) { |
| 53 | 53 | if (!$deleteTrackInfoDataProvider instanceof DeleteTrackInfoDataProvider) { |
| 54 | 54 | throw new \RuntimeException( |
| 55 | 55 | sprintf('tracksInfo should be instanceof class: %s', DeleteTrackInfoDataProvider::class) |
| 56 | 56 | ); |
| 57 | 57 | } |
| 58 | - $tracksToDelete[] = $deleteTrackInfoDataProvider->toArray(); |
|
| 58 | + $tracksToDelete[ ] = $deleteTrackInfoDataProvider->toArray(); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | $this->baseSpotifyWebAPI->setReturnType(Request::RETURN_OBJECT); |
| 62 | - $delete = (bool)$this->baseSpotifyWebAPI->deletePlaylistTracks($playlistId, $tracksToDelete); |
|
| 62 | + $delete = (bool) $this->baseSpotifyWebAPI->deletePlaylistTracks($playlistId, $tracksToDelete); |
|
| 63 | 63 | $this->baseSpotifyWebAPI->setReturnType(Request::RETURN_ASSOC); |
| 64 | 64 | |
| 65 | 65 | return $delete; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @param array $options |
| 71 | 71 | * @return PlaylistDataProvider |
| 72 | 72 | */ |
| 73 | - public function getPlaylist(string $playlistId, array $options = []): PlaylistDataProvider |
|
| 73 | + public function getPlaylist(string $playlistId, array $options = [ ]): PlaylistDataProvider |
|
| 74 | 74 | { |
| 75 | 75 | $jsonObjectResult = $this->baseSpotifyWebAPI->getPlaylist($playlistId, $options); |
| 76 | 76 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @return PlaylistDataProvider |
| 88 | 88 | * @throws PlaylistNotFound |
| 89 | 89 | */ |
| 90 | - public function getUserPlaylistByName(string $userId, string $playlistName, array $options = []): PlaylistDataProvider |
|
| 90 | + public function getUserPlaylistByName(string $userId, string $playlistName, array $options = [ ]): PlaylistDataProvider |
|
| 91 | 91 | { |
| 92 | 92 | $userPlaylistsDataProvider = $this->getUserPlaylists($userId, $options); |
| 93 | 93 | $playlists = $userPlaylistsDataProvider->getItems(); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * @param array $options |
| 106 | 106 | * @return PlaylistTracksDataProvider |
| 107 | 107 | */ |
| 108 | - public function getPlaylistTracks(string $playlistId, array $options = []): PlaylistTracksDataProvider |
|
| 108 | + public function getPlaylistTracks(string $playlistId, array $options = [ ]): PlaylistTracksDataProvider |
|
| 109 | 109 | { |
| 110 | 110 | $jsonObjectResult = $this->baseSpotifyWebAPI->getPlaylistTracks($playlistId, $options); |
| 111 | 111 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * @param array $options |
| 121 | 121 | * @return TracksSearchDataProvider |
| 122 | 122 | */ |
| 123 | - public function searchTrack(TrackSearchRequestDataProvider $trackSearchRequest, array $options = []): TracksSearchDataProvider |
|
| 123 | + public function searchTrack(TrackSearchRequestDataProvider $trackSearchRequest, array $options = [ ]): TracksSearchDataProvider |
|
| 124 | 124 | { |
| 125 | 125 | $jsonObjectResult = $this->search( |
| 126 | 126 | sprintf( |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | ); |
| 135 | 135 | |
| 136 | 136 | $tracksSearchDataProvider = new TracksSearchDataProvider(); |
| 137 | - $tracksSearchDataProvider->fromArray($jsonObjectResult[$trackSearchRequest->getResultType()]); |
|
| 137 | + $tracksSearchDataProvider->fromArray($jsonObjectResult[ $trackSearchRequest->getResultType() ]); |
|
| 138 | 138 | |
| 139 | 139 | return $tracksSearchDataProvider; |
| 140 | 140 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * @param array $options |
| 146 | 146 | * @return array |
| 147 | 147 | */ |
| 148 | - private function search(string $query, array $type, array $options = []): array |
|
| 148 | + private function search(string $query, array $type, array $options = [ ]): array |
|
| 149 | 149 | { |
| 150 | 150 | return $this->baseSpotifyWebAPI->search($query, $type, $options); |
| 151 | 151 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * @param array $options |
| 156 | 156 | * @return UserPlaylistsDataProvider |
| 157 | 157 | */ |
| 158 | - private function getUserPlaylists(string $userId, array $options = []): UserPlaylistsDataProvider |
|
| 158 | + private function getUserPlaylists(string $userId, array $options = [ ]): UserPlaylistsDataProvider |
|
| 159 | 159 | { |
| 160 | 160 | $userPlaylistInfo = $this->baseSpotifyWebAPI->getUserPlaylists($userId, $options); |
| 161 | 161 | |