| Total Complexity | 5 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | final class PublicKeyDelegate implements Verifier |
||
| 24 | { |
||
| 25 | private $hash; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * {@inheritdoc} |
||
| 29 | */ |
||
| 30 | public function __construct(string $signature, string $path) |
||
| 31 | { |
||
| 32 | if (extension_loaded('openssl')) { |
||
| 33 | $this->hash = new OpenSsl($signature, $path); |
||
| 34 | } elseif (class_exists('Crypt_RSA')) { |
||
| 35 | $this->hash = new PhpSeclib($signature, $path); |
||
| 36 | } else { |
||
| 37 | throw SignatureException::create( |
||
| 38 | 'The "openssl" extension and "phpseclib" libraries are not available.' |
||
| 39 | ); |
||
| 40 | } |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * {@inheritdoc} |
||
| 45 | */ |
||
| 46 | public function update(string $data): void |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * {@inheritdoc} |
||
| 53 | */ |
||
| 54 | public function verify(string $signature): bool |
||
| 59 |