| Conditions | 6 |
| Paths | 4 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 6.3949 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | 3 | public function __construct(string $status, ?ByteBuffer $id) |
|
| 22 | { |
||
| 23 | 3 | if (!TokenBindingStatus::isValidValue($status)) { |
|
| 24 | 1 | throw new UnexpectedValueException(sprintf('Invalid token binding status "%s".', $status)); |
|
| 25 | } |
||
| 26 | |||
| 27 | 2 | $this->status = $status; |
|
| 28 | 2 | if ($this->status === TokenBindingStatus::PRESENT && $id === null) { |
|
| 29 | throw new UnexpectedValueException("Token binding id should be set if status is 'present'."); |
||
| 30 | } |
||
| 31 | 2 | if ($this->status === TokenBindingStatus::SUPPORTED && $id !== null) { |
|
| 32 | throw new UnexpectedValueException("Token binding id cannot be set if status is 'supported'."); |
||
| 33 | } |
||
| 34 | 2 | $this->id = $id; |
|
| 35 | 2 | } |
|
| 60 |