public function __get($name) { $data = $this->getViewData(); if (!array_key_exists($name, $data)) { throw new PropertyNotFoundException($name, get_class()); } return $data[$name]; }