LdapTools\Utilities\TSPropertyArray::toBinary PHP Method

toBinary() public method

Get the full binary representation of the userParameters containing the TSPropertyArray data.
public toBinary ( ) : string
return string
    public function toBinary()
    {
        $binary = hex2bin(str_pad(dechex(MBString::ord($this->signature)), 2, 0, STR_PAD_LEFT));
        $binary .= hex2bin(str_pad(dechex(count($this->tsProperty)), 2, 0, STR_PAD_LEFT));
        foreach ($this->tsProperty as $tsProperty) {
            $binary .= $tsProperty->toBinary();
        }
        return $binary;
    }

Usage Example

 function it_should_support_being_constructed_with_a_binary_value()
 {
     $tsPropArray = new TSPropertyArray();
     $tsPropArray->set('CtxWFProfilePath', 'foo');
     $bin = $tsPropArray->toBinary();
     $this->beConstructedWith($bin);
     $this->get('CtxWFProfilePath')->shouldEqual('foo');
 }