Skip to content

Commit

Permalink
Merge pull request #5 from interactive-solutions/feature/allow-arrays…
Browse files Browse the repository at this point in the history
…-alias

We can now use aliases in arrays also
  • Loading branch information
noggan authored Jan 2, 2017
2 parents 3ec7a8c + a6aab6b commit 3c34788
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Context/ApiContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,20 @@ public function setServiceManager(ServiceManager $serviceManager)
* @return string
*/
private function convertValueToAlias($value)
{
if (is_array($value)) {

array_walk_recursive($value, function(&$value) {
$value = $this->replaceValueWithAlias($value);
});

return $value;
}

return $this->replaceValueWithAlias($value);
}

private function replaceValueWithAlias($value)
{
if (!(strpos($value, '%') === 0) && !(strpos(strrev($value), '%') === 0)) {
return $value;
Expand Down

0 comments on commit 3c34788

Please sign in to comment.