Skip to content

Commit

Permalink
Merge pull request #3 from dmaechler/4.0
Browse files Browse the repository at this point in the history
remove data attribute to both class arraymapper and rowmapper. Its us…
  • Loading branch information
moufmouf committed Jan 15, 2016
2 parents 49bc511 + 5e9b5c6 commit e952f57
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
15 changes: 3 additions & 12 deletions src/Mappers/ArrayMapper.php
Expand Up @@ -25,11 +25,6 @@ class ArrayMapper implements DataSourceInterface
*/
private $dataSource;

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

/**
* @var array
*/
Expand All @@ -54,17 +49,13 @@ public function __construct(array $matchers, DataSourceInterface $dataSource, ar
*/
public function getData()
{
if (!empty($this->data)) {
return $this->data;
}

$data = [];
foreach ($this->dataSource->getData() as $row) {
$this->data[] = array_map(function (PickerInterface $picker) use ($row) {
$data [] = array_map(function (PickerInterface $picker) use ($row) {
return $picker->pick(new Row($row));
}, $this->matchers);
}

return $this->data;
return $data;
}

/**
Expand Down
13 changes: 1 addition & 12 deletions src/Mappers/RowMapper.php
Expand Up @@ -24,11 +24,6 @@ class RowMapper implements RowInterface
*/
private $row;

/**
* @var array
*/
private $data;

/**
* @var array
*/
Expand All @@ -52,15 +47,9 @@ public function __construct(array $matchers, RowInterface $rowSource, array $par
*/
public function getRow()
{
if (!empty($this->data)) {
return $this->data;
}

$this->data = array_map(function(PickerInterface $picker) {
return array_map(function(PickerInterface $picker) {
return $picker->pick($this->row);
}, $this->matchers);

return $this->data;
}

/**
Expand Down

0 comments on commit e952f57

Please sign in to comment.