Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | public function checkHeader(array $protected_headers, array $headers, array $checked_claims) |
||
20 | { |
||
21 | if (!array_key_exists('crit', $protected_headers)) { |
||
22 | return; |
||
23 | } |
||
24 | |||
25 | if (!is_array($protected_headers['crit'])) { |
||
26 | throw new \InvalidArgumentException('The parameter "crit" must be a list.'); |
||
27 | } |
||
28 | |||
29 | $diff = array_diff($protected_headers['crit'], $checked_claims); |
||
30 | if (!empty($diff)) { |
||
31 | throw new \InvalidArgumentException(sprintf('One or more claims are marked as critical, but they are missing or not have not been checked (%s).', json_encode(array_values($diff)))); |
||
32 | } |
||
33 | } |
||
34 | |||
36 |