LdapTools\Utilities\UserParameters::toBinary PHP Method

toBinary() public method

Get the userParameters in binary form that can be saved back to LDAP.
public toBinary ( ) : string
return string
    public function toBinary()
    {
        /**
         * @todo There is no documentation on the reserved data, but this is how it seems to act. May need to change this.
         */
        if (!$this->tsPropertyArray && !$this->dialInData) {
            $binary = $this->encodeReservedData('');
        } elseif ($this->tsPropertyArray && $this->dialInData) {
            $binary = $this->encodeReservedData(self::RESERVED_DATA_VALUE['NPS_RDS']);
        } elseif ($this->dialInData) {
            $binary = $this->encodeReservedData(self::RESERVED_DATA_VALUE['NPS']);
        } else {
            $binary = $this->encodeReservedData(self::RESERVED_DATA_VALUE['RDS']);
        }
        $binary .= $this->dialInData ? $this->dialInData->toBinary() : hex2bin(str_pad('', 52, '20'));
        if ($this->tsPropertyArray) {
            $binary .= $this->tsPropertyArray->toBinary();
        }
        return $binary . $this->postBinary;
    }