protected function generateRulesets()
    {
        $model = $this->cldrRepository->getModel('supplemental/plurals');
        $pluralRulesSet = $model->getRawArray('plurals');

        $index = 0;
        foreach ($pluralRulesSet as $pluralRulesNodeString => $pluralRules) {
            $localeLanguages = $model->getAttributeValue($pluralRulesNodeString, 'locales');

            foreach (explode(' ', $localeLanguages) as $localeLanguage) {
                $this->rulesetsIndices[$localeLanguage] = $index;
            }

            if (is_array($pluralRules)) {
                $ruleset = [];
                foreach ($pluralRules as $pluralRuleNodeString => $pluralRule) {
                    $pluralForm = $model->getAttributeValue($pluralRuleNodeString, 'count');
                    $ruleset[$pluralForm] = $this->parseRule($pluralRule);
                }

                foreach (explode(' ', $localeLanguages) as $localeLanguage) {
                    $this->rulesets[$localeLanguage][$index] = $ruleset;
                }
            }

            ++$index;
        }
    }
protected function generateRulesets()
    {
        $model = $this->cldrRepository->getModel('supplemental/plurals');
        $pluralRulesSet = $model->getRawArray('plurals');

        $index = 0;
        foreach ($pluralRulesSet as $pluralRulesNodeString => $pluralRules) {
            $localeLanguages = $model->getAttributeValue($pluralRulesNodeString, 'locales');

            foreach (explode(' ', $localeLanguages) as $localeLanguage) {
                $this->rulesetsIndices[$localeLanguage] = $index;
            }

            if (is_array($pluralRules)) {
                $ruleset = [];
                foreach ($pluralRules as $pluralRuleNodeString => $pluralRule) {
                    $pluralForm = $model->getAttributeValue($pluralRuleNodeString, 'count');
                    $ruleset[$pluralForm] = $this->parseRule($pluralRule);
                }

                foreach (explode(' ', $localeLanguages) as $localeLanguage) {
                    $this->rulesets[$localeLanguage][$index] = $ruleset;
                }
            }

            ++$index;
        }
    }
protected function generateRulesets ( ) { $ model = $ this -> cldrRepository -> getModel ( 'supplemental/plurals' ) ; $ pluralRulesSet = $ model -> getRawArray ( 'plurals' ) ; $ index = 0 ; foreach ( $ pluralRulesSet as $ pluralRulesNodeString => $ pluralRules ) { $ localeLanguages = $ model -> getAttributeValue ( $ pluralRulesNodeString , 'locales' ) ; foreach ( explode ( ' ' , $ localeLanguages ) as $ localeLanguage ) { $ this -> rulesetsIndices [ $ localeLanguage ] = $ index ; } if ( is_array ( $ pluralRules ) ) { $ ruleset = [ ] ; foreach ( $ pluralRules as $ pluralRuleNodeString => $ pluralRule ) { $ pluralForm = $ model -> getAttributeValue ( $ pluralRuleNodeString , 'count' ) ; $ ruleset [ $ pluralForm ] = $ this -> parseRule ( $ pluralRule ) ; } foreach ( explode ( ' ' , $ localeLanguages ) as $ localeLanguage ) { $ this -> rulesets [ $ localeLanguage ] [ $ index ] = $ ruleset ; } } ++ $ index ; } }
Generates an internal representation of plural rules which can be found
in plurals.xml CLDR file.

The properties $rulesets and $rulesetsIndices should be empty before
running this method.

@return void
@see PluralsReader::$rulesets
Generates an internal representation of plural rules which can be found in plurals . xml CLDR file .