public function injectParams(&$input)
 {
     if ($this->limit !== null && $this->limit >= 0) {
         $input['size'] = $this->limit;
     }
     if ($this->skip !== null && $this->skip >= 0) {
         $input['from'] = $this->skip;
     }
     if ($this->explain !== null) {
         $input['explain'] = $this->explain;
     }
     if ($this->highlightStyle !== null) {
         $input['highlight'] = array('style' => $this->highlightStyle);
         if (count($this->highlightFields) > 0) {
             $input['highlight']['fields'] = $this->highlightFields;
         }
     }
     if (count($this->fields) > 0) {
         $input['fields'] = $this->fields;
     }
     if (count($this->facets) > 0) {
         $facets = array();
         foreach ($this->facets as $key => $value) {
             $facets[$key] = array();
             $value->injectParams($facets[$key]);
         }
         $input['facets'] = $facets;
     }
     $control = array();
     //check need for timeout
     if ($this->serverSideTimeout !== null) {
         $control['timeout'] = $this->serverSideTimeout;
     }
     if ($this->mutationState) {
         $control['consistency'] = array('level' => 'at_plus', 'vectors' => array($this->indexName => $this->mutationState->exportForSearch()));
     }
     //if any control was set, inject it
     if (count($control) > 0) {
         $input['ctl'] = $control;
     }
 }
 public static function from($source = array())
 {
     $state = new CouchbaseMutationState();
     $state->add($source);
     return $state;
 }