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