original_string: public function addContentElement(ApiElement $element)
      {
          $newContent = [];
          $rawElements = [];
          $content = $this->getContent();
  
          if ($this->hasCopy()) {
              $newContent[] = array_shift($content);
          }
  
          foreach ($content as $resourceGroup) {
              if (!is_array($resourceGroup)) {
                  $newContent[] = array_shift($content);
              } else {
                  $rawElements[] = $resourceGroup;
              }
          }
  
          array_shift($rawElements);
          $newContent[] = $element;
  
          $this->content = array_merge($newContent, $rawElements);
      }
code: public function addContentElement(ApiElement $element)
      {
          $newContent = [];
          $rawElements = [];
          $content = $this->getContent();
  
          if ($this->hasCopy()) {
              $newContent[] = array_shift($content);
          }
  
          foreach ($content as $resourceGroup) {
              if (!is_array($resourceGroup)) {
                  $newContent[] = array_shift($content);
              } else {
                  $rawElements[] = $resourceGroup;
              }
          }
  
          array_shift($rawElements);
          $newContent[] = $element;
  
          $this->content = array_merge($newContent, $rawElements);
      }
code_tokens: public function addContentElement ( ApiElement $ element ) { $ newContent = [ ] ; $ rawElements = [ ] ; $ content = $ this -> getContent ( ) ; if ( $ this -> hasCopy ( ) ) { $ newContent [ ] = array_shift ( $ content ) ; } foreach ( $ content as $ resourceGroup ) { if ( ! is_array ( $ resourceGroup ) ) { $ newContent [ ] = array_shift ( $ content ) ; } else { $ rawElements [ ] = $ resourceGroup ; } } array_shift ( $ rawElements ) ; $ newContent [ ] = $ element ; $ this -> content = array_merge ( $ newContent , $ rawElements ) ; }
docstring: Add content element to the current content
  
  This method has to be used sequentially while querying the recursive
  element tree. It will replace the raw content element one by one, top to bottom.
  
  Example:
  
  - copy element
  - raw array element (1)
  - raw array element (2)
  
  Calling `addContentElement` with a resource element:
  
  - copy element
  - resource element
  - raw array element (2)
  
  As you can see `raw array element (1)` was replaced with `resource element`
  So *you* need to make sure that *you* turned the raw array element into the resource element.
  
  @param ApiElement $element
docstring_tokens: Add content element to the current content