public static function fromArray(array $options)
    {
        $defaultOptions = [
            'host' => '127.0.0.1',
            'port' => 9200,
            'index' => '',
            'shards' => 3,
            'replicas' => 0,
            'minScore' => 4,
            'highlight' => true,
            'populate_order'     => self::POPULATE_ORDER_RID,
            'populate_direction' => self::POPULATE_DIRECTION_DESC,
            'activeTab' => null,
        ];

        foreach(self::getAggregableTechnicalFields() as $k => $f) {
            $defaultOptions[$k.'_limit'] = 0;
        }
        $options = array_replace($defaultOptions, $options);


        $self = new self();
        $self->setHost($options['host']);
        $self->setPort($options['port']);
        $self->setIndexName($options['index']);
        $self->setShards($options['shards']);
        $self->setReplicas($options['replicas']);
        $self->setMinScore($options['minScore']);
        $self->setHighlight($options['highlight']);
        $self->setPopulateOrder($options['populate_order']);
        $self->setPopulateDirection($options['populate_direction']);
        $self->setActiveTab($options['activeTab']);
        foreach(self::getAggregableTechnicalFields() as $k => $f) {
            $self->setAggregableFieldLimit($k, $options[$k.'_limit']);
        }


        return $self;
    }
public static function fromArray(array $options)
    {
        $defaultOptions = [
            'host' => '127.0.0.1',
            'port' => 9200,
            'index' => '',
            'shards' => 3,
            'replicas' => 0,
            'minScore' => 4,
            'highlight' => true,
            'populate_order'     => self::POPULATE_ORDER_RID,
            'populate_direction' => self::POPULATE_DIRECTION_DESC,
            'activeTab' => null,
        ];

        foreach(self::getAggregableTechnicalFields() as $k => $f) {
            $defaultOptions[$k.'_limit'] = 0;
        }
        $options = array_replace($defaultOptions, $options);


        $self = new self();
        $self->setHost($options['host']);
        $self->setPort($options['port']);
        $self->setIndexName($options['index']);
        $self->setShards($options['shards']);
        $self->setReplicas($options['replicas']);
        $self->setMinScore($options['minScore']);
        $self->setHighlight($options['highlight']);
        $self->setPopulateOrder($options['populate_order']);
        $self->setPopulateDirection($options['populate_direction']);
        $self->setActiveTab($options['activeTab']);
        foreach(self::getAggregableTechnicalFields() as $k => $f) {
            $self->setAggregableFieldLimit($k, $options[$k.'_limit']);
        }


        return $self;
    }
public static function fromArray ( array $ options ) { $ defaultOptions = [ 'host' => '127.0.0.1' , 'port' => 9200 , 'index' => '' , 'shards' => 3 , 'replicas' => 0 , 'minScore' => 4 , 'highlight' => true , 'populate_order' => self :: POPULATE_ORDER_RID , 'populate_direction' => self :: POPULATE_DIRECTION_DESC , 'activeTab' => null , ] ; foreach ( self :: getAggregableTechnicalFields ( ) as $ k => $ f ) { $ defaultOptions [ $ k . '_limit' ] = 0 ; } $ options = array_replace ( $ defaultOptions , $ options ) ; $ self = new self ( ) ; $ self -> setHost ( $ options [ 'host' ] ) ; $ self -> setPort ( $ options [ 'port' ] ) ; $ self -> setIndexName ( $ options [ 'index' ] ) ; $ self -> setShards ( $ options [ 'shards' ] ) ; $ self -> setReplicas ( $ options [ 'replicas' ] ) ; $ self -> setMinScore ( $ options [ 'minScore' ] ) ; $ self -> setHighlight ( $ options [ 'highlight' ] ) ; $ self -> setPopulateOrder ( $ options [ 'populate_order' ] ) ; $ self -> setPopulateDirection ( $ options [ 'populate_direction' ] ) ; $ self -> setActiveTab ( $ options [ 'activeTab' ] ) ; foreach ( self :: getAggregableTechnicalFields ( ) as $ k => $ f ) { $ self -> setAggregableFieldLimit ( $ k , $ options [ $ k . '_limit' ] ) ; } return $ self ; }
Factory method to hydrate an instance from serialized options

@param array $options
@return self
Factory method to hydrate an instance from serialized options