@@ 160-166 (lines=7) @@ | ||
157 | */ |
|
158 | public static function checkLastConsonantSoftness($word) |
|
159 | { |
|
160 | if (($substring = S::findLastPositionForOneOfChars(S::lower($word), static::$consonants)) !== false) { |
|
161 | if (in_array(S::slice($substring, 0, 1), ['й', 'ч', 'щ', 'ш'], true)) { // always soft consonants |
|
162 | return true; |
|
163 | } elseif (S::length($substring) > 1 && in_array(S::slice($substring, 1, 2), ['е', 'ё', 'и', 'ю', 'я', 'ь'], true)) { // consonants are soft if they are trailed with these vowels |
|
164 | return true; |
|
165 | } |
|
166 | } |
|
167 | return false; |
|
168 | } |
|
169 | ||
@@ 181-187 (lines=7) @@ | ||
178 | unset($consonants[array_search('н', $consonants)]); |
|
179 | unset($consonants[array_search('й', $consonants)]); |
|
180 | ||
181 | if (($substring = S::findLastPositionForOneOfChars(S::lower($word), $consonants)) !== false) { |
|
182 | if (in_array(S::slice($substring, 0, 1), ['й', 'ч', 'щ', 'ш'], true)) { // always soft consonants |
|
183 | return true; |
|
184 | } elseif (S::length($substring) > 1 && in_array(S::slice($substring, 1, 2), ['е', 'ё', 'и', 'ю', 'я', 'ь'], true)) { // consonants are soft if they are trailed with these vowels |
|
185 | return true; |
|
186 | } |
|
187 | } |
|
188 | return false; |
|
189 | } |
|
190 |