Stringy\Stringy::underscored PHP 메소드

underscored() 공개 메소드

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
리턴 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());
 }