| Total Complexity | 4 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Coverage | 75% |
| Changes | 5 | ||
| Bugs | 1 | Features | 3 |
| 1 | <?php |
||
| 14 | class PhpGenerator implements Generator |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * The maximum random number |
||
| 18 | * |
||
| 19 | * @var int |
||
| 20 | */ |
||
| 21 | protected $max = PHP_INT_MAX; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * The minimum random number |
||
| 25 | * |
||
| 26 | * @var int |
||
| 27 | */ |
||
| 28 | protected $min = 1; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param int $max The maximum random number |
||
| 32 | * @param int $min The minimum random number (must be positive) |
||
| 33 | */ |
||
| 34 | 68 | public function __construct(int $max = PHP_INT_MAX, int $min = 1) |
|
| 35 | { |
||
| 36 | 68 | if ($min < 1) { |
|
| 37 | 2 | throw new OutOfRangeException('The min number must be a positive integer.'); |
|
| 38 | } |
||
| 39 | |||
| 40 | 66 | $this->min = $min; |
|
| 41 | 66 | $this->max = $max; |
|
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @inheritdoc |
||
| 46 | */ |
||
| 47 | 21 | public function getRandomInt() |
|
| 58 | } |
||
| 59 | } |
||
| 60 |