From 41f07fcf5050287de7e76b84eedf659b777f9e0f Mon Sep 17 00:00:00 2001 From: Sebastian Marcet Date: Tue, 5 Apr 2016 17:48:52 -0300 Subject: [PATCH 1/2] [smarcet] * fixed code issues --- src/jws/impl/JWS.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/jws/impl/JWS.php b/src/jws/impl/JWS.php index 34b9173..e5c54df 100644 --- a/src/jws/impl/JWS.php +++ b/src/jws/impl/JWS.php @@ -28,6 +28,7 @@ use jws\exceptions\JWSNotSupportedAlgorithm; use jws\IJWS; use jws\IJWSPayloadClaimSetSpec; +use jws\IJWSPayloadRawSpec; use jws\IJWSPayloadSpec; use jws\payloads\JWSPayloadFactory; use jwt\IBasicJWT; @@ -39,7 +40,6 @@ use jwt\utils\JOSEHeaderSerializer; use jwt\utils\JWTClaimSetSerializer; use jwt\utils\JWTRawSerializer; -use utils\json_types\JsonArray; use utils\json_types\JsonValue; use utils\json_types\StringOrURI; @@ -175,11 +175,12 @@ public function getEncodedPayload() throw new JWSInvalidPayloadException('payload is not set!'); $enc_payload = ''; - if($this->payload->isClaimSet() && $this->payload instanceof IJWSPayloadClaimSetSpec) + + if($this->payload instanceof IJWSPayloadClaimSetSpec) { $enc_payload = JWTClaimSetSerializer::serialize($this->payload->getClaimSet()); } - else + else if($this->payload instanceof IJWSPayloadRawSpec) { $enc_payload = JWTRawSerializer::serialize($this->payload->getRaw()); } @@ -320,8 +321,7 @@ static public function fromHeaderClaimsAndSignature(IJOSEHeader $header, IJWSPay */ public function take() { - $payload = $this->payload->isClaimSet() ? $this->claim_set : $this->payload->getRaw(); - + $payload = ($this->payload instanceof IJWSPayloadRawSpec) ? $this->payload->getRaw() : $this->claim_set; return array ( $this->header, From 1fce21d15b77c3ae2eaea101405e5fac5a81b044 Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Tue, 5 Apr 2016 21:00:18 +0000 Subject: [PATCH 2/2] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- src/jwe/impl/JWE.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/jwe/impl/JWE.php b/src/jwe/impl/JWE.php index 9ed6efd..bb9f0e8 100644 --- a/src/jwe/impl/JWE.php +++ b/src/jwe/impl/JWE.php @@ -1,16 +1,16 @@