for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types=1);
namespace SpotifyApiConnect\Domain\Model;
use SpotifyApiConnect\Message;
use RuntimeException;
final class Config implements ConfigInterface
{
/**
* @return string
*/
public function getClientId(): string
$clientId = (string)getenv('CLIENT_ID');
if (empty($clientId)) {
throw new RuntimeException(
sprintf(Message::ERROR_GET_ENV_VARIABLE, 'CLIENT_ID')
);
}
return $clientId;
public function getClientSecret(): string
$clientSecret = (string)getenv('CLIENT_SECRET');
if (empty($clientSecret)) {
sprintf(Message::ERROR_GET_ENV_VARIABLE, 'CLIENT_SECRET')
return $clientSecret;
public function getRedirectUri(): string
$redirectUri = (string)getenv('REDIRECT_URI');
if (empty($redirectUri)) {
sprintf(Message::ERROR_GET_ENV_VARIABLE, 'REDIRECT_URI')
return $redirectUri;
public function getSpotifyUsername(): string
$spotifyUsername = (string)getenv('SPOTIFY_USERNAME');
if (empty($spotifyUsername)) {
sprintf(Message::ERROR_GET_ENV_VARIABLE, 'SPOTIFY_USERNAME')
return $spotifyUsername;