src/Invoice/Completor.php
protected function validateEmail()
    {
        // Check email address.
        if (empty($this->invoice[Tag::Customer][Tag::Email])) {
            $customerSettings = $this->config->getCustomerSettings();
            $this->invoice[Tag::Customer][Tag::Email] = $customerSettings['emailIfAbsent'];
            $this->result->addWarning(801,'', $this->t('message_warning_no_email'));
        } else {
            $email = $this->invoice[Tag::Customer][Tag::Email];
            $at = strpos($email, '@');
            // Comma (,) used as separator?
            $comma = strpos($email, ',', $at);
            if ($at < $comma) {
                $email = trim(substr($email, 0, $comma));
            }
            // Semicolon (;) used as separator?
            $semicolon = strpos($email, ';', $at);
            if ($at < $semicolon) {
                $email = trim(substr($email, 0, $semicolon));
            }

            // Display name used in single remaining address?
            if (preg_match('/^(.+?)<([^>]+)>$/', $email, $matches)) {
                $email = trim($matches[2]);
            }
            $this->invoice[Tag::Customer][Tag::Email] = $email;
        }
    }
protected function validateEmail()
    {
        // Check email address.
        if (empty($this->invoice[Tag::Customer][Tag::Email])) {
            $customerSettings = $this->config->getCustomerSettings();
            $this->invoice[Tag::Customer][Tag::Email] = $customerSettings['emailIfAbsent'];
            $this->result->addWarning(801,'', $this->t('message_warning_no_email'));
        } else {
            $email = $this->invoice[Tag::Customer][Tag::Email];
            $at = strpos($email, '@');
            // Comma (,) used as separator?
            $comma = strpos($email, ',', $at);
            if ($at < $comma) {
                $email = trim(substr($email, 0, $comma));
            }
            // Semicolon (;) used as separator?
            $semicolon = strpos($email, ';', $at);
            if ($at < $semicolon) {
                $email = trim(substr($email, 0, $semicolon));
            }

            // Display name used in single remaining address?
            if (preg_match('/^(.+?)<([^>]+)>$/', $email, $matches)) {
                $email = trim($matches[2]);
            }
            $this->invoice[Tag::Customer][Tag::Email] = $email;
        }
    }
protected function validateEmail ( ) { // Check email address. if ( empty ( $ this -> invoice [ Tag :: Customer ] [ Tag :: Email ] ) ) { $ customerSettings = $ this -> config -> getCustomerSettings ( ) ; $ this -> invoice [ Tag :: Customer ] [ Tag :: Email ] = $ customerSettings [ 'emailIfAbsent' ] ; $ this -> result -> addWarning ( 801 , '' , $ this -> t ( 'message_warning_no_email' ) ) ; } else { $ email = $ this -> invoice [ Tag :: Customer ] [ Tag :: Email ] ; $ at = strpos ( $ email , '@' ) ; // Comma (,) used as separator? $ comma = strpos ( $ email , ',' , $ at ) ; if ( $ at < $ comma ) { $ email = trim ( substr ( $ email , 0 , $ comma ) ) ; } // Semicolon (;) used as separator? $ semicolon = strpos ( $ email , ';' , $ at ) ; if ( $ at < $ semicolon ) { $ email = trim ( substr ( $ email , 0 , $ semicolon ) ) ; } // Display name used in single remaining address? if ( preg_match ( '/^(.+?)<([^>]+)>$/' , $ email , $ matches ) ) { $ email = trim ( $ matches [ 2 ] ) ; } $ this -> invoice [ Tag :: Customer ] [ Tag :: Email ] = $ email ; } }
Validates the email address of the invoice.

Validations performed:
- Multiple, comma separated, email addresses are not allowed.
- Display names (My Name <my.name@example.com>) are not allowed.
- The email address may not be empty but may be left out though in which
case a new relation will be created. To prevent both, we use a fake
address and we will set a warning.
Validates the email address of the invoice .