Jose\Object\JWS::toFlattenedJSON PHP Method

toFlattenedJSON() public method

public toFlattenedJSON ( $id )
    public function toFlattenedJSON($id)
    {
        $signature = $this->getSignature($id);
        $data = [];
        $values = ['payload' => $this->getEncodedPayload($signature), 'protected' => $signature->getEncodedProtectedHeaders(), 'header' => $signature->getHeaders()];
        foreach ($values as $key => $value) {
            if (!empty($value)) {
                $data[$key] = $value;
            }
        }
        $data['signature'] = Base64Url::encode($signature->getSignature());
        return json_encode($data);
    }