Code Duplication    Length = 15-15 lines in 2 locations

src/CHM.php 2 locations

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