Code Duplication    Length = 3-3 lines in 2 locations

Utilities.php 2 locations

@@ 389-391 (lines=3) @@
386
387
        // Per RFC 4514, leading/trailing spaces should be encoded in DNs, as well as carriage returns.
388
        if ((int)$flags & LDAP_ESCAPE_DN) {
389
            if (!empty($value) && $value[0] === ' ') {
390
                $value = '\\20' . substr($value, 1);
391
            }
392
            if (!empty($value) && $value[strlen($value) - 1] === ' ') {
393
                $value = substr($value, 0, -1) . '\\20';
394
            }
@@ 392-394 (lines=3) @@
389
            if (!empty($value) && $value[0] === ' ') {
390
                $value = '\\20' . substr($value, 1);
391
            }
392
            if (!empty($value) && $value[strlen($value) - 1] === ' ') {
393
                $value = substr($value, 0, -1) . '\\20';
394
            }
395
            // Only carriage returns seem to be valid, not line feeds (per testing of AD anyway).
396
            $value = str_replace("\r", '\0d', $value);
397
        }