@@ -52,15 +52,15 @@ discard block |
||
| 52 | 52 | * @param array $options |
| 53 | 53 | * @return bool |
| 54 | 54 | */ |
| 55 | - public function addPlaylistTracks($playlistId, array $tracks, array $options = []): bool |
|
| 55 | + public function addPlaylistTracks($playlistId, array $tracks, array $options = [ ]): bool |
|
| 56 | 56 | { |
| 57 | - $trackIds = []; |
|
| 57 | + $trackIds = [ ]; |
|
| 58 | 58 | $returnAddPlaylistResult = false; |
| 59 | 59 | foreach ($tracks as $trackId) { |
| 60 | - $trackIds[] = $trackId; |
|
| 60 | + $trackIds[ ] = $trackId; |
|
| 61 | 61 | if (count($trackIds) % 100 === 0) { |
| 62 | 62 | $returnAddPlaylistResult = $this->baseSpotifyWebAPI->addPlaylistTracks($playlistId, $trackIds, $options); |
| 63 | - $trackIds = []; |
|
| 63 | + $trackIds = [ ]; |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function deletePlaylistTracks(string $playlistId, array $tracksInfo): bool |
| 80 | 80 | { |
| 81 | - $tracksToDelete = []; |
|
| 81 | + $tracksToDelete = [ ]; |
|
| 82 | 82 | $delete = false; |
| 83 | 83 | $this->baseSpotifyWebAPI->setReturnType(Request::RETURN_OBJECT); |
| 84 | 84 | |
@@ -88,15 +88,15 @@ discard block |
||
| 88 | 88 | sprintf(Message::ERROR_DELETE_PLAYLIST_TRACKS, DeleteTrackInfoDataProvider::class) |
| 89 | 89 | ); |
| 90 | 90 | } |
| 91 | - $tracksToDelete[] = $deleteTrackInfoDataProvider->toArray(); |
|
| 91 | + $tracksToDelete[ ] = $deleteTrackInfoDataProvider->toArray(); |
|
| 92 | 92 | if (count($tracksToDelete) % 100 === 0) { |
| 93 | - $delete = (bool)$this->baseSpotifyWebAPI->deletePlaylistTracks($playlistId, ['tracks' => $tracksToDelete]); |
|
| 94 | - $tracksToDelete = []; |
|
| 93 | + $delete = (bool) $this->baseSpotifyWebAPI->deletePlaylistTracks($playlistId, [ 'tracks' => $tracksToDelete ]); |
|
| 94 | + $tracksToDelete = [ ]; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if(!empty($tracksToDelete)) { |
|
| 99 | - $delete = (bool)$this->baseSpotifyWebAPI->deletePlaylistTracks($playlistId, ['tracks' => $tracksToDelete]); |
|
| 98 | + if (!empty($tracksToDelete)) { |
|
| 99 | + $delete = (bool) $this->baseSpotifyWebAPI->deletePlaylistTracks($playlistId, [ 'tracks' => $tracksToDelete ]); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | $this->baseSpotifyWebAPI->setReturnType(Request::RETURN_ASSOC); |
@@ -109,9 +109,9 @@ discard block |
||
| 109 | 109 | * @param array $options |
| 110 | 110 | * @return PlaylistDataProvider |
| 111 | 111 | */ |
| 112 | - public function getPlaylist(string $playlistId, array $options = []): PlaylistDataProvider |
|
| 112 | + public function getPlaylist(string $playlistId, array $options = [ ]): PlaylistDataProvider |
|
| 113 | 113 | { |
| 114 | - $jsonObjectResult = (array)$this->baseSpotifyWebAPI->getPlaylist($playlistId, $options); |
|
| 114 | + $jsonObjectResult = (array) $this->baseSpotifyWebAPI->getPlaylist($playlistId, $options); |
|
| 115 | 115 | |
| 116 | 116 | $playlistDataProvider = new PlaylistDataProvider(); |
| 117 | 117 | $playlistDataProvider->fromArray($jsonObjectResult); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * @return PlaylistDataProvider |
| 126 | 126 | * @throws PlaylistNotFound |
| 127 | 127 | */ |
| 128 | - public function getUserPlaylistByName(string $playlistName, array $options = []): PlaylistDataProvider |
|
| 128 | + public function getUserPlaylistByName(string $playlistName, array $options = [ ]): PlaylistDataProvider |
|
| 129 | 129 | { |
| 130 | 130 | $userPlaylistsDataProvider = $this->getUserPlaylists($options); |
| 131 | 131 | $playlists = $userPlaylistsDataProvider->getItems(); |
@@ -143,23 +143,23 @@ discard block |
||
| 143 | 143 | * @param array $options |
| 144 | 144 | * @return PlaylistTracksDataProvider |
| 145 | 145 | */ |
| 146 | - public function getPlaylistTracks(string $playlistId, array $options = []): PlaylistTracksDataProvider |
|
| 146 | + public function getPlaylistTracks(string $playlistId, array $options = [ ]): PlaylistTracksDataProvider |
|
| 147 | 147 | { |
| 148 | 148 | $offset = 0; |
| 149 | - $items = []; |
|
| 149 | + $items = [ ]; |
|
| 150 | 150 | |
| 151 | 151 | do { |
| 152 | - $response = (object)$this->baseSpotifyWebAPI->getPlaylistTracks($playlistId, [ |
|
| 152 | + $response = (object) $this->baseSpotifyWebAPI->getPlaylistTracks($playlistId, [ |
|
| 153 | 153 | 'offset' => $offset, |
| 154 | 154 | ]); |
| 155 | 155 | $offset += 100; |
| 156 | - $items[] = $response->items; |
|
| 156 | + $items[ ] = $response->items; |
|
| 157 | 157 | $hasNext = $response->next; |
| 158 | 158 | } while ($hasNext); |
| 159 | - $response->items = array_merge([], ...$items); |
|
| 159 | + $response->items = array_merge([ ], ...$items); |
|
| 160 | 160 | |
| 161 | 161 | $playlistTracksDataProvider = new PlaylistTracksDataProvider(); |
| 162 | - $playlistTracksDataProvider->fromArray((array)$response); |
|
| 162 | + $playlistTracksDataProvider->fromArray((array) $response); |
|
| 163 | 163 | |
| 164 | 164 | return $playlistTracksDataProvider; |
| 165 | 165 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * @param array $options |
| 170 | 170 | * @return TracksSearchDataProvider |
| 171 | 171 | */ |
| 172 | - public function searchTrack(TrackSearchRequestDataProvider $trackSearchRequest, array $options = []): TracksSearchDataProvider |
|
| 172 | + public function searchTrack(TrackSearchRequestDataProvider $trackSearchRequest, array $options = [ ]): TracksSearchDataProvider |
|
| 173 | 173 | { |
| 174 | 174 | $jsonObjectResult = $this->search( |
| 175 | 175 | sprintf( |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | ); |
| 184 | 184 | |
| 185 | 185 | $tracksSearchDataProvider = new TracksSearchDataProvider(); |
| 186 | - $tracksSearchDataProvider->fromArray($jsonObjectResult[$trackSearchRequest->getResultType()]); |
|
| 186 | + $tracksSearchDataProvider->fromArray($jsonObjectResult[ $trackSearchRequest->getResultType() ]); |
|
| 187 | 187 | |
| 188 | 188 | return $tracksSearchDataProvider; |
| 189 | 189 | } |
@@ -194,18 +194,18 @@ discard block |
||
| 194 | 194 | * @param array $options |
| 195 | 195 | * @return array |
| 196 | 196 | */ |
| 197 | - private function search(string $query, array $type, array $options = []): array |
|
| 197 | + private function search(string $query, array $type, array $options = [ ]): array |
|
| 198 | 198 | { |
| 199 | - return (array)$this->baseSpotifyWebAPI->search($query, $type, $options); |
|
| 199 | + return (array) $this->baseSpotifyWebAPI->search($query, $type, $options); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
| 203 | 203 | * @param array $options |
| 204 | 204 | * @return UserPlaylistsDataProvider |
| 205 | 205 | */ |
| 206 | - private function getUserPlaylists(array $options = []): UserPlaylistsDataProvider |
|
| 206 | + private function getUserPlaylists(array $options = [ ]): UserPlaylistsDataProvider |
|
| 207 | 207 | { |
| 208 | - $userPlaylistInfo = (array)$this->baseSpotifyWebAPI->getUserPlaylists($this->spotifyUsername, $options); |
|
| 208 | + $userPlaylistInfo = (array) $this->baseSpotifyWebAPI->getUserPlaylists($this->spotifyUsername, $options); |
|
| 209 | 209 | |
| 210 | 210 | $userPlaylistsDataProvider = new UserPlaylistsDataProvider(); |
| 211 | 211 | $userPlaylistsDataProvider->fromArray($userPlaylistInfo); |