Code Duplication    Length = 11-11 lines in 2 locations

src/PhpSpreadsheet/Spreadsheet.php 2 locations

@@ 341-351 (lines=11) @@
338
     * @param string $pName Sheet name
339
     * @return Worksheet
340
     */
341
    public function getSheetByCodeName($pName = '')
342
    {
343
        $worksheetCount = count($this->workSheetCollection);
344
        for ($i = 0; $i < $worksheetCount; ++$i) {
345
            if ($this->workSheetCollection[$i]->getCodeName() == $pName) {
346
                return $this->workSheetCollection[$i];
347
            }
348
        }
349
350
        return null;
351
    }
352
353
    /**
354
     * Create a new PhpSpreadsheet with one Worksheet
@@ 596-606 (lines=11) @@
593
     * @param  string $pName Sheet name
594
     * @return Worksheet
595
     */
596
    public function getSheetByName($pName = '')
597
    {
598
        $worksheetCount = count($this->workSheetCollection);
599
        for ($i = 0; $i < $worksheetCount; ++$i) {
600
            if ($this->workSheetCollection[$i]->getTitle() === $pName) {
601
                return $this->workSheetCollection[$i];
602
            }
603
        }
604
605
        return null;
606
    }
607
608
    /**
609
     * Get index for sheet