diff --git a/composer.json b/composer.json
index d83172f..f2633d8 100644
--- a/composer.json
+++ b/composer.json
@@ -3,7 +3,7 @@
"type": "library",
"description": "Package to create and stream e-books in the ePub 2.0 and 3.0 formats.",
"keywords": ["epub", "e-book"],
- "homepage": "https://github.com/wallabag/PHPePub",
+ "homepage": "https://github.com/Hi-Folks/PHPePub",
"license": "LGPL-2.1",
"minimum-stability": "stable",
"authors": [
@@ -51,6 +51,10 @@
]
},
"require-dev": {
- "rector/rector": "^0.18.13"
+ "rector/rector": "^0.18.13",
+ "laravel/pint": "^1.13"
+ },
+ "scripts": {
+ "format": "pint"
}
}
diff --git a/legacy/EPub.Test.Example.php b/legacy/EPub.Test.Example.php
index 51ea8e4..b4d3efe 100644
--- a/legacy/EPub.Test.Example.php
+++ b/legacy/EPub.Test.Example.php
@@ -1,4 +1,5 @@
Test Book\n
By: John Doe Johnson
\n" . $bookEnd;
$book->addChapter("Notices", "Cover.html", $cover);
-$book->buildTOC(NULL, "toc", "Table of Contents", TRUE, TRUE);
+$book->buildTOC(null, "toc", "Table of Contents", true, true);
// function buildTOC($cssFileName = NULL, $tocCSSClass = "toc", $title = "Table of Contents", $addReferences = TRUE, $addToIndex = FALSE, $tocFileName = "TOC.xhtml") {
diff --git a/pint.json b/pint.json
new file mode 100644
index 0000000..58e569c
--- /dev/null
+++ b/pint.json
@@ -0,0 +1,3 @@
+{
+ "preset": "per"
+}
\ No newline at end of file
diff --git a/src/PHPePub/Core/EPub.php b/src/PHPePub/Core/EPub.php
index 3fb7309..bf50f81 100644
--- a/src/PHPePub/Core/EPub.php
+++ b/src/PHPePub/Core/EPub.php
@@ -1,4 +1,5 @@
setUp();
}
- private function setUp() {
+ private function setUp()
+ {
$this->referencesOrder = [Reference::COVER => 'Cover Page', Reference::TITLE_PAGE => 'Title Page', Reference::ACKNOWLEDGEMENTS => 'Acknowledgements', Reference::BIBLIOGRAPHY => 'Bibliography', Reference::COLOPHON => 'Colophon', Reference::COPYRIGHT_PAGE => 'Copyright', Reference::DEDICATION => 'Dedication', Reference::EPIGRAPH => 'Epigraph', Reference::FOREWORD => 'Foreword', Reference::TABLE_OF_CONTENTS => 'Table of Contents', Reference::NOTES => 'Notes', Reference::PREFACE => 'Preface', Reference::TEXT => 'First Page', Reference::LIST_OF_ILLUSTRATIONS => 'List of Illustrations', Reference::LIST_OF_TABLES => 'List of Tables', Reference::GLOSSARY => 'Glossary', Reference::INDEX => 'Index'];
$this->docRoot = filter_input(INPUT_SERVER, 'DOCUMENT_ROOT') . '/';
@@ -182,7 +184,8 @@ private function setUp() {
* @return void
* @TODO make sure elements in the destructor match the current class elements
*/
- function __destruct() {
+ public function __destruct()
+ {
unset($this->bookVersion, $this->maxImageWidth, $this->maxImageHeight);
unset($this->splitDefaultSize, $this->isGifImagesEnabled, $this->isReferencesAddedToToc);
unset($this->zip, $this->title, $this->language, $this->identifier, $this->identifierType);
@@ -210,7 +213,8 @@ function __destruct() {
*
* @return mixed $success FALSE if the addition failed, else the new NavPoint.
*/
- function addChapter($chapterName, $fileName, $chapterData = null, $autoSplit = false, $externalReferences = EPub::EXTERNAL_REF_IGNORE, $baseDir = "") {
+ public function addChapter($chapterName, $fileName, $chapterData = null, $autoSplit = false, $externalReferences = EPub::EXTERNAL_REF_IGNORE, $baseDir = "")
+ {
if ($this->isFinalized) {
return false;
}
@@ -326,9 +330,10 @@ function addChapter($chapterName, $fileName, $chapterData = null, $autoSplit = f
* @param string $chapterData
* @return array
*/
- function findIdAttributes($chapterData) {
+ public function findIdAttributes($chapterData)
+ {
switch ($this->htmlFormat) {
- case EPub::FORMAT_HTML5;
+ case EPub::FORMAT_HTML5:
$html5 = new HTML5();
$xmlDoc = $html5->loadHTML($chapterData);
break;
@@ -354,7 +359,8 @@ function findIdAttributes($chapterData) {
* @param string $partName
* @param string $chapterData
*/
- public function extractIdAttributes($partName, $chapterData) {
+ public function extractIdAttributes($partName, $chapterData)
+ {
$item = $this->opf->getItemById($partName);
$ids = $this->findIdAttributes($chapterData);
foreach ($ids as $id) {
@@ -386,7 +392,8 @@ public function extractIdAttributes($partName, $chapterData) {
*
* @return bool false if unsuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE).
*/
- protected function processChapterExternalReferences(mixed &$doc, $externalReferences = EPub::EXTERNAL_REF_ADD, $baseDir = "", $htmlDir = "") {
+ protected function processChapterExternalReferences(mixed &$doc, $externalReferences = EPub::EXTERNAL_REF_ADD, $baseDir = "", $htmlDir = "")
+ {
if ($this->isFinalized || $externalReferences === EPub::EXTERNAL_REF_IGNORE) {
return false;
}
@@ -399,7 +406,7 @@ protected function processChapterExternalReferences(mixed &$doc, $externalRefere
$doc = StringHelper::removeComments($doc);
switch ($this->htmlFormat) {
- case EPub::FORMAT_HTML5;
+ case EPub::FORMAT_HTML5:
$html5 = new HTML5();
$xmlDoc = $html5->loadHTML($doc);
break;
@@ -471,7 +478,8 @@ protected function processChapterExternalReferences(mixed &$doc, $externalRefere
*
* @return bool FALSE if uncuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE).
*/
- protected function processChapterStyles(&$xmlDoc, $externalReferences = EPub::EXTERNAL_REF_ADD, $baseDir = "", $htmlDir = "") {
+ protected function processChapterStyles(&$xmlDoc, $externalReferences = EPub::EXTERNAL_REF_ADD, $baseDir = "", $htmlDir = "")
+ {
if ($this->isFinalized || $externalReferences === EPub::EXTERNAL_REF_IGNORE) {
return false;
}
@@ -503,7 +511,8 @@ protected function processChapterStyles(&$xmlDoc, $externalReferences = EPub::EX
*
* @return bool FALSE if unsuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE).
*/
- protected function processCSSExternalReferences(&$cssFile, $externalReferences = EPub::EXTERNAL_REF_ADD, $baseDir = "", $cssDir = "") {
+ protected function processCSSExternalReferences(&$cssFile, $externalReferences = EPub::EXTERNAL_REF_ADD, $baseDir = "", $cssDir = "")
+ {
if ($this->isFinalized || $externalReferences === EPub::EXTERNAL_REF_IGNORE) {
return false;
}
@@ -548,7 +557,8 @@ protected function processCSSExternalReferences(&$cssFile, $externalReferences =
*
* @return bool
*/
- protected function resolveImage($source, &$internalPath, &$internalSrc, &$isSourceExternal, $baseDir = "", $htmlDir = "") {
+ protected function resolveImage($source, &$internalPath, &$internalSrc, &$isSourceExternal, $baseDir = "", $htmlDir = "")
+ {
if ($this->isFinalized) {
return false;
}
@@ -611,7 +621,8 @@ protected function resolveImage($source, &$internalPath, &$internalSrc, &$isSour
*
* @return bool $success
*/
- function addFileToMETAINF($fileName, $fileData) {
+ public function addFileToMETAINF($fileName, $fileData)
+ {
if ($this->isFinalized) {
return false;
}
@@ -635,7 +646,8 @@ function addFileToMETAINF($fileName, $fileData) {
*
* @return bool $success
*/
- function addFile($fileName, $fileId, $fileData, $mimetype) {
+ public function addFile($fileName, $fileId, $fileData, $mimetype)
+ {
if ($this->isFinalized || array_key_exists($fileName, $this->fileList)) {
return false;
}
@@ -665,7 +677,8 @@ function addFile($fileName, $fileId, $fileData, $mimetype) {
*
* @return bool FALSE if uncuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE).
*/
- protected function processChapterLinks(&$xmlDoc, $externalReferences = EPub::EXTERNAL_REF_ADD, $baseDir = "", $htmlDir = "", $backPath = "") {
+ protected function processChapterLinks(&$xmlDoc, $externalReferences = EPub::EXTERNAL_REF_ADD, $baseDir = "", $htmlDir = "", $backPath = "")
+ {
if ($this->isFinalized || $externalReferences === EPub::EXTERNAL_REF_IGNORE) {
return false;
}
@@ -731,7 +744,8 @@ protected function processChapterLinks(&$xmlDoc, $externalReferences = EPub::EXT
*
* @return bool $success
*/
- function addCSSFile($fileName, $fileId, $fileData, $externalReferences = EPub::EXTERNAL_REF_IGNORE, $baseDir = "") {
+ public function addCSSFile($fileName, $fileId, $fileData, $externalReferences = EPub::EXTERNAL_REF_IGNORE, $baseDir = "")
+ {
if ($this->isFinalized || array_key_exists($fileName, $this->fileList)) {
return false;
}
@@ -765,7 +779,8 @@ function addCSSFile($fileName, $fileId, $fileData, $externalReferences = EPub::E
*
* @return bool FALSE if uncuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE).
*/
- protected function processChapterImages(&$xmlDoc, $externalReferences = EPub::EXTERNAL_REF_ADD, $baseDir = "", $htmlDir = "", $backPath = "") {
+ protected function processChapterImages(&$xmlDoc, $externalReferences = EPub::EXTERNAL_REF_ADD, $baseDir = "", $htmlDir = "", $backPath = "")
+ {
if ($this->isFinalized || $externalReferences === EPub::EXTERNAL_REF_IGNORE) {
return false;
}
@@ -830,7 +845,8 @@ protected function processChapterImages(&$xmlDoc, $externalReferences = EPub::EX
*
* @return bool FALSE if uncuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE).
*/
- protected function processChapterSources(&$xmlDoc, $externalReferences = EPub::EXTERNAL_REF_ADD, $baseDir = "", $htmlDir = "", $backPath = "") {
+ protected function processChapterSources(&$xmlDoc, $externalReferences = EPub::EXTERNAL_REF_ADD, $baseDir = "", $htmlDir = "", $backPath = "")
+ {
if ($this->isFinalized || $externalReferences === EPub::EXTERNAL_REF_IGNORE) {
return false;
}
@@ -890,7 +906,8 @@ protected function processChapterSources(&$xmlDoc, $externalReferences = EPub::E
*
* @return bool
*/
- protected function resolveMedia($source, &$internalPath, &$internalSrc, &$isSourceExternal, $baseDir = "", $htmlDir = "") {
+ protected function resolveMedia($source, &$internalPath, &$internalSrc, &$isSourceExternal, $baseDir = "", $htmlDir = "")
+ {
if ($this->isFinalized) {
return false;
}
@@ -954,7 +971,8 @@ protected function resolveMedia($source, &$internalPath, &$internalSrc, &$isSour
*
* @return bool $success
*/
- function addLargeFile($fileName, $fileId, $filePath, $mimetype) {
+ public function addLargeFile($fileName, $fileId, $filePath, $mimetype)
+ {
if ($this->isFinalized || array_key_exists($fileName, $this->fileList)) {
return false;
}
@@ -976,7 +994,8 @@ function addLargeFile($fileName, $fileId, $filePath, $mimetype) {
/**
* initialize defaults.
*/
- private function initialize() {
+ private function initialize()
+ {
if ($this->isInitialized) {
return;
}
@@ -1013,7 +1032,8 @@ private function initialize() {
*
* @param string $bookRoot
*/
- function setBookRoot($bookRoot) {
+ public function setBookRoot($bookRoot)
+ {
if ($this->isInitialized) {
die("bookRoot can't be set after book initialization (first file added).");
}
@@ -1031,7 +1051,8 @@ function setBookRoot($bookRoot) {
/**
* @return bool
*/
- function isEPubVersion2() {
+ public function isEPubVersion2()
+ {
return $this->bookVersion === EPub::BOOK_VERSION_EPUB2;
}
@@ -1048,7 +1069,8 @@ function isEPubVersion2() {
*
* @return bool|NavPoint The new NavPoint for that level.
*/
- function subLevel($navTitle = null, $navId = null, $navClass = null, $isNavHidden = false, $writingDirection = null) {
+ public function subLevel($navTitle = null, $navId = null, $navClass = null, $isNavHidden = false, $writingDirection = null)
+ {
return $this->ncx->subLevel(StringHelper::decodeHtmlEntities($navTitle), $navId, $navClass, $isNavHidden, $writingDirection);
}
@@ -1057,7 +1079,8 @@ function subLevel($navTitle = null, $navId = null, $navClass = null, $isNavHidde
*
* Subsequent chapters will be added to this chapters parent level.
*/
- function backLevel() {
+ public function backLevel()
+ {
$this->ncx->backLevel();
}
@@ -1066,7 +1089,8 @@ function backLevel() {
*
* Subsequent chapters will be added to the rooot NavMap.
*/
- function rootLevel() {
+ public function rootLevel()
+ {
$this->ncx->rootLevel();
}
@@ -1077,7 +1101,8 @@ function rootLevel() {
*
* @param int $newLevel
*/
- function setCurrentLevel($newLevel) {
+ public function setCurrentLevel($newLevel)
+ {
$this->ncx->setCurrentLevel($newLevel);
}
@@ -1087,7 +1112,8 @@ function setCurrentLevel($newLevel) {
*
* @return int current level count;
*/
- function getCurrentLevel() {
+ public function getCurrentLevel()
+ {
return $this->ncx->getCurrentLevel();
}
@@ -1095,7 +1121,8 @@ function getCurrentLevel() {
* @param string $nsName
* @param string $nsURI
*/
- function addCustomNamespace($nsName, $nsURI) {
+ public function addCustomNamespace($nsName, $nsURI)
+ {
if ($this->isFinalized) {
return;
}
@@ -1111,7 +1138,8 @@ function addCustomNamespace($nsName, $nsURI) {
* @param string $name
* @param string $URI
*/
- function addCustomPrefix($name, $URI) {
+ public function addCustomPrefix($name, $URI)
+ {
if ($this->isFinalized) {
return;
}
@@ -1129,7 +1157,8 @@ function addCustomPrefix($name, $URI) {
*
* @param MetaValue $value
*/
- function addCustomMetaValue($value) {
+ public function addCustomMetaValue($value)
+ {
if ($this->isFinalized) {
return;
}
@@ -1148,7 +1177,8 @@ function addCustomMetaValue($value) {
* @param string $name property name, including the namespace declaration, ie. "dcterms:modified"
* @param string $content
*/
- function addCustomMetaProperty($name, $content) {
+ public function addCustomMetaProperty($name, $content)
+ {
if ($this->isFinalized) {
return;
}
@@ -1163,7 +1193,8 @@ function addCustomMetaProperty($name, $content) {
* @param string $name
* @param string $content
*/
- function addCustomMetadata($name, $content) {
+ public function addCustomMetadata($name, $content)
+ {
if ($this->isFinalized) {
return;
}
@@ -1179,7 +1210,8 @@ function addCustomMetadata($name, $content) {
* @param string $dublinCoreConstant name
* @param string $value
*/
- function addDublinCoreMetadata($dublinCoreConstant, $value) {
+ public function addDublinCoreMetadata($dublinCoreConstant, $value)
+ {
if ($this->isFinalized) {
return;
}
@@ -1199,7 +1231,8 @@ function addDublinCoreMetadata($dublinCoreConstant, $value) {
*
* @return bool $success
*/
- function setCoverImage($fileName, $imageData = null, $mimetype = null) {
+ public function setCoverImage($fileName, $imageData = null, $mimetype = null)
+ {
if ($this->isFinalized || $this->isCoverImageSet || array_key_exists("CoverPage.xhtml", $this->fileList)) {
return false;
}
@@ -1302,7 +1335,8 @@ function setCoverImage($fileName, $imageData = null, $mimetype = null) {
*
* @return bool $success
*/
- function addReferencePage($pageName, $fileName, $pageData, $reference, $externalReferences = EPub::EXTERNAL_REF_IGNORE, $baseDir = "") {
+ public function addReferencePage($pageName, $fileName, $pageData, $reference, $externalReferences = EPub::EXTERNAL_REF_IGNORE, $baseDir = "")
+ {
if ($this->isFinalized) {
return false;
}
@@ -1346,7 +1380,8 @@ function addReferencePage($pageName, $fileName, $pageData, $reference, $external
*
* @return string $content
*/
- private function wrapChapter($content) {
+ private function wrapChapter($content)
+ {
return $this->htmlContentHeader . "\n" . $content . "\n" . $this->htmlContentFooter;
}
@@ -1356,7 +1391,8 @@ private function wrapChapter($content) {
* @access public
* @return number of chapters
*/
- function getChapterCount() {
+ public function getChapterCount()
+ {
return $this->chapterCount;
}
@@ -1366,7 +1402,8 @@ function getChapterCount() {
* @access public
* @return string $title
*/
- function getTitle() {
+ public function getTitle()
+ {
return $this->title;
}
@@ -1380,7 +1417,8 @@ function getTitle() {
* @access public
* @return bool $success
*/
- function setTitle($title) {
+ public function setTitle($title)
+ {
if ($this->isFinalized) {
return false;
}
@@ -1395,7 +1433,8 @@ function setTitle($title) {
* @access public
* @return string $language
*/
- function getLanguage() {
+ public function getLanguage()
+ {
return $this->language;
}
@@ -1412,7 +1451,8 @@ function getLanguage() {
* @access public
* @return bool $success
*/
- function setLanguage($language) {
+ public function setLanguage($language)
+ {
if ($this->isFinalized || 0 === preg_match('/^((?([A-Za-z]{2,3}(-(?[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(?[A-Za-z]{2}|[0-9]{3}))?)$/', $language)) {
return false;
}
@@ -1427,7 +1467,8 @@ function setLanguage($language) {
* @access public
* @return string $identifier
*/
- function getIdentifier() {
+ public function getIdentifier()
+ {
return $this->identifier;
}
@@ -1454,7 +1495,8 @@ function getIdentifier() {
* @access public
* @return bool $success
*/
- function setIdentifier($identifier, $identifierType) {
+ public function setIdentifier($identifier, $identifierType)
+ {
if ($this->isFinalized || ($identifierType !== EPub::IDENTIFIER_URI && $identifierType !== EPub::IDENTIFIER_ISBN && $identifierType !== EPub::IDENTIFIER_UUID)) {
return false;
}
@@ -1470,7 +1512,8 @@ function setIdentifier($identifier, $identifierType) {
* @access public
* @return string $identifierType
*/
- function getIdentifierType() {
+ public function getIdentifierType()
+ {
return $this->identifierType;
}
@@ -1480,7 +1523,8 @@ function getIdentifierType() {
* @access public
* @return string $description
*/
- function getDescription() {
+ public function getDescription()
+ {
return $this->description;
}
@@ -1500,7 +1544,8 @@ function getDescription() {
* @access public
* @return bool $success
*/
- function setDescription($description) {
+ public function setDescription($description)
+ {
if ($this->isFinalized) {
return false;
}
@@ -1515,7 +1560,8 @@ function setDescription($description) {
* @access public
* @return string $author
*/
- function getAuthor() {
+ public function getAuthor()
+ {
return $this->author;
}
@@ -1540,7 +1586,8 @@ function getAuthor() {
* @access public
* @return bool $success
*/
- function setAuthor($author, $authorSortKey) {
+ public function setAuthor($author, $authorSortKey)
+ {
if ($this->isFinalized) {
return false;
}
@@ -1566,7 +1613,8 @@ function setAuthor($author, $authorSortKey) {
* @access public
* @return bool $success
*/
- function setPublisher($publisherName, $publisherURL) {
+ public function setPublisher($publisherName, $publisherURL)
+ {
if ($this->isFinalized) {
return false;
}
@@ -1582,7 +1630,8 @@ function setPublisher($publisherName, $publisherURL) {
* @access public
* @return string $publisherName
*/
- function getPublisherName() {
+ public function getPublisherName()
+ {
return $this->publisherName;
}
@@ -1592,7 +1641,8 @@ function getPublisherName() {
* @access public
* @return string $publisherURL
*/
- function getPublisherURL() {
+ public function getPublisherURL()
+ {
return $this->publisherURL;
}
@@ -1602,7 +1652,8 @@ function getPublisherURL() {
* @access public
* @return string $date
*/
- function getDate() {
+ public function getDate()
+ {
return $this->date;
}
@@ -1624,7 +1675,8 @@ function getDate() {
* @access public
* @return bool $success
*/
- function setDate($timestamp) {
+ public function setDate($timestamp)
+ {
if ($this->isFinalized) {
return false;
}
@@ -1640,7 +1692,8 @@ function setDate($timestamp) {
* @access public
* @return string $rights
*/
- function getRights() {
+ public function getRights()
+ {
return $this->rights;
}
@@ -1660,7 +1713,8 @@ function getRights() {
* @access public
* @return bool $success
*/
- function setRights($rightsText) {
+ public function setRights($rightsText)
+ {
if ($this->isFinalized) {
return false;
}
@@ -1681,7 +1735,8 @@ function setRights($rightsText) {
*
* @param string $subject
*/
- function setSubject($subject) {
+ public function setSubject($subject)
+ {
if ($this->isFinalized) {
return;
}
@@ -1694,7 +1749,8 @@ function setSubject($subject) {
* @access public
* @return string $sourceURL
*/
- function getSourceURL() {
+ public function getSourceURL()
+ {
return $this->sourceURL;
}
@@ -1714,7 +1770,8 @@ function getSourceURL() {
* @access public
* @return bool $success
*/
- function setSourceURL($sourceURL) {
+ public function setSourceURL($sourceURL)
+ {
if ($this->isFinalized) {
return false;
}
@@ -1729,7 +1786,8 @@ function setSourceURL($sourceURL) {
* @access public
* @return string $coverage
*/
- function getCoverage() {
+ public function getCoverage()
+ {
return $this->coverage;
}
@@ -1757,7 +1815,8 @@ function getCoverage() {
* @access public
* @return bool $success
*/
- function setCoverage($coverage) {
+ public function setCoverage($coverage)
+ {
if ($this->isFinalized) {
return false;
}
@@ -1771,7 +1830,8 @@ function setCoverage($coverage) {
*
* @return string The relation.
*/
- function getRelation() {
+ public function getRelation()
+ {
return $this->relation;
}
@@ -1785,7 +1845,8 @@ function getRelation() {
*
* @param string $relation
*/
- function setRelation($relation) {
+ public function setRelation($relation)
+ {
if ($this->isFinalized) {
return;
}
@@ -1797,7 +1858,8 @@ function setRelation($relation) {
*
* @return string The generator identity string.
*/
- function getGenerator() {
+ public function getGenerator()
+ {
return $this->generator;
}
@@ -1809,7 +1871,8 @@ function getGenerator() {
*
* @param string $generator
*/
- function setGenerator($generator) {
+ public function setGenerator($generator)
+ {
if ($this->isFinalized) {
return;
}
@@ -1826,7 +1889,8 @@ function setGenerator($generator) {
* @access public
* @return bool $success
*/
- function setShortDateFormat() {
+ public function setShortDateFormat()
+ {
if ($this->isFinalized) {
return false;
}
@@ -1844,7 +1908,8 @@ function setShortDateFormat() {
*
* @return bool
*/
- function setReferencesTitle($referencesTitle = "Guide", $referencesId = "", $referencesClass = "references") {
+ public function setReferencesTitle($referencesTitle = "Guide", $referencesId = "", $referencesClass = "references")
+ {
if ($this->isFinalized) {
return false;
}
@@ -1862,7 +1927,8 @@ function setReferencesTitle($referencesTitle = "Guide", $referencesId = "", $ref
*
* @return bool
*/
- function setisReferencesAddedToToc($isReferencesAddedToToc = true) {
+ public function setisReferencesAddedToToc($isReferencesAddedToToc = true)
+ {
if ($this->isFinalized) {
return false;
}
@@ -1877,7 +1943,8 @@ function setisReferencesAddedToToc($isReferencesAddedToToc = true) {
* @access public
* @return bool
*/
- function isFinalized() {
+ public function isFinalized()
+ {
return $this->isFinalized;
}
@@ -1893,7 +1960,8 @@ function isFinalized() {
*
* @return bool
*/
- function buildTOC($cssFileName = null, $tocCSSClass = "toc", $title = "Table of Contents", $addReferences = true, $addToIndex = false, $tocFileName = "TOC.xhtml") {
+ public function buildTOC($cssFileName = null, $tocCSSClass = "toc", $title = "Table of Contents", $addReferences = true, $addToIndex = false, $tocFileName = "TOC.xhtml")
+ {
if ($this->isFinalized) {
return false;
}
@@ -1929,7 +1997,8 @@ function buildTOC($cssFileName = null, $tocCSSClass = "toc", $title = "Table of
*
* @return string The sent file name if successful, FALSE if it failed.
*/
- function saveBook($fileName, $baseDir = '.') {
+ public function saveBook($fileName, $baseDir = '.')
+ {
// Make fileName safe
// $fileName = self::sanitizeFileName($fileName); // It is up to the user to ensure valid file names.
@@ -1964,7 +2033,8 @@ function saveBook($fileName, $baseDir = '.') {
*
* @return bool $success
*/
- function finalize() {
+ public function finalize()
+ {
if ($this->isFinalized || $this->chapterCount == 0 || empty($this->title) || empty($this->language)) {
return false;
}
@@ -2091,7 +2161,8 @@ function finalize() {
*
* @return bool
*/
- private function finalizeTOC() {
+ private function finalizeTOC()
+ {
if (!$this->buildTOC) {
return false;
}
@@ -2118,14 +2189,14 @@ private function finalizeTOC() {
}
$tocData .= $this->getViewportMetaLine();
$tocData .= "\n";
if (!empty($this->tocCssFileName)) {
$tocData .= "tocCssFileName . "\" />\n";
@@ -2147,7 +2218,7 @@ private function finalizeTOC() {
/** @var $navPoint NavPoint */
$fileName = $navPoint->getContentSrc();
$level = $navPoint->getLevel() - 2;
- $tocData .= "\t"
+ $tocData .= "\t
"
/* . str_repeat(" ", $level) . */
. "" . $chapterName . "
\n";
}
@@ -2180,7 +2251,8 @@ private function finalizeTOC() {
*
* @return bool
*/
- function addEPub3TOC($fileName, $tocData) {
+ public function addEPub3TOC($fileName, $tocData)
+ {
if ($this->isEPubVersion2() || $this->isFinalized || array_key_exists($fileName, $this->fileList)) {
return false;
}
@@ -2205,7 +2277,8 @@ function addEPub3TOC($fileName, $tocData) {
*
* @return string
*/
- function buildEPub3TOC($cssFileName = null, $title = "Table of Contents") {
+ public function buildEPub3TOC($cssFileName = null, $title = "Table of Contents")
+ {
$this->ncx->referencesOrder = $this->referencesOrder;
$this->ncx->setDocTitle(StringHelper::decodeHtmlEntities($this->title));
@@ -2217,7 +2290,8 @@ function buildEPub3TOC($cssFileName = null, $title = "Table of Contents") {
*
* @return string with the book in binary form.
*/
- function getBook() {
+ public function getBook()
+ {
if (!$this->isFinalized) {
$this->finalize();
}
@@ -2230,7 +2304,8 @@ function getBook() {
*
* @return string
*/
- function getBookSize() {
+ public function getBookSize()
+ {
if (!$this->isFinalized) {
$this->finalize();
}
@@ -2249,7 +2324,8 @@ function getBookSize() {
*
* @return string|bool The sent file name if successful, FALSE if it failed.
*/
- function sendBook($fileName) {
+ public function sendBook($fileName)
+ {
if (!$this->isFinalized) {
$this->finalize();
}
@@ -2272,7 +2348,8 @@ function sendBook($fileName) {
*
* @return array file list
*/
- function getFileList() {
+ public function getFileList()
+ {
return $this->fileList;
}
@@ -2284,7 +2361,8 @@ function getFileList() {
*
* @return void
*/
- function setSplitSize($size) {
+ public function setSplitSize($size)
+ {
$this->splitDefaultSize = (int)$size;
if ($size < 10240) {
$this->splitDefaultSize = 10240; // Making the file smaller than 10k is not a good idea.
@@ -2296,14 +2374,16 @@ function setSplitSize($size) {
*
* @return int $size
*/
- function getSplitSize() {
+ public function getSplitSize()
+ {
return $this->splitDefaultSize;
}
/**
* @return string
*/
- function getLog() {
+ public function getLog()
+ {
return $this->log->getLog();
}
@@ -2316,7 +2396,8 @@ function getLog() {
* @param int|string $width integer for the width, or a string referencing an entry in the $viewportMap.
* @param int $height
*/
- public function setViewport($width = null, $height = null) {
+ public function setViewport($width = null, $height = null)
+ {
if ($width == null) {
unset($this->viewport);
}
@@ -2333,7 +2414,8 @@ public function setViewport($width = null, $height = null) {
*
* @return string the meta data line, or an empty string if no viewport is defined.
*/
- public function getViewportMetaLine() {
+ public function getViewportMetaLine()
+ {
if (empty($this->viewport)) {
return "";
}
@@ -2349,7 +2431,8 @@ public function getViewportMetaLine() {
*
* @param bool $dangermode
*/
- public function setDangermode($dangermode) {
+ public function setDangermode($dangermode)
+ {
$this->dangermode = $dangermode === true;
}
@@ -2358,7 +2441,8 @@ public function setDangermode($dangermode) {
*
* @return null|Opf the Opf structure class.
*/
- public function DANGER_getOpf() {
+ public function DANGER_getOpf()
+ {
return $this->dangermode ? $this->opf : null;
}
@@ -2367,7 +2451,8 @@ public function DANGER_getOpf() {
*
* @return null|Ncx The Ncx Navigation class
*/
- public function DANGER_getNcx() {
+ public function DANGER_getNcx()
+ {
return $this->dangermode ? $this->ncx : null;
}
@@ -2380,7 +2465,8 @@ public function DANGER_getNcx() {
*
* @return null|Zip The actual zip file.
*/
- public function DANGER_getZip() {
+ public function DANGER_getZip()
+ {
return $this->dangermode ? $this->zip : null;
}
}
diff --git a/src/PHPePub/Core/EPubChapterSplitter.php b/src/PHPePub/Core/EPubChapterSplitter.php
index 0050cef..6d6164b 100644
--- a/src/PHPePub/Core/EPubChapterSplitter.php
+++ b/src/PHPePub/Core/EPubChapterSplitter.php
@@ -1,4 +1,5 @@
setHtmlFormat($htmlFormat);
}
@@ -35,7 +38,8 @@ function __construct($htmlFormat = EPub::FORMAT_XHTML) {
*
* @param string $bookVersion
*/
- function setVersion($bookVersion) {
+ public function setVersion($bookVersion)
+ {
$this->bookVersion = is_string($bookVersion) ? trim($bookVersion) : EPub::BOOK_VERSION_EPUB2;
}
@@ -44,7 +48,8 @@ function setVersion($bookVersion) {
*
* @param string $htmlFormat
*/
- public function setHtmlFormat($htmlFormat) {
+ public function setHtmlFormat($htmlFormat)
+ {
$this->htmlFormat = in_array($htmlFormat, [EPub::FORMAT_XHTML, EPub::FORMAT_HTML5])
? $htmlFormat
: EPub::FORMAT_XHTML;
@@ -58,7 +63,8 @@ public function setHtmlFormat($htmlFormat) {
*
* @return void
*/
- function setSplitSize($size) {
+ public function setSplitSize($size)
+ {
$this->splitDefaultSize = (int)$size;
if ($size < 10240) {
$this->splitDefaultSize = 10240; // Making the file smaller than 10k is not a good idea.
@@ -70,7 +76,8 @@ function setSplitSize($size) {
*
* @return int $size
*/
- function getSplitSize() {
+ public function getSplitSize()
+ {
return $this->splitDefaultSize;
}
@@ -86,7 +93,8 @@ function getSplitSize() {
*
* @return array with 1 or more parts
*/
- function splitChapter($chapter, $splitOnSearchString = false, $searchString = '/^Chapter\\ /i') {
+ public function splitChapter($chapter, $splitOnSearchString = false, $searchString = '/^Chapter\\ /i')
+ {
$chapterData = [];
$isSearchRegexp = $splitOnSearchString && (preg_match('#^(\D|\S|\W).+\1[imsxeADSUXJu]*$#m', $searchString) == 1);
if ($splitOnSearchString && !$isSearchRegexp) {
@@ -98,7 +106,7 @@ function splitChapter($chapter, $splitOnSearchString = false, $searchString = '/
}
switch ($this->htmlFormat) {
- case EPub::FORMAT_HTML5;
+ case EPub::FORMAT_HTML5:
$html5 = new HTML5();
$xmlDoc = $html5->loadHTML($chapter);
break;
diff --git a/src/PHPePub/Core/Logger.php b/src/PHPePub/Core/Logger.php
index 5398ae9..57d660d 100644
--- a/src/PHPePub/Core/Logger.php
+++ b/src/PHPePub/Core/Logger.php
@@ -1,4 +1,5 @@
name = "";
} else {
@@ -30,7 +33,8 @@ function __construct($name = null, private $isLogging = false) {
$this->start();
}
- function start() {
+ public function start()
+ {
/* Prepare Logging. Just in case it's used. later */
if ($this->isLogging) {
$this->tStart = gettimeofday();
@@ -40,7 +44,8 @@ function start() {
}
}
- function logLine($line) {
+ public function logLine($line)
+ {
if ($this->isLogging) {
$tTemp = gettimeofday();
$tS = $this->tStart['sec'] + (((int)($this->tStart['usec'] / 100)) / 10000);
@@ -63,11 +68,13 @@ function logLine($line) {
* @return void
* @TODO make sure elements in the destructor match the current class elements
*/
- function __destruct() {
+ public function __destruct()
+ {
unset($this->log);
}
- function dumpInstalledModules() {
+ public function dumpInstalledModules()
+ {
if ($this->isLogging) {
$isCurlInstalled = extension_loaded('curl') && function_exists('curl_version');
$isGdInstalled = extension_loaded('gd') && function_exists('gd_info');
@@ -83,7 +90,8 @@ function dumpInstalledModules() {
}
}
- function getLog() {
+ public function getLog()
+ {
return $this->log;
}
@@ -92,7 +100,8 @@ function getLog() {
*
* @return string
*/
- public function boolYN($isCurlInstalled) {
+ public function boolYN($isCurlInstalled)
+ {
return ($isCurlInstalled ? "Yes" : "No");
}
}
diff --git a/src/PHPePub/Core/StaticData.php b/src/PHPePub/Core/StaticData.php
index db90683..49b793e 100644
--- a/src/PHPePub/Core/StaticData.php
+++ b/src/PHPePub/Core/StaticData.php
@@ -1,4 +1,5 @@
"\x22",
// " ((double) quotation mark)
diff --git a/src/PHPePub/Core/Structure/NCX/AbstractNavEntry.php b/src/PHPePub/Core/Structure/NCX/AbstractNavEntry.php
index 09a4b58..31bbeaa 100644
--- a/src/PHPePub/Core/Structure/NCX/AbstractNavEntry.php
+++ b/src/PHPePub/Core/Structure/NCX/AbstractNavEntry.php
@@ -8,7 +8,8 @@
namespace PHPePub\Core\Structure\NCX;
-abstract class AbstractNavEntry {
+abstract class AbstractNavEntry
+{
/**
* @return AbstractNavEntry
*/
diff --git a/src/PHPePub/Core/Structure/NCX/NavMap.php b/src/PHPePub/Core/Structure/NCX/NavMap.php
index 88ac5b4..eecbe2d 100644
--- a/src/PHPePub/Core/Structure/NCX/NavMap.php
+++ b/src/PHPePub/Core/Structure/NCX/NavMap.php
@@ -9,7 +9,8 @@
* @copyright 2014- A. Grandt
* @license GNU LGPL 2.1
*/
-class NavMap extends AbstractNavEntry {
+class NavMap extends AbstractNavEntry
+{
final public const _VERSION = 3.30;
private $navPoints = [];
@@ -21,7 +22,8 @@ class NavMap extends AbstractNavEntry {
*
* @param string $writingDirection
*/
- function __construct($writingDirection = null) {
+ public function __construct($writingDirection = null)
+ {
$this->setWritingDirection($writingDirection);
}
@@ -30,11 +32,13 @@ function __construct($writingDirection = null) {
*
* @return void
*/
- function __destruct() {
+ public function __destruct()
+ {
unset($this->navPoints, $this->navLevels, $this->writingDirection);
}
- function getWritingDirection() {
+ public function getWritingDirection()
+ {
return $this->writingDirection;
}
@@ -43,7 +47,8 @@ function getWritingDirection() {
*
* @param string $writingDirection
*/
- function setWritingDirection($writingDirection) {
+ public function setWritingDirection($writingDirection)
+ {
$this->writingDirection = isset($writingDirection) && is_string($writingDirection) ? trim($writingDirection) : null;
}
@@ -54,7 +59,8 @@ function setWritingDirection($writingDirection) {
*
* @return NavMap
*/
- function addNavPoint($navPoint) {
+ public function addNavPoint($navPoint)
+ {
if ($navPoint != null && is_object($navPoint) && $navPoint instanceof NavPoint) {
$navPoint->setParent($this);
if ($navPoint->getWritingDirection() == null) {
@@ -74,18 +80,21 @@ function addNavPoint($navPoint) {
*
* @return number
*/
- function getNavLevels() {
+ public function getNavLevels()
+ {
return $this->navLevels + 1;
}
- function getLevel() {
+ public function getLevel()
+ {
return 1;
}
/**
* @return AbstractNavEntry this
*/
- function getParent() {
+ public function getParent()
+ {
return $this;
}
@@ -93,7 +102,8 @@ function getParent() {
* Finalize the navMap, the final max depth for the "dtb:depth" meta attribute can be retrieved with getNavLevels after finalization
*
*/
- function finalize() {
+ public function finalize()
+ {
$playOrder = 0;
$this->navLevels = 0;
@@ -116,7 +126,8 @@ function finalize() {
* Finalize the navMap, the final max depth for the "dtb:depth" meta attribute can be retrieved with getNavLevels after finalization
*
*/
- function finalizeEPub3() {
+ public function finalizeEPub3()
+ {
$playOrder = 0;
$level = 0;
$this->navLevels = 0;
diff --git a/src/PHPePub/Core/Structure/NCX/NavPoint.php b/src/PHPePub/Core/Structure/NCX/NavPoint.php
index db4e074..bd22d67 100644
--- a/src/PHPePub/Core/Structure/NCX/NavPoint.php
+++ b/src/PHPePub/Core/Structure/NCX/NavPoint.php
@@ -11,7 +11,8 @@
* @copyright 2014- A. Grandt
* @license GNU LGPL 2.1
*/
-class NavPoint extends AbstractNavEntry {
+class NavPoint extends AbstractNavEntry
+{
final public const _VERSION = 3.30;
private $label = null;
@@ -36,7 +37,8 @@ class NavPoint extends AbstractNavEntry {
* @param bool $isNavHidden
* @param string $writingDirection
*/
- function __construct($label, $contentSrc = null, $id = null, $navClass = null, $isNavHidden = false, $writingDirection = null) {
+ public function __construct($label, $contentSrc = null, $id = null, $navClass = null, $isNavHidden = false, $writingDirection = null)
+ {
$this->setLabel($label);
$this->setContentSrc($contentSrc);
$this->setId($id);
@@ -52,7 +54,8 @@ function __construct($label, $contentSrc = null, $id = null, $navClass = null, $
*
* @param string $id
*/
- function setId($id) {
+ public function setId($id)
+ {
$this->id = is_string($id) ? trim($id) : null;
}
@@ -61,7 +64,8 @@ function setId($id) {
*
* @param string $navClass
*/
- function setNavClass($navClass) {
+ public function setNavClass($navClass)
+ {
$this->navClass = isset($navClass) && is_string($navClass) ? trim($navClass) : null;
}
@@ -70,7 +74,8 @@ function setNavClass($navClass) {
*
* @param $isNavHidden
*/
- function setNavHidden($isNavHidden) {
+ public function setNavHidden($isNavHidden)
+ {
$this->isNavHidden = $isNavHidden === true;
}
@@ -79,7 +84,8 @@ function setNavHidden($isNavHidden) {
*
* @return void
*/
- function __destruct() {
+ public function __destruct()
+ {
unset($this->label, $this->contentSrc, $this->id, $this->navClass);
unset($this->isNavHidden, $this->navPoints, $this->parent);
}
@@ -89,7 +95,8 @@ function __destruct() {
*
* @return string Label
*/
- function getLabel() {
+ public function getLabel()
+ {
return $this->label;
}
@@ -100,7 +107,8 @@ function getLabel() {
*
* @param string $label
*/
- function setLabel($label) {
+ public function setLabel($label)
+ {
$this->label = is_string($label) ? trim($label) : null;
}
@@ -109,7 +117,8 @@ function setLabel($label) {
*
* @return string content src url.
*/
- function getContentSrc() {
+ public function getContentSrc()
+ {
return $this->contentSrc;
}
@@ -120,7 +129,8 @@ function getContentSrc() {
*
* @param string $contentSrc
*/
- function setContentSrc($contentSrc) {
+ public function setContentSrc($contentSrc)
+ {
$this->contentSrc = isset($contentSrc) && is_string($contentSrc) ? trim($contentSrc) : null;
}
@@ -129,7 +139,8 @@ function setContentSrc($contentSrc) {
*
* @return AbstractNavEntry if the parent is the root.
*/
- function getParent() {
+ public function getParent()
+ {
return $this->parent;
}
@@ -138,7 +149,8 @@ function getParent() {
*
* @param NavPoint|NavMap $parent
*/
- function setParent($parent) {
+ public function setParent($parent)
+ {
if ($parent != null && is_object($parent) && $parent instanceof AbstractNavEntry) {
$this->parent = $parent;
}
@@ -149,7 +161,8 @@ function setParent($parent) {
*
* @return int level
*/
- function getLevel() {
+ public function getLevel()
+ {
return $this->parent === null ? 1 : $this->parent->getLevel() + 1;
}
@@ -160,7 +173,8 @@ function getLevel() {
*
* @return $this
*/
- function addNavPoint($navPoint) {
+ public function addNavPoint($navPoint)
+ {
if ($navPoint != null && is_object($navPoint) && $navPoint instanceof NavPoint) {
/** @var $navPoint NavPoint */
$navPoint->setParent($this);
@@ -175,7 +189,8 @@ function addNavPoint($navPoint) {
return $this;
}
- function getWritingDirection() {
+ public function getWritingDirection()
+ {
return $this->writingDirection;
}
@@ -184,7 +199,8 @@ function getWritingDirection() {
*
* @param string $writingDirection
*/
- function setWritingDirection($writingDirection) {
+ public function setWritingDirection($writingDirection)
+ {
$this->writingDirection = isset($writingDirection) && is_string($writingDirection) ? trim($writingDirection) : null;
}
@@ -198,7 +214,8 @@ function setWritingDirection($writingDirection) {
*
* @return int
*/
- function finalize(&$nav = "", &$playOrder = 0, $level = 0) {
+ public function finalize(&$nav = "", &$playOrder = 0, $level = 0)
+ {
$maxLevel = $level;
$levelAdjust = 0;
@@ -251,7 +268,8 @@ function finalize(&$nav = "", &$playOrder = 0, $level = 0) {
*
* @return int
*/
- function finalizeEPub3(&$nav = "", &$playOrder = 0, $level = 0, $subLevelClass = null, $subLevelHidden = false) {
+ public function finalizeEPub3(&$nav = "", &$playOrder = 0, $level = 0, $subLevelClass = null, $subLevelHidden = false)
+ {
$maxLevel = $level;
if ($this->id == null) {
diff --git a/src/PHPePub/Core/Structure/Ncx.php b/src/PHPePub/Core/Structure/Ncx.php
index 0d0693e..539c950 100644
--- a/src/PHPePub/Core/Structure/Ncx.php
+++ b/src/PHPePub/Core/Structure/Ncx.php
@@ -1,4 +1,5 @@
navMap = new NavMap($writingDirection);
$this->currentLevel = $this->navMap;
$this->setUid($uid);
@@ -64,7 +67,8 @@ function __construct($uid = null, $docTitle = null, $docAuthor = null, $language
*
* @return void
*/
- function __destruct() {
+ public function __destruct()
+ {
unset($this->parentBook, $this->bookVersion, $this->navMap, $this->uid, $this->meta);
unset($this->docTitle, $this->docAuthor, $this->currentLevel, $this->lastLevel);
unset($this->languageCode, $this->writingDirection, $this->chapterList, $this->referencesTitle);
@@ -75,7 +79,8 @@ function __destruct() {
/**
* @param EPub $parentBook
*/
- public function setBook($parentBook) {
+ public function setBook($parentBook)
+ {
$this->parentBook = $parentBook;
}
@@ -85,7 +90,8 @@ public function setBook($parentBook) {
*
* @param string $bookVersion
*/
- function setVersion($bookVersion) {
+ public function setVersion($bookVersion)
+ {
$this->bookVersion = is_string($bookVersion) ? trim($bookVersion) : EPub::BOOK_VERSION_EPUB2;
}
@@ -93,7 +99,8 @@ function setVersion($bookVersion) {
*
* @return bool TRUE if the book is set to type ePub 2
*/
- function isEPubVersion2() {
+ public function isEPubVersion2()
+ {
return $this->bookVersion === EPub::BOOK_VERSION_EPUB2;
}
@@ -103,7 +110,8 @@ function isEPubVersion2() {
*
* @param string $uid
*/
- function setUid($uid) {
+ public function setUid($uid)
+ {
$this->uid = is_string($uid) ? trim($uid) : null;
}
@@ -113,7 +121,8 @@ function setUid($uid) {
*
* @param string $docTitle
*/
- function setDocTitle($docTitle) {
+ public function setDocTitle($docTitle)
+ {
$this->docTitle = is_string($docTitle) ? trim($docTitle) : null;
}
@@ -123,7 +132,8 @@ function setDocTitle($docTitle) {
*
* @param string $docAuthor
*/
- function setDocAuthor($docAuthor) {
+ public function setDocAuthor($docAuthor)
+ {
$this->docAuthor = is_string($docAuthor) ? trim($docAuthor) : null;
}
@@ -133,7 +143,8 @@ function setDocAuthor($docAuthor) {
*
* @param string $languageCode
*/
- function setLanguageCode($languageCode) {
+ public function setLanguageCode($languageCode)
+ {
$this->languageCode = is_string($languageCode) ? trim($languageCode) : "en";
}
@@ -143,7 +154,8 @@ function setLanguageCode($languageCode) {
*
* @param string $writingDirection
*/
- function setWritingDirection($writingDirection) {
+ public function setWritingDirection($writingDirection)
+ {
$this->writingDirection = is_string($writingDirection) ? trim($writingDirection) : EPub::DIRECTION_LEFT_TO_RIGHT;
}
@@ -153,7 +165,8 @@ function setWritingDirection($writingDirection) {
*
* @param NavMap $navMap
*/
- function setNavMap($navMap) {
+ public function setNavMap($navMap)
+ {
if ($navMap != null && is_object($navMap) && $navMap instanceof NavMap) {
$this->navMap = $navMap;
}
@@ -172,7 +185,8 @@ function setNavMap($navMap) {
*
* @return bool|NavPoint
*/
- function subLevel($navTitle = null, $navId = null, $navClass = null, $isNavHidden = false, $writingDirection = null) {
+ public function subLevel($navTitle = null, $navId = null, $navClass = null, $isNavHidden = false, $writingDirection = null)
+ {
$navPoint = false;
if (isset($navTitle) && isset($navClass)) {
$navPoint = new NavPoint($navTitle, null, $navId, $navClass, $isNavHidden, $writingDirection);
@@ -190,7 +204,8 @@ function subLevel($navTitle = null, $navId = null, $navClass = null, $isNavHidde
*
* Subsequent chapters will be added to this chapters parent level.
*/
- function backLevel() {
+ public function backLevel()
+ {
$this->lastLevel = $this->currentLevel;
$this->currentLevel = $this->currentLevel->getParent();
}
@@ -200,7 +215,8 @@ function backLevel() {
*
* Subsequent chapters will be added to the rooot NavMap.
*/
- function rootLevel() {
+ public function rootLevel()
+ {
$this->lastLevel = $this->currentLevel;
$this->currentLevel = $this->navMap;
}
@@ -212,7 +228,8 @@ function rootLevel() {
*
* @param int $newLevel
*/
- function setCurrentLevel($newLevel) {
+ public function setCurrentLevel($newLevel)
+ {
if ($newLevel <= 1) {
$this->rootLevel();
} else {
@@ -228,7 +245,8 @@ function setCurrentLevel($newLevel) {
*
* @return int current level count;
*/
- function getCurrentLevel() {
+ public function getCurrentLevel()
+ {
return $this->currentLevel->getLevel();
}
@@ -237,7 +255,8 @@ function getCurrentLevel() {
*
* @param NavPoint $navPoint
*/
- function addNavPoint($navPoint) {
+ public function addNavPoint($navPoint)
+ {
$this->lastLevel = $this->currentLevel->addNavPoint($navPoint);
}
@@ -247,7 +266,8 @@ function addNavPoint($navPoint) {
*
* @return NavMap
*/
- function getNavMap() {
+ public function getNavMap()
+ {
return $this->navMap;
}
@@ -258,7 +278,8 @@ function getNavMap() {
* @param string $name
* @param string $content
*/
- function addMetaEntry($name, $content) {
+ public function addMetaEntry($name, $content)
+ {
$name = is_string($name) ? trim($name) : null;
$content = is_string($content) ? trim($content) : null;
@@ -273,7 +294,8 @@ function addMetaEntry($name, $content) {
*
* @return string
*/
- function finalize() {
+ public function finalize()
+ {
$nav = $this->navMap->finalize();
$ncx = "\n";
@@ -313,7 +335,8 @@ function finalize() {
*
* @return string
*/
- function finalizeEPub3($title = "Table of Contents", $cssFileName = null) {
+ public function finalizeEPub3($title = "Table of Contents", $cssFileName = null)
+ {
$end = "\n"
. "referencesList) && count($this->referencesList) > 0) {
$this->rootLevel();
$this->subLevel($this->referencesTitle, $this->referencesId, $this->referencesClass);
@@ -369,7 +393,8 @@ function finalizeReferences() {
*
* @return string
*/
- function finalizeEPub3Landmarks() {
+ public function finalizeEPub3Landmarks()
+ {
$lm = "";
if (isset($this->referencesList) && count($this->referencesList) > 0) {
$lm = "\t\t\t