public function createCustomToken($uid, array $claims = [], \DateTimeInterface $expiresAt = null): Token
    {
        if (count($claims)) {
            $this->builder->set('claims', $claims);
        }

        $this->builder->set('uid', (string) $uid);

        $now = time();
        $expiration = $expiresAt ? $expiresAt->getTimestamp() : $now + (60 * 60);

        $token = $this->builder
            ->setIssuedAt($now)
            ->setExpiration($expiration)
            ->sign($this->signer, $this->privateKey)
            ->getToken();

        $this->builder->unsign();

        return $token;
    }
public function createCustomToken($uid, array $claims = [], \DateTimeInterface $expiresAt = null): Token
    {
        if (count($claims)) {
            $this->builder->set('claims', $claims);
        }

        $this->builder->set('uid', (string) $uid);

        $now = time();
        $expiration = $expiresAt ? $expiresAt->getTimestamp() : $now + (60 * 60);

        $token = $this->builder
            ->setIssuedAt($now)
            ->setExpiration($expiration)
            ->sign($this->signer, $this->privateKey)
            ->getToken();

        $this->builder->unsign();

        return $token;
    }
public function createCustomToken ( $ uid , array $ claims = [ ] , \ DateTimeInterface $ expiresAt = null ) : Token { if ( count ( $ claims ) ) { $ this -> builder -> set ( 'claims' , $ claims ) ; } $ this -> builder -> set ( 'uid' , ( string ) $ uid ) ; $ now = time ( ) ; $ expiration = $ expiresAt ? $ expiresAt -> getTimestamp ( ) : $ now + ( 60 * 60 ) ; $ token = $ this -> builder -> setIssuedAt ( $ now ) -> setExpiration ( $ expiration ) -> sign ( $ this -> signer , $ this -> privateKey ) -> getToken ( ) ; $ this -> builder -> unsign ( ) ; return $ token ; }
Returns a token for the given user and claims.

@param mixed $uid
@param array $claims
@param \DateTimeInterface $expiresAt

@throws \BadMethodCallException when a claim is invalid

@return Token
Returns a token for the given user and claims .