Skip to content

Commit

Permalink
Code simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
mnapoli committed May 15, 2016
1 parent 5bb67bf commit 36a090b
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/DI/Definition/Resolver/ArrayResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ public function resolve(Definition $definition, array $parameters = [])
{
$values = $definition->getValues();

$values = $this->resolveNestedDefinitions($definition, $values);
// Resolve nested definitions
foreach ($values as $key => $value) {
if ($value instanceof DefinitionHelper) {
$values[$key] = $this->resolveDefinition($value, $definition, $key);
}
}

return $values;
}
Expand All @@ -55,17 +60,6 @@ public function isResolvable(Definition $definition, array $parameters = [])
return true;
}

private function resolveNestedDefinitions(ArrayDefinition $definition, array $values)
{
foreach ($values as $key => $value) {
if ($value instanceof DefinitionHelper) {
$values[$key] = $this->resolveDefinition($value, $definition, $key);
}
}

return $values;
}

private function resolveDefinition(DefinitionHelper $value, ArrayDefinition $definition, $key)
{
try {
Expand Down

0 comments on commit 36a090b

Please sign in to comment.