/**
  * @author Martin Lonsky (martin@lonsky.net, +420 736 645876)
  * @param string $combiner
  * @return \ElasticSearchPredicate\Predicate\Predicates\PredicateInterface
  * @throws \ElasticSearchPredicate\Predicate\PredicateException
  */
 public function setCombiner(string $combiner) : PredicateInterface
 {
     if (strtoupper($combiner) === 'or') {
         throw new PredicateException('Not allowed combiner inside not predicate');
     }
     return parent::setCombiner($combiner);
 }
 /**
  * @author Martin Lonsky (martin@lonsky.net, +420 736 645876)
  * @return array
  * @throws \ElasticSearchPredicate\Predicate\PredicateException
  */
 public function toArray() : array
 {
     $_functions = $this->getFunctions();
     if ($_functions->isEmpty()) {
         throw new PredicateException('FunctionScore should contain at least one function');
     }
     $_ret = ['function_score' => []];
     if (!empty($_query = parent::toArray())) {
         $_ret['function_score']['query'] = $_query;
     }
     if (isset($this->_boost_mode)) {
         $_ret['function_score']['boost_mode'] = $this->_boost_mode;
     }
     if (isset($this->_max_boost)) {
         $_ret['function_score']['max_boost'] = $this->_max_boost;
     }
     if (isset($this->_score_mode)) {
         $_ret['function_score']['score_mode'] = $this->_score_mode;
     }
     if (isset($this->_min_score)) {
         $_ret['function_score']['min_score'] = $this->_min_score;
     }
     $_ret['function_score']['functions'] = $_functions->map(function (FunctionInterface $item) {
         return $item->toArray();
     })->toArray();
     return $_ret;
 }