示例#1
0
 public function testHyphenatingStringWithConsecutiveCapitals()
 {
     /* Given... (Fixture) */
     $camelCased = "ThisIsHTML";
     /* When... (Action) */
     $hyphenated = Inflector::hyphenate($camelCased, TRUE);
     /* Then... (Assertions) */
     $this->assertEquals('this-is-html', $hyphenated);
 }
示例#2
0
 /**
  * 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))));
     });
 }