From 68c838c2917434e753e8391ea7733e8e13ecddb6 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Mon, 30 Mar 2020 14:13:26 +0200 Subject: [PATCH 1/7] Fix phpdoc --- src/CHM.php | 38 ++++++++++++++--------------- src/Entry.php | 8 +++--- src/Header/ITSF.php | 8 +++--- src/Header/ITSP.php | 8 +++--- src/Header/LZXC.php | 6 ++--- src/Header/PMGI.php | 4 +-- src/Header/PMGL.php | 6 ++--- src/Header/VersionedHeader.php | 2 +- src/LZX/Inflater.php | 12 ++++----- src/LZX/LRUCache.php | 4 +-- src/LZX/Tree.php | 12 ++++----- src/Map.php | 4 +-- src/Reader/BitReader.php | 4 +-- src/Reader/FileReader.php | 10 ++++---- src/Reader/StringReader.php | 8 +++--- src/Section/MSCompressedSection.php | 2 +- src/Section/Section.php | 4 +-- src/Section/UncompressedSection.php | 4 +-- src/TOCIndex/Item.php | 18 +++++++------- src/TOCIndex/Tree.php | 26 ++++++++++---------- 20 files changed, 94 insertions(+), 94 deletions(-) diff --git a/src/CHM.php b/src/CHM.php index aa6bcf1..decf87b 100644 --- a/src/CHM.php +++ b/src/CHM.php @@ -16,58 +16,58 @@ class CHM /** * The reader that provides the data. * - * @var Reader + * @var \CHMLib\Reader\Reader */ protected $reader; /** * The CHM initial header. * - * @var Header\ITSF + * @var \CHMLib\Header\ITSF */ protected $itsf; /** * The directory listing header. * - * @var Header\ITSP + * @var \CHMLib\Header\ITSP */ protected $itsp; /** * The entries found in this CHM. * - * @var Entry[] + * @var \CHMLib\Entry[] */ protected $entries; /** * The data sections. * - * @var Section\Section[] + * @var \CHMLib\Section\Section[] */ protected $sections; /** * The TOC. * - * @var TOCIndex\Tree|null|false + * @var \CHMLib\TOCIndex\Tree|null|false */ protected $toc; /** * The index. * - * @var TOCIndex\Tree|null|false + * @var \CHMLib\TOCIndex\Tree|null|false */ protected $index; /** * Initializes the instance. * - * @param Reader $reader The reader that provides the data. + * @param \CHMLib\Reader\Reader $reader The reader that provides the data. * - * @throws Exception Throws an Exception in case of errors. + * @throws \Exception Throws an Exception in case of errors. */ public function __construct(Reader $reader) { @@ -128,7 +128,7 @@ public static function fromFile($filename) /** * Get the reader that provides the data. * - * @return Reader + * @return \CHMLib\Reader\Reader */ public function getReader() { @@ -138,7 +138,7 @@ public function getReader() /** * Get the CHM initial header. * - * @return Header\ITSF + * @return \CHMLib\Header\ITSF */ public function getITSF() { @@ -148,7 +148,7 @@ public function getITSF() /** * Get the directory listing header. * - * @return Header\ITSP + * @return \CHMLib\Header\ITSP */ public function getITSP() { @@ -160,7 +160,7 @@ public function getITSP() * * @param string $path The full path (case sensitive) of the entry to look for. * - * @return Entry|null + * @return \CHMLib\Entry|null */ public function getEntryByPath($path) { @@ -192,7 +192,7 @@ public function getEntries($type = null) * * @param int $i * - * @return Section\Section|null + * @return \CHMLib\Section\Section|null */ public function getSectionByIndex($i) { @@ -202,9 +202,9 @@ public function getSectionByIndex($i) /** * Retrieve the list of the entries contained in this CHM. * - * @throws Exception Throws an Exception in case of errors. + * @throws \Exception Throws an Exception in case of errors. * - * @return Entry[] + * @return \CHMLib\Entry[] */ protected function retrieveEntryList() { @@ -242,7 +242,7 @@ protected function retrieveEntryList() /** * Retrieve the list of the data sections contained in this CHM. * - * @throws Exception Throws an Exception in case of errors. + * @throws \Exception Throws an Exception in case of errors. */ protected function retrieveSectionList() { @@ -285,7 +285,7 @@ protected function retrieveSectionList() /** * Get the TOC of this CHM file (if available). * - * @return SpecialEntry\TOC|null + * @return \CHMLib\TOCIndex\Tree|null */ public function getTOC() { @@ -306,7 +306,7 @@ public function getTOC() /** * Get the index of this CHM file (if available). * - * @return TOCIndex\Tree|null + * @return \CHMLib\TOCIndex\Tree|null */ public function getIndex() { diff --git a/src/Entry.php b/src/Entry.php index 05d4d81..f4fbd32 100644 --- a/src/Entry.php +++ b/src/Entry.php @@ -67,7 +67,7 @@ public static function setContentCacheEnabled($enabled) /** * The parent CHM file. * - * @var CHM + * @var \CHMLib\CHM */ protected $chm; @@ -116,7 +116,7 @@ public static function setContentCacheEnabled($enabled) /** * Initializes the instance. * - * @param CHM $chm The parent CHM file. + * @param \CHMLib\CHM $chm The parent CHM file. */ public function __construct(CHM $chm) { @@ -145,7 +145,7 @@ public function __construct(CHM $chm) /** * Get the parent CHM file. * - * @return CHM + * @return \CHMLib\CHM */ public function getCHM() { @@ -245,7 +245,7 @@ public function getType() /** * Get the contents of this entry. * - * @throws Exception Throws an Exception in case of errors. + * @throws \Exception Throws an Exception in case of errors. * * @return string */ diff --git a/src/Header/ITSF.php b/src/Header/ITSF.php index 804062e..4d6eb39 100644 --- a/src/Header/ITSF.php +++ b/src/Header/ITSF.php @@ -22,7 +22,7 @@ class ITSF extends VersionedHeader /** * The language of the OS at the time of compilation. * - * @var Language + * @var \CHMLib\Windows\Language */ protected $originalOSLanguage; @@ -80,8 +80,8 @@ class ITSF extends VersionedHeader * * @param Reader $reader The reader that provides the data. * - * @throws UnexpectedHeaderException Throws an UnexpectedHeaderException if the header signature is not valid. - * @throws Exception Throws an Exception in case of errors. + * @throws \CHMLib\Exception\UnexpectedHeaderException Throws an UnexpectedHeaderException if the header signature is not valid. + * @throws \Exception Throws an Exception in case of errors. */ public function __construct(Reader $reader) { @@ -121,7 +121,7 @@ public function getTimestamp() /** * Get the language of the OS at the time of compilation. * - * @return Language + * @return \CHMLib\Windows\Language */ public function getOriginalOSLanguage() { diff --git a/src/Header/ITSP.php b/src/Header/ITSP.php index aa17627..bbf4b73 100644 --- a/src/Header/ITSP.php +++ b/src/Header/ITSP.php @@ -66,7 +66,7 @@ class ITSP extends VersionedHeader /** * The language of the program that generated the CHM file. * - * @var Language + * @var \CHMLib\Windows\Language */ protected $generatorLanguage; @@ -82,8 +82,8 @@ class ITSP extends VersionedHeader * * @param Reader $reader The reader that provides the data. * - * @throws UnexpectedHeaderException Throws an UnexpectedHeaderException if the header signature is not valid. - * @throws Exception Throws an Exception in case of errors. + * @throws \CHMLib\Exception\UnexpectedHeaderException Throws an UnexpectedHeaderException if the header signature is not valid. + * @throws \Exception Throws an Exception in case of errors. */ public function __construct(Reader $reader) { @@ -186,7 +186,7 @@ public function getNumberOfDirectoryChunks() /** * Get the language of the program that generated the CHM file. * - * @return Language + * @return \CHMLib\Windows\Language */ public function getGeneratorLanguage() { diff --git a/src/Header/LZXC.php b/src/Header/LZXC.php index 9b8d497..60fc319 100644 --- a/src/Header/LZXC.php +++ b/src/Header/LZXC.php @@ -42,10 +42,10 @@ class LZXC extends Header /** * Initializes the instance. * - * @param Reader $reader The reader that provides the data. + * @param \CHMLib\Reader\Reader $reader The reader that provides the data. * - * @throws UnexpectedHeaderException Throws an UnexpectedHeaderException if the header signature is not valid. - * @throws Exception Throws an Exception in case of errors. + * @throws \CHMLib\Exception\UnexpectedHeaderException Throws an UnexpectedHeaderException if the header signature is not valid. + * @throws \Exception Throws an Exception in case of errors. */ public function __construct(Reader $reader) { diff --git a/src/Header/PMGI.php b/src/Header/PMGI.php index e4b297d..6800e24 100644 --- a/src/Header/PMGI.php +++ b/src/Header/PMGI.php @@ -23,8 +23,8 @@ class PMGI extends Header * * @param Reader $reader The reader that provides the data. * - * @throws UnexpectedHeaderException Throws an UnexpectedHeaderException if the header signature is not valid. - * @throws Exception Throws an Exception in case of errors. + * @throws \CHMLib\Exception\UnexpectedHeaderException Throws an UnexpectedHeaderException if the header signature is not valid. + * @throws \Exception Throws an Exception in case of errors. */ public function __construct(Reader $reader) { diff --git a/src/Header/PMGL.php b/src/Header/PMGL.php index c301e3b..18bed98 100644 --- a/src/Header/PMGL.php +++ b/src/Header/PMGL.php @@ -35,10 +35,10 @@ class PMGL extends Header /** * Initializes the instance. * - * @param Reader $reader The reader that provides the data. + * @param \CHMLib\Reader\Reader $reader The reader that provides the data. * - * @throws UnexpectedHeaderException Throws an UnexpectedHeaderException if the header signature is not valid. - * @throws Exception Throws an Exception in case of errors. + * @throws \CHMLib\Exception\UnexpectedHeaderException Throws an UnexpectedHeaderException if the header signature is not valid. + * @throws \Exception Throws an Exception in case of errors. */ public function __construct(Reader $reader) { diff --git a/src/Header/VersionedHeader.php b/src/Header/VersionedHeader.php index e742db2..73374da 100644 --- a/src/Header/VersionedHeader.php +++ b/src/Header/VersionedHeader.php @@ -26,7 +26,7 @@ abstract class VersionedHeader extends Header /** * Initializes the instance. * - * @param Reader $reader The reader that provides the data. + * @param \CHMLib\Reader\Reader $reader The reader that provides the data. * * @throws \Exception Throws an Exception in case of errors. */ diff --git a/src/LZX/Inflater.php b/src/LZX/Inflater.php index 96084d7..a5cfc50 100644 --- a/src/LZX/Inflater.php +++ b/src/LZX/Inflater.php @@ -198,21 +198,21 @@ class Inflater /** * The main Huffman tree. * - * @var Tree + * @var \CHMLib\LZX\Tree */ protected $mainTree; /** * The length Huffman tree. * - * @var Tree + * @var \CHMLib\LZX\Tree */ protected $lengthTree; /** * The aligned offset Huffman tree. * - * @var Tree + * @var \CHMLib\LZX\Tree */ protected $alignedTree; @@ -221,7 +221,7 @@ class Inflater * * @param int $windowSize The window size (determines the number of window subdivisions, or "position slots"), * - * @throws Exception Throws an Exception in case of errors. + * @throws \Exception Throws an Exception in case of errors. */ public function __construct($windowSize) { @@ -255,10 +255,10 @@ public function __construct($windowSize) * Uncompress bytes. * * @param bool $reset Reset the LXZ state? - * @param BitReader $reader The reader that provides the data. + * @param \CHMLib\Reader\BitReader $reader The reader that provides the data. * @param int $numberOfBytes The number of decompressed bytes to retrieve. * - * @throws Exception Throws an Exception in case of errors. + * @throws \Exception Throws an Exception in case of errors. * * @return string */ diff --git a/src/LZX/LRUCache.php b/src/LZX/LRUCache.php index e35c979..a196dab 100644 --- a/src/LZX/LRUCache.php +++ b/src/LZX/LRUCache.php @@ -12,7 +12,7 @@ class LRUCache /** * The cached items. * - * @var LRUCacheItem[] + * @var \CHMLib\LZX\LRUCacheItem[] */ protected $cache; @@ -28,7 +28,7 @@ class LRUCache * * @param int $capacity The maximim capacity of the cache. * - * @throws Exception Throws an Exception in case of errors. + * @throws \Exception Throws an Exception in case of errors. */ public function __construct($capacity) { diff --git a/src/LZX/Tree.php b/src/LZX/Tree.php index 3538bf3..19abf6c 100644 --- a/src/LZX/Tree.php +++ b/src/LZX/Tree.php @@ -69,7 +69,7 @@ public function __construct($bits, $maxSymbol) /** * Build a fast Huffman decoding table out of just a canonical Huffman code lengths table. * - * @throws Exception Throws an Exception in case of errors. + * @throws \Exception Throws an Exception in case of errors. * * @author This function was coded by David Tritscher. */ @@ -142,9 +142,9 @@ public function makeSymbolTable() /** * Read the align lengths data. * - * @param BitReader $reader The reader that provides the data. + * @param \CHMLib\Reader\BitReader $reader The reader that provides the data. * - * @throws Exception Throws an Exception in case of errors. + * @throws \Exception Throws an Exception in case of errors. */ public function readAlignLengthTable(BitReader $reader) { @@ -157,7 +157,7 @@ public function readAlignLengthTable(BitReader $reader) * Read in code lengths for symbols first to last in the given table. * The code lengths are stored in their own special LZX way. * - * @param BitReader $reader The reader that provides the data. + * @param \CHMLib\Reader\BitReader $reader The reader that provides the data. * @param int $first * @param int $last */ @@ -207,9 +207,9 @@ public function readLengthTable(BitReader $reader, $first, $last) /** * Decode a Huffman symbol from the bitstream using the stated table and return it. * - * @param BitReader $reader The reader that provides the data. + * @param \CHMLib\Reader\BitReader $reader The reader that provides the data. * - * @throws Exception Throws an Exception in case of errors. + * @throws \Exception Throws an Exception in case of errors. * * @return int */ diff --git a/src/Map.php b/src/Map.php index 57e344e..55fcb84 100644 --- a/src/Map.php +++ b/src/Map.php @@ -26,7 +26,7 @@ public function __construct() * Add a parsed CHM file to this map. * * @param string $name The name to give the new CHM instance. - * @param CHM $chm The parsed CHM file. + * @param \CHMLib\CHM $chm The parsed CHM file. */ public function add($name, CHM $chm) { @@ -38,7 +38,7 @@ public function add($name, CHM $chm) * * @param string $name The mapped name. * - * @return CHM|null + * @return \CHMLib\CHM|null */ public function get($name) { diff --git a/src/Reader/BitReader.php b/src/Reader/BitReader.php index 53213b5..eacf4d6 100644 --- a/src/Reader/BitReader.php +++ b/src/Reader/BitReader.php @@ -118,7 +118,7 @@ public function readLE($n) * * @param int $n The number of bytes to skip. * - * @throws Exception Throws an Exception in case of errors. + * @throws \Exception Throws an Exception in case of errors. */ public function skip($n) { @@ -134,7 +134,7 @@ public function skip($n) * @param int $offset The offset at which the data should be inserted. * @param int $length The number of bytes to read. * - * @throws Exception Throws an Exception in case of errors. + * @throws \Exception Throws an Exception in case of errors. * * @return array Return the $buffer array with filled-in bytes. */ diff --git a/src/Reader/FileReader.php b/src/Reader/FileReader.php index abbe3b3..062b967 100644 --- a/src/Reader/FileReader.php +++ b/src/Reader/FileReader.php @@ -35,7 +35,7 @@ class FileReader extends Reader * * @param string $filename The file name to be read. * - * @throws Exception Throws an Exception in case of errors. + * @throws \Exception Throws an Exception in case of errors. */ public function __construct($filename) { @@ -81,7 +81,7 @@ public function getFilename() /** * {@inheritdoc} * - * @see Reader::setPosition() + * @see \CHMLib\Reader\Reader::setPosition() */ public function setPosition($position) { @@ -93,7 +93,7 @@ public function setPosition($position) /** * {@inheritdoc} * - * @see Reader::getPosition() + * @see \CHMLib\Reader\Reader::getPosition() */ public function getPosition() { @@ -108,7 +108,7 @@ public function getPosition() /** * {@inheritdoc} * - * @see Reader::getLength() + * @see \CHMLib\Reader\Reader::getLength() */ public function getLength() { @@ -118,7 +118,7 @@ public function getLength() /** * {@inheritdoc} * - * @see Reader::readString() + * @see \CHMLib\Reader\Reader::readString() */ public function readString($length) { diff --git a/src/Reader/StringReader.php b/src/Reader/StringReader.php index 179e588..d71f617 100644 --- a/src/Reader/StringReader.php +++ b/src/Reader/StringReader.php @@ -45,7 +45,7 @@ public function __construct($string) /** * {@inheritdoc} * - * @see Reader::setPosition() + * @see \CHMLib\Reader\Reader::setPosition() */ public function setPosition($position) { @@ -58,7 +58,7 @@ public function setPosition($position) /** * {@inheritdoc} * - * @see Reader::getPosition() + * @see \CHMLib\Reader\Reader::getPosition() */ public function getPosition() { @@ -68,7 +68,7 @@ public function getPosition() /** * {@inheritdoc} * - * @see Reader::getLength() + * @see \CHMLib\Reader\Reader::getLength() */ public function getLength() { @@ -78,7 +78,7 @@ public function getLength() /** * {@inheritdoc} * - * @see Reader::readString() + * @see \CHMLib\Reader\Reader::readString() */ public function readString($length) { diff --git a/src/Section/MSCompressedSection.php b/src/Section/MSCompressedSection.php index bf71f63..db0efb3 100644 --- a/src/Section/MSCompressedSection.php +++ b/src/Section/MSCompressedSection.php @@ -60,7 +60,7 @@ class MSCompressedSection extends Section /** * The currently cached blocks. * - * @var LRUCache + * @var \CHMLib\LZX\LRUCache */ protected $cachedBlocks; diff --git a/src/Section/Section.php b/src/Section/Section.php index b8b2210..eab51b7 100644 --- a/src/Section/Section.php +++ b/src/Section/Section.php @@ -26,7 +26,7 @@ abstract class Section /** * Initializes the instance. * - * @param CHM $chm The parent CHM file. + * @param \CHMLib\CHM $chm The parent CHM file. */ public function __construct(CHM $chm) { @@ -39,7 +39,7 @@ public function __construct(CHM $chm) * @param int $offset The position where the data starts (relative to the start of this section). * @param int $length The length of the (compressed) data. * - * @throws Exception Throws an Exception in case of errors. + * @throws \Exception Throws an Exception in case of errors. * * @return string */ diff --git a/src/Section/UncompressedSection.php b/src/Section/UncompressedSection.php index 7d44e68..86906e7 100644 --- a/src/Section/UncompressedSection.php +++ b/src/Section/UncompressedSection.php @@ -12,7 +12,7 @@ class UncompressedSection extends Section /** * Initializes the instance. * - * @param CHM $chm The parent CHM file. + * @param \CHMLib\CHM $chm The parent CHM file. */ public function __construct(CHM $chm) { @@ -23,7 +23,7 @@ public function __construct(CHM $chm) /** * {@inheritdoc} * - * @see Section::getContents() + * @see \CHMLib\Section\Section::getContents() */ public function getContents($offset, $length) { diff --git a/src/TOCIndex/Item.php b/src/TOCIndex/Item.php index 59cc12a..853acca 100644 --- a/src/TOCIndex/Item.php +++ b/src/TOCIndex/Item.php @@ -15,7 +15,7 @@ class Item /** * The parent CHM instance. * - * @var CHM + * @var \CHMLib\CHM */ protected $chm; @@ -99,17 +99,17 @@ class Item /** * The sub-elements of this Item. * - * @var Tree + * @var \CHMLib\TOCIndex\Tree */ protected $children; /** * Initializes the instance. * - * @param CHM $chm The parent CHM instance. - * @param DOMElement $object The OBJECT element. + * @param \CHMLib\CHM $chm The parent CHM instance. + * @param \DOMElement $object The OBJECT element. * - * @throws Exception Throw an Exception in case of errors. + * @throws \Exception Throw an Exception in case of errors. * * @return static */ @@ -187,7 +187,7 @@ public function __construct(CHM $chm, DOMElement $object) /** * Get the parent CHM instance. * - * @return CHM + * @return \CHMLib\CHM */ public function getCHM() { @@ -307,7 +307,7 @@ public function getImageNumber() /** * Get the sub-elements of this Item. * - * @return Tree + * @return \CHMLib\TOCIndex\Tree */ public function getChildren() { @@ -317,10 +317,10 @@ public function getChildren() /** * Resolve the items contained in other CHM files. * - * @param Map $map + * @param \CHMLib\Map $map * @param bool $ignoreErrors Set to true to ignore missing CHM and/or entries. * - * @throws Exception Throw an Exception in case of errors. + * @throws \Exception Throw an Exception in case of errors. * * @return static[] */ diff --git a/src/TOCIndex/Tree.php b/src/TOCIndex/Tree.php index c2726b1..2509179 100644 --- a/src/TOCIndex/Tree.php +++ b/src/TOCIndex/Tree.php @@ -18,7 +18,7 @@ class Tree implements Iterator /** * List of Item instances children of this tree. * - * @var Item[] + * @var \CHMLib\TOCIndex\Item[] */ protected $items; @@ -40,7 +40,7 @@ public function __construct() /** * Get the items contained in this tree. * - * @return Item[] + * @return \CHMLib\TOCIndex\Item[] */ public function getItems() { @@ -65,10 +65,10 @@ public function getItemsCount() /** * Resolve the items contained in other CHM files. * - * @param Map $map + * @param \CHMLib\Map $map * @param bool $ignoreErrors Set to true to ignore missing CHM and/or entries. * - * @throws Exception Throw an Exception in case of errors. + * @throws \Exception Throw an Exception in case of errors. */ public function resolve(Map $map, $ignoreErrors = false) { @@ -83,10 +83,10 @@ public function resolve(Map $map, $ignoreErrors = false) /** * Create a new instance starting from the whole TOC/Index source 'HTML'. * - * @param CHM $chm The parent CHM instance. + * @param \CHMLib\CHM $chm The parent CHM instance. * @param string $data The contents of the .hhc/.hhk file. * - * @throws Exception Throw an Exception in case of errors. + * @throws \Exception Throw an Exception in case of errors. * * @return static */ @@ -129,8 +129,8 @@ public static function fromString(CHM $chm, $data) /** * Parse a DOMElement and read the items/sub trees. * - * @param CHM $chm - * @param DOMElement $parentElement + * @param \CHMLib\CHM $chm + * @param \DOMElement $parentElement * @param int $depth */ protected function parseParentElement(CHM $chm, DOMElement $parentElement, $depth) @@ -164,7 +164,7 @@ protected function parseParentElement(CHM $chm, DOMElement $parentElement, $dept /** * {@inheritdoc} * - * @see Iterator::current() + * @see \Iterator::current() */ public function current() { @@ -174,7 +174,7 @@ public function current() /** * {@inheritdoc} * - * @see Iterator::key() + * @see \Iterator::key() */ public function key() { @@ -184,7 +184,7 @@ public function key() /** * {@inheritdoc} * - * @see Iterator::next() + * @see \Iterator::next() */ public function next() { @@ -194,7 +194,7 @@ public function next() /** * {@inheritdoc} * - * @see Iterator::rewind() + * @see \Iterator::rewind() */ public function rewind() { @@ -204,7 +204,7 @@ public function rewind() /** * {@inheritdoc} * - * @see Iterator::valid() + * @see \Iterator::valid() */ public function valid() { From 478167efca4b51053229677fc38b517dae12b741 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Mon, 30 Mar 2020 14:14:13 +0200 Subject: [PATCH 2/7] Remove unused variable --- src/Section/MSCompressedSection.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Section/MSCompressedSection.php b/src/Section/MSCompressedSection.php index db0efb3..42682a9 100644 --- a/src/Section/MSCompressedSection.php +++ b/src/Section/MSCompressedSection.php @@ -138,7 +138,6 @@ public function getContents($offset, $length) $blockNo = $startBlockNo - $startBlockNo % $this->resetInterval; $inflater = new Inflater($this->windowSize); - $buf = array(); $pos = 0; $bytesLeft = 0; $reader = $this->chm->getReader(); From 1eea9d6a259ec2e97e1b7cf2cf2a46a399a2f5b7 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Mon, 30 Mar 2020 14:16:38 +0200 Subject: [PATCH 3/7] Fix IDE warnings --- src/CHM.php | 2 +- src/TOCIndex/Item.php | 1 + src/TOCIndex/Tree.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/CHM.php b/src/CHM.php index decf87b..dca5560 100644 --- a/src/CHM.php +++ b/src/CHM.php @@ -221,7 +221,7 @@ protected function retrieveEntryList() throw $x; } $this->reader->setPosition($offset); - $pmgi = new Header\PMGI($this->reader); + new Header\PMGI($this->reader); $pmgl = null; } if ($pmgl !== null) { diff --git a/src/TOCIndex/Item.php b/src/TOCIndex/Item.php index 853acca..fec9712 100644 --- a/src/TOCIndex/Item.php +++ b/src/TOCIndex/Item.php @@ -128,6 +128,7 @@ public function __construct(CHM $chm, DOMElement $object) $this->merge = null; $this->imageNumber = null; $this->children = new Tree(); + $matches = null; foreach ($object->childNodes as $p) { if ($p instanceof DOMElement && strcasecmp($p->tagName, 'param') === 0) { $name = trim((string) $p->getAttribute('name')); diff --git a/src/TOCIndex/Tree.php b/src/TOCIndex/Tree.php index 2509179..69381e7 100644 --- a/src/TOCIndex/Tree.php +++ b/src/TOCIndex/Tree.php @@ -6,7 +6,6 @@ use CHMLib\Map; use DOMDocument; use DOMElement; -use DOMXpath; use Exception; use Iterator; @@ -98,6 +97,7 @@ public static function fromString(CHM $chm, $data) $result = new static(); $data = trim((string) $data); if (stripos($data, ' Date: Mon, 30 Mar 2020 14:22:30 +0200 Subject: [PATCH 4/7] Add funding stuff --- .github/FUNDING.yml | 2 ++ README.md | 6 ++++++ composer.json | 12 +++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..4ba6f42 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: mlocati +custom: "https://paypal.me/mlocati" diff --git a/README.md b/README.md index 16da74e..1281ff0 100644 --- a/README.md +++ b/README.md @@ -115,3 +115,9 @@ $toc->resolve($map); // Now the TOC of the main CHM file contains references to the entries in the other two CHM files printTree($toc, 0); ``` + + + +## Do you want to really say thank you? + +You can offer me a [monthly coffee](https://github.com/sponsors/mlocati) or a [one-time coffee](https://paypal.me/mlocati) :wink: diff --git a/composer.json b/composer.json index 286a764..17e4d5c 100644 --- a/composer.json +++ b/composer.json @@ -27,5 +27,15 @@ }, "require": { "php": ">=5.3.3" - } + }, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/mlocati" + }, + { + "type": "other", + "url": "https://www.paypal.me/mlocati" + } + ] } From 5300f32618d108d215b6840ea0a2186c31d00d63 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Mon, 30 Mar 2020 14:26:53 +0200 Subject: [PATCH 5/7] Add support for X-Condition attribute of TOC items --- src/TOCIndex/Item.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/TOCIndex/Item.php b/src/TOCIndex/Item.php index fec9712..f8d3898 100644 --- a/src/TOCIndex/Item.php +++ b/src/TOCIndex/Item.php @@ -96,6 +96,13 @@ class Item */ protected $imageNumber; + /** + * The value of the X-Condition parameter. + * + * @var string + */ + protected $xCondition; + /** * The sub-elements of this Item. * @@ -127,6 +134,7 @@ public function __construct(CHM $chm, DOMElement $object) $this->windowName = ''; $this->merge = null; $this->imageNumber = null; + $this->xCondition = ''; $this->children = new Tree(); $matches = null; foreach ($object->childNodes as $p) { @@ -178,6 +186,9 @@ public function __construct(CHM $chm, DOMElement $object) throw new Exception("Invalid value of the '$name' attribute: $value"); } break; + case 'x-condition': + $this->xCondition = $value; + break; default: throw new Exception("Unknown parameter name '$name' of a tree item (value: '$value')"); } @@ -304,6 +315,16 @@ public function getImageNumber() { return $this->imageNumber; } + + /** + * Get the value of the X-Condition parameter. + * + * @return string + */ + public function getXCondition() + { + return $this->xCondition; + } /** * Get the sub-elements of this Item. From 1a3fc0b30b834dc72592dea91d16fc5554746629 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Mon, 30 Mar 2020 14:27:44 +0200 Subject: [PATCH 6/7] Run TravisCI tests only in master branch --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 6289cb6..054d170 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,10 @@ sudo: true language: php +branches: + only: + - master + env: - COMPOSER_DISABLE_XDEBUG_WARN=1 From 556c22de63c16fdace1a4f8e1adc360658d1c506 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Mon, 30 Mar 2020 14:32:06 +0200 Subject: [PATCH 7/7] Test more PHP versions --- .travis.yml | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 054d170..e14a184 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,13 +9,6 @@ branches: env: - COMPOSER_DISABLE_XDEBUG_WARN=1 -php: - - 5.3 - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - hhvm before_script: - sudo apt-get -qq update @@ -28,6 +21,35 @@ script: - mkdir -p build/logs - ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml +matrix: + fast_finish: true + allow_failures: + - name: Test with PHP Nightly + include: + - name: Test with PHP 5.3 + dist: precise + php: '5.3' + - name: Test with PHP 5.4 + dist: trusty + php: '5.4' + - name: Test with PHP 5.5 + dist: trusty + php: '5.5' + - name: Test with PHP 5.6 + php: '5.6' + - name: Test with PHP 7.0 + php: '7.0' + - name: Test with PHP 7.1 + php: '7.1' + - name: Test with PHP 7.2 + php: '7.2' + - name: Test with PHP 7.3 + php: '7.3' + - name: Test with PHP 7.4 + php: '7.4' + - name: Test with PHP Nightly + php: nightly + cache: directories: - vendor