original_string: protected function removeElement($element, $contents)
      {
          $newContents = preg_replace('@'.$element->regex.'@xi', '', $contents);
  
          if ($newContents !== $contents && isset($element->elements)) {
              foreach ($element->elements as $element) {
                  $newContents = $this->removeElement($element, $newContents);
              }
          }
  
          return $newContents;
      }
code: protected function removeElement($element, $contents)
      {
          $newContents = preg_replace('@'.$element->regex.'@xi', '', $contents);
  
          if ($newContents !== $contents && isset($element->elements)) {
              foreach ($element->elements as $element) {
                  $newContents = $this->removeElement($element, $newContents);
              }
          }
  
          return $newContents;
      }
code_tokens: protected function removeElement ( $ element , $ contents ) { $ newContents = preg_replace ( '@' . $ element -> regex . '@xi' , '' , $ contents ) ; if ( $ newContents !== $ contents && isset ( $ element -> elements ) ) { foreach ( $ element -> elements as $ element ) { $ newContents = $ this -> removeElement ( $ element , $ newContents ) ; } } return $ newContents ; }
docstring: Remove an optional element.
  
  @param object $element
  @param string $contents
  
  @return string
docstring_tokens: Remove an optional element .