Phred/src/Orm/PairityConnection.php

33 lines
626 B
PHP

<?php
declare(strict_types=1);
namespace Phred\Orm;
use Phred\Orm\Contracts\ConnectionInterface;
use Pairity\Manager;
final class PairityConnection implements ConnectionInterface
{
private bool $connected = false;
private ?Manager $manager = null;
public function connect(): void
{
$this->connected = true;
$this->manager = new Manager();
}
public function isConnected(): bool
{
return $this->connected;
}
public function getManager(): Manager
{
if (!$this->manager) {
$this->connect();
}
return $this->manager;
}
}