src/Utils/UUID.php
protected static function makeBin($str, $len)
    {
        if ($str instanceof self) {
            return $str->bytes;
        }
        if (\strlen($str) === $len) {
            return $str;
        }

        $str = (string)preg_replace([
            // strip URN scheme and namespace
            '/^urn:uuid:/is',
            // strip non-hex characters
            '/[^a-f0-9]/is',
        ], '', $str);

        if (\strlen($str) !== ($len * 2)) {
            return null;
        }

        return pack('H*', $str);
    }
protected static function makeBin($str, $len)
    {
        if ($str instanceof self) {
            return $str->bytes;
        }
        if (\strlen($str) === $len) {
            return $str;
        }

        $str = (string)preg_replace([
            // strip URN scheme and namespace
            '/^urn:uuid:/is',
            // strip non-hex characters
            '/[^a-f0-9]/is',
        ], '', $str);

        if (\strlen($str) !== ($len * 2)) {
            return null;
        }

        return pack('H*', $str);
    }
protected static function makeBin ( $ str , $ len ) { if ( $ str instanceof self ) { return $ str -> bytes ; } if ( \ strlen ( $ str ) === $ len ) { return $ str ; } $ str = ( string ) preg_replace ( [ // strip URN scheme and namespace '/^urn:uuid:/is' , // strip non-hex characters '/[^a-f0-9]/is' , ] , '' , $ str ) ; if ( \ strlen ( $ str ) !== ( $ len * 2 ) ) { return null ; } return pack ( 'H*' , $ str ) ; }
Insure that an input string is either binary or hexadecimal.
Returns binary representation, or false on failure.

@param string $str
@param integer $len
@return string|null
Insure that an input string is either binary or hexadecimal . Returns binary representation or false on failure .