Skip to content

Commit

Permalink
Update S methods
Browse files Browse the repository at this point in the history
  • Loading branch information
wapmorgan committed Feb 5, 2018
1 parent e4e3945 commit 127b747
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Russian/RussianLanguage.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected static function isVelarConsonant($consonant)
*/
public static function countSyllables($string)
{
return S::chars_count($string, self::$vowels);
return S::countChars($string, self::$vowels);
}

/**
Expand All @@ -137,7 +137,7 @@ public static function isPaired($consonant)
*/
public static function checkLastConsonantSoftness($word)
{
if (($substring = S::last_position_for_one_of_chars(S::lower($word), self::$consonants)) !== false) {
if (($substring = S::findLastPositionForOneOfChars(S::lower($word), self::$consonants)) !== false) {
if (in_array(S::slice($substring, 0, 1), ['й', 'ч', 'щ'])) { // always soft consonants
return true;
} elseif (S::length($substring) > 1 && in_array(S::slice($substring, 1, 2), ['е', 'ё', 'и', 'ю', 'я', 'ь'])) { // consonants are soft if they are trailed with these vowels
Expand Down
6 changes: 3 additions & 3 deletions src/S.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class S
/**
* Sets encoding for using in morphos/* functions.
*/
public static function set_encoding($encoding)
public static function setEncoding($encoding)
{
if (function_exists('mb_internal_encoding')) {
mb_internal_encoding($encoding);
Expand Down Expand Up @@ -93,7 +93,7 @@ public static function name($string)
/**
* multiple substr_count().
*/
public static function chars_count($string, array $chars)
public static function countChars($string, array $chars)
{
if (function_exists('mb_split')) {
return count(mb_split('('.implode('|', $chars).')', $string)) - 1;
Expand All @@ -102,7 +102,7 @@ public static function chars_count($string, array $chars)
}
}

public static function last_position_for_one_of_chars($string, array $chars)
public static function findLastPositionForOneOfChars($string, array $chars)
{
if (function_exists('mb_strrpos')) {
$last_position = false;
Expand Down
2 changes: 1 addition & 1 deletion src/initialization.php
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?php
morphos\S::set_encoding('utf-8');
morphos\S::setEncoding('utf-8');

0 comments on commit 127b747

Please sign in to comment.