@@ 176-184 (lines=9) @@ | ||
173 | */ |
|
174 | public static function checkLastConsonantSoftness($word) |
|
175 | { |
|
176 | if (($substring = S::findLastPositionForOneOfChars(S::lower($word), static::$consonants)) !== false) { |
|
177 | if (in_array(S::slice($substring, 0, 1), ['й', 'ч', 'щ', 'ш'], true)) { // always soft consonants |
|
178 | return true; |
|
179 | } |
|
180 | ||
181 | if (S::length($substring) > 1 && in_array(S::slice($substring, 1, 2), ['е', 'ё', 'и', 'ю', 'я', 'ь'], true)) { // consonants are soft if they are trailed with these vowels |
|
182 | return true; |
|
183 | } |
|
184 | } |
|
185 | return false; |
|
186 | } |
|
187 | ||
@@ 199-207 (lines=9) @@ | ||
196 | unset($consonants[array_search('н', $consonants)]); |
|
197 | unset($consonants[array_search('й', $consonants)]); |
|
198 | ||
199 | if (($substring = S::findLastPositionForOneOfChars(S::lower($word), $consonants)) !== false) { |
|
200 | if (in_array(S::slice($substring, 0, 1), ['й', 'ч', 'щ', 'ш'], true)) { // always soft consonants |
|
201 | return true; |
|
202 | } |
|
203 | ||
204 | if (S::length($substring) > 1 && in_array(S::slice($substring, 1, 2), ['е', 'ё', 'и', 'ю', 'я', 'ь'], true)) { // consonants are soft if they are trailed with these vowels |
|
205 | return true; |
|
206 | } |
|
207 | } |
|
208 | return false; |
|
209 | } |
|
210 |