/**
  * @param ISurveyStep $current_step
  * @param ISurveyQuestionTemplate $question
  * @param FormField $field
  */
 protected function buildDependantRules(ISurveyStep $current_step, ISurveyQuestionTemplate $question, FormField $field)
 {
     //depends : check visibility
     $depends = $question->getDependsOn();
     //$depends = $question->DependsOn();
     if (count($depends) > 0) {
         $js_rules = array();
         $static_rules = array();
         // pre process ...
         foreach ($depends as $d) {
             if ($question->step()->belongsToQuestion($d)) {
                 // js rule, question on which we depends on its on the same step (form)
                 if (!isset($js_rules[$d->getIdentifier()])) {
                     $js_rules[$d->getIdentifier()] = array('question' => $d, 'values' => array(), 'operator' => $d->Operator, 'visibility' => $d->Visibility, 'default' => $d->DependantDefaultValue, 'boolean_operator' => $d->BooleanOperatorOnValues, 'initial_condition' => $d->BooleanOperatorOnValues === 'And' ? true : false);
                 }
                 array_push($js_rules[$d->getIdentifier()]['values'], $d->ValueID);
             } else {
                 // belongs to another step (former one)
                 if (!isset($static_rules[$d->getIdentifier()])) {
                     $static_rules[$d->getIdentifier()] = array('question' => $d, 'values' => array(), 'operator' => $d->Operator, 'visibility' => $d->Visibility, 'default' => $d->DependantDefaultValue, 'boolean_operator' => $d->BooleanOperatorOnValues, 'initial_condition' => $d->BooleanOperatorOnValues === 'And' ? true : false);
                 }
                 array_push($static_rules[$d->getIdentifier()]['values'], $d->ValueID);
             }
         }
         $static_strategy = new StaticRulesStrategy();
         $dynamic_strategy = new JSRulesStrategy();
         $static_strategy->apply($current_step, $question, $static_rules, $field);
         $dynamic_strategy->apply($current_step, $question, $js_rules, $field);
     }
 }