Code Duplication    Length = 23-23 lines in 2 locations

src/Mailer/Email.php 2 locations

@@ 944-966 (lines=23) @@
941
     * @return $this
942
     * @throws \InvalidArgumentException
943
     */
944
    protected function _setEmail($varName, $email, $name)
945
    {
946
        if (!is_array($email)) {
947
            $this->_validateEmail($email, $varName);
948
            if ($name === null) {
949
                $name = $email;
950
            }
951
            $this->{$varName} = [$email => $name];
952
953
            return $this;
954
        }
955
        $list = [];
956
        foreach ($email as $key => $value) {
957
            if (is_int($key)) {
958
                $key = $value;
959
            }
960
            $this->_validateEmail($key, $varName);
961
            $list[$key] = $value;
962
        }
963
        $this->{$varName} = $list;
964
965
        return $this;
966
    }
967
968
    /**
969
     * Validate email address
@@ 1032-1054 (lines=23) @@
1029
     * @return $this
1030
     * @throws \InvalidArgumentException
1031
     */
1032
    protected function _addEmail($varName, $email, $name)
1033
    {
1034
        if (!is_array($email)) {
1035
            $this->_validateEmail($email, $varName);
1036
            if ($name === null) {
1037
                $name = $email;
1038
            }
1039
            $this->{$varName}[$email] = $name;
1040
1041
            return $this;
1042
        }
1043
        $list = [];
1044
        foreach ($email as $key => $value) {
1045
            if (is_int($key)) {
1046
                $key = $value;
1047
            }
1048
            $this->_validateEmail($key, $varName);
1049
            $list[$key] = $value;
1050
        }
1051
        $this->{$varName} = array_merge($this->{$varName}, $list);
1052
1053
        return $this;
1054
    }
1055
1056
    /**
1057
     * Sets subject.