public function __construct($params = array())
 {
     parent::__construct($params);
     $this->_pageSize = $this->_count <= static::DEFAULT_PAGE_SIZE ? $this->_count : static::DEFAULT_PAGE_SIZE;
     if (isset($params['buffer'])) {
         $this->_buffer = $params['buffer'];
         // Increment pages for next search. We trust that injected buffer is first page.
         $this->_currentPage++;
     }
     $this->_codec = new PhpArray();
     $this->_adaptPagination();
 }
 public function __construct($params = array())
 {
     parent::__construct($params);
     if (!isset($params['mapper'])) {
         throw new InvalidArgumentException("Mongo mapper must be defined");
     }
     $mapper = $params['mapper'];
     unset($params['mapper']);
     if (is_string($mapper)) {
         $mapper = $mapper::getInstance();
     }
     if (!$mapper instanceof MongoAbstractStreamMapper) {
         throw new InvalidArgumentException("Mapper must be a mongo mapper");
     }
     $this->_mapper = $mapper;
     $this->_options = $params;
 }