LdapTools\Operation\Handler\QueryOperationHandler::processSearchResult PHP Method

processSearchResult() protected method

Process a LDAP search result and merge it with the existing entries if possible.
protected processSearchResult ( resource $result, array $allEntries ) : array
$result resource
$allEntries array
return array
    protected function processSearchResult($result, array $allEntries)
    {
        if (!$result) {
            throw new LdapConnectionException(sprintf('LDAP search failed. Diagnostic message: "%s"', $this->connection->getDiagnosticMessage()));
        }
        $entries = @ldap_get_entries($this->connection->getConnection(), $result);
        if (!$entries) {
            return $allEntries;
        }
        $allEntries['count'] = isset($allEntries['count']) ? $allEntries['count'] + $entries['count'] : $entries['count'];
        unset($entries['count']);
        return array_merge($allEntries, $entries);
    }