Beispiel #1
0
 static function create(phpMorphy $morphy)
 {
     $locale = $GLOBALS['__phpmorphy_strtolower']($morphy->getLocale());
     if (!isset(self::$included[$locale])) {
         $file_name = PHPMORPHY_DIR . "/langs_stuff/{$locale}.php";
         $class = "phpMorphy_GrammemsProvider_{$locale}";
         if (is_readable($file_name)) {
             require $file_name;
             if (!class_exists($class)) {
                 throw new phpMorphy_Exception("Class '{$class}' not found in '{$file_name}' file");
             }
             self::$included[$locale] = call_user_func(array($class, 'instance'), $morphy);
         } else {
             self::$included[$locale] = new phpMorphy_GrammemsProvider_Empty($morphy);
         }
     }
     return self::$included[$locale];
 }