protected function GetSetMethodNormalizer::formatAttribute

Format attribute name to access parameters or methods As option, if attribute name is found on camelizedAttributes array returns attribute name in camelcase format

Parameters

string $attributeName:

Return value

string

1 call to GetSetMethodNormalizer::formatAttribute()
GetSetMethodNormalizer::denormalize in drupal/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php
Denormalizes data back into an object of the given class

File

drupal/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php, line 164

Class

GetSetMethodNormalizer
Converts between objects with getter and setter methods and arrays.

Namespace

Symfony\Component\Serializer\Normalizer

Code

protected function formatAttribute($attributeName) {
  if (in_array($attributeName, $this->camelizedAttributes)) {
    return preg_replace_callback('/(^|_|\\.)+(.)/', function ($match) {
      return ('.' === $match[1] ? '_' : '') . strtoupper($match[2]);
    }, $attributeName);
  }
  return $attributeName;
}