| Total Complexity | 4 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | class Hash implements VerifyInterface |
||
| 25 | { |
||
| 26 | /** |
||
| 27 | * The hash context. |
||
| 28 | * |
||
| 29 | * @var resource |
||
| 30 | */ |
||
| 31 | private $context; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @see VerifyInterface::init |
||
| 35 | * |
||
| 36 | * @param mixed $algorithm |
||
| 37 | * @param mixed $path |
||
| 38 | */ |
||
| 39 | public function init($algorithm, $path): void |
||
| 40 | { |
||
| 41 | $algorithm = strtolower( |
||
| 42 | preg_replace( |
||
| 43 | '/[^A-Za-z0-9]+/', |
||
| 44 | '', |
||
| 45 | $algorithm |
||
| 46 | ) |
||
| 47 | ); |
||
| 48 | |||
| 49 | if (false === ($this->context = @hash_init($algorithm))) { |
||
| 50 | $this->context = null; |
||
| 51 | |||
| 52 | throw SignatureException::lastError(); |
||
| 53 | } |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @see VerifyInterface::update |
||
| 58 | * |
||
| 59 | * @param mixed $data |
||
| 60 | */ |
||
| 61 | public function update($data): void |
||
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @see VerifyInterface::verify |
||
| 68 | * |
||
| 69 | * @param mixed $signature |
||
| 70 | */ |
||
| 71 | public function verify($signature) |
||
| 76 |