* * 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:----j3FQ47111j7ss1GE+8NB/MIpy//1cDFT2CwMDhQwf3iN8ZyMPfbkZlEp4bd0kcqMXaQhjUrzw5KOKjTJO8Ag+5OA3nHuLofydVX7PeQ9yNSUBPVW32hmmuUE1ggVQ3bj889kXDrgPP6o51cJdup4z4+dDRs6FnXKOOhQy5SrARZwPaxqOIe4KL/l2VqtXLsFguyDOlYdSudJ6ai7B1eJHhDX/VcxBmkk/nN5fANMSvHOuh1lfXMioL4xEQ70cA7DH+QzPapubScXKxqyFkBEVEX594Cuf4Zhu33hnYaFglYIYB0YLB2YSUQVpryp/6MhODLLnVcC01vGgk4MtS+HNltUzvwUZsOc7soGR0stxhhYCF1iYPw3S9XVfgSGWLf1OjIzz6eiDLS8Ju9oMe/1i0PW9SRnBzI8cC0MDAoNOaLZS3/YM/wxWzSqE0wlWfGeXSfY3VlyjnJSCSFKYDHgt1S2Um7rfY13lCPDm/wJkDO+sJKg2k4SQ1oWoheEoK73+WwH+qAs7D97Ax8UAFFEk6I4i8jco3lrNhmSZADKqf/d+MjM3EYQxuhSx8CxxQmcbmjiIj+j1OsT3urWI3KrDTVOvW70xt9mxVXpM1ZuS5+Y4yHAdg7PjSqzZn6VnHUw2USl6g4dBT0FbzXp7+klk0X//IgbmZwzmXG2x+6XrNY=----ATTACHMENT:----NTc2MjQyNzQ5MzUyMTEgODE2MDg2MTQ2NjA0Mzk5IDUxMzA2MTczNDQyNjEy