Sections_Noniterable_Object.php 556 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. class Sections_NonIterable_Object extends Mustache {
  3. public $start = "It worked the first time.";
  4. public function middle() {
  5. return new Non_Iterable_Object;
  6. }
  7. public $final = "Then, surprisingly, it worked the final time.";
  8. }
  9. class Non_Iterable_Object
  10. {
  11. protected $_data = array(
  12. 'foo' => 'And it worked the second time.',
  13. 'bar' => 'As well as the third.'
  14. );
  15. public function __get($key)
  16. {
  17. return isset($this->_data[$key]) ? $this->_data[$key] : NULL;
  18. }
  19. public function __isset($key)
  20. {
  21. return isset($this->_data[$key]);
  22. }
  23. }