/** * @param string $payloadJson * @return Claim\ClaimInterface[] */ protected function parsePayload($payloadJson) { $claims = []; $payload = json_decode($payloadJson, true); foreach ($payload as $name => $value) { $claim = $this->claimFactory->get($name); $claim->setValue($value); $claims[] = $claim; } return $claims; }
/** * @param string $payloadJson * * @return Claim\ClaimInterface[] * @throws \InvalidArgumentException */ protected function parsePayload($payloadJson) { $claims = []; $payload = json_decode($payloadJson, true); if (!is_array($payload)) { throw new \InvalidArgumentException('Not a valid payload of JWT string passed for deserialization'); } foreach ($payload as $name => $value) { $claim = $this->claimFactory->get($name); $claim->setValue($value); $claims[] = $claim; } return $claims; }