Vendor/langcode-conv/zendframework/zend-stdlib/src/Message.php
public function setMetadata($spec, $value = null)
    {
        if (is_scalar($spec)) {
            $this->metadata[$spec] = $value;
            return $this;
        }
        if (!is_array($spec) && !$spec instanceof Traversable) {
            throw new Exception\InvalidArgumentException(sprintf(
                'Expected a string, array, or Traversable argument in first position; received "%s"',
                (is_object($spec) ? get_class($spec) : gettype($spec))
            ));
        }
        foreach ($spec as $key => $value) {
            $this->metadata[$key] = $value;
        }
        return $this;
    }
public function setMetadata($spec, $value = null)
    {
        if (is_scalar($spec)) {
            $this->metadata[$spec] = $value;
            return $this;
        }
        if (!is_array($spec) && !$spec instanceof Traversable) {
            throw new Exception\InvalidArgumentException(sprintf(
                'Expected a string, array, or Traversable argument in first position; received "%s"',
                (is_object($spec) ? get_class($spec) : gettype($spec))
            ));
        }
        foreach ($spec as $key => $value) {
            $this->metadata[$key] = $value;
        }
        return $this;
    }
public function setMetadata ( $ spec , $ value = null ) { if ( is_scalar ( $ spec ) ) { $ this -> metadata [ $ spec ] = $ value ; return $ this ; } if ( ! is_array ( $ spec ) && ! $ spec instanceof Traversable ) { throw new Exception \ InvalidArgumentException ( sprintf ( 'Expected a string, array, or Traversable argument in first position; received "%s"' , ( is_object ( $ spec ) ? get_class ( $ spec ) : gettype ( $ spec ) ) ) ) ; } foreach ( $ spec as $ key => $ value ) { $ this -> metadata [ $ key ] = $ value ; } return $ this ; }
Set message metadata

Non-destructive setting of message metadata; always adds to the metadata, never overwrites
the entire metadata container.

@param  string|int|array|Traversable $spec
@param  mixed $value
@throws Exception\InvalidArgumentException
@return Message
Set message metadata