Adldap\Query\Processor::process PHP Method

process() public method

Processes LDAP search results and constructs their model instances.
public process ( resource $results ) : array
$results resource
return array
    public function process($results)
    {
        // Normalize entries. Get entries returns false on failure.
        // We'll always want an array in this situation.
        $entries = $this->connection->getEntries($results) ?: [];
        if ($this->builder->isRaw()) {
            // If the builder is asking for a raw
            // LDAP result, we can return here.
            return $entries;
        }
        $models = [];
        if (Arr::has($entries, 'count')) {
            for ($i = 0; $i < $entries['count']; $i++) {
                // We'll go through each entry and construct a new
                // model instance with the raw LDAP attributes.
                $models[] = $this->newLdapEntry($entries[$i]);
            }
        }
        if (!$this->builder->isPaginated()) {
            // If the current query isn't paginated,
            // we'll sort the models array here.
            $models = $this->processSort($models);
        }
        return $models;
    }