@@ -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 |
@@ -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 |
@@ -1,3 +1,3 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require __DIR__ . '/../vendor/autoload.php'; |
|
| 3 | +require __DIR__.'/../vendor/autoload.php'; |
|
@@ -15,7 +15,7 @@ discard block |
||
| 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 |
||
| 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 |
@@ -12,7 +12,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 73 | 73 | */ |
| 74 | 74 | private function get(string $name) |
| 75 | 75 | { |
| 76 | - return $_ENV[$name]; |
|
| 76 | + return $_ENV[ $name ]; |
|
| 77 | 77 | } |
| 78 | 78 | } |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | $this->config = new Config(); |
| 28 | 28 | foreach ($this->env as $envName => $envValue) { |
| 29 | - $this->env[$envName] = $_ENV[$envName]; |
|
| 30 | - $_ENV[$envName] = null; |
|
| 29 | + $this->env[ $envName ] = $_ENV[ $envName ]; |
|
| 30 | + $_ENV[ $envName ] = null; |
|
| 31 | 31 | } |
| 32 | 32 | parent::setUp(); |
| 33 | 33 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | protected function tearDown(): void |
| 36 | 36 | { |
| 37 | 37 | foreach ($this->env as $envName => $envValue) { |
| 38 | - $_ENV[$envName] = $envValue; |
|
| 38 | + $_ENV[ $envName ] = $envValue; |
|
| 39 | 39 | } |
| 40 | 40 | parent::tearDown(); |
| 41 | 41 | } |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | public function testGetClientSecret() |
| 44 | 44 | { |
| 45 | 45 | $envValue = 'UnitSecret'; |
| 46 | - $_ENV['CLIENT_SECRET'] = $envValue; |
|
| 47 | - $this->assertSame($envValue,$this->config->getClientSecret()); |
|
| 46 | + $_ENV[ 'CLIENT_SECRET' ] = $envValue; |
|
| 47 | + $this->assertSame($envValue, $this->config->getClientSecret()); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public function testGetClientSecretException() |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | public function testGetClientId() |
| 57 | 57 | { |
| 58 | 58 | $envValue = 'UnitId'; |
| 59 | - $_ENV['CLIENT_ID'] = $envValue; |
|
| 60 | - $this->assertSame($envValue,$this->config->getClientId()); |
|
| 59 | + $_ENV[ 'CLIENT_ID' ] = $envValue; |
|
| 60 | + $this->assertSame($envValue, $this->config->getClientId()); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | public function testGetClientIdException() |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | public function testGetRedirectUri() |
| 70 | 70 | { |
| 71 | 71 | $envValue = 'UnitRedirectUri'; |
| 72 | - $_ENV['REDIRECT_URI'] = $envValue; |
|
| 73 | - $this->assertSame($envValue,$this->config->getRedirectUri()); |
|
| 72 | + $_ENV[ 'REDIRECT_URI' ] = $envValue; |
|
| 73 | + $this->assertSame($envValue, $this->config->getRedirectUri()); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | public function testGetRedirectUriException() |
@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | public function testGetSpotifyUsername() |
| 83 | 83 | { |
| 84 | 84 | $envValue = 'UnitSpotifyUserName'; |
| 85 | - $_ENV['SPOTIFY_USERNAME'] = $envValue; |
|
| 86 | - $this->assertSame($envValue,$this->config->getSpotifyUsername()); |
|
| 85 | + $_ENV[ 'SPOTIFY_USERNAME' ] = $envValue; |
|
| 86 | + $this->assertSame($envValue, $this->config->getSpotifyUsername()); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | public function testGetSpotifyUsernameException() |
@@ -28,22 +28,22 @@ |
||
| 28 | 28 | |
| 29 | 29 | $this->assertNotEmpty($redirectUrl, 'authorize url from spotify is empty'); |
| 30 | 30 | $parseRedirectUrl = parse_url($redirectUrl); |
| 31 | - $this->assertSame('accounts.spotify.com', $parseRedirectUrl['host']); |
|
| 32 | - $this->assertSame('/authorize', $parseRedirectUrl['path']); |
|
| 31 | + $this->assertSame('accounts.spotify.com', $parseRedirectUrl[ 'host' ]); |
|
| 32 | + $this->assertSame('/authorize', $parseRedirectUrl[ 'path' ]); |
|
| 33 | 33 | |
| 34 | - $this->assertNotEmpty($parseRedirectUrl['query']); |
|
| 34 | + $this->assertNotEmpty($parseRedirectUrl[ 'query' ]); |
|
| 35 | 35 | |
| 36 | - $info = []; |
|
| 37 | - parse_str($parseRedirectUrl['query'], $info); |
|
| 36 | + $info = [ ]; |
|
| 37 | + parse_str($parseRedirectUrl[ 'query' ], $info); |
|
| 38 | 38 | |
| 39 | - $this->assertSame('code', $info['response_type']); |
|
| 40 | - $this->assertSame($_ENV['REDIRECT_URI'], $info['redirect_uri']); |
|
| 41 | - $this->assertTrue(isset($info['client_id'])); |
|
| 39 | + $this->assertSame('code', $info[ 'response_type' ]); |
|
| 40 | + $this->assertSame($_ENV[ 'REDIRECT_URI' ], $info[ 'redirect_uri' ]); |
|
| 41 | + $this->assertTrue(isset($info[ 'client_id' ])); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public function testRefreshAccessToken() |
| 45 | 45 | { |
| 46 | - $this->assertTrue($this->session->refreshAccessToken($_ENV['REFRESH_TOKEN'])); |
|
| 46 | + $this->assertTrue($this->session->refreshAccessToken($_ENV[ 'REFRESH_TOKEN' ])); |
|
| 47 | 47 | $this->assertNotEmpty($this->session->getAccessToken()); |
| 48 | 48 | } |
| 49 | 49 | |