LdapTools\Ldif\LdifStringBuilderTrait::getLdifLine PHP Method

getLdifLine() protected method

Construct a single line of the LDIF for a given directive and value.
protected getLdifLine ( string $directive, string $value ) : string
$directive string
$value string
return string
    protected function getLdifLine($directive, $value)
    {
        $separator = Ldif::KEY_VALUE_SEPARATOR;
        // Per the RFC, any value starting with a space should be base64 encoded
        if (substr($value, 0, strlen(' ')) === ' ') {
            $separator .= Ldif::KEY_VALUE_SEPARATOR;
            $value = base64_encode($value);
        }
        return $directive . $separator . ' ' . $this->getValueForLine($value) . $this->lineEnding;
    }