Conditions | 3 |
Paths | 2 |
Total Lines | 7 |
Lines | 7 |
Ratio | 100 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
17 | View Code Duplication | public static function checkRange(int $number, int $limit): int |
|
|
|||
18 | { |
||
19 | if ($number < 0 || $number > $limit) { |
||
20 | throw new static(sprintf('Value is out of range "%s" must contain 1-%s positive digits.', $number, strlen((string) $limit))); |
||
21 | } |
||
22 | return $number; |
||
23 | } |
||
24 | |||
44 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.