protected function matchApiUrl($path, $params = [])
{
$pathRequirements = "#{(\\w*)}#";
preg_match_all($pathRequirements, $path, $matches);
$replace = $pattern = [];
$matches = array_pop($matches);
foreach ($matches as $match) {
if (!isset($params[$match])) {
throw new UnexpectedValueException("Don't isset {$match} in params");
}
$pattern[] = $pathRequirements;
$replace[] = $params[$match];
unset($params[$match]);
}
return preg_replace($pattern, $replace, $path, 1);
}