for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Ray\AuraSqlModule;
use Aura\Sql\ExtendedPdo;
class Connection
{
private string $dsn;
private string $username;
private string $password;
/** @var array<string> */
private array $options;
private array $queries;
private ?ExtendedPdo $pdo = null;
/**
* @phpstan-param array<string> $options
* @phpstan-param array<string> $queries
*/
public function __construct(
string $dsn,
string $username = '',
string $password = '',
array $options = [],
array $queries = []
) {
$this->dsn = $dsn;
$this->username = $username;
$this->password = $password;
$this->options = $options;
$this->queries = $queries;
}
public function __invoke(): ExtendedPdo
if ($this->pdo instanceof ExtendedPdo) {
return $this->pdo;
$this->pdo = new ExtendedPdo($this->dsn, $this->username, $this->password, $this->options, $this->queries);
return $this->pdo
null
Aura\Sql\ExtendedPdo
public function isSame(string $dsn, string $username, string $password): bool
return $dsn === $this->dsn &&
$username === $this->username &&
$password === $this->password;