public function getToken($offset = null, array $default = null)
    {
        if (null === $offset) {
            $offset = $this->offset;
        }

        if (isset($this->tokens[$offset])) {
            if (!isset($this->tokens[$offset][0])) {
                throw InvalidTokenException::create(
                    'Token #%d is missing its token identifier.',
                    $offset
                );
            }

            if (!isset(self::$valid[$this->tokens[$offset][0]])) {
                throw InvalidTokenException::create(
                    'Token #%d does not have a valid token identifier.',
                    $offset
                );
            }

            if ((isset(self::$hasValue[$this->tokens[$offset][0]]))
                && !isset($this->tokens[$offset][1])) {
                throw InvalidTokenException::create(
                    'Token #%d (%d) is missing its value.',
                    $offset,
                    $this->tokens[$offset][0]
                );
            }

            return $this->tokens[$offset];
        }

        return $default;
    }
public function getToken($offset = null, array $default = null)
    {
        if (null === $offset) {
            $offset = $this->offset;
        }

        if (isset($this->tokens[$offset])) {
            if (!isset($this->tokens[$offset][0])) {
                throw InvalidTokenException::create(
                    'Token #%d is missing its token identifier.',
                    $offset
                );
            }

            if (!isset(self::$valid[$this->tokens[$offset][0]])) {
                throw InvalidTokenException::create(
                    'Token #%d does not have a valid token identifier.',
                    $offset
                );
            }

            if ((isset(self::$hasValue[$this->tokens[$offset][0]]))
                && !isset($this->tokens[$offset][1])) {
                throw InvalidTokenException::create(
                    'Token #%d (%d) is missing its value.',
                    $offset,
                    $this->tokens[$offset][0]
                );
            }

            return $this->tokens[$offset];
        }

        return $default;
    }
public function getToken ( $ offset = null , array $ default = null ) { if ( null === $ offset ) { $ offset = $ this -> offset ; } if ( isset ( $ this -> tokens [ $ offset ] ) ) { if ( ! isset ( $ this -> tokens [ $ offset ] [ 0 ] ) ) { throw InvalidTokenException :: create ( 'Token #%d is missing its token identifier.' , $ offset ) ; } if ( ! isset ( self :: $ valid [ $ this -> tokens [ $ offset ] [ 0 ] ] ) ) { throw InvalidTokenException :: create ( 'Token #%d does not have a valid token identifier.' , $ offset ) ; } if ( ( isset ( self :: $ hasValue [ $ this -> tokens [ $ offset ] [ 0 ] ] ) ) && ! isset ( $ this -> tokens [ $ offset ] [ 1 ] ) ) { throw InvalidTokenException :: create ( 'Token #%d (%d) is missing its value.' , $ offset , $ this -> tokens [ $ offset ] [ 0 ] ) ; } return $ this -> tokens [ $ offset ] ; } return $ default ; }
Returns the token at the offset, or the default given.

@param integer $offset  The offset to retrieve.
@param array   $default The default token to return.

@return array The token, or the default.

@throws Exception
@throws InvalidTokenException If the token is not valid.
Returns the token at the offset or the default given .