1: <?php
2:
3: namespace Guzzle\Iterator;
4:
5: /**
6: * Proxies missing method calls to the innermost iterator
7: */
8: class MethodProxyIterator extends \IteratorIterator
9: {
10: /**
11: * Proxy method calls to the wrapped iterator
12: *
13: * @param string $name Name of the method
14: * @param array $args Arguments to proxy
15: *
16: * @return mixed
17: */
18: public function __call($name, array $args)
19: {
20: $i = $this->getInnerIterator();
21: while ($i instanceof \OuterIterator) {
22: $i = $i->getInnerIterator();
23: }
24:
25: return call_user_func_array(array($i, $name), $args);
26: }
27: }
28: