示例#1
0
 /**
  * Convert string into css class name
  *
  * @param   string  $input  string
  *
  * @return  string
  */
 protected function toVariable($input)
 {
     // Should simply be (except there's a bug in J)
     // JStringNormalise::toVariable($event->className);
     $input = trim($input);
     // Remove dashes and underscores, then convert to camel case.
     $input = JStringNormalise::toSpaceSeparated($input);
     $input = JStringNormalise::toCamelCase($input);
     // Remove leading digits.
     $input = preg_replace('#^[\\d\\.]*#', '', $input);
     // Lowercase the first character.
     $first = JString::substr($input, 0, 1);
     $first = JString::strtolower($first);
     // Replace the first character with the lowercase character.
     $input = JString::substr_replace($input, $first, 0, 1);
     return $input;
 }
 /**
  * Method to test JStringNormalise::toSpaceSeparated().
  *
  * @param   string  $expected  The expected value from the method.
  * @param   string  $input     The input value for the method.
  *
  * @return  void
  *
  * @dataProvider  seedToSpaceSeparated
  * @since   11.3
  */
 public function testToSpaceSeparated($expected, $input)
 {
     $this->assertEquals($expected, JStringNormalise::toSpaceSeparated($input));
 }
示例#3
0
 /**
  * Helper wrapper method for toSpaceSeparated
  *
  * @param   string  $input  The string input (ASCII only).
  *
  * @return string  The space separated string.
  *
  * @see     JUserHelper::toSpaceSeparated()
  * @since   3.4
  */
 public function toSpaceSeparated($input)
 {
     return JStringNormalise::toSpaceSeparated($input);
 }