Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrutinizer Auto-Fixes #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/jwe/impl/JWE.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php
/**
* Copyright 2015 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
* Copyright 2015 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/

namespace jwe\impl;

Expand Down
10 changes: 5 additions & 5 deletions src/jws/impl/JWS.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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,
Expand Down