Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. AttributesBuilder.php

function AttributesBuilder::merge

Overrides AttributesBuilderInterface::merge

File

vendor/open-telemetry/sdk/Common/Attribute/AttributesBuilder.php, line 30

Class

AttributesBuilder
@internal

Namespace

OpenTelemetry\SDK\Common\Attribute

Code

public function merge(AttributesInterface $old, AttributesInterface $updating) : AttributesInterface {
    $new = $old->toArray();
    $dropped = $old->getDroppedAttributesCount() + $updating->getDroppedAttributesCount();
    foreach ($updating->toArray() as $key => $value) {
        if (count($new) === $this->attributeCountLimit && !array_key_exists($key, $new)) {
            $dropped++;
        }
        else {
            $new[$key] = $value;
        }
    }
    return new Attributes($new, $dropped);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal