code/http/token/token.php
public function toString()
    {
        $date = new \DateTime('now');

        //Make sure we have an issue time
        if (!isset($this->_claims['iat'])) {
            $this->setIssueTime($date);
        }

        if (!isset($this->_claims['exp'])){
            $this->setExpireTime($date->modify('+24 hours'));
        }

        $header    = $this->_toBase64url($this->_toJson($this->_header));
        $payload   = $this->_toBase64url($this->_toJson($this->_claims));

        return sprintf("%s.%s", $header, $payload);
    }
public function toString()
    {
        $date = new \DateTime('now');

        //Make sure we have an issue time
        if (!isset($this->_claims['iat'])) {
            $this->setIssueTime($date);
        }

        if (!isset($this->_claims['exp'])){
            $this->setExpireTime($date->modify('+24 hours'));
        }

        $header    = $this->_toBase64url($this->_toJson($this->_header));
        $payload   = $this->_toBase64url($this->_toJson($this->_claims));

        return sprintf("%s.%s", $header, $payload);
    }
public function toString ( ) { $ date = new \ DateTime ( 'now' ) ; //Make sure we have an issue time if ( ! isset ( $ this -> _claims [ 'iat' ] ) ) { $ this -> setIssueTime ( $ date ) ; } if ( ! isset ( $ this -> _claims [ 'exp' ] ) ) { $ this -> setExpireTime ( $ date -> modify ( '+24 hours' ) ) ; } $ header = $ this -> _toBase64url ( $ this -> _toJson ( $ this -> _header ) ) ; $ payload = $ this -> _toBase64url ( $ this -> _toJson ( $ this -> _claims ) ) ; return sprintf ( "%s.%s" , $ header , $ payload ) ; }
Encode to a JWT string

This method returns the text representation of the name/value pair defined in the JWT token. First segment is
the name/value pairs of the header segment and the second segment is the collection of the name/value pair of
the claim segment.

By default tokens expire 24 hours after they have been issued. To change this set a different expire time.

@return string  A serialised JWT token string
Encode to a JWT string