src/FreeDSx/Asn1/Type/BitStringType.php
public static function fromBinary($bytes, ?int $minLength = null)
    {
        $bitstring = '';

        $length = strlen($bytes);
        for ($i = 0; $i < $length; $i++) {
            $bitstring .= sprintf('%08d', decbin(ord($bytes[$i])));
        }
        if ($minLength && strlen($bitstring) < $minLength) {
            $bitstring = str_pad($bitstring, $minLength, '0');
        }

        return new self($bitstring);
    }
public static function fromBinary($bytes, ?int $minLength = null)
    {
        $bitstring = '';

        $length = strlen($bytes);
        for ($i = 0; $i < $length; $i++) {
            $bitstring .= sprintf('%08d', decbin(ord($bytes[$i])));
        }
        if ($minLength && strlen($bitstring) < $minLength) {
            $bitstring = str_pad($bitstring, $minLength, '0');
        }

        return new self($bitstring);
    }
public static function fromBinary ( $ bytes , ? int $ minLength = null ) { $ bitstring = '' ; $ length = strlen ( $ bytes ) ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ bitstring .= sprintf ( '%08d' , decbin ( ord ( $ bytes [ $ i ] ) ) ) ; } if ( $ minLength && strlen ( $ bitstring ) < $ minLength ) { $ bitstring = str_pad ( $ bitstring , $ minLength , '0' ) ; } return new self ( $ bitstring ) ; }
Construct the bit string from a binary string value.

@param $bytes
@param int|null $minLength
@return BitStringType
Construct the bit string from a binary string value .