Skip to content

Commit

Permalink
Merge pull request #57 from fcastilloes/master
Browse files Browse the repository at this point in the history
Fixed Response accessors for attributes
  • Loading branch information
fcastilloes committed Aug 14, 2017
2 parents f4248cf + 427b47f commit 7f98471
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.1.10] - 2017-08-14
## Fixed
- Fixed Response accessors for attributes

## [1.1.9] - 2017-08-14
## Added
- Support for request attributes from katana 1.1.12
Expand Down
14 changes: 3 additions & 11 deletions src/Api/ResponseApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ class ResponseApi extends Api implements Response
*/
private $return;

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

/**
* Response constructor.
* @param KatanaLogger $logger
Expand All @@ -74,7 +69,6 @@ class ResponseApi extends Api implements Response
* @param Transport $transport
* @param PayloadMeta $payloadMeta
* @param ReturnValue $return
* @param array $attributes
*/
public function __construct(
KatanaLogger $logger,
Expand All @@ -90,8 +84,7 @@ public function __construct(
HttpResponse $response,
Transport $transport,
PayloadMeta $payloadMeta,
ReturnValue $return,
array $attributes = []
ReturnValue $return
) {
parent::__construct(
$logger,
Expand All @@ -109,7 +102,6 @@ public function __construct(
$this->transport = $transport;
$this->payloadMeta = $payloadMeta;
$this->return = $return;
$this->attributes = $attributes;
}

/**
Expand Down Expand Up @@ -186,14 +178,14 @@ public function getReturn()
*/
public function getRequestAttribute(string $name, string $default = ''): string
{
return $this->attributes[$name] ?? $default;
return $this->payloadMeta->getAttribute($name, $default);
}

/**
* @return array
*/
public function getRequestAttributes(): array
{
return $this->attributes;
return $this->payloadMeta->getAttributes();
}
}

0 comments on commit 7f98471

Please sign in to comment.