Code Duplication    Length = 11-11 lines in 2 locations

src/PhpSpreadsheet/Spreadsheet.php 2 locations

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