1 | <?php |
||
5 | trait IntegerGenerator |
||
6 | { |
||
7 | protected $start = 0; |
||
8 | |||
9 | protected $end = PHP_INT_MAX; |
||
10 | |||
11 | /** |
||
12 | * Set numeric end. |
||
13 | * |
||
14 | * @param int $end |
||
15 | * @return $this |
||
16 | */ |
||
17 | 1 | public function end($end) |
|
23 | |||
24 | /** |
||
25 | * Generate a random integer. |
||
26 | * |
||
27 | * @return int |
||
28 | */ |
||
29 | 1 | protected function generateInteger() |
|
33 | |||
34 | /** |
||
35 | * Generate a random integer. |
||
36 | * |
||
37 | * @param int $start |
||
38 | * @param int $end |
||
39 | * @return int |
||
40 | */ |
||
41 | 2 | protected function generateRandomInt($start, $end) |
|
45 | |||
46 | /** |
||
47 | * Get numeric end. |
||
48 | * |
||
49 | * @return int |
||
50 | */ |
||
51 | 1 | public function getEnd() |
|
55 | |||
56 | /** |
||
57 | * Get numeric start. |
||
58 | * |
||
59 | * @return int |
||
60 | */ |
||
61 | 1 | public function getStart() |
|
65 | |||
66 | /** |
||
67 | * Set numeric start. |
||
68 | * |
||
69 | * @param int $start |
||
70 | * @return $this |
||
71 | */ |
||
72 | 1 | public function start($start) |
|
78 | } |
||
79 |