| Conditions | 2 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 17 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 32 | 17 | public function setAlgorithmicCost($cost) |
|
| 33 | { |
||
| 34 | 17 | $cost = filter_var( |
|
| 35 | 17 | $cost, |
|
| 36 | 17 | FILTER_VALIDATE_INT, |
|
| 37 | 17 | [ |
|
| 38 | 17 | "options" => [ |
|
| 39 | 17 | "min_range" => static::MINIMUM_ALGORITHMIC_COST, |
|
| 40 | 17 | "max_range" => static::MAXIMUM_ALGORITHMIC_COST, |
|
| 41 | 17 | ], |
|
| 42 | 17 | ] |
|
| 43 | 17 | ); |
|
| 44 | |||
| 45 | 17 | if ($cost === false) { |
|
| 46 | 1 | throw new \InvalidArgumentException( |
|
| 47 | 1 | 'The number of internal iterations must be a valid integer bigger than 0.' |
|
| 48 | 1 | ); |
|
| 49 | } |
||
| 50 | |||
| 51 | 17 | $this->computationalCost = $cost; |
|
| 52 | |||
| 53 | 17 | return $this; |
|
| 54 | } |
||
| 66 |