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 ( ) : |
||
Результат | Object with an underscored $str |
/** * 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()); }