array.php 682 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * @todo Documentation
  4. */
  5. class pQueryArray extends pQuery {
  6. function get($index) {
  7. return isset($this->variable[$index]) ? $this->variable[$index] : null;
  8. }
  9. function count() {
  10. return count($this->variable);
  11. }
  12. function is_empty() {
  13. return !$this->count();
  14. }
  15. function reverse() {
  16. $this->variable = array_reverse($this->variable);
  17. return $this;
  18. }
  19. function __call($method, $args) {
  20. $function = 'array_'.$method;
  21. if( function_exists($function) ) {
  22. array_unshift($args, &$this->variable);
  23. return call_user_func_array($function, $args);
  24. }
  25. return self::error('Plugin "%s" has no method "%s".', __CLASS__, $method);
  26. }
  27. }
  28. ?>