protected function buildGroup(array $parents)
{
if (empty($parents)) {
throw new \InvalidArgumentException('The $parents argument must not be empty.');
}
$countryCode = array_shift($parents);
$group = $countryCode;
if ($parents) {
// A dash per key allows the depth to be guessed later.
$group .= str_repeat('-', count($parents));
// Hash the remaining keys to ensure that the group is ASCII safe.
// crc32b is the fastest but has collisions due to its short length.
// sha1 and md5 are forbidden by many projects and organizations.
// This is the next fastest option.
$group .= hash('tiger128,3', implode('-', $parents));
}
return $group;
}