protected function _validatePhrase($phrase)
    {
        // Splits on one or more Tab or space.
        $parts = preg_split('/[ \\x09]+/', $phrase, -1, PREG_SPLIT_NO_EMPTY);

        $phrase_parts = array();
        while (count($parts) > 0){
            $phrase_parts[] = $this->_splitCheck($parts, ' ');
            for ($i = 0; $i < $this->index + 1; $i++)
                array_shift($parts);
        }

        foreach ($phrase_parts as $part) {
            // If quoted string:
            if (substr($part, 0, 1) == '"') {
                if (!$this->_validateQuotedString($part)) {
                    return false;
                }
                continue;
            }

            // Otherwise it's an atom:
            if (!$this->_validateAtom($part)) return false;
        }

        return true;
    }
protected function _validatePhrase($phrase)
    {
        // Splits on one or more Tab or space.
        $parts = preg_split('/[ \\x09]+/', $phrase, -1, PREG_SPLIT_NO_EMPTY);

        $phrase_parts = array();
        while (count($parts) > 0){
            $phrase_parts[] = $this->_splitCheck($parts, ' ');
            for ($i = 0; $i < $this->index + 1; $i++)
                array_shift($parts);
        }

        foreach ($phrase_parts as $part) {
            // If quoted string:
            if (substr($part, 0, 1) == '"') {
                if (!$this->_validateQuotedString($part)) {
                    return false;
                }
                continue;
            }

            // Otherwise it's an atom:
            if (!$this->_validateAtom($part)) return false;
        }

        return true;
    }
protected function _validatePhrase ( $ phrase ) { // Splits on one or more Tab or space. $ parts = preg_split ( '/[ \\x09]+/' , $ phrase , - 1 , PREG_SPLIT_NO_EMPTY ) ; $ phrase_parts = array ( ) ; while ( count ( $ parts ) > 0 ) { $ phrase_parts [ ] = $ this -> _splitCheck ( $ parts , ' ' ) ; for ( $ i = 0 ; $ i < $ this -> index + 1 ; $ i ++ ) array_shift ( $ parts ) ; } foreach ( $ phrase_parts as $ part ) { // If quoted string: if ( substr ( $ part , 0 , 1 ) == '"' ) { if ( ! $ this -> _validateQuotedString ( $ part ) ) { return false ; } continue ; } // Otherwise it's an atom: if ( ! $ this -> _validateAtom ( $ part ) ) return false ; } return true ; }
Function to validate a phrase.

@param string $phrase The phrase to check.
@return boolean Success or failure.
Function to validate a phrase .