1 | <?php |
||
12 | class Prime extends Combinatorics implements \Iterator, \Countable { |
||
13 | |||
14 | /** |
||
15 | * @var int |
||
16 | */ |
||
17 | protected $max; |
||
18 | |||
19 | /** |
||
20 | * @var int |
||
21 | */ |
||
22 | protected $key; |
||
23 | |||
24 | /** |
||
25 | * @var int |
||
26 | */ |
||
27 | protected $count = 1; |
||
28 | |||
29 | /** |
||
30 | * @var int |
||
31 | */ |
||
32 | protected $current = 2; |
||
33 | |||
34 | /** |
||
35 | * Prime constructor. |
||
36 | */ |
||
37 | 2 | public function __construct() { |
|
40 | |||
41 | /** |
||
42 | * @inheritdoc |
||
43 | */ |
||
44 | 2 | public function current() { |
|
47 | |||
48 | /** |
||
49 | * @inheritdoc |
||
50 | */ |
||
51 | 2 | public function next() { |
|
62 | |||
63 | /** |
||
64 | * @inheritdoc |
||
65 | */ |
||
66 | 2 | public function key() { |
|
69 | |||
70 | /** |
||
71 | * @inheritdoc |
||
72 | */ |
||
73 | 2 | public function valid() { |
|
76 | |||
77 | /** |
||
78 | * @inheritdoc |
||
79 | */ |
||
80 | 2 | public function rewind() { |
|
84 | |||
85 | /** |
||
86 | * @return int |
||
87 | 2 | */ |
|
88 | 2 | public function count() { |
|
91 | 2 | ||
92 | 2 | /** |
|
93 | 2 | * @return array |
|
94 | 2 | */ |
|
95 | public function toArray() { |
||
104 | |||
105 | 2 | ||
106 | 2 | /** |
|
107 | 2 | * @param $number |
|
108 | * |
||
109 | 2 | * @return bool |
|
110 | */ |
||
111 | protected function isPrimeNumber($number) { |
||
130 | |||
131 | /** |
||
132 | * @param int $max |
||
133 | */ |
||
134 | public function setMaxLimit($max) { |
||
137 | 2 | ||
138 | /** |
||
139 | * @return int |
||
140 | */ |
||
141 | public function getMaxLimit() { |
||
144 | |||
145 | } |
||
146 |