Files
michaelschiemer/src/Infrastructure/Music/ValueObjects/SpotifyCredentials.php
Michael Schiemer 5050c7d73a docs: consolidate documentation into organized structure
- Move 12 markdown files from root to docs/ subdirectories
- Organize documentation by category:
  • docs/troubleshooting/ (1 file)  - Technical troubleshooting guides
  • docs/deployment/      (4 files) - Deployment and security documentation
  • docs/guides/          (3 files) - Feature-specific guides
  • docs/planning/        (4 files) - Planning and improvement proposals

Root directory cleanup:
- Reduced from 16 to 4 markdown files in root
- Only essential project files remain:
  • CLAUDE.md (AI instructions)
  • README.md (Main project readme)
  • CLEANUP_PLAN.md (Current cleanup plan)
  • SRC_STRUCTURE_IMPROVEMENTS.md (Structure improvements)

This improves:
 Documentation discoverability
 Logical organization by purpose
 Clean root directory
 Better maintainability
2025-10-05 11:05:04 +02:00

50 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Infrastructure\Music\ValueObjects;
/**
* Spotify API Credentials Value Object
*
* Immutable credentials for Spotify API authentication
*/
final readonly class SpotifyCredentials
{
public function __construct(
public string $clientId,
public string $clientSecret,
public string $redirectUri
) {
if (empty($this->clientId)) {
throw new \InvalidArgumentException('Spotify Client ID cannot be empty');
}
if (empty($this->clientSecret)) {
throw new \InvalidArgumentException('Spotify Client Secret cannot be empty');
}
if (empty($this->redirectUri) || !filter_var($this->redirectUri, FILTER_VALIDATE_URL)) {
throw new \InvalidArgumentException('Spotify Redirect URI must be a valid URL');
}
}
public static function fromEnvironment(array $env): self
{
return new self(
clientId: $env['SPOTIFY_CLIENT_ID'] ?? '',
clientSecret: $env['SPOTIFY_CLIENT_SECRET'] ?? '',
redirectUri: $env['SPOTIFY_REDIRECT_URI'] ?? ''
);
}
public function toArray(): array
{
return [
'client_id' => $this->clientId,
'client_secret' => $this->clientSecret,
'redirect_uri' => $this->redirectUri,
];
}
}