getEntries() public method

Retrieve the entries from a search result.
public getEntries ( $searchResult ) : mixed
$searchResult
return mixed
Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
 /**
  * Processes LDAP search results into a nice array.
  *
  * If raw is not set to true, an ArrayCollection is returned.
  *
  * @param resource $results
  *
  * @return array|ArrayCollection
  */
 private function processResults($results)
 {
     $entries = $this->connection->getEntries($results);
     if ($this->raw === 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]);
             }
         }
         return $models;
     }
 }
Exemplo n.º 3
0
 /**
  * Processes LDAP search results into a nice array.
  *
  * If raw is not set to true, an ArrayCollection is returned.
  *
  * @param resource $results
  *
  * @return array|ArrayCollection
  */
 private function processResults($results)
 {
     $entries = $this->connection->getEntries($results);
     if ($this->raw === 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->paginated) {
             $models = $this->processSort($models);
         }
         return $models;
     }
 }