diff --git a/src/PHPePub/Core/EPub.php b/src/PHPePub/Core/EPub.php
index 39a480f..e40b82b 100644
--- a/src/PHPePub/Core/EPub.php
+++ b/src/PHPePub/Core/EPub.php
@@ -297,18 +297,17 @@ function addChapter($chapterName, $fileName, $chapterData = null, $autoSplit = f
$this->chapterCount++;
foreach ($chapter as $oneChapter) {
- $v = reset($oneChapter);
if ($this->encodeHTML === true) {
- $v = StringHelper::encodeHtml($v);
+ $oneChapter = StringHelper::encodeHtml($oneChapter);
}
if ($externalReferences !== EPub::EXTERNAL_REF_IGNORE) {
- $this->processChapterExternalReferences($v, $externalReferences, $baseDir);
+ $this->processChapterExternalReferences($oneChapter, $externalReferences, $baseDir);
}
$partCount++;
$partName = $name . "_" . $partCount;
- $this->addFile($partName . "." . $extension, $partName, $v, "application/xhtml+xml");
- $this->extractIdAttributes($partName, $v);
+ $this->addFile($partName . "." . $extension, $partName, $oneChapter, "application/xhtml+xml");
+ $this->extractIdAttributes($partName, $oneChapter);
$this->opf->addItemRef($partName);
}
diff --git a/src/PHPePub/Core/EPubChapterSplitter.php b/src/PHPePub/Core/EPubChapterSplitter.php
index 5c45925..3ba1333 100644
--- a/src/PHPePub/Core/EPubChapterSplitter.php
+++ b/src/PHPePub/Core/EPubChapterSplitter.php
@@ -174,9 +174,7 @@ function splitChapter($chapter, $splitOnSearchString = false, $searchString = '/
$curParent = $curFile;
if ($domDepth > 0) {
foreach ($domClonedPath as $oneDomClonedPath) {
- /** @var $v \DOMNode */
- $v = reset($oneDomClonedPath);
- $newParent = $v->cloneNode(false);
+ $newParent = $oneDomClonedPath->cloneNode(false);
$curParent->appendChild($newParent);
$curParent = $newParent;
}
diff --git a/src/PHPePub/Core/Structure/OPF/Metadata.php b/src/PHPePub/Core/Structure/OPF/Metadata.php
index 0689424..4a39bd6 100644
--- a/src/PHPePub/Core/Structure/OPF/Metadata.php
+++ b/src/PHPePub/Core/Structure/OPF/Metadata.php
@@ -123,13 +123,13 @@ function finalize($bookVersion = EPub::BOOK_VERSION_EPUB2, $date = null) {
}
foreach ($this->metaProperties as $data) {
- $content = reset($data);
+ $content = current($data);
$name = key($data);
$metadata .= "\t\t" . $content . "\n";
}
foreach ($this->meta as $data) {
- $content = reset($data);
+ $content = current($data);
$name = key($data);
$metadata .= "\t\t\n";
}