Code Duplication    Length = 11-11 lines in 2 locations

src/PhpSpreadsheet/Spreadsheet.php 2 locations

@@ 357-367 (lines=11) @@
354
     *
355
     * @return Worksheet
356
     */
357
    public function getSheetByCodeName($pName)
358
    {
359
        $worksheetCount = count($this->workSheetCollection);
360
        for ($i = 0; $i < $worksheetCount; ++$i) {
361
            if ($this->workSheetCollection[$i]->getCodeName() == $pName) {
362
                return $this->workSheetCollection[$i];
363
            }
364
        }
365
366
        return null;
367
    }
368
369
    /**
370
     * Create a new PhpSpreadsheet with one Worksheet.
@@ 622-632 (lines=11) @@
619
     *
620
     * @return Worksheet
621
     */
622
    public function getSheetByName($pName)
623
    {
624
        $worksheetCount = count($this->workSheetCollection);
625
        for ($i = 0; $i < $worksheetCount; ++$i) {
626
            if ($this->workSheetCollection[$i]->getTitle() === $pName) {
627
                return $this->workSheetCollection[$i];
628
            }
629
        }
630
631
        return null;
632
    }
633
634
    /**
635
     * Get index for sheet.