| 1 | <?php |
||
| 12 | class Fibonacci extends Combinatorics implements \Iterator { |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var int |
||
| 16 | */ |
||
| 17 | protected $max; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var int |
||
| 21 | */ |
||
| 22 | private $previous = 1; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var int |
||
| 26 | */ |
||
| 27 | private $current = 0; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var int |
||
| 31 | */ |
||
| 32 | private $key = 0; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Fibonacci constructor. |
||
| 36 | */ |
||
| 37 | 2 | public function __construct() { |
|
| 40 | |||
| 41 | /** |
||
| 42 | * @return int |
||
| 43 | */ |
||
| 44 | 2 | public function current() { |
|
| 47 | |||
| 48 | /** |
||
| 49 | * @return int |
||
| 50 | */ |
||
| 51 | public function key() { |
||
| 54 | |||
| 55 | /** |
||
| 56 | * |
||
| 57 | */ |
||
| 58 | 2 | public function next() { |
|
| 62 | |||
| 63 | /** |
||
| 64 | * |
||
| 65 | */ |
||
| 66 | 2 | public function rewind() { |
|
| 71 | |||
| 72 | /** |
||
| 73 | * @return bool |
||
| 74 | */ |
||
| 75 | 2 | public function valid() { |
|
| 78 | |||
| 79 | /** |
||
| 80 | * @return int |
||
| 81 | */ |
||
| 82 | 2 | public function count() { |
|
| 85 | |||
| 86 | /** |
||
| 87 | * @return array |
||
| 88 | */ |
||
| 89 | 2 | public function toArray() { |
|
| 98 | |||
| 99 | /** |
||
| 100 | * @param int $max |
||
| 101 | */ |
||
| 102 | 2 | public function setMaxLimit($max) { |
|
| 105 | |||
| 106 | /** |
||
| 107 | * @return int |
||
| 108 | */ |
||
| 109 | 2 | public function getMaxLimit() { |
|
| 112 | |||
| 113 | } |
||
| 114 |