public function toBytes(int $bitOffset, int $numBytes) : SplFixedArray
    {
        $bytes = new SplFixedArray($numBytes);

        for ($i = 0; $i < $numBytes; ++$i) {
            $byte = 0;

            for ($j = 0; $j < 8; ++$j) {
                if ($this->get($bitOffset)) {
                    $byte |= 1 << (7 - $j);
                }

                ++$bitOffset;
            }

            $bytes[$i] = $byte;
        }

        return $bytes;
    }
public function toBytes(int $bitOffset, int $numBytes) : SplFixedArray
    {
        $bytes = new SplFixedArray($numBytes);

        for ($i = 0; $i < $numBytes; ++$i) {
            $byte = 0;

            for ($j = 0; $j < 8; ++$j) {
                if ($this->get($bitOffset)) {
                    $byte |= 1 << (7 - $j);
                }

                ++$bitOffset;
            }

            $bytes[$i] = $byte;
        }

        return $bytes;
    }
public function toBytes ( int $ bitOffset , int $ numBytes ) : SplFixedArray { $ bytes = new SplFixedArray ( $ numBytes ) ; for ( $ i = 0 ; $ i < $ numBytes ; ++ $ i ) { $ byte = 0 ; for ( $ j = 0 ; $ j < 8 ; ++ $ j ) { if ( $ this -> get ( $ bitOffset ) ) { $ byte |= 1 << ( 7 - $ j ) ; } ++ $ bitOffset ; } $ bytes [ $ i ] = $ byte ; } return $ bytes ; }
Converts the bit array to a byte array.

@return SplFixedArray<int>
Converts the bit array to a byte array .