/** * Factory method to hydrate an instance from serialized options * * @param array $options * @return self */ public static function fromArray(array $options) { $options = array_replace(['host' => '127.0.0.1', 'port' => 9200, 'index' => '', 'shards' => 3, 'replicas' => 0, 'minScore' => 4, 'highlight' => true], $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']); return $self; }