@@ -63,7 +63,9 @@ discard block |
||
63 | 63 | { |
64 | 64 | parent::__construct($headers); |
65 | 65 | |
66 | - if(count($headers) === 0 ) return; |
|
66 | + if(count($headers) === 0 ) { |
|
67 | + return; |
|
68 | + } |
|
67 | 69 | |
68 | 70 | // certificates |
69 | 71 | if(in_array(PublicJSONWebKeyParameters::X_509CertificateChain, $headers) && is_array($headers[PublicJSONWebKeyParameters::X_509CertificateChain])){ |
@@ -109,8 +111,9 @@ discard block |
||
109 | 111 | */ |
110 | 112 | public function setVisibility($visibility) |
111 | 113 | { |
112 | - if(!in_array($visibility, JSONWebKeyVisibility::$valid_values)) |
|
113 | - throw new InvalidJWKVisibilityException; |
|
114 | + if(!in_array($visibility, JSONWebKeyVisibility::$valid_values)) { |
|
115 | + throw new InvalidJWKVisibilityException; |
|
116 | + } |
|
114 | 117 | $this->visibility = $visibility; |
115 | 118 | return $this; |
116 | 119 | } |
@@ -42,7 +42,9 @@ discard block |
||
42 | 42 | */ |
43 | 43 | protected function __construct(array $headers = array()){ |
44 | 44 | |
45 | - if(count($headers) === 0 ) return; |
|
45 | + if(count($headers) === 0 ) { |
|
46 | + return; |
|
47 | + } |
|
46 | 48 | |
47 | 49 | $alg = @$headers[JSONWebKeyParameters::Algorithm]; |
48 | 50 | $this->setAlgorithm($alg); |
@@ -84,8 +86,9 @@ discard block |
||
84 | 86 | */ |
85 | 87 | public function setId($kid) |
86 | 88 | { |
87 | - if(!empty($kid)) |
|
88 | - $this->set[JSONWebKeyParameters::KeyId] = new JsonValue($kid); |
|
89 | + if(!empty($kid)) { |
|
90 | + $this->set[JSONWebKeyParameters::KeyId] = new JsonValue($kid); |
|
91 | + } |
|
89 | 92 | return $this; |
90 | 93 | } |
91 | 94 | |
@@ -96,8 +99,9 @@ discard block |
||
96 | 99 | */ |
97 | 100 | public function setAlgorithm($alg) |
98 | 101 | { |
99 | - if(!in_array($alg, JSONWebSignatureAndEncryptionAlgorithms::$header_location_alg)) |
|
100 | - throw new InvalidJWKAlgorithm (sprintf('alg %s', $alg)); |
|
102 | + if(!in_array($alg, JSONWebSignatureAndEncryptionAlgorithms::$header_location_alg)) { |
|
103 | + throw new InvalidJWKAlgorithm (sprintf('alg %s', $alg)); |
|
104 | + } |
|
101 | 105 | |
102 | 106 | $this->set[JSONWebKeyParameters::Algorithm] = new StringOrURI($alg); |
103 | 107 | return $this; |
@@ -110,9 +114,12 @@ discard block |
||
110 | 114 | */ |
111 | 115 | public function setKeyUse($use) |
112 | 116 | { |
113 | - if(empty($use)) return $this; |
|
114 | - if(!in_array($use, JSONWebKeyPublicKeyUseValues::$valid_uses)) |
|
115 | - throw new InvalidJWKUseException(sprintf('use %s', $use)); |
|
117 | + if(empty($use)) { |
|
118 | + return $this; |
|
119 | + } |
|
120 | + if(!in_array($use, JSONWebKeyPublicKeyUseValues::$valid_uses)) { |
|
121 | + throw new InvalidJWKUseException(sprintf('use %s', $use)); |
|
122 | + } |
|
116 | 123 | |
117 | 124 | $this->set[JSONWebKeyParameters::PublicKeyUse] = new StringOrURI($use); |
118 | 125 | return $this; |
@@ -125,8 +132,9 @@ discard block |
||
125 | 132 | */ |
126 | 133 | public function setType($type) |
127 | 134 | { |
128 | - if(!in_array($type, JSONWebKeyTypes::$valid_keys_set)) |
|
129 | - throw new InvalidJWKType(sprintf('use %s', $type)); |
|
135 | + if(!in_array($type, JSONWebKeyTypes::$valid_keys_set)) { |
|
136 | + throw new InvalidJWKType(sprintf('use %s', $type)); |
|
137 | + } |
|
130 | 138 | |
131 | 139 | $this->set[JSONWebKeyParameters::KeyType] = new StringOrURI($type); |
132 | 140 | return $this; |