You are here

protected static function Porter2::hasEnding in Porter-Stemmer 8

Checks whether the word ends with the given string.

Parameters

string $word: The word to check.

string $string: The string.

Return value

bool TRUE if the word ends with the given string, FALSE otherwise.

8 calls to Porter2::hasEnding()
Porter2::step0 in src/Porter2.php
Search for the longest among the "s" suffixes and removes it.
Porter2::step1a in src/Porter2.php
Handles various suffixes, of which the longest is replaced.
Porter2::step1b in src/Porter2.php
Handles various suffixes, of which the longest is replaced.
Porter2::step1c in src/Porter2.php
Replaces suffix y or Y with i if after non-vowel not @ word begin.
Porter2::step2 in src/Porter2.php
Implements step 2 of the Porter2 algorithm.

... See full list

File

src/Porter2.php, line 570

Class

Porter2
PHP Implementation of the Porter2 Stemming Algorithm.

Namespace

Drupal\porterstemmer

Code

protected static function hasEnding($word, $string) {
  $length = strlen($string);
  if ($length > strlen($word)) {
    return FALSE;
  }
  return substr_compare($word, $string, -1 * $length, $length) === 0;
}