Conditions | 2 |
Paths | 2 |
Total Lines | 8 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
37 | 4 | public function hex2bin(StreamInterface $hexStream): StreamInterface |
|
38 | { |
||
39 | 4 | $hex = $hexStream->getContents(); |
|
40 | 4 | if (!ctype_xdigit($hex)) { |
|
41 | 1 | throw new InvalidMessageException("Invalid hex as input"); |
|
42 | } |
||
43 | |||
44 | 3 | return new Stream($this->createStream(pack("H*", $hex))); |
|
45 | } |
||
47 |