Code Duplication    Length = 21-21 lines in 2 locations

vendor/cakephp/cakephp/src/Mailer/Email.php 2 locations

@@ 599-619 (lines=21) @@
596
     * @return $this
597
     * @throws \InvalidArgumentException
598
     */
599
    protected function _setEmail($varName, $email, $name)
600
    {
601
        if (!is_array($email)) {
602
            $this->_validateEmail($email);
603
            if ($name === null) {
604
                $name = $email;
605
            }
606
            $this->{$varName} = [$email => $name];
607
            return $this;
608
        }
609
        $list = [];
610
        foreach ($email as $key => $value) {
611
            if (is_int($key)) {
612
                $key = $value;
613
            }
614
            $this->_validateEmail($key);
615
            $list[$key] = $value;
616
        }
617
        $this->{$varName} = $list;
618
        return $this;
619
    }
620
621
    /**
622
     * Validate email address
@@ 672-692 (lines=21) @@
669
     * @return $this
670
     * @throws \InvalidArgumentException
671
     */
672
    protected function _addEmail($varName, $email, $name)
673
    {
674
        if (!is_array($email)) {
675
            $this->_validateEmail($email);
676
            if ($name === null) {
677
                $name = $email;
678
            }
679
            $this->{$varName}[$email] = $name;
680
            return $this;
681
        }
682
        $list = [];
683
        foreach ($email as $key => $value) {
684
            if (is_int($key)) {
685
                $key = $value;
686
            }
687
            $this->_validateEmail($key);
688
            $list[$key] = $value;
689
        }
690
        $this->{$varName} = array_merge($this->{$varName}, $list);
691
        return $this;
692
    }
693
694
    /**
695
     * Get/Set Subject.