Exemple #1
0
 /**
  * Supports a simple form of Fluent Interfaces. Allows you to assign variables to the view by using the variable
  * name as the method name. If the method name is a setter method the setter will be called instead.
  *
  * For example : $view->layout('foo')->title('name')->render().
  *
  * @param   string  $method Method name
  * @param   array   $args   Array containing all the arguments for the original call
  * @return  ViewAbstract
  *
  * @see http://martinfowler.com/bliki/FluentInterface.html
  */
 public function __call($method, $args)
 {
     //If one argument is passed we assume a setter method is being called
     if (count($args) == 1) {
         if (method_exists($this, 'set' . ucfirst($method))) {
             return $this->{'set' . ucfirst($method)}($args[0]);
         } else {
             return $this->{$method} = $args[0];
         }
     }
     return parent::__call($method, $args);
 }