| 1 | <?php |
||
| 10 | abstract class Combinatorics implements \Countable |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * The dataset. |
||
| 14 | * |
||
| 15 | * @var array |
||
| 16 | */ |
||
| 17 | protected $dataset; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * The number of values in the dataset. |
||
| 21 | * |
||
| 22 | * @var int |
||
| 23 | */ |
||
| 24 | protected $datasetCount; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * The length. |
||
| 28 | * |
||
| 29 | * @var int |
||
| 30 | */ |
||
| 31 | protected $length; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Combinatorics constructor. |
||
| 35 | * |
||
| 36 | * @param array $dataset |
||
| 37 | * The dataset. |
||
| 38 | * @param int|null $length |
||
| 39 | * The length. |
||
| 40 | */ |
||
| 41 | public function __construct(array $dataset = [], $length = null) |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Set the length. |
||
| 50 | * |
||
| 51 | * @param int $length |
||
| 52 | * The length. |
||
| 53 | * |
||
| 54 | * @return $this |
||
| 55 | */ |
||
| 56 | public function setLength($length = null) |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Get the length. |
||
| 66 | * |
||
| 67 | * @return int |
||
| 68 | * The length. |
||
| 69 | */ |
||
| 70 | public function getLength() |
||
| 74 | |||
| 75 | /** |
||
| 76 | * Set the dataset. |
||
| 77 | * |
||
| 78 | * @param array $dataset |
||
| 79 | * The dataset. |
||
| 80 | * |
||
| 81 | * @return $this |
||
| 82 | */ |
||
| 83 | public function setDataset(array $dataset = []) |
||
| 89 | |||
| 90 | /** |
||
| 91 | * Get the dataset. |
||
| 92 | * |
||
| 93 | * @return mixed[] |
||
| 94 | * The dataset. |
||
| 95 | */ |
||
| 96 | public function getDataset() |
||
| 100 | |||
| 101 | /** |
||
| 102 | * Compute the factorial of an integer. |
||
| 103 | * |
||
| 104 | * @param int $n |
||
| 105 | * The number to get its factorial. |
||
| 106 | * @param int $total |
||
| 107 | * The total. |
||
| 108 | * |
||
| 109 | * @return int |
||
| 110 | * The factorial of $n. |
||
| 111 | */ |
||
| 112 | protected function fact($n, $total = 1) |
||
| 116 | } |
||
| 117 |
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.