original_string: public function getValue()
      {
          $selected = [];
  
          // walk all options
          foreach ($this->options as $option) {
              if ($option instanceof Option) {
                  if ($option->isSelected()) {
                      $selected[] = $option->getValue();
                  }
              } else {
                  if ($option instanceof Optgroup) {
                      $options = $option->getOptions();
                      foreach ($options as $option2) {
                          if ($option2->isSelected()) {
                              $selected[] = $option2->getValue();
                          }
                      }
                  }
              }
          }
  
          $count = sizeof($selected);
          if ($count > 0) {
              if ($this->isMultiple()) {
                  return $selected;
              } else {
                  // return last selected item as value
                  return $selected[$count - 1];
              }
          }
  
          return $this->isMultiple() ? [] : "";
      }
code: public function getValue()
      {
          $selected = [];
  
          // walk all options
          foreach ($this->options as $option) {
              if ($option instanceof Option) {
                  if ($option->isSelected()) {
                      $selected[] = $option->getValue();
                  }
              } else {
                  if ($option instanceof Optgroup) {
                      $options = $option->getOptions();
                      foreach ($options as $option2) {
                          if ($option2->isSelected()) {
                              $selected[] = $option2->getValue();
                          }
                      }
                  }
              }
          }
  
          $count = sizeof($selected);
          if ($count > 0) {
              if ($this->isMultiple()) {
                  return $selected;
              } else {
                  // return last selected item as value
                  return $selected[$count - 1];
              }
          }
  
          return $this->isMultiple() ? [] : "";
      }
code_tokens: public function getValue ( ) { $ selected = [ ] ; // walk all options foreach ( $ this -> options as $ option ) { if ( $ option instanceof Option ) { if ( $ option -> isSelected ( ) ) { $ selected [ ] = $ option -> getValue ( ) ; } } else { if ( $ option instanceof Optgroup ) { $ options = $ option -> getOptions ( ) ; foreach ( $ options as $ option2 ) { if ( $ option2 -> isSelected ( ) ) { $ selected [ ] = $ option2 -> getValue ( ) ; } } } } } $ count = sizeof ( $ selected ) ; if ( $ count > 0 ) { if ( $ this -> isMultiple ( ) ) { return $ selected ; } else { // return last selected item as value return $ selected [ $ count - 1 ] ; } } return $ this -> isMultiple ( ) ? [ ] : "" ; }
docstring: Return the value for this field.
  This will return an array if the field
  is setup as "multiple". Otherwise it will return a string with the selected value.
  
  @return array|string
docstring_tokens: Return the value for this field . This will return an array if the field is setup as multiple . Otherwise it will return a string with the selected value .