original_string: public function addOptionsAsArray(array $options, $useArrayKeyAsValue = true)
      {
          foreach ($options as $value => $label) {
              $option = new Option();
              $option->setLabel($label);
              $option->setValue($useArrayKeyAsValue ? $value : $label);
  
              $this->options[] = $option;
          }
  
          // this will auto select the options based on this fields value
          $this->selectOptionsFromValue();
  
          return $this;
      }
code: public function addOptionsAsArray(array $options, $useArrayKeyAsValue = true)
      {
          foreach ($options as $value => $label) {
              $option = new Option();
              $option->setLabel($label);
              $option->setValue($useArrayKeyAsValue ? $value : $label);
  
              $this->options[] = $option;
          }
  
          // this will auto select the options based on this fields value
          $this->selectOptionsFromValue();
  
          return $this;
      }
code_tokens: public function addOptionsAsArray ( array $ options , $ useArrayKeyAsValue = true ) { foreach ( $ options as $ value => $ label ) { $ option = new Option ( ) ; $ option -> setLabel ( $ label ) ; $ option -> setValue ( $ useArrayKeyAsValue ? $ value : $ label ) ; $ this -> options [ ] = $ option ; } // this will auto select the options based on this fields value $ this -> selectOptionsFromValue ( ) ; return $ this ; }
docstring: Add options with an assoc array
  
  @param array $options
  @param boolean $useArrayKeyAsValue
  @return SelectField
docstring_tokens: Add options with an assoc array