| Total Complexity | 8 | 
| Total Lines | 45 | 
| Duplicated Lines | 0 % | 
| Coverage | 0% | 
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); | ||
| 11 | trait ProvidesConnector | ||
| 12 | { | ||
| 13 | private array $settings; | ||
| 14 | |||
| 15 | /** @var mixed */ | ||
| 16 | private $connection; | ||
| 17 | |||
| 18 | public function __construct(array $settings = []) | ||
| 19 |     { | ||
| 20 | $this->settings = $settings; | ||
| 21 | } | ||
| 22 | |||
| 23 | public function __destruct() | ||
| 26 | } | ||
| 27 | |||
| 28 | public function getConnection() | ||
| 29 |     { | ||
| 30 |         if (!$this->isConnected()) { | ||
| 31 | $this->connection = $this->connect(); | ||
| 32 | } | ||
| 33 | |||
| 34 | return $this->connection; | ||
| 35 | } | ||
| 36 | |||
| 37 | public function isConnected(): bool | ||
| 38 |     { | ||
| 39 | return $this->connection !== null; | ||
| 40 | } | ||
| 41 | |||
| 42 | public function disconnect(): void | ||
| 46 | } | ||
| 47 | } | ||
| 48 | |||
| 49 | public function getSettings(): array | ||
| 52 | } | ||
| 53 | |||
| 54 | /** @return mixed */ | ||
| 55 | abstract protected function connect(); | ||
| 56 | } | ||
| 57 |