original_string: public function addButton($label, $options = array())
      {
          $position = 'after';
          if (is_string($options)) {
              $position = $options;
          } else {
              if (isset($options['position'])) {
                  $position = $options['position'];
              }
          }
          if ($position == 'after') {
              /** @type Button $button */
              $button = $this->afterField()->add('Button', $options);
              $button->set($label);
          } else {
              /** @type Button $button */
              $button = $this->beforeField()->add('Button', $options);
              $button->set($label);
          }
          $this->js('change', $button->js()->data('val', $this->js()->val()));
  
          return $button;
      }
code: public function addButton($label, $options = array())
      {
          $position = 'after';
          if (is_string($options)) {
              $position = $options;
          } else {
              if (isset($options['position'])) {
                  $position = $options['position'];
              }
          }
          if ($position == 'after') {
              /** @type Button $button */
              $button = $this->afterField()->add('Button', $options);
              $button->set($label);
          } else {
              /** @type Button $button */
              $button = $this->beforeField()->add('Button', $options);
              $button->set($label);
          }
          $this->js('change', $button->js()->data('val', $this->js()->val()));
  
          return $button;
      }
code_tokens: public function addButton ( $ label , $ options = array ( ) ) { $ position = 'after' ; if ( is_string ( $ options ) ) { $ position = $ options ; } else { if ( isset ( $ options [ 'position' ] ) ) { $ position = $ options [ 'position' ] ; } } if ( $ position == 'after' ) { /** @type Button $button */ $ button = $ this -> afterField ( ) -> add ( 'Button' , $ options ) ; $ button -> set ( $ label ) ; } else { /** @type Button $button */ $ button = $ this -> beforeField ( ) -> add ( 'Button' , $ options ) ; $ button -> set ( $ label ) ; } $ this -> js ( 'change' , $ button -> js ( ) -> data ( 'val' , $ this -> js ( ) -> val ( ) ) ) ; return $ button ; }
docstring: Position can be either 'before' or 'after'
docstring_tokens: Position can be either before or after