Failed Conditions
Push — master ( c48688...d6cc4f )
by Rafal
02:23 queued 54s
created
src/Application/SpotifyApiAuth.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
src/Application/SpotifyWebApiPhp/Session.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Application/SpotifyWebApiPhp/SessionInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
config/config_default.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
test/bootstrap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,3 +1,3 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-require __DIR__ . '/../vendor/autoload.php';
3
+require __DIR__.'/../vendor/autoload.php';
Please login to merge, or discard this patch.
src/Application/SpotifyWebApiPhp/SpotifyWebApi.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Application/SpotifyWebApiInterface.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
      * @param array $options
16 16
      * @return bool
17 17
      */
18
-    public function addPlaylistTracks($playlistId, array $tracks, array $options = []): bool;
18
+    public function addPlaylistTracks($playlistId, array $tracks, array $options = [ ]): bool;
19 19
 
20 20
     /**
21 21
      * @param string $playlistId
@@ -29,26 +29,26 @@  discard block
 block discarded – undo
29 29
      * @param array $options
30 30
      * @return PlaylistDataProvider
31 31
      */
32
-    public function getPlaylist(string $playlistId, array $options = []): PlaylistDataProvider;
32
+    public function getPlaylist(string $playlistId, array $options = [ ]): PlaylistDataProvider;
33 33
 
34 34
     /**
35 35
      * @param $playlistId
36 36
      * @param array $options
37 37
      * @return PlaylistTracksDataProvider
38 38
      */
39
-    public function getPlaylistTracks(string $playlistId, array $options = []);
39
+    public function getPlaylistTracks(string $playlistId, array $options = [ ]);
40 40
 
41 41
     /**
42 42
      * @param string $playlistName
43 43
      * @param array $options
44 44
      * @return PlaylistDataProvider
45 45
      */
46
-    public function getUserPlaylistByName(string $playlistName, array $options = []): PlaylistDataProvider;
46
+    public function getUserPlaylistByName(string $playlistName, array $options = [ ]): PlaylistDataProvider;
47 47
 
48 48
     /**
49 49
      * @param TrackSearchRequestDataProvider $trackSearchRequest
50 50
      * @param array $options
51 51
      * @return TracksSearchDataProvider
52 52
      */
53
-    public function searchTrack(TrackSearchRequestDataProvider $trackSearchRequest, array $options = []): TracksSearchDataProvider;
53
+    public function searchTrack(TrackSearchRequestDataProvider $trackSearchRequest, array $options = [ ]): TracksSearchDataProvider;
54 54
 }
55 55
\ No newline at end of file
Please login to merge, or discard this patch.
src/Domain/Model/Config.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
      */
13 13
     public function getClientId(): string
