| 1 | <?php |
||
| 13 | class Content implements \Iterator |
||
| 14 | { |
||
| 15 | const UTF8_BOM = "\xEF\xBB\xBF"; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Robots.txt file content |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | protected $content; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Reader separator |
||
| 25 | * @var string |
||
| 26 | */ |
||
| 27 | protected $separator; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Current line |
||
| 31 | * @var string |
||
| 32 | */ |
||
| 33 | private $line; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Current iterator key |
||
| 37 | * @var integer |
||
| 38 | */ |
||
| 39 | private $read = 0; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @param string $content |
||
| 43 | */ |
||
| 44 | public function __construct($content, $separator = "\r\n") |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Retrieve current line |
||
| 53 | * @return string |
||
| 54 | */ |
||
| 55 | public function current() |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Number of chars read |
||
| 62 | * @return integer |
||
| 63 | */ |
||
| 64 | public function key() |
||
| 68 | |||
| 69 | /** |
||
| 70 | * Get the next line in content |
||
| 71 | */ |
||
| 72 | public function next() |
||
| 81 | |||
| 82 | /** |
||
| 83 | * Rewind at beginning |
||
| 84 | */ |
||
| 85 | public function rewind() |
||
| 90 | |||
| 91 | /** |
||
| 92 | * Check if current item is valid or not |
||
| 93 | * @return boolean |
||
| 94 | */ |
||
| 95 | public function valid() |
||
| 99 | } |
||
| 100 |