protected function buildGroup(array $parents)
    {
        if (empty($parents)) {
            throw new \InvalidArgumentException('The $parents argument must not be empty.');
        }
        $countryCode = array_shift($parents);
        $group = strtoupper($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;
    }
protected function buildGroup(array $parents)
    {
        if (empty($parents)) {
            throw new \InvalidArgumentException('The $parents argument must not be empty.');
        }
        $countryCode = array_shift($parents);
        $group = strtoupper($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;
    }
protected function buildGroup ( array $ parents ) { if ( empty ( $ parents ) ) { throw new \ InvalidArgumentException ( 'The $parents argument must not be empty.' ) ; } $ countryCode = array_shift ( $ parents ) ; $ group = strtoupper ( $ 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 ; }
Builds a group from the provided parents.

Used for storing a country's subdivisions of a specific level.

@param array $parents The parents (country code, subdivision codes).

@return string The group.
Builds a group from the provided parents .