code/libraries/joomlatools/library/http/token/token.php
public function fromString($token)
    {
        $segments = explode('.', $token);

        if (count($segments) == 3)
        {
            list($header, $payload, $signature) = $segments;

            $this->_header    = $this->_fromJson($this->_fromBase64url($header));
            $this->_claims    = $this->_fromJson($this->_fromBase64url($payload));
            $this->_signature = $this->_fromBase64url($signature);

            if(isset($this->_header['alg'])) {
                $this->setAlgorithm($this->_header['alg']);
            } else {
                $this->setAlgorithm('none');
            }
        }
        else throw new InvalidArgumentException(sprintf('The token "%s" is an invalid JWT', $token));

        return $this;
    }
public function fromString($token)
    {
        $segments = explode('.', $token);

        if (count($segments) == 3)
        {
            list($header, $payload, $signature) = $segments;

            $this->_header    = $this->_fromJson($this->_fromBase64url($header));
            $this->_claims    = $this->_fromJson($this->_fromBase64url($payload));
            $this->_signature = $this->_fromBase64url($signature);

            if(isset($this->_header['alg'])) {
                $this->setAlgorithm($this->_header['alg']);
            } else {
                $this->setAlgorithm('none');
            }
        }
        else throw new InvalidArgumentException(sprintf('The token "%s" is an invalid JWT', $token));

        return $this;
    }
public function fromString ( $ token ) { $ segments = explode ( '.' , $ token ) ; if ( count ( $ segments ) == 3 ) { list ( $ header , $ payload , $ signature ) = $ segments ; $ this -> _header = $ this -> _fromJson ( $ this -> _fromBase64url ( $ header ) ) ; $ this -> _claims = $ this -> _fromJson ( $ this -> _fromBase64url ( $ payload ) ) ; $ this -> _signature = $ this -> _fromBase64url ( $ signature ) ; if ( isset ( $ this -> _header [ 'alg' ] ) ) { $ this -> setAlgorithm ( $ this -> _header [ 'alg' ] ) ; } else { $ this -> setAlgorithm ( 'none' ) ; } } else throw new InvalidArgumentException ( sprintf ( 'The token "%s" is an invalid JWT' , $ token ) ) ; return $ this ; }
Decode from JWT string

@param string      $token  A serialised token
@return KHttpToken
@throws InvalidArgumentException If the token is invalid
Decode from JWT string