Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "benmorel/ebay-sdk-php",
"name": "xtremevision/ebay-sdk-php",
"description": "An eBay SDK for PHP. Fork of dts/ebay-sdk-php with support for PHP 8.",
"keywords": ["ebay", "api", "sdk"],
"type": "library",
Expand Down
1 change: 1 addition & 0 deletions src/Services/BaseService.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ function (ResponseInterface $res) use ($debug, $responseClass) {

$response = $xmlParser->parse($xmlResponse);
$response->attachment($attachment);
$response->responseHeaders($res->getHeaders());

return $response;
}
Expand Down
27 changes: 27 additions & 0 deletions src/Types/BaseType.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ class BaseType implements JmesPathableObjectInterface
*/
private $attachment;

/**
* @var array Associative array storing the httpHandler responseHeaders.
*/
private $responseheaders;

/**
* @param array $values Can pass an associative array that will set the objects properties.
*/
Expand All @@ -62,6 +67,7 @@ public function __construct(array $values = [])
$this->setValues(__CLASS__, $values);

$this->attachment = ['data' => null, 'mimeType' => null];
$this->responseheaders = ['data' => null];
}

/**
Expand Down Expand Up @@ -207,6 +213,27 @@ public function hasAttachment()
return $this->attachment['data'] !== null;
}

/**
* Method to get or set the object's response headers. Overrides any existing response headers.
*
* @param mixed $data If a string it is assumed to be the contents of the response headers. If an array copy its values across.
*
* @return mixed Returns the contents of the current response headers or null if none has been specified.
*/
public function responseheaders($data = null) : mixed
{
if ($data !== null) {
$this->responseheaders['data'] = json_encode($data);
}

return $this->responseheaders;
}

public function getResponseHeaders()
{
return json_decode($this->responseheaders['data']);
}

/**
* Helper method that returns an associative array of the object's properties and values.
*
Expand Down