Skip to content

Commit 2f39065

Browse files
committed
Fix missing frames when <Frames> nodes are repeated
1 parent a0ca30f commit 2f39065

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/TocFileParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function writeRawTocToFile(string $filename, string $outDir, string $pref
136136
}
137137
$targetFile = rtrim($outDir, '/') . '/' . ltrim($targetFile, '/');
138138
if (!is_dir(dirname($targetFile))) {
139-
mkdir($outDir . '/' . dirname($filename), recursive: true);
139+
mkdir(dirname($targetFile), recursive: true);
140140
}
141141

142142
copy($filename, $targetFile);

src/XmlFileParser.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,26 @@ private function parseNode(SimpleXMLElement $node, Registry $fileRegistry, strin
129129
}
130130
}
131131
if (isset($node->Frames)) {
132-
foreach ($node->Frames->children() as $frameChild) {
133-
$this->parseNode($frameChild, $fileRegistry, $filename, $frame);
132+
foreach ($node->Frames as $framesNode) {
133+
foreach ($framesNode->children() as $frameChild) {
134+
$this->parseNode($frameChild, $fileRegistry, $filename, $frame);
135+
}
134136
}
135137
}
136138
if (isset($node->Layers)) {
137-
foreach ($node->Layers->children() as $layer) {
138-
foreach ($layer->children() as $frameChild) {
139-
$this->parseNode($frameChild, $fileRegistry, $filename, $frame);
139+
foreach ($node->Layers as $layersNode) {
140+
foreach ($layersNode->children() as $layer) {
141+
foreach ($layer->children() as $frameChild) {
142+
$this->parseNode($frameChild, $fileRegistry, $filename, $frame);
143+
}
140144
}
141145
}
142146
}
143147
if (isset($node->Animations)) {
144-
foreach ($node->Animations->children() as $animationGroup) {
145-
$this->parseNode($animationGroup, $fileRegistry, $filename, $frame);
148+
foreach ($node->Animations as $animationsNode) {
149+
foreach ($animationsNode->children() as $animationGroup) {
150+
$this->parseNode($animationGroup, $fileRegistry, $filename, $frame);
151+
}
146152
}
147153
}
148154
if (self::TYPE_ANIMATION_GROUP === $type) {

0 commit comments

Comments
 (0)