Code Duplication    Length = 6-7 lines in 2 locations

code/MailgunHelper.php 2 locations

@@ 169-175 (lines=7) @@
166
    public static function resolveDefaultFromEmail($from = null, $createDefault = true)
167
    {
168
        $original_from = $from;
169
        if (!empty($from)) {
170
            // If we have a sender, validate its email
171
            $from = EmailUtils::get_email_from_rfc_email($from);
172
            if (filter_var($from, FILTER_VALIDATE_EMAIL)) {
173
                return $original_from;
174
            }
175
        }
176
        // Look in siteconfig for default sender
177
        $config = SiteConfig::current_site_config();
178
        $config_field = self::config()->siteconfig_from;
@@ 206-211 (lines=6) @@
203
            return $to;
204
        }
205
        $original_to = $to;
206
        if (!empty($to)) {
207
            $to = EmailUtils::get_email_from_rfc_email($to);
208
            if (filter_var($to, FILTER_VALIDATE_EMAIL)) {
209
                return $original_to;
210
            }
211
        }
212
        $config = SiteConfig::current_site_config();
213
        $config_field = self::config()->siteconfig_to;
214
        if ($config_field && !empty($config->$config_field)) {