/** * {@inheritdoc} * @see \BitWasp\Buffertools\Types\TypeInterface::read() */ public function read(Parser &$parser) { $math = $this->getMath(); $uint8 = new Uint8($math); $int = $uint8->readBits($parser); if ($math->cmp($int, 0xfd) < 0) { return $int; } else { $uint = $this->solveReadSize($int)[0]; return $uint->read($parser); } }
/** * @expectedException \Exception * @expectedExceptionMessage Bit string length must be a multiple of 8 */ public function testInvalidFlipLength() { $math = EccFactory::getAdapter(); $u = new Uint8($math, 1); $u->flipBits('0'); }