class = $class; } /** * Sets the name of the class to be instantiated by the factory. * * @param string $class The name of the class. * @return void */ public function setClass($class) { $this->class = $class; $this; } /** * Gets the name of the class currently configured to be instantiated by the factory. * * @return string */ public function getClass() { return $this->class; } /** * Creates an instance of the class configured in the factory. * * @param array $args (Optional) Additional arguments for the class constructor. * @return mixed The created instance. * * @throws \ReflectionException * @throws \Phacil\Framework\Exception * @throws \Exception */ public function create(array $args = []) { return \Phacil\Framework\Registry::getInstance()->create($this->class, $args); } }