protected function matchesMail($mail = [], $matches = [])
    {
        // Discard criteria that are just zero-length strings.
        $matches = array_filter($matches, 'strlen');
        // For each criteria, check the specified mail field contains the value.
        foreach ($matches as $field => $value) {
            // Case insensitive.
            if (stripos($mail[$field], $value) === false) {
                return false;
            }
        }
        return true;
    }
protected function matchesMail($mail = [], $matches = [])
    {
        // Discard criteria that are just zero-length strings.
        $matches = array_filter($matches, 'strlen');
        // For each criteria, check the specified mail field contains the value.
        foreach ($matches as $field => $value) {
            // Case insensitive.
            if (stripos($mail[$field], $value) === false) {
                return false;
            }
        }
        return true;
    }
protected function matchesMail ( $ mail = [ ] , $ matches = [ ] ) { // Discard criteria that are just zero-length strings. $ matches = array_filter ( $ matches , 'strlen' ) ; // For each criteria, check the specified mail field contains the value. foreach ( $ matches as $ field => $ value ) { // Case insensitive. if ( stripos ( $ mail [ $ field ] , $ value ) === false ) { return false ; } } return true ; }
Determine if a mail meets criteria.

@param array $mail
The mail, as an array of mail fields.
@param array $matches
The criteria: an associative array of mail fields and desired values.

@return bool
Whether the mail matches the criteria.
Determine if a mail meets criteria .