Skip to content

Commit

Permalink
Deprecate the attributes and use headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
p-pichet committed Aug 13, 2024
1 parent c8c4993 commit aea4844
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions pkg/gps/GpsMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ class GpsMessage implements Message, \JsonSerializable
*/
private $headers;

/**
* @var array
*/
private $attributes = [];

/**
* @var bool
*/
Expand All @@ -34,11 +39,12 @@ class GpsMessage implements Message, \JsonSerializable
*/
private $nativeMessage;

public function __construct(string $body = '', array $properties = [], array $headers = [])
public function __construct(string $body = '', array $properties = [], array $headers = [], array $attributes = [])
{
$this->body = $body;
$this->properties = $properties;
$this->headers = $headers;
$this->attributes = $attributes;

$this->redelivered = false;
}
Expand Down Expand Up @@ -80,7 +86,7 @@ public function setHeaders(array $headers): void

public function getHeaders(): array
{
return $this->headers;
return array_merge($this->attributes, $this->headers);
}

public function setHeader(string $name, $value): void
Expand Down Expand Up @@ -173,4 +179,20 @@ public function setNativeMessage(?GoogleMessage $message = null): void
{
$this->nativeMessage = $message;
}

/**
* @deprecated This will be removed in the V1, use headers instead
*/
public function setAttributes(array $attributes): void
{
$this->attributes = $attributes;
}

/**
* @deprecated This will be removed in the V1, use headers instead
*/
public function getAttributes(): array
{
return $this->attributes;
}
}

0 comments on commit aea4844

Please sign in to comment.