public function parse($jwt)
    {
        $data = $this->splitJwt($jwt);
        $header = $this->parseHeader($data[0]);
        $claims = $this->parseClaims($data[1]);
        $signature = $this->parseSignature($header, $data[2]);

        foreach ($claims as $name => $value) {
            if (isset($header[$name])) {
                $header[$name] = $value;
            }
        }

        if ($signature === null) {
            unset($data[2]);
        }

        return new Token($header, $claims, $signature, $data);
    }
public function parse($jwt)
    {
        $data = $this->splitJwt($jwt);
        $header = $this->parseHeader($data[0]);
        $claims = $this->parseClaims($data[1]);
        $signature = $this->parseSignature($header, $data[2]);

        foreach ($claims as $name => $value) {
            if (isset($header[$name])) {
                $header[$name] = $value;
            }
        }

        if ($signature === null) {
            unset($data[2]);
        }

        return new Token($header, $claims, $signature, $data);
    }
public function parse ( $ jwt ) { $ data = $ this -> splitJwt ( $ jwt ) ; $ header = $ this -> parseHeader ( $ data [ 0 ] ) ; $ claims = $ this -> parseClaims ( $ data [ 1 ] ) ; $ signature = $ this -> parseSignature ( $ header , $ data [ 2 ] ) ; foreach ( $ claims as $ name => $ value ) { if ( isset ( $ header [ $ name ] ) ) { $ header [ $ name ] = $ value ; } } if ( $ signature === null ) { unset ( $ data [ 2 ] ) ; } return new Token ( $ header , $ claims , $ signature , $ data ) ; }
Parses the JWT and returns a token

@param string $jwt

@return Token
Parses the JWT and returns a token