Passed
Pull Request — master (#2)
by Rafal
02:23 queued 42s
created
src/Application/SpotifyWebApiPhp/SpotifyWebApiInterface.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Application/SpotifyWebApiPhp/SpotifyWebApi.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
test/Integration/Application/SpotifyWebApiPhp/SpotifyWebApiTest.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
     public function testGetUserPlaylists(): void
63 63
     {
64 64
         $spotifyPlaylist = $this->spotifyWebApi->getUserPlaylistByName(
65
-            static::spotifyInfo['user'],
66
-            static::spotifyInfo['playlistName']
65
+            static::spotifyInfo[ 'user' ],
66
+            static::spotifyInfo[ 'playlistName' ]
67 67
         );
68
-        $this->assertSame(static::spotifyInfo['playlistId'], $spotifyPlaylist->getId());
68
+        $this->assertSame(static::spotifyInfo[ 'playlistId' ], $spotifyPlaylist->getId());
69 69
     }
70 70
 
71 71
     public function testGetUserPlaylistsNotFoundUser(): void
@@ -77,18 +77,18 @@  discard block
 block discarded – undo
77 77
     public function testGetUserPlaylistsNotFoundPlayList(): void
78 78
     {
79 79
         $this->expectException(PlaylistNotFound::class);
80
-        $this->spotifyWebApi->getUserPlaylistByName(static::spotifyInfo['user'], 'uniTest-Not_FOUND-Playlist');
80
+        $this->spotifyWebApi->getUserPlaylistByName(static::spotifyInfo[ 'user' ], 'uniTest-Not_FOUND-Playlist');
81 81
     }
82 82
 
83 83
     public function testGetPlaylist(): void
84 84
     {
85 85
         $spotifyPlayList = $this->spotifyWebApi->getPlaylist(
86
-            static::spotifyInfo['playlistId']
86
+            static::spotifyInfo[ 'playlistId' ]
87 87
         );
88
-        $this->assertSame(static::spotifyInfo['playlistId'], $spotifyPlayList->getId());
89
-        $this->assertSame(static::spotifyInfo['playlistName'], $spotifyPlayList->getName());
88
+        $this->assertSame(static::spotifyInfo[ 'playlistId' ], $spotifyPlayList->getId());
89
+        $this->assertSame(static::spotifyInfo[ 'playlistName' ], $spotifyPlayList->getName());
90 90
         $this->assertTrue($spotifyPlayList->getPublic());
91
-        $this->assertSame('U2', $spotifyPlayList->getTracks()->getItems()[0]->getTrack()->getArtists()[0]->getName());
91
+        $this->assertSame('U2', $spotifyPlayList->getTracks()->getItems()[ 0 ]->getTrack()->getArtists()[ 0 ]->getName());
92 92
     }
93 93
 
94 94
     public function testGetNoExistUserPlaylist(): void
@@ -111,15 +111,15 @@  discard block
 block discarded – undo
111 111
     {
112 112
         $trackSearchRequestDataProvider = new TrackSearchRequestDataProvider();
113 113
         $trackSearchRequestDataProvider->setArtist(
114
-            static::spotifySong['artist']
114
+            static::spotifySong[ 'artist' ]
115 115
         );
116 116
         $trackSearchRequestDataProvider->setTrack(
117
-            static::spotifySong['track']
117
+            static::spotifySong[ 'track' ]
118 118
         );
119 119
         $searchResult = $this->spotifyWebApi->searchTrack($trackSearchRequestDataProvider);
120 120
 
121 121
         $this->assertGreaterThan(0, $searchResult->getItems());
122
-        $this->assertSame(strtolower(static::spotifySong['track']), strtolower($searchResult->getItems()[0]->getName(9)));
122
+        $this->assertSame(strtolower(static::spotifySong[ 'track' ]), strtolower($searchResult->getItems()[ 0 ]->getName(9)));
123 123
     }
124 124
 
125 125
     public function testSearchTrackNotFound()
@@ -139,27 +139,27 @@  discard block
 block discarded – undo
139 139
     public function testAddPlaylistTracks()
140 140
     {
141 141
         $addResult = $this->spotifyWebApi->addPlaylistTracks(
142
-            static::spotifyInfo['playlistId'],
142
+            static::spotifyInfo[ 'playlistId' ],
143 143
             [
144
-                static::spotifySong['trackId']
144
+                static::spotifySong[ 'trackId' ]
145 145
             ]
146 146
         );
147 147
         $this->assertTrue($addResult);
148 148
 
149 149
         $spotifyPlayList = $this->spotifyWebApi->getPlaylistTracks(
150
-            static::spotifyInfo['playlistId']
150
+            static::spotifyInfo[ 'playlistId' ]
151 151
         );
152 152
 
153 153
         $this->assertNotEmpty($spotifyPlayList->getItems());
154 154
         $this->assertNotEmpty($spotifyPlayList->getTotal());
155
-        $this->assertSame(static::spotifySong['trackId'], $spotifyPlayList->getItems()[1]->getTrack()->getId());
155
+        $this->assertSame(static::spotifySong[ 'trackId' ], $spotifyPlayList->getItems()[ 1 ]->getTrack()->getId());
156 156
     }
157 157
 
158 158
     public function testAddPlaylistTracksNotExistTrackId()
159 159
     {
160 160
         try {
161 161
             $this->spotifyWebApi->addPlaylistTracks(
162
-                static::spotifyInfo['playlistId'],
162
+                static::spotifyInfo[ 'playlistId' ],
163 163
                 [
164 164
                     'uniTest-Not_FOUND--ID'
165 165
                 ]
@@ -178,24 +178,24 @@  discard block
 block discarded – undo
178 178
     public function testDeleteUserPlaylistTracks()
179 179
     {
180 180
         $spotifyPlayList = $this->spotifyWebApi->getPlaylistTracks(
181
-            static::spotifyInfo['playlistId']
181
+            static::spotifyInfo[ 'playlistId' ]
182 182
         );
183 183
 
184 184
         $this->assertCount(2, $spotifyPlayList->getItems());
185 185
         $this->assertSame(2, $spotifyPlayList->getTotal());
186 186
 
187 187
         $deleteTrack = new DeleteTrackInfoDataProvider();
188
-        $deleteTrack->setId(static::spotifySong['trackId']);
188
+        $deleteTrack->setId(static::spotifySong[ 'trackId' ]);
189 189
 
190 190
         $result = $this->spotifyWebApi->deletePlaylistTracks(
191
-            static::spotifyInfo['playlistId'],
192
-            [$deleteTrack]
191
+            static::spotifyInfo[ 'playlistId' ],
192
+            [ $deleteTrack ]
193 193
         );
194 194
 
195 195
         $this->assertTrue($result);
196 196
 
197 197
         $spotifyPlayList = $this->spotifyWebApi->getPlaylistTracks(
198
-            static::spotifyInfo['playlistId']
198
+            static::spotifyInfo[ 'playlistId' ]
199 199
         );
200 200
 
201 201
         $this->assertCount(1, $spotifyPlayList->getItems());
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
             $deleteTrack = new DeleteTrackInfoDataProvider();
209 209
             $deleteTrack->setId('uniTest-Not_FOUND--ID');
210 210
             $this->spotifyWebApi->deletePlaylistTracks(
211
-                static::spotifyInfo['playlistId'],
212
-                [$deleteTrack]
211
+                static::spotifyInfo[ 'playlistId' ],
212
+                [ $deleteTrack ]
213 213
             );
214 214
         } catch (\SpotifyWebAPI\SpotifyWebAPIException $e) {
215 215
             $this->assertSame(
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
     {
227 227
         $this->expectException(\RuntimeException::class);
228 228
         $this->spotifyWebApi->deletePlaylistTracks(
229
-            static::spotifyInfo['playlistId'],
230
-            ['id' => 'hahaha']
229
+            static::spotifyInfo[ 'playlistId' ],
230
+            [ 'id' => 'hahaha' ]
231 231
         );
232 232
     }
233 233
 }
Please login to merge, or discard this patch.