renderer = new $rendererName($phpWord); } /** * Magic method to handle direct calls to the configured PDF renderer wrapper class. * * @param string $name Renderer library method name * @param mixed[] $arguments Array of arguments to pass to the renderer method * * @return mixed Returned data from the PDF renderer wrapper method */ public function __call($name, $arguments) { // Note: Commented because all exceptions should already be catched by `__construct` // if ($this->renderer === null) { // throw new Exception("PDF Rendering library has not been defined."); // } return call_user_func_array([$this->getRenderer(), $name], $arguments); } public function save(string $filename): void { $this->getRenderer()->save($filename); } public function getRenderer(): AbstractRenderer { return $this->renderer; } }