public function read(BinaryReader &$br, $length = null)
    {
        if (!is_int($length)) {
            throw new InvalidDataException('The length parameter must be an integer');
        }

        $br->align();

        if (!$br->canReadBytes($length)) {
            throw new \OutOfBoundsException('Cannot read bytes, it exceeds the boundary of the file');
        }

        $segment = $br->readFromHandle($length);

        return $segment;
    }
public function read(BinaryReader &$br, $length = null)
    {
        if (!is_int($length)) {
            throw new InvalidDataException('The length parameter must be an integer');
        }

        $br->align();

        if (!$br->canReadBytes($length)) {
            throw new \OutOfBoundsException('Cannot read bytes, it exceeds the boundary of the file');
        }

        $segment = $br->readFromHandle($length);

        return $segment;
    }
public function read ( BinaryReader & $ br , $ length = null ) { if ( ! is_int ( $ length ) ) { throw new InvalidDataException ( 'The length parameter must be an integer' ) ; } $ br -> align ( ) ; if ( ! $ br -> canReadBytes ( $ length ) ) { throw new \ OutOfBoundsException ( 'Cannot read bytes, it exceeds the boundary of the file' ) ; } $ segment = $ br -> readFromHandle ( $ length ) ; return $ segment ; }
Returns an variable number of bytes

@param  \PhpBinaryReader\BinaryReader $br
@param  int|null                      $length
@return string
@throws \OutOfBoundsException
@throws InvalidDataException
Returns an variable number of bytes