original_string: protected function selectOptionsFromValue()
      {
          if (!$this->options) {
              return;
          }
  
          // there is no current value known. So, just stop.
          if ($this->value === null) {
              return;
          }
  
          // walk all options
          foreach ($this->options as $option) {
              if ($option instanceof Option) {
                  if (is_array($this->value)) {
                      $option->setSelected(in_array($option->getValue(), $this->value));
                  } else {
                      $option->setSelected($option->getValue() == $this->value);
                  }
              } else {
                  if ($option instanceof Optgroup) {
                      $options = $option->getOptions();
                      if ($options) {
                          foreach ($options as $option2) {
                              if (is_array($this->value)) {
                                  $option2->setSelected(in_array($option2->getValue(), $this->value));
                              } else {
                                  $option2->setSelected($option2->getValue() == $this->value);
                              }
                          }
                      }
                  }
              }
          }
      }
code: protected function selectOptionsFromValue()
      {
          if (!$this->options) {
              return;
          }
  
          // there is no current value known. So, just stop.
          if ($this->value === null) {
              return;
          }
  
          // walk all options
          foreach ($this->options as $option) {
              if ($option instanceof Option) {
                  if (is_array($this->value)) {
                      $option->setSelected(in_array($option->getValue(), $this->value));
                  } else {
                      $option->setSelected($option->getValue() == $this->value);
                  }
              } else {
                  if ($option instanceof Optgroup) {
                      $options = $option->getOptions();
                      if ($options) {
                          foreach ($options as $option2) {
                              if (is_array($this->value)) {
                                  $option2->setSelected(in_array($option2->getValue(), $this->value));
                              } else {
                                  $option2->setSelected($option2->getValue() == $this->value);
                              }
                          }
                      }
                  }
              }
          }
      }
code_tokens: protected function selectOptionsFromValue ( ) { if ( ! $ this -> options ) { return ; } // there is no current value known. So, just stop. if ( $ this -> value === null ) { return ; } // walk all options foreach ( $ this -> options as $ option ) { if ( $ option instanceof Option ) { if ( is_array ( $ this -> value ) ) { $ option -> setSelected ( in_array ( $ option -> getValue ( ) , $ this -> value ) ) ; } else { $ option -> setSelected ( $ option -> getValue ( ) == $ this -> value ) ; } } else { if ( $ option instanceof Optgroup ) { $ options = $ option -> getOptions ( ) ; if ( $ options ) { foreach ( $ options as $ option2 ) { if ( is_array ( $ this -> value ) ) { $ option2 -> setSelected ( in_array ( $ option2 -> getValue ( ) , $ this -> value ) ) ; } else { $ option2 -> setSelected ( $ option2 -> getValue ( ) == $ this -> value ) ; } } } } } } }
docstring: This function will use the "value" for this field to
  select the correct options
docstring_tokens: This function will use the value for this field to select the correct options