original_string: public function validateConditionsTrigger()
      {
          $field = 'data.conditions';
  
          if ($this->isExcluded($field)) {
              return null;
          }
  
          $value = $this->getSubmitted($field);
  
          if ($this->isUpdating() && !isset($value)) {
              $this->unsetSubmitted($field);
              return null;
          }
  
          $label = $this->translation->text('Conditions');
  
          if (empty($value)) {
              $this->setErrorRequired($field, $label);
              return false;
          }
  
          if (!is_array($value)) {
              $this->setErrorInvalid($field, $label);
              return false;
          }
  
          $submitted = $this->getSubmitted();
          $operators = array_map('htmlspecialchars', array_keys($this->condition->getOperators()));
  
          $errors = $modified = array();
  
          foreach ($value as $line => $condition) {
  
              $line++;
  
              $parts = gplcart_string_explode_whitespace($condition, 3);
              $condition_id = array_shift($parts);
              $operator = array_shift($parts);
              $parameters = array_filter(explode(',', implode('', $parts)), function ($value) {
                  return $value !== '';
              });
  
              if (empty($parameters)) {
                  $errors[] = $line;
                  continue;
              }
  
              if (!in_array(htmlspecialchars($operator), $operators)) {
                  $errors[] = $line;
                  continue;
              }
  
              $args = array($parameters, $operator, $condition_id, $submitted);
              $result = $this->validateConditionTrigger($condition_id, $args);
  
              if ($result !== true) {
                  $errors[] = $line;
                  continue;
              }
  
              $modified[] = array(
                  'weight' => $line,
                  'id' => $condition_id,
                  'value' => $parameters,
                  'operator' => $operator,
                  'original' => "$condition_id $operator " . implode(',', $parameters),
              );
          }
  
          if (!empty($errors)) {
              $error = $this->translation->text('Error in @num definition', array('@num' => implode(',', $errors)));
              $this->setError($field, $error);
          }
  
          if ($this->isError()) {
              return false;
          }
  
          $this->setSubmitted($field, $modified);
          return true;
      }
code: public function validateConditionsTrigger()
      {
          $field = 'data.conditions';
  
          if ($this->isExcluded($field)) {
              return null;
          }
  
          $value = $this->getSubmitted($field);
  
          if ($this->isUpdating() && !isset($value)) {
              $this->unsetSubmitted($field);
              return null;
          }
  
          $label = $this->translation->text('Conditions');
  
          if (empty($value)) {
              $this->setErrorRequired($field, $label);
              return false;
          }
  
          if (!is_array($value)) {
              $this->setErrorInvalid($field, $label);
              return false;
          }
  
          $submitted = $this->getSubmitted();
          $operators = array_map('htmlspecialchars', array_keys($this->condition->getOperators()));
  
          $errors = $modified = array();
  
          foreach ($value as $line => $condition) {
  
              $line++;
  
              $parts = gplcart_string_explode_whitespace($condition, 3);
              $condition_id = array_shift($parts);
              $operator = array_shift($parts);
              $parameters = array_filter(explode(',', implode('', $parts)), function ($value) {
                  return $value !== '';
              });
  
              if (empty($parameters)) {
                  $errors[] = $line;
                  continue;
              }
  
              if (!in_array(htmlspecialchars($operator), $operators)) {
                  $errors[] = $line;
                  continue;
              }
  
              $args = array($parameters, $operator, $condition_id, $submitted);
              $result = $this->validateConditionTrigger($condition_id, $args);
  
              if ($result !== true) {
                  $errors[] = $line;
                  continue;
              }
  
              $modified[] = array(
                  'weight' => $line,
                  'id' => $condition_id,
                  'value' => $parameters,
                  'operator' => $operator,
                  'original' => "$condition_id $operator " . implode(',', $parameters),
              );
          }
  
          if (!empty($errors)) {
              $error = $this->translation->text('Error in @num definition', array('@num' => implode(',', $errors)));
              $this->setError($field, $error);
          }
  
          if ($this->isError()) {
              return false;
          }
  
          $this->setSubmitted($field, $modified);
          return true;
      }
code_tokens: public function validateConditionsTrigger ( ) { $ field = 'data.conditions' ; if ( $ this -> isExcluded ( $ field ) ) { return null ; } $ value = $ this -> getSubmitted ( $ field ) ; if ( $ this -> isUpdating ( ) && ! isset ( $ value ) ) { $ this -> unsetSubmitted ( $ field ) ; return null ; } $ label = $ this -> translation -> text ( 'Conditions' ) ; if ( empty ( $ value ) ) { $ this -> setErrorRequired ( $ field , $ label ) ; return false ; } if ( ! is_array ( $ value ) ) { $ this -> setErrorInvalid ( $ field , $ label ) ; return false ; } $ submitted = $ this -> getSubmitted ( ) ; $ operators = array_map ( 'htmlspecialchars' , array_keys ( $ this -> condition -> getOperators ( ) ) ) ; $ errors = $ modified = array ( ) ; foreach ( $ value as $ line => $ condition ) { $ line ++ ; $ parts = gplcart_string_explode_whitespace ( $ condition , 3 ) ; $ condition_id = array_shift ( $ parts ) ; $ operator = array_shift ( $ parts ) ; $ parameters = array_filter ( explode ( ',' , implode ( '' , $ parts ) ) , function ( $ value ) { return $ value !== '' ; } ) ; if ( empty ( $ parameters ) ) { $ errors [ ] = $ line ; continue ; } if ( ! in_array ( htmlspecialchars ( $ operator ) , $ operators ) ) { $ errors [ ] = $ line ; continue ; } $ args = array ( $ parameters , $ operator , $ condition_id , $ submitted ) ; $ result = $ this -> validateConditionTrigger ( $ condition_id , $ args ) ; if ( $ result !== true ) { $ errors [ ] = $ line ; continue ; } $ modified [ ] = array ( 'weight' => $ line , 'id' => $ condition_id , 'value' => $ parameters , 'operator' => $ operator , 'original' => "$condition_id $operator " . implode ( ',' , $ parameters ) , ) ; } if ( ! empty ( $ errors ) ) { $ error = $ this -> translation -> text ( 'Error in @num definition' , array ( '@num' => implode ( ',' , $ errors ) ) ) ; $ this -> setError ( $ field , $ error ) ; } if ( $ this -> isError ( ) ) { return false ; } $ this -> setSubmitted ( $ field , $ modified ) ; return true ; }
docstring: Validates and modifies trigger conditions
  @return boolean|null
docstring_tokens: Validates and modifies trigger conditions