1 | <?php |
||
12 | class Permutations extends Combinatorics { |
||
13 | |||
14 | /** |
||
15 | * Count the number of permutations. |
||
16 | * |
||
17 | * @return int |
||
18 | * The number of element. |
||
19 | */ |
||
20 | public function count() { |
||
23 | 4 | ||
24 | 4 | /** |
|
25 | * Return the permutations. |
||
26 | * |
||
27 | * @return array |
||
28 | * The permutations result set. |
||
29 | */ |
||
30 | public function generator() { |
||
52 | |||
53 | /** |
||
54 | 3 | * Internal method to compute the permutations. |
|
55 | 3 | * |
|
56 | 3 | * @param array $items |
|
57 | 3 | * The items. |
|
58 | * @param int $length |
||
59 | 3 | * The length. |
|
60 | 3 | * |
|
61 | * @return bool|array |
||
|
|||
62 | 3 | * The permutations. |
|
63 | */ |
||
64 | protected function permute(array $items, $length) { |
||
90 | 3 | ||
91 | /** |
||
92 | * Swap two variables. |
||
93 | 3 | * |
|
94 | * @param mixed $x |
||
95 | * The first variable. |
||
96 | 3 | * @param mixed $y |
|
97 | 3 | * The second variable. |
|
98 | 3 | */ |
|
99 | protected function swap(&$x, &$y) { |
||
102 | |||
103 | /** |
||
104 | * Transform the iterator into an array. |
||
105 | * |
||
106 | * @return array |
||
107 | * The permutations result set. |
||
108 | */ |
||
109 | public function toArray() { |
||
118 | |||
119 | } |
||
120 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.