public function getModelForLocale(I18n\Locale $locale, $directoryPath = 'main')
    {
        $directoryPath = Files::concatenatePaths([$this->cldrBasePath, $directoryPath]);

        if (isset($this->models[$directoryPath][(string)$locale])) {
            return $this->models[$directoryPath][(string)$locale];
        }

        if (!is_dir($directoryPath)) {
            return null;
        }

        $filesInHierarchy = $this->findLocaleChain($locale, $directoryPath);

        return $this->models[$directoryPath][(string)$locale] = new CldrModel($filesInHierarchy);
    }
public function getModelForLocale(I18n\Locale $locale, $directoryPath = 'main')
    {
        $directoryPath = Files::concatenatePaths([$this->cldrBasePath, $directoryPath]);

        if (isset($this->models[$directoryPath][(string)$locale])) {
            return $this->models[$directoryPath][(string)$locale];
        }

        if (!is_dir($directoryPath)) {
            return null;
        }

        $filesInHierarchy = $this->findLocaleChain($locale, $directoryPath);

        return $this->models[$directoryPath][(string)$locale] = new CldrModel($filesInHierarchy);
    }
public function getModelForLocale ( I18n \ Locale $ locale , $ directoryPath = 'main' ) { $ directoryPath = Files :: concatenatePaths ( [ $ this -> cldrBasePath , $ directoryPath ] ) ; if ( isset ( $ this -> models [ $ directoryPath ] [ ( string ) $ locale ] ) ) { return $ this -> models [ $ directoryPath ] [ ( string ) $ locale ] ; } if ( ! is_dir ( $ directoryPath ) ) { return null ; } $ filesInHierarchy = $ this -> findLocaleChain ( $ locale , $ directoryPath ) ; return $ this -> models [ $ directoryPath ] [ ( string ) $ locale ] = new CldrModel ( $ filesInHierarchy ) ; }
Returns an instance of CldrModel which represents group of CLDR files
which are related in hierarchy.

This method finds a group of CLDR files within $directoryPath dir,
for particular Locale. Returned model represents whole locale-chain.

For example, for locale en_GB, returned model could represent 'en_GB',
'en', and 'root' CLDR files.

Returns false when $directoryPath doesn't point to existing directory.

@param I18n\Locale $locale A locale
@param string $directoryPath Relative path to existing CLDR directory which contains one file per locale (see 'main' directory in CLDR for example)
@return CldrModel A CldrModel instance or NULL on failure
Returns an instance of CldrModel which represents group of CLDR files which are related in hierarchy .