Skip to content

Commit cc4f52b

Browse files
committed
Added Token Support to XML Engine
1 parent 061847a commit cc4f52b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/generator/engine/xml/Xml.php

+10
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
use TheSeer\phpDox\Generator\ClassStartEvent;
4343
use TheSeer\phpDox\Generator\InterfaceStartEvent;
4444
use TheSeer\phpDox\Generator\PHPDoxEndEvent;
45+
use TheSeer\phpDox\Generator\TokenFileStartEvent;
4546
use TheSeer\phpDox\Generator\TraitStartEvent;
4647

4748
class Xml extends AbstractEngine {
@@ -57,6 +58,7 @@ public function registerEventHandlers(EventHandlerRegistry $registry) {
5758
$registry->addHandler('class.start', $this, 'handle');
5859
$registry->addHandler('trait.start', $this, 'handle');
5960
$registry->addHandler('interface.start', $this, 'handle');
61+
$registry->addHandler('token.file.start', $this, 'handleToken');
6062
}
6163

6264
public function handle(AbstractEvent $event) {
@@ -85,6 +87,14 @@ public function handleIndex(PHPDoxEndEvent $event) {
8587
$dom = $event->getIndex()->asDom();
8688
$this->saveDomDocument($dom, $this->outputDir . '/index.xml');
8789
}
90+
91+
public function handleToken(TokenFileStartEvent $event) {
92+
$dom = $event->getTokenFile()->asDom();
93+
$this->saveDomDocument($dom,
94+
$this->outputDir . '/tokens/' . $dom->queryOne('//phpdox:file')->getAttribute('relative') . '.xml'
95+
);
96+
97+
}
8898
}
8999

90100
class XMLEngineException extends EngineException {

0 commit comments

Comments
 (0)