Code Duplication    Length = 11-11 lines in 2 locations

src/PhpSpreadsheet/Spreadsheet.php 2 locations

@@ 337-347 (lines=11) @@
334
     *
335
     * @return Worksheet
336
     */
337
    public function getSheetByCodeName($pName)
338
    {
339
        $worksheetCount = count($this->workSheetCollection);
340
        for ($i = 0; $i < $worksheetCount; ++$i) {
341
            if ($this->workSheetCollection[$i]->getCodeName() == $pName) {
342
                return $this->workSheetCollection[$i];
343
            }
344
        }
345
346
        return null;
347
    }
348
349
    /**
350
     * Create a new PhpSpreadsheet with one Worksheet.
@@ 603-613 (lines=11) @@
600
     *
601
     * @return Worksheet
602
     */
603
    public function getSheetByName($pName)
604
    {
605
        $worksheetCount = count($this->workSheetCollection);
606
        for ($i = 0; $i < $worksheetCount; ++$i) {
607
            if ($this->workSheetCollection[$i]->getTitle() === $pName) {
608
                return $this->workSheetCollection[$i];
609
            }
610
        }
611
612
        return null;
613
    }
614
615
    /**
616
     * Get index for sheet.