/** * Checks if the string ends with the provided suffix. * * @param string|Mol_DataType_String $suffix * @return boolean True if the string ends with the suffix, false otherwise. */ public function endsWith($suffix) { return Mol_Util_String::endsWith($this->value, $this->toValue($suffix)); }
/** * Checks if the value ends with an allowed suffix. * * @param string $value * @return boolean True if the value ends with a suffix, false otherwise. */ protected function endsWithSuffix($value) { foreach ($this->suffixes as $suffix) { /* @var $suffix string */ if (Mol_Util_String::endsWith($value, $suffix)) { return true; } } return false; }
/** * Ensures that endsWith() returns false if the string does not even contain * the given suffix. */ public function testEndsWithReturnsFalseIfTheStringDoesNotContainTheSuffix() { $result = Mol_Util_String::endsWith('this is a test string', 'demo'); $this->assertFalse($result); }