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