@@ -41,8 +41,9 @@ |
||
41 | 41 | |
42 | 42 | public function offsetUnset($offset) |
43 | 43 | { |
44 | - if ($this->offsetExists($offset)) |
|
45 | - unset($this->value[$offset]); |
|
44 | + if ($this->offsetExists($offset)) { |
|
45 | + unset($this->value[$offset]); |
|
46 | + } |
|
46 | 47 | } |
47 | 48 | |
48 | 49 | public function append($value){ |
@@ -95,8 +95,9 @@ discard block |
||
95 | 95 | foreach($this->set as $key => $val){ |
96 | 96 | if($val instanceof JsonValue){ |
97 | 97 | $res[$key] = $val->getValue(); |
98 | - if($res[$key] instanceof JsonObject) |
|
99 | - $res[$key] = $res[$key]->toArray(); |
|
98 | + if($res[$key] instanceof JsonObject) { |
|
99 | + $res[$key] = $res[$key]->toArray(); |
|
100 | + } |
|
100 | 101 | if(is_array($res[$key])){ |
101 | 102 | $res[$key] = $this->processArray($res[$key]); |
102 | 103 | } |
@@ -109,8 +110,9 @@ discard block |
||
109 | 110 | private function processArray($original){ |
110 | 111 | $temp = array(); |
111 | 112 | foreach($original as $k => $val){ |
112 | - if($val instanceof JsonObject) |
|
113 | - $val = $val->toArray(); |
|
113 | + if($val instanceof JsonObject) { |
|
114 | + $val = $val->toArray(); |
|
115 | + } |
|
114 | 116 | $temp[$k] = $val; |
115 | 117 | } |
116 | 118 | return $temp; |
@@ -40,7 +40,9 @@ |
||
40 | 40 | $type = @RegisteredJWEJOSEHeaderNames::$registered_basic_headers_set_types[$header_name]; |
41 | 41 | if(!is_null($value)) |
42 | 42 | { |
43 | - if(is_null($type)) continue; |
|
43 | + if(is_null($type)) { |
|
44 | + continue; |
|
45 | + } |
|
44 | 46 | $class = new \ReflectionClass($type); |
45 | 47 | $value = $class->newInstanceArgs(array($value)); |
46 | 48 | } |
@@ -50,8 +50,9 @@ |
||
50 | 50 | |
51 | 51 | $this->set[RegisteredJWEJOSEHeaderNames::EncryptionAlgorithm] = $enc; |
52 | 52 | |
53 | - if(!is_null($zip) && CompressionAlgorithms_Registry::getInstance()->get($zip->getValue())) |
|
54 | - $this->set[RegisteredJWEJOSEHeaderNames::CompressionAlgorithm] = $zip; |
|
53 | + if(!is_null($zip) && CompressionAlgorithms_Registry::getInstance()->get($zip->getValue())) { |
|
54 | + $this->set[RegisteredJWEJOSEHeaderNames::CompressionAlgorithm] = $zip; |
|
55 | + } |
|
55 | 56 | } |
56 | 57 | |
57 | 58 | /** |
@@ -47,7 +47,9 @@ |
||
47 | 47 | |
48 | 48 | static public function deserialize($input){ |
49 | 49 | $parts = explode(IBasicJWT::SegmentSeparator, $input); |
50 | - if (count($parts) !== 5) throw new JWEInvalidCompactFormatException; |
|
50 | + if (count($parts) !== 5) { |
|
51 | + throw new JWEInvalidCompactFormatException; |
|
52 | + } |
|
51 | 53 | |
52 | 54 | $header = JWEJOSEHeaderSerializer::deserialize($parts[0]); |
53 | 55 | $enc_cek = JWTRawSerializer::deserialize($parts[1]); |
@@ -66,11 +66,13 @@ |
||
66 | 66 | public function __construct(IJWK $key, StringOrURI $alg, StringOrURI $enc, $payload, JsonValue $zip = null) |
67 | 67 | { |
68 | 68 | |
69 | - if(is_null($key)) |
|
70 | - throw new JWEInvalidRecipientKeyException(); |
|
69 | + if(is_null($key)) { |
|
70 | + throw new JWEInvalidRecipientKeyException(); |
|
71 | + } |
|
71 | 72 | |
72 | - if(is_null($payload)) |
|
73 | - throw new JWEInvalidPayloadException('missing payload'); |
|
73 | + if(is_null($payload)) { |
|
74 | + throw new JWEInvalidPayloadException('missing payload'); |
|
75 | + } |
|
74 | 76 | |
75 | 77 | $this->key = $key; |
76 | 78 | $this->alg = $alg; |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | if($spec instanceof IJWE_ParamsSpecification) |
41 | 41 | { |
42 | 42 | |
43 | - if($spec->getRecipientKey()->getKeyUse()->getString() !== JSONWebKeyPublicKeyUseValues::Encryption) |
|
44 | - throw new InvalidJWKType |
|
43 | + if($spec->getRecipientKey()->getKeyUse()->getString() !== JSONWebKeyPublicKeyUseValues::Encryption) { |
|
44 | + throw new InvalidJWKType |
|
45 | 45 | ( |
46 | 46 | sprintf |
47 | 47 | ( |
@@ -49,9 +49,10 @@ discard block |
||
49 | 49 | $spec->getRecipientKey()->getKeyUse()->getString() |
50 | 50 | ) |
51 | 51 | ); |
52 | + } |
|
52 | 53 | |
53 | - if($spec->getAlg()->getString() !== $spec->getRecipientKey()->getAlgorithm()->getString()) |
|
54 | - throw new InvalidJWKAlgorithm |
|
54 | + if($spec->getAlg()->getString() !== $spec->getRecipientKey()->getAlgorithm()->getString()) { |
|
55 | + throw new InvalidJWKAlgorithm |
|
55 | 56 | ( |
56 | 57 | sprintf |
57 | 58 | ( |
@@ -60,6 +61,7 @@ discard block |
||
60 | 61 | $spec->getRecipientKey()->getAlgorithm()->getString() |
61 | 62 | ) |
62 | 63 | ); |
64 | + } |
|
63 | 65 | |
64 | 66 | $header = new JWEJOSEHeader |
65 | 67 | ( |
@@ -71,8 +73,9 @@ discard block |
||
71 | 73 | //set zip alg |
72 | 74 | $zip = $spec->getZip(); |
73 | 75 | |
74 | - if(!is_null($zip)) |
|
75 | - $header->setCompressionAlgorithm($zip); |
|
76 | + if(!is_null($zip)) { |
|
77 | + $header->setCompressionAlgorithm($zip); |
|
78 | + } |
|
76 | 79 | |
77 | 80 | $jwe = JWE::fromHeaderAndPayload($header, $spec->getPayload()); |
78 | 81 |
@@ -64,7 +64,9 @@ |
||
64 | 64 | * @return null|CompressionAlgorithm |
65 | 65 | */ |
66 | 66 | public function get($alg){ |
67 | - if(!$this->isSupported($alg)) return null; |
|
67 | + if(!$this->isSupported($alg)) { |
|
68 | + return null; |
|
69 | + } |
|
68 | 70 | return $this->algorithms[$alg]; |
69 | 71 | } |
70 | 72 | } |
71 | 73 | \ No newline at end of file |
@@ -37,8 +37,9 @@ |
||
37 | 37 | |
38 | 38 | parent::__construct($pem_format, $password); |
39 | 39 | $this->d = $this->rsa_imp->exponent; |
40 | - if($this->d->toString() === $this->e->toString()) |
|
41 | - throw new RSABadPEMFormat(sprintf('pem %s is a public key!', $pem_format)); |
|
40 | + if($this->d->toString() === $this->e->toString()) { |
|
41 | + throw new RSABadPEMFormat(sprintf('pem %s is a public key!', $pem_format)); |
|
42 | + } |
|
42 | 43 | } |
43 | 44 | |
44 | 45 | /** |