src/CorsService.php
protected function isValidToken($text)
    {
        // Make sure $text is string
        if (!is_string($text)) {
            throw new InvalidArgumentException(
                '$text must be string'
            );
        }

        $separators = [
            '(', ')', '<', '>', '@',
            ',', ';', ':', '\\', '"',
            '/', '[', ']', '?', '=',
            '{', '}', 32, 9
        ];

        // If contains separator, return false
        foreach ($separators as $s) {
            if (strpos($text, $s) !== false) {
                return false;
            }
        }

        // If contains control character, return false
        if (ctype_cntrl($text)) {
            return false;
        }

        return true;
    }
protected function isValidToken($text)
    {
        // Make sure $text is string
        if (!is_string($text)) {
            throw new InvalidArgumentException(
                '$text must be string'
            );
        }

        $separators = [
            '(', ')', '<', '>', '@',
            ',', ';', ':', '\\', '"',
            '/', '[', ']', '?', '=',
            '{', '}', 32, 9
        ];

        // If contains separator, return false
        foreach ($separators as $s) {
            if (strpos($text, $s) !== false) {
                return false;
            }
        }

        // If contains control character, return false
        if (ctype_cntrl($text)) {
            return false;
        }

        return true;
    }
protected function isValidToken ( $ text ) { // Make sure $text is string if ( ! is_string ( $ text ) ) { throw new InvalidArgumentException ( '$text must be string' ) ; } $ separators = [ '(' , ')' , '<' , '>' , '@' , ',' , ';' , ':' , '\\' , '"' , '/' , '[' , ']' , '?' , '=' , '{' , '}' , 32 , 9 ] ; // If contains separator, return false foreach ( $ separators as $ s ) { if ( strpos ( $ text , $ s ) !== false ) { return false ; } } // If contains control character, return false if ( ctype_cntrl ( $ text ) ) { return false ; } return true ; }
Check if text is valid "token"

@see https://tools.ietf.org/html/rfc2616#section-2.2

@param string $text
@return bool
@throws InvalidArgumentException
Check if text is valid token