{ $ret = $this->done(); $this->reset(); return $ret; } public function reset() { $this->options_ = []; return $this; } public function __call($name, $argv) { switch ($name) { case 'default': if (count($argv) !== 1) { throw new \BadMethodCallException(sprintf('Method "%s::%s()" requires a single argument, %d arguments passed', __CLASS__, $name, count($argv))); } return $this->defVal($argv[0]); default: throw new \BadMethodCallException(sprintf('Method "%s::%s()" does not exist', __CLASS__, $name)); } } private function defVal($value) { $this->options_['default'] = $value; return $this; } } $c = new PropertyFactory(); $c->default('dsf');