Stringy\Stringy::underscored PHP Méthode

underscored() public méthode

Underscores are inserted before uppercase characters (with the exception of the first character of the string), and in place of spaces as well as dashes.
public underscored ( ) : Stringy
Résultat Stringy Object with an underscored $str
    public function underscored()
    {
        return $this->delimit('_');
    }

Usage Example

 /**
  * Guesses possible raw data keys from a constructor parameter name.
  *
  * @param \ReflectionParameter $parameter The parameter to guess keys for
  *
  * @return array
  */
 private function getPossibleParameterKeys(\ReflectionParameter $parameter)
 {
     $parameterString = new Stringy($parameter->getName());
     return array((string) $parameterString->underscored(), (string) $parameterString->regexReplace('([a-z]+)([0-9]+)', '\\1_\\2'), $parameter->getName());
 }