private function getToken($token, &$hasSeenBy)
    {
        switch ($token) {
            case 'And':
                return new AndToken();
            case 'Or':
                return new OrToken();
            case 'By':
            case 'Where':
                $hasSeenBy = true;
                return new ByToken();
            case 'All':
                return new AllToken();
            case 'Distinct':
                if ($hasSeenBy) {
                    return new ValueToken($token);
                } else {
                    return new DistinctToken();
                }
            case 'Like':
                if ($hasSeenBy) {
                    return new LikeToken();
                } else {
                    return new ValueToken($token);
                }
            default:
                return new ValueToken($token);
        }
    }
private function getToken($token, &$hasSeenBy)
    {
        switch ($token) {
            case 'And':
                return new AndToken();
            case 'Or':
                return new OrToken();
            case 'By':
            case 'Where':
                $hasSeenBy = true;
                return new ByToken();
            case 'All':
                return new AllToken();
            case 'Distinct':
                if ($hasSeenBy) {
                    return new ValueToken($token);
                } else {
                    return new DistinctToken();
                }
            case 'Like':
                if ($hasSeenBy) {
                    return new LikeToken();
                } else {
                    return new ValueToken($token);
                }
            default:
                return new ValueToken($token);
        }
    }
private function getToken ( $ token , & $ hasSeenBy ) { switch ( $ token ) { case 'And' : return new AndToken ( ) ; case 'Or' : return new OrToken ( ) ; case 'By' : case 'Where' : $ hasSeenBy = true ; return new ByToken ( ) ; case 'All' : return new AllToken ( ) ; case 'Distinct' : if ( $ hasSeenBy ) { return new ValueToken ( $ token ) ; } else { return new DistinctToken ( ) ; } case 'Like' : if ( $ hasSeenBy ) { return new LikeToken ( ) ; } else { return new ValueToken ( $ token ) ; } default : return new ValueToken ( $ token ) ; } }
Translate a token source to a token object.
@param $token string the token source
@return Token the token object
Translate a token source to a token object .