Lcobucci\JWT\Configuration::getParser PHP Method

getParser() public method

public getParser ( ) : Parser
return Parser
    public function getParser() : Parser
    {
        if ($this->parser === null) {
            $this->parser = new Parser($this->getDecoder(), $this->getClaimFactory());
        }
        return $this->parser;
    }

Usage Example

Example #1
0
 /**
  * @test
  *
  * @covers \Lcobucci\JWT\Configuration
  * @covers \Lcobucci\JWT\Builder
  * @covers \Lcobucci\JWT\Parser
  * @covers \Lcobucci\JWT\Token
  * @covers \Lcobucci\JWT\Signature
  * @covers \Lcobucci\JWT\Signer\Key
  * @covers \Lcobucci\JWT\Signer\BaseSigner
  * @covers \Lcobucci\JWT\Signer\Hmac
  * @covers \Lcobucci\JWT\Signer\Hmac\Sha256
  * @covers \Lcobucci\JWT\Claim\Factory
  * @covers \Lcobucci\JWT\Claim\Basic
  */
 public function everythingShouldWorkWhenUsingATokenGeneratedByOtherLibs()
 {
     $data = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJoZWxsbyI6IndvcmxkIn0.Rh' . '7AEgqCB7zae1PkgIlvOpeyw9Ab8NGTbeOH7heHO0o';
     $token = $this->config->getParser()->parse((string) $data);
     self::assertEquals('world', $token->getClaim('hello'));
     self::assertTrue($token->verify($this->config->getSigner(), 'testing'));
 }
All Usage Examples Of Lcobucci\JWT\Configuration::getParser