original_string: private function processElement(array $element, $class, BaseElement $parent, $replaceAttribute = null)
      {
          $apiElement = new $class($element);
  
          if (!$replaceAttribute) {
              $parent->addContentElement($apiElement);
          } else {
              $parent->replaceAttributeWithElement($replaceAttribute, $apiElement);
          }
  
          if (isset($element['attributes'])) {
              foreach ($element['attributes'] as $attributeName => $attributeValue) {
                  if (!isset($this->elementMap[$attributeName])) {
                      continue;
                  }
  
                  $this->processElement(
                      $attributeValue,
                      $this->elementMap[$attributeName],
                      $apiElement,
                      $attributeName
                  );
              }
          }
  
          if (!isset($element['content'])) {
              return;
          }
  
          if (!is_array($element['content'])) {
              return;
          }
  
          $this->iterate($element['content'], $apiElement);
      }
code: private function processElement(array $element, $class, BaseElement $parent, $replaceAttribute = null)
      {
          $apiElement = new $class($element);
  
          if (!$replaceAttribute) {
              $parent->addContentElement($apiElement);
          } else {
              $parent->replaceAttributeWithElement($replaceAttribute, $apiElement);
          }
  
          if (isset($element['attributes'])) {
              foreach ($element['attributes'] as $attributeName => $attributeValue) {
                  if (!isset($this->elementMap[$attributeName])) {
                      continue;
                  }
  
                  $this->processElement(
                      $attributeValue,
                      $this->elementMap[$attributeName],
                      $apiElement,
                      $attributeName
                  );
              }
          }
  
          if (!isset($element['content'])) {
              return;
          }
  
          if (!is_array($element['content'])) {
              return;
          }
  
          $this->iterate($element['content'], $apiElement);
      }
code_tokens: private function processElement ( array $ element , $ class , BaseElement $ parent , $ replaceAttribute = null ) { $ apiElement = new $ class ( $ element ) ; if ( ! $ replaceAttribute ) { $ parent -> addContentElement ( $ apiElement ) ; } else { $ parent -> replaceAttributeWithElement ( $ replaceAttribute , $ apiElement ) ; } if ( isset ( $ element [ 'attributes' ] ) ) { foreach ( $ element [ 'attributes' ] as $ attributeName => $ attributeValue ) { if ( ! isset ( $ this -> elementMap [ $ attributeName ] ) ) { continue ; } $ this -> processElement ( $ attributeValue , $ this -> elementMap [ $ attributeName ] , $ apiElement , $ attributeName ) ; } } if ( ! isset ( $ element [ 'content' ] ) ) { return ; } if ( ! is_array ( $ element [ 'content' ] ) ) { return ; } $ this -> iterate ( $ element [ 'content' ] , $ apiElement ) ; }
docstring: Create new element from raw data and add it to its parent
  
  @param array $element Raw element data
  @param string $class FQCN to use for creating an element
  @param BaseElement $parent parent element to add the newly created one to
  @param null|string $replaceAttribute usually, the new element will be added to the content
  of the given parent. There are some cases, hrefVariables for example,
  where the attributes actually contain elements as well.
  To add the new element to the attributes, pass the name of the
  key inside of attributes that should be replaced
docstring_tokens: Create new element from raw data and add it to its parent