From 7fc72427ecdf5a0fe1217aa55ca3c5cdd6532942 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Mon, 11 Nov 2024 11:53:47 +0100 Subject: [PATCH] Fix SinglePage::hasPageNodes() and SinglePage::getPageNodes() --- .../Importer/CIF/Element/SinglePage.php | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/PortlandLabs/Concrete5/MigrationTool/Importer/CIF/Element/SinglePage.php b/src/PortlandLabs/Concrete5/MigrationTool/Importer/CIF/Element/SinglePage.php index 82c67c0..0dee49b 100644 --- a/src/PortlandLabs/Concrete5/MigrationTool/Importer/CIF/Element/SinglePage.php +++ b/src/PortlandLabs/Concrete5/MigrationTool/Importer/CIF/Element/SinglePage.php @@ -10,13 +10,33 @@ class SinglePage extends Page { protected $pages = array(); + /** + * {@inheritdoc} + * + * @see \PortlandLabs\Concrete5\MigrationTool\Importer\CIF\Element\Page::hasPageNodes() + */ + public function hasPageNodes() + { + return isset($this->simplexml->singlepages->page); + } + + /** + * {@inheritdoc} + * + * @see \PortlandLabs\Concrete5\MigrationTool\Importer\CIF\Element\Page::getPageNodes() + */ + public function getPageNodes() + { + return isset($this->simplexml->singlepages->page); + } + public function getObjectCollection(\SimpleXMLElement $element, Batch $batch) { $this->simplexml = $element; $i = 0; $collection = new SinglePageObjectCollection(); - if ($this->simplexml->singlepages->page) { - foreach ($this->simplexml->singlepages->page as $node) { + if ($this->hasPageNodes()) { + foreach ($this->getPageNodes() as $node) { $page = $this->parsePage($node); $page->setPosition($i); ++$i;