| 1 | <?php |
||
| 9 | abstract class AbstractList implements IteratorAggregate |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var int |
||
| 13 | */ |
||
| 14 | protected $start; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var int |
||
| 18 | */ |
||
| 19 | protected $end; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var int |
||
| 23 | */ |
||
| 24 | protected $step = 1; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var Closure format output string (i.e. '2' => 'February'). |
||
| 28 | */ |
||
| 29 | protected $format; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @var string format string for values (i.e. '2' => '02'). |
||
| 33 | */ |
||
| 34 | public $formatValue = '%02d'; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * constructor |
||
| 38 | * |
||
| 39 | * @param int $start |
||
| 40 | * @param int $end |
||
| 41 | * @param int $step |
||
| 42 | * @param null|Closure $format |
||
| 43 | */ |
||
| 44 | protected function __construct($start, $end, $step, $format = null) |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @param Closure $format |
||
| 55 | * @return $this |
||
| 56 | */ |
||
| 57 | public function setFormat($format) |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @param mixed $value |
||
| 65 | * @return string |
||
| 66 | */ |
||
| 67 | public function format($value) |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @return callable |
||
| 77 | */ |
||
| 78 | public function getFormat() |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @return array |
||
| 85 | */ |
||
| 86 | protected function getList() |
||
| 103 | |||
| 104 | /** |
||
| 105 | * @return Traversable |
||
| 106 | */ |
||
| 107 | public function getIterator() |
||
| 111 | |||
| 112 | /** |
||
| 113 | * use formatted print for output. |
||
| 114 | * |
||
| 115 | * @param string $fmt |
||
| 116 | * @return $this |
||
| 117 | */ |
||
| 118 | public function usePrintFormat($fmt) |
||
| 124 | } |