/** * Magic overload: Proxy calls to {@link findRelation()} or container * * Examples of finder calls: * <code> * // METHOD // SAME AS * $h->findRelNext($page); // $h->findRelation($page, 'rel', 'next') * $h->findRevSection($page); // $h->findRelation($page, 'rev', 'section'); * $h->findRelFoo($page); // $h->findRelation($page, 'rel', 'foo'); * </code> * * @param string $method method name * @param array $arguments method arguments * @throws IfwPsn_Vendor_Zend_Navigation_Exception if method does not exist in container */ public function __call($method, array $arguments = array()) { if (@preg_match('/find(Rel|Rev)(.+)/', $method, $match)) { return $this->findRelation($arguments[0], strtolower($match[1]), strtolower($match[2])); } return parent::__call($method, $arguments); }
/** * Magic overload: Proxy to other navigation helpers or the container * * Examples of usage from a view script or layout: * <code> * // proxy to Menu helper and render container: * echo $this->navigation()->menu(); * * // proxy to Breadcrumbs helper and set indentation: * $this->navigation()->breadcrumbs()->setIndent(8); * * // proxy to container and find all pages with 'blog' route: * $blogPages = $this->navigation()->findAllByRoute('blog'); * </code> * * @param string $method helper name or method name in * container * @param array $arguments [optional] arguments to pass * @return mixed returns what the proxied call returns * @throws IfwPsn_Vendor_Zend_View_Exception if proxying to a helper, and the * helper is not an instance of the * interface specified in * {@link findHelper()} * @throws IfwPsn_Vendor_Zend_Navigation_Exception if method does not exist in container */ public function __call($method, array $arguments = array()) { // check if call should proxy to another helper if ($helper = $this->findHelper($method, false)) { return call_user_func_array(array($helper, $method), $arguments); } // default behaviour: proxy call to container return parent::__call($method, $arguments); }