Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| SignEngineFactory | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| resolve | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | /** |
| 5 | * SPDX-FileCopyrightText: 2025 LibreCode coop and contributors |
| 6 | * SPDX-License-Identifier: AGPL-3.0-or-later |
| 7 | */ |
| 8 | |
| 9 | namespace OCA\Libresign\Handler\SignEngine; |
| 10 | |
| 11 | use Psr\Container\ContainerInterface; |
| 12 | |
| 13 | class SignEngineFactory { |
| 14 | public function __construct( |
| 15 | private ContainerInterface $container, |
| 16 | ) { |
| 17 | } |
| 18 | |
| 19 | public function resolve(string $extension): ISignEngineHandler { |
| 20 | return match (strtolower($extension)) { |
| 21 | 'pdf' => $this->container->get(Pkcs12Handler::class), |
| 22 | default => $this->container->get(Pkcs7Handler::class), |
| 23 | }; |
| 24 | } |
| 25 | } |