14 14
     {
15
-        $clientId = (string)$this->get('CLIENT_ID');
15
+        $clientId = (string) $this->get('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
 block discarded – undo
27 27
      */
28 28
     public function getClientSecret(): string
29 29
     {
30
-        $clientSecret = (string)$this->get('CLIENT_SECRET');
30
+        $clientSecret = (string) $this->get('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
 block discarded – undo
42 42
      */
43 43
     public function getRedirectUri(): string
44 44
     {
45
-        $redirectUri = (string)$this->get('REDIRECT_URI');
45
+        $redirectUri = (string) $this->get('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
 block discarded – undo
57 57
      */
58 58
     public function getSpotifyUsername(): string
59 59
     {
60
-        $spotifyUsername = (string)$this->get('SPOTIFY_USERNAME');
60
+        $spotifyUsername = (string) $this->get('SPOTIFY_USERNAME');
61 61
         if (empty($spotifyUsername)) {
62 62
             throw new RuntimeException(
63 63
                 sprintf(Message::ERROR_GET_ENV_VARIABLE, 'SPOTIFY_USERNAME')
@@ -73,6 +73,6 @@  discard block
 block discarded – undo
73 73
      */
74 74
     private function get(string $name)
75 75
     {        
76
-        return $_ENV[$name];
76
+        return $_ENV[ $name ];
77 77
     }
78 78
 }
Please login to merge, or discard this patch.
test/Integration/Application/SpotifyWebApiPhp/SpotifyWebApiTest.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -36,17 +36,17 @@  discard block
 block discarded – undo
36 36
         parent::setUp();
37 37
         $spotifyApiConnectFactory = new SpotifyApiConnectFactory();
38 38
         $spotifyApiAuth = $spotifyApiConnectFactory->createSpotifyApiAuth();
39
-        $accessToken = $spotifyApiAuth->getAccessByRefreshToken($_ENV['REFRESH_TOKEN']);
40
-        $this->spotifyWebApi =  $spotifyApiConnectFactory->createSpotifyWebApi($accessToken);
39
+        $accessToken = $spotifyApiAuth->getAccessByRefreshToken($_ENV[ 'REFRESH_TOKEN' ]);
40
+        $this->spotifyWebApi = $spotifyApiConnectFactory->createSpotifyWebApi($accessToken);
41 41
     }
42 42
 
43 43
 
44 44
     public function testGetUserPlaylists(): void
45 45
     {
46 46
         $spotifyPlaylist = $this->spotifyWebApi->getUserPlaylistByName(
47
-            static::spotifyInfo['playlistName']
47
+            static::spotifyInfo[ 'playlistName' ]
48 48
         );
49
-        $this->assertSame(static::spotifyInfo['playlistId'], $spotifyPlaylist->getId());
49
+        $this->assertSame(static::spotifyInfo[ 'playlistId' ], $spotifyPlaylist->getId());
50 50
     }
51 51
 
52 52
     public function testGetUserPlaylistsNotFoundPlayList(): void
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
     public function testGetPlaylist(): void
59 59
     {
60 60
         $spotifyPlayList = $this->spotifyWebApi->getPlaylist(
61
-            static::spotifyInfo['playlistId']
61
+            static::spotifyInfo[ 'playlistId' ]
62 62
         );
63
-        $this->assertSame(static::spotifyInfo['playlistId'], $spotifyPlayList->getId());
64
-        $this->assertSame(static::spotifyInfo['playlistName'], $spotifyPlayList->getName());
63
+        $this->assertSame(static::spotifyInfo[ 'playlistId' ], $spotifyPlayList->getId());
64
+        $this->assertSame(static::spotifyInfo[ 'playlistName' ], $spotifyPlayList->getName());
65 65
         $this->assertTrue($spotifyPlayList->getPublic());
66
-        $this->assertSame('U2', $spotifyPlayList->getTracks()->getItems()[0]->getTrack()->getArtists()[0]->getName());
66
+        $this->assertSame('U2', $spotifyPlayList->getTracks()->getItems()[ 0 ]->getTrack()->getArtists()[ 0 ]->getName());
67 67
     }
68 68
 
69 69
     public function testGetNoExistUserPlaylist(): void
@@ -86,18 +86,18 @@  discard block
 block discarded – undo
86 86
     {
87 87
         $trackSearchRequestDataProvider = new TrackSearchRequestDataProvider();
88 88
         $trackSearchRequestDataProvider->setArtist(
89
-            static::spotifySong['artist']
89
+            static::spotifySong[ 'artist' ]
90 90
         );
91 91
         $trackSearchRequestDataProvider->setTrack(
92
-            static::spotifySong['track']
92
+            static::spotifySong[ 'track' ]
93 93
         );
94 94
         $searchResult = $this->spotifyWebApi->searchTrack($trackSearchRequestDataProvider);
95 95
 
96 96
         $this->assertGreaterThan(0, $searchResult->getItems());
97 97
         $this->assertSame(
98
-            strtolower(static::spotifySong['track']),
98
+            strtolower(static::spotifySong[ 'track' ]),
99 99
             strtolower(
100
-                $searchResult->getItems()[0]->getName()
100
+                $searchResult->getItems()[ 0 ]->getName()
101 101
             )
102 102
         );
103 103
     }
@@ -119,27 +119,27 @@  discard block
 block discarded – undo
119 119
     public function testAddPlaylistTracks()
120 120
     {
121 121
         $addResult = $this->spotifyWebApi->addPlaylistTracks(
122
-            static::spotifyInfo['playlistId'],
122
+            static::spotifyInfo[ 'playlistId' ],
123 123
             [
124
-                static::spotifySong['trackId']
124
+                static::spotifySong[ 'trackId' ]
125 125
             ]
126 126
         );
127 127
         $this->assertTrue($addResult);
128 128
 
129 129
         $spotifyPlayList = $this->spotifyWebApi->getPlaylistTracks(
130
-            static::spotifyInfo['playlistId']
130
+            static::spotifyInfo[ 'playlistId' ]
131 131
         );
132 132
 
133 133
         $this->assertNotEmpty($spotifyPlayList->getItems());
134 134
         $this->assertNotEmpty($spotifyPlayList->getTotal());
135
-        $this->assertSame(static::spotifySong['trackId'], $spotifyPlayList->getItems()[1]->getTrack()->getId());
135
+        $this->assertSame(static::spotifySong[ 'trackId' ], $spotifyPlayList->getItems()[ 1 ]->getTrack()->getId());
136 136
     }
137 137
 
138 138
     public function testAddPlaylistTracksNotExistTrackId()
139 139
     {
140 140
         try {
141 141
             $this->spotifyWebApi->addPlaylistTracks(
142
-                static::spotifyInfo['playlistId'],
142
+                static::spotifyInfo[ 'playlistId' ],
143 143
                 [
144 144
                     'uniTest-Not_FOUND--ID'
145 145
                 ]
@@ -158,24 +158,24 @@  discard block
 block discarded – undo
158 158
     public function testDeleteUserPlaylistTracks()
159 159
     {
160 160
         $spotifyPlayList = $this->spotifyWebApi->getPlaylistTracks(
161
-            static::spotifyInfo['playlistId']
161
+            static::spotifyInfo[ 'playlistId' ]
162 162
         );
163 163
 
164 164
         $this->assertCount(2, $spotifyPlayList->getItems());
165 165
         $this->assertSame(2, $spotifyPlayList->getTotal());
166 166
 
167 167
         $deleteTrack = new DeleteTrackInfoDataProvider();
168
-        $deleteTrack->setId(static::spotifySong['trackId']);
168
+        $deleteTrack->setId(static::spotifySong[ 'trackId' ]);
169 169
 
170 170
         $result = $this->spotifyWebApi->deletePlaylistTracks(
171
-            static::spotifyInfo['playlistId'],
172
-            [$deleteTrack]
171
+            static::spotifyInfo[ 'playlistId' ],
172
+            [ $deleteTrack ]
173 173
         );
174 174
 
175 175
         $this->assertTrue($result);
176 176
 
177 177
         $spotifyPlayList = $this->spotifyWebApi->getPlaylistTracks(
178
-            static::spotifyInfo['playlistId']
178
+            static::spotifyInfo[ 'playlistId' ]
179 179
         );
180 180
 
181 181
         $this->assertCount(1, $spotifyPlayList->getItems());
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
             $deleteTrack = new DeleteTrackInfoDataProvider();
189 189
             $deleteTrack->setId('uniTest-Not_FOUND--ID');
190 190
             $this->spotifyWebApi->deletePlaylistTracks(
191
-                static::spotifyInfo['playlistId'],
192
-                [$deleteTrack]
191
+                static::spotifyInfo[ 'playlistId' ],
192
+                [ $deleteTrack ]
193 193
             );
194 194
         } catch (\SpotifyWebAPI\SpotifyWebAPIException $e) {
195 195
             $this->assertSame(
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
     {
207 207
         $this->expectException(\RuntimeException::class);
208 208
         $this->spotifyWebApi->deletePlaylistTracks(
209
-            static::spotifyInfo['playlistId'],
210
-            ['id' => 'hahaha']
209
+            static::spotifyInfo[ 'playlistId' ],
210
+            [ 'id' => 'hahaha' ]
211 211
         );
212 212
     }
213 213
 }
Please login to merge, or discard this patch.