Skip to content

Commit

Permalink
Ref
Browse files Browse the repository at this point in the history
  • Loading branch information
vvval committed Jan 15, 2017
1 parent 97ba20a commit eac1d0b
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/Metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,10 @@ public function fetch(
callable $valueCallback = null
) {
$output = [];
$decoded = $input->getDecoded();

foreach ($keys as $key) {
$fetched = $this->utils->fetchKeys(
$input->getDecoded(),
$this->config->getAliases($key)
);

foreach ($fetched as $name => $value) {
foreach ($this->getKeyValues($decoded, $key) as $name => $value) {
//Get first not-empty value.
if (!empty($value)) {
if (!empty($keyCallback)) {
Expand All @@ -74,4 +70,14 @@ public function fetch(

return $output;
}

/**
* @param array $data
* @param string $key
* @return array
*/
protected function getKeyValues(array $data, $key)
{
return $this->utils->fetchKeys($data, $this->config->getAliases($key));
}
}

0 comments on commit eac1d0b

Please # to comment.