complex.php 613 B

123456789101112131415161718192021222324
  1. <?php
  2. class Complex extends Mustache {
  3. public $header = 'Colors';
  4. public $item = array(
  5. array('name' => 'red', 'current' => true, 'url' => '#Red'),
  6. array('name' => 'green', 'current' => false, 'url' => '#Green'),
  7. array('name' => 'blue', 'current' => false, 'url' => '#Blue'),
  8. );
  9. public function isLink() {
  10. // Exploit the fact that the current iteration item is at the top of the context stack.
  11. return $this->getVariable('current', $this->context) != true;
  12. }
  13. public function notEmpty() {
  14. return !($this->isEmpty());
  15. }
  16. public function isEmpty() {
  17. return count($this->item) === 0;
  18. }
  19. }