platform/api/symfony/Component/Serializer/Normalizer/CustomNormalizer.yaml
2024-09-02 10:44:11 -07:00

66 lines
2.5 KiB
YAML

name: CustomNormalizer
class_comment: null
dependencies:
- name: SerializerAwareInterface
type: class
source: Symfony\Component\Serializer\SerializerAwareInterface
- name: SerializerAwareTrait
type: class
source: Symfony\Component\Serializer\SerializerAwareTrait
- name: ObjectToPopulateTrait
type: class
source: ObjectToPopulateTrait
- name: SerializerAwareTrait
type: class
source: SerializerAwareTrait
properties: []
methods:
- name: supportsNormalization
visibility: public
parameters:
- name: data
- name: format
default: 'null'
- name: context
default: '[]'
comment: "# * @author Jordi Boggiano <j.boggiano@seld.be>\n# */\n# final class CustomNormalizer\
\ implements NormalizerInterface, DenormalizerInterface, SerializerAwareInterface\n\
# {\n# use ObjectToPopulateTrait;\n# use SerializerAwareTrait;\n# \n# public function\
\ getSupportedTypes(?string $format): array\n# {\n# return [\n# NormalizableInterface::class\
\ => true,\n# DenormalizableInterface::class => true,\n# ];\n# }\n# \n# public\
\ function normalize(mixed $object, ?string $format = null, array $context = []):\
\ array|string|int|float|bool|\\ArrayObject|null\n# {\n# return $object->normalize($this->serializer,\
\ $format, $context);\n# }\n# \n# public function denormalize(mixed $data, string\
\ $type, ?string $format = null, array $context = []): mixed\n# {\n# $object =\
\ $this->extractObjectToPopulate($type, $context) ?? new $type();\n# $object->denormalize($this->serializer,\
\ $data, $format, $context);\n# \n# return $object;\n# }\n# \n# /**\n# * Checks\
\ if the given class implements the NormalizableInterface.\n# *\n# * @param mixed\
\ $data Data to normalize\n# * @param string|null $format The format being\
\ (de-)serialized from or into"
- name: supportsDenormalization
visibility: public
parameters:
- name: data
- name: type
- name: format
default: 'null'
- name: context
default: '[]'
comment: '# * Checks if the given class implements the DenormalizableInterface.
# *
# * @param mixed $data Data to denormalize from
# * @param string $type The class to which the data should be denormalized
# * @param string|null $format The format being deserialized from'
traits:
- Symfony\Component\Serializer\SerializerAwareInterface
- Symfony\Component\Serializer\SerializerAwareTrait
- ObjectToPopulateTrait
- SerializerAwareTrait
interfaces:
- NormalizerInterface
- the
- the