public function testHyphenatingStringWithConsecutiveCapitals() { /* Given... (Fixture) */ $camelCased = "ThisIsHTML"; /* When... (Action) */ $hyphenated = Inflector::hyphenate($camelCased, TRUE); /* Then... (Assertions) */ $this->assertEquals('this-is-html', $hyphenated); }
/** * Inflect a word to a routeable format. All non-alphanumeric characters will be removed, and any spaces or underscores will be changed to dashes. * * @param string $string * @return string */ public static function route($string) { return static::cache(array(__METHOD__, $string), function () use($string) { return mb_strtolower(Inflector::hyphenate(str_replace('_', '-', preg_replace('/[^-_a-z0-9\\s\\.]+/i', '', $string)))); }); }