FrameListIterator

Linked-list Iterator.

Defined (1)

The class is defined in the following location(s).

/lib/dompdf/include/frame.cls.php  
  1. class FrameListIterator implements Iterator { 
  2.  
  3. /** 
  4. * @var Frame 
  5. */ 
  6. protected $_parent; 
  7.  
  8. /** 
  9. * @var Frame 
  10. */ 
  11. protected $_cur; 
  12.  
  13. /** 
  14. * @var int 
  15. */ 
  16. protected $_num; 
  17.  
  18. function __construct(Frame $frame) { 
  19. $this->_parent = $frame; 
  20. $this->_cur = $frame->get_first_child(); 
  21. $this->_num = 0; 
  22.  
  23. function rewind() { 
  24. $this->_cur = $this->_parent->get_first_child(); 
  25. $this->_num = 0; 
  26.  
  27. /** 
  28. * @return bool 
  29. */ 
  30. function valid() { 
  31. return isset($this->_cur);// && ($this->_cur->get_prev_sibling() === $this->_prev); 
  32.  
  33. function key() { return $this->_num; } 
  34.  
  35. /** 
  36. * @return Frame 
  37. */ 
  38. function current() { return $this->_cur; } 
  39.  
  40. /** 
  41. * @return Frame 
  42. */ 
  43. function next() { 
  44.  
  45. $ret = $this->_cur; 
  46. if ( !$ret ) { 
  47. return null; 
  48.  
  49. $this->_cur = $this->_cur->get_next_sibling(); 
  50. $this->_num++; 
  51. return $ret;