setOptions($options); } public function __get($key) { if ('_' == $key[0]) { throw new Qs_ViewController_Exception(sprintf('Cannot retrieve value for protected/private property "%s"', $key)); } if (!isset($this->$key)) { return null; } return $this->$key; } /** * @param mixed $translator * @return $this */ public function setTranslator($translator) { $this->_translator = $translator; return $this; } /** * @return mixed */ public function getTranslator() { return $this->_translator; } public function __set($key, $value) { $this->setProperty($key, $value); } public function setProperty($name, $value) { $name = (string) $name; if ('_' == $name[0]) { // Ignore protected options return $this; } if (null === $value) { unset($this->$name); } else { $this->$name = $value; } return $this; } public function setOptions($options) { foreach ($options as $key => $value) { $method = 'set' . ucfirst($key); if (method_exists($this, $method) && $key != 'options') { $this->$method($value); } else { $this->setProperty($key, $value); } } return $this; } public function setTemplatePath($templatePath) { $this->_templatePath = $templatePath; } public function getTemplate($template) { return Qs_SiteMap::getTemplate($template, $this->_templatePath); } public function translate() { $args = func_get_args(); if (null === $this->_translator) { return count($args) == 1 ? $args[0] : $args; } $arguments = Qs_Array::flatten($args); return $this->_translator->translate($arguments); } }