/** * Internal method to save the generated XMI to a file. * Use export() instead if you need to save from outside the Exporter object. * * @param string $outputFile Filename */ protected function save($outputFile) { if ($ptr = fopen($outputFile, 'w+')) { fwrite($ptr, $this->xmiDocument->dump()); fclose($ptr); } else { throw new PHP_UML_Exception('File ' . $outputFile . ' could not be created.'); } }
/** * Generates output data by applying a transformation on the XMI stored in the * property $xmi * * @param string $outputDir Output folder * * @return DOMDocument A DOM document containing the result of the XSLT */ public function export($outputDir) { $xslFile = $this->getXslFilepath(); if (empty($this->xmiDocument)) { $temp = new PHP_UML_Output_Xmi_Exporter(); /* * Component views and deployment views don't mean anything * for output formats other than XMI. Yet, since ExporterXSL is * a subclass of ExportXMI, we must force these options to * false, otherwise they will appear in the output produced by * the XSL transformation: */ $temp->setComponentView(false); $temp->setDeploymentView(false); $temp->setModel($this->structure); $temp->generateXmi(); $this->xmiDocument = $temp->getXmiDocument(); } if (file_exists($xslFile)) { return $this->exportFromXml($outputDir, $xslFile, $this->xmiDocument->dump()); } else { throw new PHP_UML_Exception('Could not find the XSL template file. It must be named ' . self::STARTING_TPL . ', under Format/YourTemplate/'); } }