/** * Adds a tag built from the given key and value. * * @param string $key * @param string $value * @return void * @throws Exception */ public function addTag($key, $value) { $key = trim($key); if ($key === '') { throw new Exception('Tag Key must not be empty', 1448264366); } $value = trim($value); if ($value === '') { throw new Exception('Tag Value must not be empty', 1448264367); } $tag = Functions::ucfirst($key) . 'DynamicTag_' . $value; $this->tags[$tag] = true; }
/** * Uppercase the first letter of a string * * Example:: * * String.firstLetterToUpperCase('hello world') == 'Hello world' * * @param string $string The input string * @return string The string with the first letter in uppercase */ public function firstLetterToUpperCase($string) { return UnicodeFunctions::ucfirst($string); }
/** * Checks if our version of ucfirst can handle some common special chars. * * @test */ public function ucfirstWorksWithCertainSpecialChars() { $testString = 'äeugiat tincidunt duo id, 23 quam delenit vocibus nam eu'; $expectedResult = 'Äeugiat tincidunt duo id, 23 quam delenit vocibus nam eu'; $this->assertEquals($expectedResult, Functions::ucfirst($testString), 'ucfirst() did not return the correct string for a umlaut.'); $testString = 'åeugiat tincidunt duo id, 23 quam delenit vocibus nam eu'; $expectedResult = 'Åeugiat tincidunt duo id, 23 quam delenit vocibus nam eu'; $this->assertEquals($expectedResult, Functions::ucfirst($testString), 'ucfirst() did not return the correct string for danish a.'); }