original_string: protected function parseTag(Tag $tag, Element $element)
      {
          $list = [
              'disabled' => 'isDisabled',
              'readonly' => 'isReadonly',
              'required' => 'isRequired',
              'placeholder' => 'getPlaceholder',
              'id' => 'getId',
              'title' => 'getTitle',
              'style' => 'getStyle',
              'class' => 'getClass',
              'tabindex' => 'getTabindex',
              'accesskey' => 'getAccessKey',
              'size' => 'getSize'
          ];
  
          foreach ($list as $attribute => $method) {
              if (method_exists($element, $method)) {
                  $value = $element->$method();
  
                  if (substr($method, 0, 2) == 'is') {
                      if ($value) {
                          $tag->setAttribute($attribute, $attribute);
                      }
                  } else {
                      $tag->setAttribute($attribute, $value);
                  }
              }
          }
  
          if (method_exists($element, 'getName') && $element->getName()) {
              $name = $element->getName();
              $suffix = '';
              if (method_exists($element, 'isMultiple') && $element->isMultiple() && substr($name, -1) != ']') {
                  $suffix = '[]';
              }
  
              $tag->setAttribute('name', $name . $suffix);
          }
  
          if (method_exists($element, 'getValue') &&
              $element->getValue() !== null &&
              $tag->getName() != 'textarea' &&
              is_scalar($element->getValue())
          ) {
              $tag->setAttribute('value', htmlentities($element->getValue(), ENT_QUOTES, 'UTF-8'));
          }
  
          foreach ($element->getAttributes() as $name => $value) {
              $tag->setAttribute($name, $value);
          }
  
          return $tag->render();
      }
code: protected function parseTag(Tag $tag, Element $element)
      {
          $list = [
              'disabled' => 'isDisabled',
              'readonly' => 'isReadonly',
              'required' => 'isRequired',
              'placeholder' => 'getPlaceholder',
              'id' => 'getId',
              'title' => 'getTitle',
              'style' => 'getStyle',
              'class' => 'getClass',
              'tabindex' => 'getTabindex',
              'accesskey' => 'getAccessKey',
              'size' => 'getSize'
          ];
  
          foreach ($list as $attribute => $method) {
              if (method_exists($element, $method)) {
                  $value = $element->$method();
  
                  if (substr($method, 0, 2) == 'is') {
                      if ($value) {
                          $tag->setAttribute($attribute, $attribute);
                      }
                  } else {
                      $tag->setAttribute($attribute, $value);
                  }
              }
          }
  
          if (method_exists($element, 'getName') && $element->getName()) {
              $name = $element->getName();
              $suffix = '';
              if (method_exists($element, 'isMultiple') && $element->isMultiple() && substr($name, -1) != ']') {
                  $suffix = '[]';
              }
  
              $tag->setAttribute('name', $name . $suffix);
          }
  
          if (method_exists($element, 'getValue') &&
              $element->getValue() !== null &&
              $tag->getName() != 'textarea' &&
              is_scalar($element->getValue())
          ) {
              $tag->setAttribute('value', htmlentities($element->getValue(), ENT_QUOTES, 'UTF-8'));
          }
  
          foreach ($element->getAttributes() as $name => $value) {
              $tag->setAttribute($name, $value);
          }
  
          return $tag->render();
      }
code_tokens: protected function parseTag ( Tag $ tag , Element $ element ) { $ list = [ 'disabled' => 'isDisabled' , 'readonly' => 'isReadonly' , 'required' => 'isRequired' , 'placeholder' => 'getPlaceholder' , 'id' => 'getId' , 'title' => 'getTitle' , 'style' => 'getStyle' , 'class' => 'getClass' , 'tabindex' => 'getTabindex' , 'accesskey' => 'getAccessKey' , 'size' => 'getSize' ] ; foreach ( $ list as $ attribute => $ method ) { if ( method_exists ( $ element , $ method ) ) { $ value = $ element -> $ method ( ) ; if ( substr ( $ method , 0 , 2 ) == 'is' ) { if ( $ value ) { $ tag -> setAttribute ( $ attribute , $ attribute ) ; } } else { $ tag -> setAttribute ( $ attribute , $ value ) ; } } } if ( method_exists ( $ element , 'getName' ) && $ element -> getName ( ) ) { $ name = $ element -> getName ( ) ; $ suffix = '' ; if ( method_exists ( $ element , 'isMultiple' ) && $ element -> isMultiple ( ) && substr ( $ name , - 1 ) != ']' ) { $ suffix = '[]' ; } $ tag -> setAttribute ( 'name' , $ name . $ suffix ) ; } if ( method_exists ( $ element , 'getValue' ) && $ element -> getValue ( ) !== null && $ tag -> getName ( ) != 'textarea' && is_scalar ( $ element -> getValue ( ) ) ) { $ tag -> setAttribute ( 'value' , htmlentities ( $ element -> getValue ( ) , ENT_QUOTES , 'UTF-8' ) ) ; } foreach ( $ element -> getAttributes ( ) as $ name => $ value ) { $ tag -> setAttribute ( $ name , $ value ) ; } return $ tag -> render ( ) ; }
docstring: Parse the given element and put it's attributes in the given tag.
  Then render the HTML tag and return its HTML body.
  
  @param Tag $tag
  @param Element $element
  @return string
docstring_tokens: Parse the given element and put it s attributes in the given tag . Then render the HTML tag and return its HTML body .