protected function _rfc822IsAtext($chr, $validate = null)
    {
        if (!$this->_params['validate'] && !is_null($validate)) {
            return strcspn($chr, $validate);
        }

        $ord = ord($chr);

        /* UTF-8 characters check. */
        if ($ord > 127) {
            return ($this->_params['validate'] === 'eai');
        }

        /* Check for DISALLOWED characters under both RFCs 5322 and 6532. */

        /* Unprintable characters && [SPACE] */
        if ($ord <= 32) {
            return false;
        }

        /* "(),:;<>@[\] [DEL] */
        switch ($ord) {
        case 34:
        case 40:
        case 41:
        case 44:
        case 58:
        case 59:
        case 60:
        case 62:
        case 64:
        case 91:
        case 92:
        case 93:
        case 127:
            return false;
        }

        return true;
    }
protected function _rfc822IsAtext($chr, $validate = null)
    {
        if (!$this->_params['validate'] && !is_null($validate)) {
            return strcspn($chr, $validate);
        }

        $ord = ord($chr);

        /* UTF-8 characters check. */
        if ($ord > 127) {
            return ($this->_params['validate'] === 'eai');
        }

        /* Check for DISALLOWED characters under both RFCs 5322 and 6532. */

        /* Unprintable characters && [SPACE] */
        if ($ord <= 32) {
            return false;
        }

        /* "(),:;<>@[\] [DEL] */
        switch ($ord) {
        case 34:
        case 40:
        case 41:
        case 44:
        case 58:
        case 59:
        case 60:
        case 62:
        case 64:
        case 91:
        case 92:
        case 93:
        case 127:
            return false;
        }

        return true;
    }
protected function _rfc822IsAtext ( $ chr , $ validate = null ) { if ( ! $ this -> _params [ 'validate' ] && ! is_null ( $ validate ) ) { return strcspn ( $ chr , $ validate ) ; } $ ord = ord ( $ chr ) ; /* UTF-8 characters check. */ if ( $ ord > 127 ) { return ( $ this -> _params [ 'validate' ] === 'eai' ) ; } /* Check for DISALLOWED characters under both RFCs 5322 and 6532. */ /* Unprintable characters && [SPACE] */ if ( $ ord <= 32 ) { return false ; } /* "(),:;<>@[\] [DEL] */ switch ( $ ord ) { case 34 : case 40 : case 41 : case 44 : case 58 : case 59 : case 60 : case 62 : case 64 : case 91 : case 92 : case 93 : case 127 : return false ; } return true ; }
Check if data is an atom.

@param string $chr       The character to check.
@param string $validate  If in non-validate mode, use these characters
as the non-atom delimiters.

@return boolean  True if a valid atom.
Check if data is an atom .