original_string: public function generateSelectOptions($options, $attr)
      {
          $return = '';
  
          foreach ($options as $key => $value) {
              if (is_array($value)) {
                  $subArray = $this->generateSelectOptions($value, $attr);
  
                  $return .= $this->Html->tag(
                      'optgroup',
                      array(
                          'label' => $key
                      ),
                      $subArray,
                      true
                  );
              } else {
                  $optionsAttr = array('value' => $key);
  
                  if (isset($attr['selected']) && $attr['selected'] == $key) {
                      $optionsAttr[] = 'selected';
                  }
  
                  $return .= $this->Html->tag(
                      'option',
                      $optionsAttr,
                      $value,
                      true
                  );
              }
          }
  
          return $return;
      }
code: public function generateSelectOptions($options, $attr)
      {
          $return = '';
  
          foreach ($options as $key => $value) {
              if (is_array($value)) {
                  $subArray = $this->generateSelectOptions($value, $attr);
  
                  $return .= $this->Html->tag(
                      'optgroup',
                      array(
                          'label' => $key
                      ),
                      $subArray,
                      true
                  );
              } else {
                  $optionsAttr = array('value' => $key);
  
                  if (isset($attr['selected']) && $attr['selected'] == $key) {
                      $optionsAttr[] = 'selected';
                  }
  
                  $return .= $this->Html->tag(
                      'option',
                      $optionsAttr,
                      $value,
                      true
                  );
              }
          }
  
          return $return;
      }
code_tokens: public function generateSelectOptions ( $ options , $ attr ) { $ return = '' ; foreach ( $ options as $ key => $ value ) { if ( is_array ( $ value ) ) { $ subArray = $ this -> generateSelectOptions ( $ value , $ attr ) ; $ return .= $ this -> Html -> tag ( 'optgroup' , array ( 'label' => $ key ) , $ subArray , true ) ; } else { $ optionsAttr = array ( 'value' => $ key ) ; if ( isset ( $ attr [ 'selected' ] ) && $ attr [ 'selected' ] == $ key ) { $ optionsAttr [ ] = 'selected' ; } $ return .= $ this -> Html -> tag ( 'option' , $ optionsAttr , $ value , true ) ; } } return $ return ; }
docstring: generate the options for a select box
  
  @param   array   array of options
  @param   array   array of attributes
  @return  string
docstring_tokens: generate the options for a select box