1 | <?php |
||
14 | class FiniteGroup extends Combinatorics implements \Iterator, \Countable { |
||
15 | |||
16 | /** |
||
17 | * The group size. |
||
18 | * |
||
19 | * @var int |
||
20 | */ |
||
21 | protected $size; |
||
22 | |||
23 | /** |
||
24 | * The group. |
||
25 | * |
||
26 | * @var int[] |
||
27 | */ |
||
28 | protected $group; |
||
29 | |||
30 | /** |
||
31 | * The key. |
||
32 | * |
||
33 | * @var int |
||
34 | */ |
||
35 | protected $key; |
||
36 | |||
37 | /** |
||
38 | * Combinatorics constructor. |
||
39 | */ |
||
40 | 2 | public function __construct() { |
|
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | 2 | public function current() { |
|
50 | |||
51 | /** |
||
52 | * {@inheritdoc} |
||
53 | */ |
||
54 | 2 | public function next() { |
|
58 | |||
59 | /** |
||
60 | * {@inheritdoc} |
||
61 | */ |
||
62 | 2 | public function key() { |
|
65 | |||
66 | /** |
||
67 | * {@inheritdoc} |
||
68 | */ |
||
69 | 2 | public function valid() { |
|
72 | |||
73 | /** |
||
74 | * {@inheritdoc} |
||
75 | */ |
||
76 | 2 | public function rewind() { |
|
79 | |||
80 | /** |
||
81 | * Count elements of an object. |
||
82 | * |
||
83 | * @return int |
||
84 | * The number of element. |
||
85 | */ |
||
86 | 2 | public function count() { |
|
89 | |||
90 | /** |
||
91 | * Convert the iterator into an array. |
||
92 | * |
||
93 | * @return array |
||
94 | * The elements. |
||
95 | */ |
||
96 | 2 | public function toArray() { |
|
105 | |||
106 | /** |
||
107 | * Set the group size. |
||
108 | * |
||
109 | * @param int $size |
||
110 | * The size. |
||
111 | */ |
||
112 | 2 | public function setSize($size) { |
|
116 | |||
117 | /** |
||
118 | * Get the group size. |
||
119 | * |
||
120 | * @return int |
||
121 | * The size. |
||
122 | */ |
||
123 | 2 | public function getSize() { |
|
126 | |||
127 | /** |
||
128 | * Clean out the group from unwanted values. |
||
129 | */ |
||
130 | 2 | private function computeGroup() { |
|
139 | |||
140 | /** |
||
141 | * Get the greater common divisor between two numbers. |
||
142 | * |
||
143 | * @param int $a |
||
144 | * The first number. |
||
145 | * @param int $b |
||
146 | * The second number. |
||
147 | * |
||
148 | * @return int |
||
149 | * The greater common divisor between $a and $b. |
||
150 | */ |
||
151 | 2 | private function gcd($a, $b) { |
|
154 | |||
155 | /** |
||
156 | * Get the order. |
||
157 | * |
||
158 | * @param int $generator |
||
159 | * The generator. |
||
160 | * |
||
161 | * @return int |
||
162 | * The order. |
||
163 | */ |
||
164 | public function order($generator) { |
||
174 | |||
175 | } |
||
176 |
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.