public static function fromString(string $emailAddress): self
    {
        if (!preg_match('/^([^><]+?)\s*(?:<([^><]+)>)?$/', $emailAddress, $matches)) {
            throw new InvalidArgumentException(sprintf('"%s" is not a valid e-mail address.', $emailAddress));
        }

        return isset($matches[2]) ? new static($matches[2], $matches[1]) : new static($matches[1]);
    }
public static function fromString(string $emailAddress): self
    {
        if (!preg_match('/^([^><]+?)\s*(?:<([^><]+)>)?$/', $emailAddress, $matches)) {
            throw new InvalidArgumentException(sprintf('"%s" is not a valid e-mail address.', $emailAddress));
        }

        return isset($matches[2]) ? new static($matches[2], $matches[1]) : new static($matches[1]);
    }
public static function fromString ( string $ emailAddress ) : self { if ( ! preg_match ( '/^([^><]+?)\s*(?:<([^><]+)>)?$/' , $ emailAddress , $ matches ) ) { throw new InvalidArgumentException ( sprintf ( '"%s" is not a valid e-mail address.' , $ emailAddress ) ) ; } return isset ( $ matches [ 2 ] ) ? new static ( $ matches [ 2 ] , $ matches [ 1 ] ) : new static ( $ matches [ 1 ] ) ; }
Create a new e-mail address by parsing the given string.

@param string $emailAddress The string to be parsed.

@return static Newly created e-mail address.

@throws InvalidArgumentException
Create a new e - mail address by parsing the given string .