Beispiel #1
0
 /**
  * Get the contents of this entry.
  *
  * @throws Exception Throws an Exception in case of errors.
  *
  * @return string
  */
 public function getContents()
 {
     $cacheEnabled = static::getContentCacheEnabled();
     if ($cacheEnabled && $this->cachedContents !== null) {
         $result = $this->cachedContents;
     } else {
         $section = $this->chm->getSectionByIndex($this->contentSectionIndex);
         if ($section === null) {
             throw new Exception("The CHM file does not contain a data section with index {$this->contentSectionIndex}");
         }
         $result = $section->getContents($this->offset, $this->length);
         $this->cachedContents = $cacheEnabled ? $result : null;
     }
     return $result;
 }