/** * @param string $name * @param array $arguments * @return mixed */ public function __call($name, array $arguments) { if (strpos($name, 'get') === 0) { return $this->__get(Model::uncamelize(substr($name, 3))); } elseif (strpos($name, 'has') === 0) { return $this->__isset(Model::uncamelize(substr($name, 3))); } elseif (strpos($name, 'set') === 0) { if (0 >= sizeof($arguments)) { throw new Exception('Value not set.'); } $field = Model::uncamelize(substr($name, 3)); $value = array_shift($arguments); $this->__set($field, $value); return $this; } throw new Exception("Call to undefined method `{$name}`."); }