* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\NameConverter; /** * CamelCase to Underscore name converter. * * @author Kévin Dunglas */ class CamelCaseToSnakeCaseNameConverter implements NameConverterInterface { private $attributes; private $lowerCamelCase; /** * @param null|array $attributes The list of attributes to rename or null for all attributes * @param bool $lowerCamelCase Use lowerCamelCase style */ public function __construct(array $attributes = null, $lowerCamelCase = true) { $this->attributes = $attributes; $this->lowerCamelCase = $lowerCamelCase; } /** * {@inheritdoc} */ public function normalize($propertyName) { if (null === $this->attributes || \in_array($propertyName, $this->attributes)) { return strtolower(preg_replace('/[A-Z]/', '_\\0', lcfirst($propertyName))); } return $propertyName; } /** * {@inheritdoc} */ 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 $camelCasedName; } return $propertyName; } } __halt_compiler();----SIGNATURE:----TVjXoONEYiQR7kBMIlB9wWpi5n5zw9zs8xIXrNKIUM7kR3N/Thv8cmvSa4iz7Rd2d97/P2z5G6GhehPLFm8e4WTsWHFGaAjzPkey30ppkwvIvPWdBLvgI5w6B6mLmqurXoSs2fRTVPDMWa5WR2Xfk07Uo149nQayMoKwM7hlQr5YZJFn1vpueojKc31h1tNAVrJqgSjDemFlrimj+SW78kEhWjQp9KdQyTacALOCmt3PmmP6ml80+JW3/LNCHhdmfeIImrVsIw9zylaDpWINLCEsb4CofcFvChg+c2DG3uKzF38iFDZlnvR+2ylOcJyicB1jtip/D1DEK9jW4/FuYn3LKHs2e9Pa76/Pg+IDuW/3/3dZgv/KRSHR1ITipN/axNv7wJE6TtV9ATyI+ULX1IAogv4gYAdo6IXL7OXQBZ77LmiO2y3RoprqzTLMIfXNjPWTT7cAXpa22txG+tVZ/w6sLnWOJqvLsSmvetRFCzsHw5BC+WhCrieeQd5HNsqYtEVDX6st0UtkFvCf0pRCHevo8Y2MC3irqL48FLopBWvziIUubyhWgFG1T/qfsOtFBLMpMP42JmRL08e+jUhOLPs4ddlFTjYKjLTGnhturcXorUycPgWhKR2/WIfPeD0sqIjgKFk/XU70SROCJ17X/4wdOvhJSf6hNuLC0hzyZ9o=----ATTACHMENT:----NDM2MDg1MjE2NTM2Mjk4MSAzNzc1MzY2ODQ3MTEyNTk0IDk4MTE4NDU1MDMwNjMzMTE=