Code Coverage  | 
      ||||||||||
Lines  | 
       Functions and Methods  | 
       Classes and Traits  | 
      ||||||||
| Total |         | 
       100.00%  | 
       12 / 12  | 
               | 
       100.00%  | 
       3 / 3  | 
       CRAP |         | 
       100.00%  | 
       1 / 1  | 
      
| Config |         | 
       100.00%  | 
       12 / 12  | 
               | 
       100.00%  | 
       3 / 3  | 
       3 |         | 
       100.00%  | 
       1 / 1  | 
      
| __construct |         | 
       100.00%  | 
       10 / 10  | 
               | 
       100.00%  | 
       1 / 1  | 
       1 | |||
| hasDSN |         | 
       100.00%  | 
       1 / 1  | 
               | 
       100.00%  | 
       1 / 1  | 
       1 | |||
| hasName |         | 
       100.00%  | 
       1 / 1  | 
               | 
       100.00%  | 
       1 / 1  | 
       1 | |||
| 1 | <?php | 
| 2 | |
| 3 | declare(strict_types=1); | 
| 4 | |
| 5 | namespace Projom\Storage\Engine\Driver\Connection; | 
| 6 | |
| 7 | /** | 
| 8 | * Connection configuration. | 
| 9 | */ | 
| 10 | class Config | 
| 11 | { | 
| 12 | public null|int|string $name; | 
| 13 | public readonly array $options; | 
| 14 | |
| 15 | public null|string $dsn; | 
| 16 | public readonly null|string $username; | 
| 17 | public readonly null|string $password; | 
| 18 | public readonly null|string $host; | 
| 19 | public readonly null|string|int $port; | 
| 20 | public readonly null|string $database; | 
| 21 | public readonly null|string $charset; | 
| 22 | public readonly null|string $collation; | 
| 23 | |
| 24 | public function __construct(array $config) | 
| 25 | { | 
| 26 | $this->name = $config['name'] ?? null; | 
| 27 | $this->options = $config['options'] ?? []; | 
| 28 | |
| 29 | $this->dsn = $config['dsn'] ?? null; | 
| 30 | $this->username = $config['username'] ?? null; | 
| 31 | $this->password = $config['password'] ?? null; | 
| 32 | $this->host = $config['host'] ?? null; | 
| 33 | $this->port = $config['port'] ?? null; | 
| 34 | $this->database = $config['database'] ?? null; | 
| 35 | $this->charset = $config['charset'] ?? null; | 
| 36 | $this->collation = $config['collation'] ?? null; | 
| 37 | } | 
| 38 | |
| 39 | public function hasDSN(): bool | 
| 40 | { | 
| 41 | return $this->dsn !== null; | 
| 42 | } | 
| 43 | |
| 44 | public function hasName(): bool | 
| 45 | { | 
| 46 | return $this->name !== null; | 
| 47 | } | 
| 48 | } |