| Total Complexity | 3 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | final class FailerFactory |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * Factories indexed by the scheme |
||
| 16 | * |
||
| 17 | * @var array<string, FailerDsnFactoryInterface> |
||
| 18 | * @see FailerDsnFactoryInterface::scheme() For the key |
||
| 19 | */ |
||
| 20 | private $factories = []; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Register a new factory |
||
| 24 | * |
||
| 25 | * @param FailerDsnFactoryInterface $factory |
||
| 26 | * |
||
| 27 | * @return void |
||
| 28 | */ |
||
| 29 | 5 | public function register(FailerDsnFactoryInterface $factory): void |
|
| 30 | { |
||
| 31 | 5 | $this->factories[$factory->scheme()] = $factory; |
|
| 32 | 5 | } |
|
| 33 | |||
| 34 | /** |
||
| 35 | * Try to create the repository using a DSN string |
||
| 36 | * |
||
| 37 | * @param string $dsn The repository DSN |
||
| 38 | * |
||
| 39 | * @return FailedJobRepositoryInterface |
||
| 40 | * |
||
| 41 | * @throws InvalidArgumentException When the repository cannot be created |
||
| 42 | */ |
||
| 43 | 5 | public function createFromDsn(string $dsn): FailedJobRepositoryInterface |
|
| 54 | } |
||
| 55 | } |
||
| 56 |