| Conditions | 3 |
| Paths | 2 |
| Total Lines | 30 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 16 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 32 | 32 | public function setSignatureDigestion($signingAlgorithm) |
|
| 33 | { |
||
| 34 | $validDigestions = [ |
||
| 35 | 32 | self::SHA1_SIGNING, |
|
| 36 | 32 | self::SHA2_224_SIGNING, |
|
| 37 | 32 | self::SHA2_256_SIGNING, |
|
| 38 | 32 | self::SHA2_384_SIGNING, |
|
| 39 | 32 | self::SHA2_512_SIGNING, |
|
| 40 | ]; |
||
| 41 | |||
| 42 | 32 | $signingAlgorithm = filter_var( |
|
| 43 | 32 | $signingAlgorithm, |
|
| 44 | 32 | FILTER_VALIDATE_INT, |
|
| 45 | [ |
||
| 46 | "options" => [ |
||
| 47 | 32 | "min_range" => 1, |
|
| 48 | 32 | "max_range" => PHP_INT_MAX, |
|
| 49 | ], |
||
| 50 | ] |
||
| 51 | ); |
||
| 52 | |||
| 53 | 32 | if ($signingAlgorithm === false || !in_array($signingAlgorithm, $validDigestions, true)) { |
|
| 54 | 8 | throw new \InvalidArgumentException( |
|
| 55 | 8 | 'The digestion algorithm standard must be a valid integer bigger than 0.' |
|
| 56 | ); |
||
| 57 | } |
||
| 58 | |||
| 59 | 24 | $this->digestion = $signingAlgorithm; |
|
| 60 | |||
| 61 | 24 | return $this; |
|
| 62 | } |
||
| 74 |