Ejemplo n.º 1
0
 public function __call($name, $args)
 {
     foreach (array('modifier', 'range', 'sequence') as $type) {
         if (preg_match('#set([a-zA-Z]+)' . ucfirst($type) . '#i', $name, $matched)) {
             $key = strtolower($matched[1]);
             if (isset($this->formats[$key])) {
                 switch ($type) {
                     case 'modifier':
                         if (isset($args[0])) {
                             $this->formats[$key][$type] = $args[0];
                         }
                         break;
                     case 'range':
                         foreach (range(0, 1) as $index) {
                             if (isset($args[$index])) {
                                 $this->formats[$key][$type][$index] = $args[$index];
                             }
                         }
                         break;
                 }
                 return $this;
             }
         }
     }
     return parent::__call($name, $args);
 }