You are here

protected function Porter2::hasEnding in Search API 8

Checks whether the word ends with the given string.

Parameters

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/Plugin/search_api/processor/Resources/Porter2.php
Searches for the longest among the "s" suffixes and removes it.
Porter2::step1a in src/Plugin/search_api/processor/Resources/Porter2.php
Handles various suffixes, of which the longest is replaced.
Porter2::step1b in src/Plugin/search_api/processor/Resources/Porter2.php
Handles various suffixes, of which the longest is replaced.
Porter2::step1c in src/Plugin/search_api/processor/Resources/Porter2.php
Replaces suffix y or Y with i if after non-vowel not @ word begin.
Porter2::step2 in src/Plugin/search_api/processor/Resources/Porter2.php
Implements step 2 of the Porter2 algorithm.

... See full list

File

src/Plugin/search_api/processor/Resources/Porter2.php, line 572

Class

Porter2
Implements the Porter2 stemming algorithm.

Namespace

Drupal\search_api\Plugin\search_api\processor\Resources

Code

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