99 lines
3.6 KiB
YAML
99 lines
3.6 KiB
YAML
|
name: GetSetMethodNormalizer
|
||
|
class_comment: null
|
||
|
dependencies:
|
||
|
- name: LegacyIgnore
|
||
|
type: class
|
||
|
source: Symfony\Component\Serializer\Annotation\Ignore
|
||
|
- name: Ignore
|
||
|
type: class
|
||
|
source: Symfony\Component\Serializer\Attribute\Ignore
|
||
|
properties:
|
||
|
- name: reflectionCache
|
||
|
visibility: private
|
||
|
comment: null
|
||
|
methods:
|
||
|
- name: supports
|
||
|
visibility: private
|
||
|
parameters:
|
||
|
- name: class
|
||
|
- name: readAttributes
|
||
|
comment: "# * Converts between objects with getter and setter methods and arrays.\n\
|
||
|
# *\n# * The normalization process looks at all public methods and calls the ones\n\
|
||
|
# * which have a name starting with get and take no parameters. The result is\
|
||
|
\ a\n# * map from property names (method name stripped of the get prefix and converted\n\
|
||
|
# * to lower case) to property values. Property values are normalized through\
|
||
|
\ the\n# * serializer.\n# *\n# * The denormalization first looks at the constructor\
|
||
|
\ of the given class to see\n# * if any of the parameters have the same name as\
|
||
|
\ one of the properties. The\n# * constructor is then called with all parameters\
|
||
|
\ or an exception is thrown if\n# * any required parameters were not present as\
|
||
|
\ properties. Then the denormalizer\n# * walks through the given map of property\
|
||
|
\ names to property values to see if a\n# * setter method exists for any of the\
|
||
|
\ properties. If a setter exists it is\n# * called with the property value. No\
|
||
|
\ automatic denormalization of the value\n# * takes place.\n# *\n# * @author Nils\
|
||
|
\ Adermann <naderman@naderman.de>\n# * @author K\xE9vin Dunglas <dunglas@gmail.com>\n\
|
||
|
# */\n# final class GetSetMethodNormalizer extends AbstractObjectNormalizer\n\
|
||
|
# {\n# private static $reflectionCache = [];\n# private static array $setterAccessibleCache\
|
||
|
\ = [];\n# \n# public function getSupportedTypes(?string $format): array\n# {\n\
|
||
|
# return ['object' => true];\n# }\n# \n# public function supportsNormalization(mixed\
|
||
|
\ $data, ?string $format = null, array $context = []): bool\n# {\n# return parent::supportsNormalization($data,\
|
||
|
\ $format) && $this->supports($data::class, true);\n# }\n# \n# public function\
|
||
|
\ supportsDenormalization(mixed $data, string $type, ?string $format = null, array\
|
||
|
\ $context = []): bool\n# {\n# return parent::supportsDenormalization($data, $type,\
|
||
|
\ $format) && $this->supports($type, false);\n# }\n# \n# /**\n# * Checks if the\
|
||
|
\ given class has any getter or setter method."
|
||
|
- name: isGetMethod
|
||
|
visibility: private
|
||
|
parameters:
|
||
|
- name: method
|
||
|
comment: '# * Checks if a method''s name matches /^(get|is|has).+$/ and can be called
|
||
|
non-statically without parameters.'
|
||
|
- name: isSetMethod
|
||
|
visibility: private
|
||
|
parameters:
|
||
|
- name: method
|
||
|
comment: '# * Checks if a method''s name matches /^set.+$/ and can be called non-statically
|
||
|
with one parameter.'
|
||
|
- name: extractAttributes
|
||
|
visibility: protected
|
||
|
parameters:
|
||
|
- name: object
|
||
|
- name: format
|
||
|
default: 'null'
|
||
|
- name: context
|
||
|
default: '[]'
|
||
|
comment: null
|
||
|
- name: getAttributeValue
|
||
|
visibility: protected
|
||
|
parameters:
|
||
|
- name: object
|
||
|
- name: attribute
|
||
|
- name: format
|
||
|
default: 'null'
|
||
|
- name: context
|
||
|
default: '[]'
|
||
|
comment: null
|
||
|
- name: setAttributeValue
|
||
|
visibility: protected
|
||
|
parameters:
|
||
|
- name: object
|
||
|
- name: attribute
|
||
|
- name: value
|
||
|
- name: format
|
||
|
default: 'null'
|
||
|
- name: context
|
||
|
default: '[]'
|
||
|
comment: null
|
||
|
- name: isAllowedAttribute
|
||
|
visibility: protected
|
||
|
parameters:
|
||
|
- name: classOrObject
|
||
|
- name: attribute
|
||
|
- name: format
|
||
|
default: 'null'
|
||
|
- name: context
|
||
|
default: '[]'
|
||
|
comment: null
|
||
|
traits:
|
||
|
- Symfony\Component\Serializer\Attribute\Ignore
|
||
|
interfaces: []
|