Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| SqlitePdoFactory | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| create | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | // ╔════════════════════════════════════════════════════════════╗ |
| 4 | // ║ MIT Licence (#Expat) - https://opensource.org/licenses/MIT ║ |
| 5 | // ║ Copyright 2026 Frederic Poeydomenge <dyno@phexium.com> ║ |
| 6 | // ╚════════════════════════════════════════════════════════════╝ |
| 7 | |
| 8 | declare(strict_types=1); |
| 9 | |
| 10 | namespace Phexium\Plugin\PdoFactory\Internal; |
| 11 | |
| 12 | use PDO; |
| 13 | |
| 14 | final readonly class SqlitePdoFactory |
| 15 | { |
| 16 | public function __construct( |
| 17 | private array $env, |
| 18 | ) {} |
| 19 | |
| 20 | public function create(): PDO |
| 21 | { |
| 22 | $dbFile = dirname(__DIR__, 4).'/'.($this->env['database.sqlite.fullpath'] ?? 'var/database/sqlite.db'); |
| 23 | |
| 24 | return new PDO('sqlite:'.$dbFile); |
| 25 | } |
| 26 | } |