1 | <?php |
||
12 | class Perfect extends Combinatorics implements \Iterator, \Countable { |
||
13 | |||
14 | /** |
||
15 | * The minimum limit. |
||
16 | * |
||
17 | * @var int |
||
18 | */ |
||
19 | protected $min; |
||
20 | |||
21 | /** |
||
22 | * The maximum limit. |
||
23 | * |
||
24 | * @var int |
||
25 | */ |
||
26 | protected $max; |
||
27 | |||
28 | /** |
||
29 | * The key. |
||
30 | * |
||
31 | * @var int |
||
32 | */ |
||
33 | protected $key; |
||
34 | |||
35 | /** |
||
36 | * Perfect constructor. |
||
37 | */ |
||
38 | 4 | public function __construct() { |
|
42 | |||
43 | /** |
||
44 | * {@inheritdoc} |
||
45 | */ |
||
46 | 4 | public function current() { |
|
56 | |||
57 | /** |
||
58 | * {@inheritdoc} |
||
59 | */ |
||
60 | 4 | public function next() { |
|
63 | |||
64 | /** |
||
65 | * {@inheritdoc} |
||
66 | */ |
||
67 | 4 | public function key() { |
|
70 | |||
71 | /** |
||
72 | * {@inheritdoc} |
||
73 | */ |
||
74 | 4 | public function valid() { |
|
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | */ |
||
81 | 4 | public function rewind() { |
|
84 | |||
85 | /** |
||
86 | * Count elements of an object. |
||
87 | * |
||
88 | * @return int |
||
89 | * The number of element. |
||
90 | */ |
||
91 | 4 | public function count() { |
|
94 | |||
95 | /** |
||
96 | * Convert the iterator into an array. |
||
97 | * |
||
98 | * @return array |
||
99 | * The elements. |
||
100 | */ |
||
101 | 4 | public function toArray() { |
|
110 | |||
111 | /** |
||
112 | * Test if a number is perfect or not. |
||
113 | * |
||
114 | * Source: http://iceyboard.no-ip.org/projects/code/php/perfect_number/ |
||
115 | * |
||
116 | * @param int $number |
||
117 | * The number to test. |
||
118 | * |
||
119 | * @return bool |
||
120 | * The true if the number is perfect, false otherwise. |
||
121 | */ |
||
122 | 4 | protected function isPerfectNumber($number) { |
|
136 | |||
137 | /** |
||
138 | * Set the maximum limit. |
||
139 | * |
||
140 | * @param int $max |
||
141 | * The limit. |
||
142 | */ |
||
143 | 4 | public function setMaxLimit($max) { |
|
146 | |||
147 | /** |
||
148 | * Get the maximum limit. |
||
149 | * |
||
150 | * @return int |
||
151 | * The limit. |
||
152 | */ |
||
153 | 4 | public function getMaxLimit() { |
|
156 | |||
157 | /** |
||
158 | * Set the minimum limit. |
||
159 | * |
||
160 | * @param int $min |
||
161 | * The limit. |
||
162 | */ |
||
163 | 4 | public function setMinLimit($min) { |
|
166 | |||
167 | /** |
||
168 | * Get the minimum limit. |
||
169 | * |
||
170 | * @return int |
||
171 | * The limit. |
||
172 | */ |
||
173 | 4 | public function getMinLimit() { |
|
176 | |||
177 | } |
||
178 |
Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.