public function CamelCaseToSnakeCaseNameConverter::denormalize in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php \Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter::denormalize()
Converts a property name to its denormalized value.
Parameters
string $propertyName:
Return value
string
Overrides NameConverterInterface::denormalize
File
- vendor/
symfony/ serializer/ NameConverter/ CamelCaseToSnakeCaseNameConverter.php, line 66
Class
- CamelCaseToSnakeCaseNameConverter
- CamelCase to Underscore name converter.
Namespace
Symfony\Component\Serializer\NameConverterCode
public function denormalize($propertyName) {
$camelCasedName = preg_replace_callback('/(^|_|\\.)+(.)/', function ($match) {
return ('.' === $match[1] ? '_' : '') . strtoupper($match[2]);
}, $propertyName);
if ($this->lowerCamelCase) {
$camelCasedName = lcfirst($camelCasedName);
}
if (null === $this->attributes || in_array($camelCasedName, $this->attributes)) {
return $this->lowerCamelCase ? lcfirst($camelCasedName) : $camelCasedName;
}
return $propertyName;
}