| @@ 299-313 (lines=15) @@ | ||
| 296 | * |
|
| 297 | * @return \CHMLib\TOCIndex\Tree|null |
|
| 298 | */ |
|
| 299 | public function getTOC() |
|
| 300 | { |
|
| 301 | if ($this->toc === null) { |
|
| 302 | $r = false; |
|
| 303 | foreach ($this->entries as $entry) { |
|
| 304 | if ($entry->isFile() && strcasecmp(substr($entry->getPath(), -4), '.hhc') === 0) { |
|
| 305 | $r = TOCIndex\Tree::fromString($this, $entry->getContents()); |
|
| 306 | break; |
|
| 307 | } |
|
| 308 | } |
|
| 309 | $this->toc = $r; |
|
| 310 | } |
|
| 311 | ||
| 312 | return ($this->toc === false) ? null : $this->toc; |
|
| 313 | } |
|
| 314 | ||
| 315 | /** |
|
| 316 | * Get the index of this CHM file (if available). |
|
| @@ 320-334 (lines=15) @@ | ||
| 317 | * |
|
| 318 | * @return \CHMLib\TOCIndex\Tree|null |
|
| 319 | */ |
|
| 320 | public function getIndex() |
|
| 321 | { |
|
| 322 | if ($this->index === null) { |
|
| 323 | $r = false; |
|
| 324 | foreach ($this->entries as $entry) { |
|
| 325 | if ($entry->isFile() && strcasecmp(substr($entry->getPath(), -4), '.hhk') === 0) { |
|
| 326 | $r = TOCIndex\Tree::fromString($this, $entry->getContents()); |
|
| 327 | break; |
|
| 328 | } |
|
| 329 | } |
|
| 330 | $this->index = $r; |
|
| 331 | } |
|
| 332 | ||
| 333 | return ($this->index === false) ? null : $this->index; |
|
| 334 | } |
|
| 335 | } |
|
| 336 | ||