示例#1
0
 private static function extractPronounTransforms($from, $to, &$transforms, &$places)
 {
     $origFrom = $from;
     // We have one special case
     if ($from == 'doisprezecelea' && $to == 'douăsprezecea') {
         $transforms[] = Transform::create('i', 'uă');
         $transforms[] = Transform::create('lea', 'a');
         $places[] = 2;
         $places[] = 11;
         return 1;
     }
     if (StringUtil::startsWith($to, $from)) {
         $t = Transform::create('', mb_substr($to, mb_strlen($from)));
         $transforms[] = $t;
         $places[] = mb_strlen($from);
         return 1;
     }
     while (mb_strlen($from) > 1 && $to && StringUtil::getLastChar($from) == StringUtil::getLastChar($to)) {
         $from = StringUtil::dropLastChar($from);
         $to = StringUtil::dropLastChar($to);
     }
     $place = 0;
     while (mb_strlen($from) > 1 && $to && StringUtil::getCharAt($from, 0) == StringUtil::getCharAt($to, 0)) {
         $from = mb_substr($from, 1);
         $to = mb_substr($to, 1);
         $place++;
     }
     $transforms[] = Transform::create($from, $to);
     $places[] = $place;
     return 1;
 }