<?php namespace Slovocast\Infrastructure\Database; use Slovocast\Infrastructure\Api\Database\DatabaseHandlerInterface; use PDO; class DatabaseConnection implements DatabaseHandlerInterface { private PDO $pdo; public function __construct( private string $host, private string $username, private string $password, private string $database, private int $port = 3306 ) { $this->pdo = new PDO($this->getDsn(), $username, $password); } public function getConnection(): PDO { return $this->pdo; } public function getDsn(): string { return "mysql:dbname={$this->database};host={$this->host};port={$this->port}"; } public function getHost(): string { return $this->host; } public function getDatabase(): string { return $this->database; } }