LdapTools\Utilities\TSProperty::decodePropValue PHP Method

decodePropValue() protected method

Decode the property by inspecting the nibbles of each blob, checking the control, and adding up the results into a final value.
protected decodePropValue ( string $hex, boolean $string = false ) : string
$hex string
$string boolean Whether or not this is simple string data.
return string
    protected function decodePropValue($hex, $string = false)
    {
        $decodePropValue = '';
        $blobs = str_split($hex, 6);
        foreach ($blobs as $blob) {
            $bin = decbin(hexdec($blob));
            $controlY = substr($bin, 4, 6);
            $nibbleY = substr($bin, 10, 4);
            $controlX = substr($bin, 14, 6);
            $nibbleX = substr($bin, 20, 4);
            $byte = $this->nibbleControl($nibbleX, $controlX) . $this->nibbleControl($nibbleY, $controlY);
            if ($string) {
                $decodePropValue .= MBString::chr(bindec($byte));
            } else {
                $decodePropValue = $this->dec2hex(bindec($byte)) . $decodePropValue;
            }
        }
        return $decodePropValue;
    }