private function getPath(array $action, array $args) { $pattern = '/{(\\d+)}/'; $callback = function ($matches) use($args) { return $args[$matches[1]]; }; return preg_replace_callback($pattern, $callback, $action['path']); }