CommerceGuys\Addressing\Subdivision\SubdivisionRepository::processDefinitions PHP Method

processDefinitions() protected method

Adds keys and values that were removed from the JSON files for brevity.
protected processDefinitions ( array $definitions ) : array
$definitions array The definitions.
return array The processed definitions.
    protected function processDefinitions(array $definitions)
    {
        foreach ($definitions['subdivisions'] as $code => &$definition) {
            // Add common keys from the root level.
            $definition['country_code'] = $definitions['country_code'];
            if (isset($definitions['locale'])) {
                $definition['locale'] = $definitions['locale'];
            }
            // Ensure the presence of code and name.
            $definition['code'] = $code;
            if (!isset($definition['name'])) {
                $definition['name'] = $code;
            }
            if (isset($definition['local_code']) && !isset($definition['local_name'])) {
                $definition['local_name'] = $definition['local_code'];
            }
        }
        return $definitions;
    }