Exemplo n.º 1
0
 /**
  * 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;
     }
 }