protected function compile($key, array $params)
{
$matches = array();
preg_match_all(self::REGEX_PLACE_HOLDER, $key, $matches);
$count = count($matches[0]);
if ($count != count($params)) {
throw new \Exception("Unmatched parameters, expected '{$count}' based on the placeholders an got '.count({$params}).'.");
}
$txt = $key;
$k = 1;
foreach ($params as $param) {
$txt = str_replace(self::PLACE_HOLDER . $k++, $param, $txt);
}
return $txt;
}