示例#1
0
 /**
  * Supports a simple form Fluent Interfaces. Allows you to set the request properties by using the request property
  * name as the method name.
  *
  * For example : $controller->layout('name')->format('html')->render();
  *
  * @param	string	$method Method name
  * @param	array	$args   Array containing all the arguments for the original call
  * @return	ControllerView
  *
  * @see http://martinfowler.com/bliki/FluentInterface.html
  */
 public function __call($method, $args)
 {
     if (!isset($this->_mixed_methods[$method])) {
         //Check for layout, view or format property
         if (in_array($method, array('layout', 'format'))) {
             $this->getRequest()->query->set($method, $args[0]);
             return $this;
         }
     }
     return parent::__call($method, $args);
 }
示例#2
0
 /**
  * Supports a simple form Fluent Interfaces. Allows you to set the request properties by using the request property
  * name as the method name.
  *
  * For example : $controller->view('name')->layout('name')->format('html')->render();
  *
  * @param   string  $method Method name
  * @param   array   $args   Array containing all the arguments for the original call
  * @return	ControllerView
  *
  * @see http://martinfowler.com/bliki/FluentInterface.html
  */
 public function __call($method, $args)
 {
     if (!$this->isMixedMethod($method)) {
         if (in_array($method, array('layout', 'view', 'format'))) {
             if ($method == 'view') {
                 $this->setView($args[0]);
             }
             if ($method == 'format') {
                 $this->getRequest()->setFormat($args[0]);
             }
             if ($method == 'layout') {
                 $this->getRequest()->getQuery()->set($method, $args[0]);
             }
             return $this;
         }
     }
     return parent::__call($method, $args);
 }