/**
  * @param string $type type
  * @param array  $args args
  *
  * @return Operator
  */
 public function createNewOperator($type, array $args)
 {
     if (empty($args) || count($args) < 2) {
         throw new \InvalidArgumentException(__METHOD__ . ' accept minimum 2 arguments');
     }
     return $this->factory->createOperator()->setType($type)->setCriterias($args);
 }
 /**
  * {@inheritdoc}
  */
 public function fromArray(array $data, QueryBuilderFactory $factory)
 {
     $criterias = array_map(function ($v) use($factory) {
         if ('operator' == $v['type']) {
             return $factory->createOperatorFromArray($v);
         } elseif ('expr' == $v['type']) {
             return $factory->createAsserterFromArray($v);
         } else {
             throw new \InvalidArgumentException(sprintf('Type "%s" is not supported, use expr or operator.', $v['type']));
         }
     }, $data['criterias']);
     $this->setType($data['value']);
     $this->setCriterias($criterias);
     return $this;
 }