Наследование: use trait Emarref\Jwt\FactoryTrait
Пример #1
0
 /**
  * @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;
 }
Пример #2
0
 /**
  * @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;
 }