function UnicodeString::endsWith
Overrides AbstractString::endsWith
File
-
vendor/
symfony/ string/ UnicodeString.php, line 94
Class
- UnicodeString
- Represents a string of Unicode grapheme clusters encoded as UTF-8.
Namespace
Symfony\Component\StringCode
public function endsWith(string|iterable|AbstractString $suffix) : bool {
if ($suffix instanceof AbstractString) {
$suffix = $suffix->string;
}
elseif (!\is_string($suffix)) {
return parent::endsWith($suffix);
}
$form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
normalizer_is_normalized($suffix, $form) ?: ($suffix = normalizer_normalize($suffix, $form));
if ('' === $suffix || false === $suffix) {
return false;
}
if ($this->ignoreCase) {
return 0 === mb_stripos(grapheme_extract($this->string, \strlen($suffix), \GRAPHEME_EXTR_MAXBYTES, \strlen($this->string) - \strlen($suffix)), $suffix, 0, 'UTF-8');
}
return $suffix === grapheme_extract($this->string, \strlen($suffix), \GRAPHEME_EXTR_MAXBYTES, \strlen($this->string) - \strlen($suffix));
}