Chris@0: generateBaseHelpDom($command); Chris@0: $dom = $this->alterHelpDocument($command, $dom); Chris@0: Chris@0: $this->command = $command; Chris@0: $this->dom = $dom; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Convert data into a \DomDocument. Chris@0: * Chris@0: * @return \DomDocument Chris@0: */ Chris@0: public function getDomData() Chris@0: { Chris@0: return $this->dom; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Create the base help DOM prior to alteration by the Command object. Chris@0: * @param Command $command Chris@0: * @return \DomDocument Chris@0: */ Chris@0: protected function generateBaseHelpDom(Command $command) Chris@0: { Chris@0: // Use Symfony to generate xml text. If other formats are Chris@0: // requested, convert from xml to the desired form. Chris@0: $descriptor = new XmlDescriptor(); Chris@0: return $descriptor->getCommandDocument($command); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Alter the DOM document per the command object Chris@0: * @param Command $command Chris@0: * @param \DomDocument $dom Chris@0: * @return \DomDocument Chris@0: */ Chris@0: protected function alterHelpDocument(Command $command, \DomDocument $dom) Chris@0: { Chris@0: if ($command instanceof HelpDocumentAlter) { Chris@0: $dom = $command->helpAlter($dom); Chris@0: } Chris@0: return $dom; Chris@0: } Chris@0: }