@@ -29,14 +29,14 @@ |
||
| 29 | 29 | /** |
| 30 | 30 | * @param int|string|array|bool|IJsonObject $value |
| 31 | 31 | */ |
| 32 | - public function __construct($value){ |
|
| 32 | + public function __construct($value) { |
|
| 33 | 33 | $this->value = $value; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * @return int|string|array|bool|IJsonObject |
| 38 | 38 | */ |
| 39 | - public function getValue(){ |
|
| 39 | + public function getValue() { |
|
| 40 | 40 | return $this->value; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Copyright 2015 OpenStack Foundation |
|
| 4 | - * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | - * you may not use this file except in compliance with the License. |
|
| 6 | - * You may obtain a copy of the License at |
|
| 7 | - * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | - * Unless required by applicable law or agreed to in writing, software |
|
| 9 | - * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | - * See the License for the specific language governing permissions and |
|
| 12 | - * limitations under the License. |
|
| 13 | - **/ |
|
| 3 | + * Copyright 2015 OpenStack Foundation |
|
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | + * you may not use this file except in compliance with the License. |
|
| 6 | + * You may obtain a copy of the License at |
|
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | + * Unless required by applicable law or agreed to in writing, software |
|
| 9 | + * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | + * See the License for the specific language governing permissions and |
|
| 12 | + * limitations under the License. |
|
| 13 | + **/ |
|
| 14 | 14 | |
| 15 | 15 | namespace jwk; |
| 16 | 16 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | class StringOrURI extends JsonValue { |
| 27 | 27 | |
| 28 | - public function getString(){ |
|
| 28 | + public function getString() { |
|
| 29 | 29 | return (string)$this->value; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -33,11 +33,11 @@ discard block |
||
| 33 | 33 | * @throws \RuntimeException |
| 34 | 34 | * @return string |
| 35 | 35 | */ |
| 36 | - public function getUri(){ |
|
| 36 | + public function getUri() { |
|
| 37 | 37 | |
| 38 | - if($this->isString()) |
|
| 38 | + if ($this->isString()) |
|
| 39 | 39 | throw new \RuntimeException('current value is not an uri!'); |
| 40 | - if(filter_var($this->value, FILTER_VALIDATE_URL) === false) |
|
| 40 | + if (filter_var($this->value, FILTER_VALIDATE_URL) === false) |
|
| 41 | 41 | throw new \RuntimeException('current value is not an uri!'); |
| 42 | 42 | |
| 43 | 43 | return (string)$this->value; |
@@ -46,21 +46,21 @@ discard block |
||
| 46 | 46 | /** |
| 47 | 47 | * @return bool |
| 48 | 48 | */ |
| 49 | - public function isString(){ |
|
| 49 | + public function isString() { |
|
| 50 | 50 | return !$this->isUri(); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * @return bool |
| 55 | 55 | */ |
| 56 | - public function isUri(){ |
|
| 56 | + public function isUri() { |
|
| 57 | 57 | return !(strstr($this->value, ':') === false); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * @return string |
| 62 | 62 | */ |
| 63 | - public function getValue(){ |
|
| 63 | + public function getValue() { |
|
| 64 | 64 | return $this->isUri() ? $this->getUri() : $this->getString(); |
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | \ No newline at end of file |
@@ -35,10 +35,12 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | public function getUri(){ |
| 37 | 37 | |
| 38 | - if($this->isString()) |
|
| 39 | - throw new \RuntimeException('current value is not an uri!'); |
|
| 40 | - if(filter_var($this->value, FILTER_VALIDATE_URL) === false) |
|
| 41 | - throw new \RuntimeException('current value is not an uri!'); |
|
| 38 | + if($this->isString()) { |
|
| 39 | + throw new \RuntimeException('current value is not an uri!'); |
|
| 40 | + } |
|
| 41 | + if(filter_var($this->value, FILTER_VALIDATE_URL) === false) { |
|
| 42 | + throw new \RuntimeException('current value is not an uri!'); |
|
| 43 | + } |
|
| 42 | 44 | |
| 43 | 45 | return (string)$this->value; |
| 44 | 46 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | class JsonArray extends JsonValue implements \ArrayAccess { |
| 22 | 22 | |
| 23 | - public function __construct(array $values){ |
|
| 23 | + public function __construct(array $values) { |
|
| 24 | 24 | parent::__construct($values); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | unset($this->value[$offset]); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function append($value){ |
|
| 48 | + public function append($value) { |
|
| 49 | 49 | array_push($this->value, $value); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -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){ |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | $input = $this->toArray(); |
| 59 | 59 | $json = json_encode($input); |
| 60 | - $json = str_replace('\/','/', $json); |
|
| 60 | + $json = str_replace('\/', '/', $json); |
|
| 61 | 61 | |
| 62 | 62 | if (function_exists('json_last_error') && $errno = json_last_error()) { |
| 63 | 63 | self::handleJsonError($errno); |
| 64 | - } elseif ($json === 'null' ) { |
|
| 64 | + } elseif ($json === 'null') { |
|
| 65 | 65 | throw new JsonParseException('Null resul with non-null input'); |
| 66 | 66 | } |
| 67 | 67 | return $json; |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | throw new JsonParseException( |
| 82 | 82 | isset($messages[$errno]) |
| 83 | 83 | ? $messages[$errno] |
| 84 | - : 'Unknown JSON error: ' . $errno |
|
| 84 | + : 'Unknown JSON error: '.$errno |
|
| 85 | 85 | ); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -92,12 +92,12 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | $res = array(); |
| 94 | 94 | |
| 95 | - foreach($this->set as $key => $val){ |
|
| 96 | - if($val instanceof JsonValue){ |
|
| 95 | + foreach ($this->set as $key => $val) { |
|
| 96 | + if ($val instanceof JsonValue) { |
|
| 97 | 97 | $res[$key] = $val->getValue(); |
| 98 | - if($res[$key] instanceof JsonObject) |
|
| 98 | + if ($res[$key] instanceof JsonObject) |
|
| 99 | 99 | $res[$key] = $res[$key]->toArray(); |
| 100 | - if(is_array($res[$key])){ |
|
| 100 | + if (is_array($res[$key])) { |
|
| 101 | 101 | $res[$key] = $this->processArray($res[$key]); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -106,10 +106,10 @@ discard block |
||
| 106 | 106 | return $res; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - private function processArray($original){ |
|
| 109 | + private function processArray($original) { |
|
| 110 | 110 | $temp = array(); |
| 111 | - foreach($original as $k => $val){ |
|
| 112 | - if($val instanceof JsonObject) |
|
| 111 | + foreach ($original as $k => $val) { |
|
| 112 | + if ($val instanceof JsonObject) |
|
| 113 | 113 | $val = $val->toArray(); |
| 114 | 114 | $temp[$k] = $val; |
| 115 | 115 | } |
@@ -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; |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Copyright 2015 OpenStack Foundation |
|
| 4 | - * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | - * you may not use this file except in compliance with the License. |
|
| 6 | - * You may obtain a copy of the License at |
|
| 7 | - * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | - * Unless required by applicable law or agreed to in writing, software |
|
| 9 | - * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | - * See the License for the specific language governing permissions and |
|
| 12 | - * limitations under the License. |
|
| 13 | - **/ |
|
| 3 | + * Copyright 2015 OpenStack Foundation |
|
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | + * you may not use this file except in compliance with the License. |
|
| 6 | + * You may obtain a copy of the License at |
|
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | + * Unless required by applicable law or agreed to in writing, software |
|
| 9 | + * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | + * See the License for the specific language governing permissions and |
|
| 12 | + * limitations under the License. |
|
| 13 | + **/ |
|
| 14 | 14 | |
| 15 | 15 | namespace jwk; |
| 16 | 16 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * @param int $byte_len |
| 25 | 25 | * @return int |
| 26 | 26 | */ |
| 27 | - static public function bitLength($byte_len){ |
|
| 27 | + static public function bitLength($byte_len) { |
|
| 28 | 28 | return $byte_len * 8; |
| 29 | 29 | } |
| 30 | 30 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * @param int $byte_len |
| 33 | 33 | * @return String |
| 34 | 34 | */ |
| 35 | - static public function randomBytes($byte_len){ |
|
| 35 | + static public function randomBytes($byte_len) { |
|
| 36 | 36 | return crypt_random_string($byte_len); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | * @param array $oct |
| 41 | 41 | * @return string |
| 42 | 42 | */ |
| 43 | - static public function convertHalfWordArrayToBin(array $oct){ |
|
| 43 | + static public function convertHalfWordArrayToBin(array $oct) { |
|
| 44 | 44 | $hex = ''; |
| 45 | - foreach($oct as $b){ |
|
| 46 | - $hex .= str_pad(dechex($b),2,'0',STR_PAD_LEFT); |
|
| 45 | + foreach ($oct as $b) { |
|
| 46 | + $hex .= str_pad(dechex($b), 2, '0', STR_PAD_LEFT); |
|
| 47 | 47 | } |
| 48 | 48 | return self::hex2bin($hex); |
| 49 | 49 | } |
@@ -52,15 +52,15 @@ discard block |
||
| 52 | 52 | * @param int $nbr |
| 53 | 53 | * @return string |
| 54 | 54 | */ |
| 55 | - static public function convert2UnsignedLongBE($nbr){ |
|
| 56 | - $hex = str_pad(dechex($nbr),16,'0',STR_PAD_LEFT); |
|
| 55 | + static public function convert2UnsignedLongBE($nbr) { |
|
| 56 | + $hex = str_pad(dechex($nbr), 16, '0', STR_PAD_LEFT); |
|
| 57 | 57 | return self::hex2bin($hex); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - static public function hex2bin($hex_string){ |
|
| 61 | - if ( function_exists( 'hex2bin' ) ){ |
|
| 60 | + static public function hex2bin($hex_string) { |
|
| 61 | + if (function_exists('hex2bin')) { |
|
| 62 | 62 | return hex2bin($hex_string); |
| 63 | 63 | } |
| 64 | - return pack("H*" , $hex_string); |
|
| 64 | + return pack("H*", $hex_string); |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | \ No newline at end of file |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | * Class Base64UrlRepresentation |
| 19 | 19 | * @package utils |
| 20 | 20 | */ |
| 21 | -final class Base64UrlRepresentation implements IObjectRepresentation{ |
|
| 21 | +final class Base64UrlRepresentation implements IObjectRepresentation { |
|
| 22 | 22 | |
| 23 | 23 | const Padding = 4; |
| 24 | 24 | /** |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Copyright 2015 OpenStack Foundation |
|
| 4 | - * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | - * you may not use this file except in compliance with the License. |
|
| 6 | - * You may obtain a copy of the License at |
|
| 7 | - * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | - * Unless required by applicable law or agreed to in writing, software |
|
| 9 | - * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | - * See the License for the specific language governing permissions and |
|
| 12 | - * limitations under the License. |
|
| 13 | - **/ |
|
| 3 | + * Copyright 2015 OpenStack Foundation |
|
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | + * you may not use this file except in compliance with the License. |
|
| 6 | + * You may obtain a copy of the License at |
|
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | + * Unless required by applicable law or agreed to in writing, software |
|
| 9 | + * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | + * See the License for the specific language governing permissions and |
|
| 12 | + * limitations under the License. |
|
| 13 | + **/ |
|
| 14 | 14 | |
| 15 | 15 | namespace jwk; |
| 16 | 16 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | final class JWEJOSEHeaderFactory { |
| 25 | 25 | |
| 26 | - static protected function getProductClass(){ |
|
| 26 | + static protected function getProductClass() { |
|
| 27 | 27 | return '\jwe\impl\JWEJOSEHeader'; |
| 28 | 28 | } |
| 29 | 29 | |
@@ -31,16 +31,16 @@ discard block |
||
| 31 | 31 | * @param array $raw_headers |
| 32 | 32 | * @return IJWEJOSEHeader |
| 33 | 33 | */ |
| 34 | - public static function build(array $raw_headers){ |
|
| 34 | + public static function build(array $raw_headers) { |
|
| 35 | 35 | |
| 36 | 36 | $args = array(); |
| 37 | 37 | |
| 38 | - foreach(RegisteredJWEJOSEHeaderNames::$registered_basic_headers_set as $header_name){ |
|
| 38 | + foreach (RegisteredJWEJOSEHeaderNames::$registered_basic_headers_set as $header_name) { |
|
| 39 | 39 | $value = isset($raw_headers[$header_name]) ? $raw_headers[$header_name] : null; |
| 40 | 40 | $type = @RegisteredJWEJOSEHeaderNames::$registered_basic_headers_set_types[$header_name]; |
| 41 | - if(!is_null($value)) |
|
| 41 | + if (!is_null($value)) |
|
| 42 | 42 | { |
| 43 | - if(is_null($type)) continue; |
|
| 43 | + if (is_null($type)) continue; |
|
| 44 | 44 | $class = new \ReflectionClass($type); |
| 45 | 45 | $value = $class->newInstanceArgs(array($value)); |
| 46 | 46 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | // unregistered headers |
| 56 | 56 | |
| 57 | - foreach($raw_headers as $k => $v){ |
|
| 57 | + foreach ($raw_headers as $k => $v) { |
|
| 58 | 58 | $basic_header->addHeader(new JOSEHeaderParam($k, new JsonValue($v))); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -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 | } |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Copyright 2015 OpenStack Foundation |
|
| 4 | - * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | - * you may not use this file except in compliance with the License. |
|
| 6 | - * You may obtain a copy of the License at |
|
| 7 | - * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | - * Unless required by applicable law or agreed to in writing, software |
|
| 9 | - * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | - * See the License for the specific language governing permissions and |
|
| 12 | - * limitations under the License. |
|
| 13 | - **/ |
|
| 3 | + * Copyright 2015 OpenStack Foundation |
|
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | + * you may not use this file except in compliance with the License. |
|
| 6 | + * You may obtain a copy of the License at |
|
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | + * Unless required by applicable law or agreed to in writing, software |
|
| 9 | + * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | + * See the License for the specific language governing permissions and |
|
| 12 | + * limitations under the License. |
|
| 13 | + **/ |
|
| 14 | 14 | |
| 15 | 15 | namespace jwk; |
| 16 | 16 | |
@@ -36,8 +36,7 @@ discard block |
||
| 36 | 36 | * @param StringOrURI|null $type |
| 37 | 37 | * @param StringOrURI|null $cty |
| 38 | 38 | */ |
| 39 | - public function __construct |
|
| 40 | - ( |
|
| 39 | + public function __construct( |
|
| 41 | 40 | StringOrURI $alg, |
| 42 | 41 | StringOrURI $enc, |
| 43 | 42 | JsonValue $kid = null, |
@@ -50,7 +49,7 @@ discard block |
||
| 50 | 49 | |
| 51 | 50 | $this->set[RegisteredJWEJOSEHeaderNames::EncryptionAlgorithm] = $enc; |
| 52 | 51 | |
| 53 | - if(!is_null($zip) && CompressionAlgorithms_Registry::getInstance()->get($zip->getValue())) |
|
| 52 | + if (!is_null($zip) && CompressionAlgorithms_Registry::getInstance()->get($zip->getValue())) |
|
| 54 | 53 | $this->set[RegisteredJWEJOSEHeaderNames::CompressionAlgorithm] = $zip; |
| 55 | 54 | } |
| 56 | 55 | |
@@ -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 | /** |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Copyright 2015 OpenStack Foundation |
|
| 4 | - * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | - * you may not use this file except in compliance with the License. |
|
| 6 | - * You may obtain a copy of the License at |
|
| 7 | - * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | - * Unless required by applicable law or agreed to in writing, software |
|
| 9 | - * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | - * See the License for the specific language governing permissions and |
|
| 12 | - * limitations under the License. |
|
| 13 | - **/ |
|
| 3 | + * Copyright 2015 OpenStack Foundation |
|
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | + * you may not use this file except in compliance with the License. |
|
| 6 | + * You may obtain a copy of the License at |
|
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | + * Unless required by applicable law or agreed to in writing, software |
|
| 9 | + * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | + * See the License for the specific language governing permissions and |
|
| 12 | + * limitations under the License. |
|
| 13 | + **/ |
|
| 14 | 14 | |
| 15 | 15 | namespace jwk; |
| 16 | 16 | |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | return sprintf('%s.%s.%s.%s.%s', $header, $enc_cek, $iv, $cipher_text, $tag); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - static public function deserialize($input){ |
|
| 48 | + static public function deserialize($input) { |
|
| 49 | 49 | $parts = explode(IBasicJWT::SegmentSeparator, $input); |
| 50 | 50 | if (count($parts) !== 5) throw new JWEInvalidCompactFormatException; |
| 51 | 51 | |
@@ -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]); |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Copyright 2015 OpenStack Foundation |
|
| 4 | - * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | - * you may not use this file except in compliance with the License. |
|
| 6 | - * You may obtain a copy of the License at |
|
| 7 | - * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | - * Unless required by applicable law or agreed to in writing, software |
|
| 9 | - * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | - * See the License for the specific language governing permissions and |
|
| 12 | - * limitations under the License. |
|
| 13 | - **/ |
|
| 3 | + * Copyright 2015 OpenStack Foundation |
|
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | + * you may not use this file except in compliance with the License. |
|
| 6 | + * You may obtain a copy of the License at |
|
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | + * Unless required by applicable law or agreed to in writing, software |
|
| 9 | + * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | + * See the License for the specific language governing permissions and |
|
| 12 | + * limitations under the License. |
|
| 13 | + **/ |
|
| 14 | 14 | |
| 15 | 15 | namespace jwk; |
| 16 | 16 | |