/** * Processes LDAP search results and constructs their model instances. * * @param resource $results * * @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; }
/** * Processes LDAP search results and constructs their model instances. * * @param resource $results * * @return array */ public function process($results) { $entries = $this->connection->getEntries($results); if ($this->builder->isRaw() === true) { return $entries; } else { $models = []; if (is_array($entries) && array_key_exists('count', $entries)) { for ($i = 0; $i < $entries['count']; $i++) { $models[] = $this->newLdapEntry($entries[$i]); } } // If the current query isn't paginated, // we'll sort the models array here. if (!$this->builder->isPaginated()) { $models = $this->processSort($models); } return $models; } }