public static function parseEmailAddress($email)
    {
        $pattern = sprintf('/^(?<local>%s)@(?<domain>%s)$/iD', self::EMAIL_REGEX_LOCAL, self::EMAIL_REGEX_DOMAIN);

        if (!preg_match($pattern, $email, $parts)) {
            throw new InvalidEmailException(sprintf('"%s" is not a valid email', $email));
        }

        return array_map('strtolower', [$parts['local'], $parts['domain']]);
    }
public static function parseEmailAddress($email)
    {
        $pattern = sprintf('/^(?<local>%s)@(?<domain>%s)$/iD', self::EMAIL_REGEX_LOCAL, self::EMAIL_REGEX_DOMAIN);

        if (!preg_match($pattern, $email, $parts)) {
            throw new InvalidEmailException(sprintf('"%s" is not a valid email', $email));
        }

        return array_map('strtolower', [$parts['local'], $parts['domain']]);
    }
public static function parseEmailAddress ( $ email ) { $ pattern = sprintf ( '/^(?<local>%s)@(?<domain>%s)$/iD' , self :: EMAIL_REGEX_LOCAL , self :: EMAIL_REGEX_DOMAIN ) ; if ( ! preg_match ( $ pattern , $ email , $ parts ) ) { throw new InvalidEmailException ( sprintf ( '"%s" is not a valid email' , $ email ) ) ; } return array_map ( 'strtolower' , [ $ parts [ 'local' ] , $ parts [ 'domain' ] ] ) ; }
Extract parts of an email address.

@param string $email The email address to parse

@return array The parts of the email. First the local part, then the domain
Extract parts of an email address .