diff --git a/src/Api/ApigeeX/Denormalizer/AppDenormalizer.php b/src/Api/ApigeeX/Denormalizer/AppDenormalizer.php index 147e34f3..89e048fc 100644 --- a/src/Api/ApigeeX/Denormalizer/AppDenormalizer.php +++ b/src/Api/ApigeeX/Denormalizer/AppDenormalizer.php @@ -70,4 +70,14 @@ public function supportsDenormalization($data, $type, $format = null) return AppInterface::class === $type || $type instanceof AppInterface || in_array(AppInterface::class, class_implements($type)); } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + AppInterface::class => true, + ]; + } } diff --git a/src/Api/ApigeeX/Denormalizer/RatePlanDenormalizerFactory.php b/src/Api/ApigeeX/Denormalizer/RatePlanDenormalizerFactory.php index 066f3a8d..c64cca65 100755 --- a/src/Api/ApigeeX/Denormalizer/RatePlanDenormalizerFactory.php +++ b/src/Api/ApigeeX/Denormalizer/RatePlanDenormalizerFactory.php @@ -93,4 +93,14 @@ public function setSerializer(SerializerInterface $serializer): void } } } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + '*' => false, + ]; + } } diff --git a/src/Api/ApigeeX/Normalizer/AppNormalizer.php b/src/Api/ApigeeX/Normalizer/AppNormalizer.php index c17990a6..3f7b3564 100644 --- a/src/Api/ApigeeX/Normalizer/AppNormalizer.php +++ b/src/Api/ApigeeX/Normalizer/AppNormalizer.php @@ -54,4 +54,14 @@ public function normalize($object, $format = null, array $context = []) return $normalized; } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + AppInterface::class => true, + ]; + } } diff --git a/src/Api/ApigeeX/Normalizer/RatePlanNormalizerFactory.php b/src/Api/ApigeeX/Normalizer/RatePlanNormalizerFactory.php index 7307b0cb..3debb38a 100755 --- a/src/Api/ApigeeX/Normalizer/RatePlanNormalizerFactory.php +++ b/src/Api/ApigeeX/Normalizer/RatePlanNormalizerFactory.php @@ -93,4 +93,14 @@ public function setSerializer(SerializerInterface $serializer): void } } } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + '*' => false, + ]; + } } diff --git a/src/Api/Management/Denormalizer/CompanyMembershipDenormalizer.php b/src/Api/Management/Denormalizer/CompanyMembershipDenormalizer.php index 42b3f38a..828e6d5a 100755 --- a/src/Api/Management/Denormalizer/CompanyMembershipDenormalizer.php +++ b/src/Api/Management/Denormalizer/CompanyMembershipDenormalizer.php @@ -53,4 +53,14 @@ public function supportsDenormalization($data, $type, $format = null) return CompanyMembership::class === $type || $type instanceof CompanyMembership; } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + CompanyMembership::class => true, + ]; + } } diff --git a/src/Api/Management/Normalizer/AppCredentialNormalizer.php b/src/Api/Management/Normalizer/AppCredentialNormalizer.php index d841560c..0903c413 100644 --- a/src/Api/Management/Normalizer/AppCredentialNormalizer.php +++ b/src/Api/Management/Normalizer/AppCredentialNormalizer.php @@ -53,4 +53,14 @@ public function normalize($object, $format = null, array $context = []) return $normalized; } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + AppCredentialInterface::class => true, + ]; + } } diff --git a/src/Api/Management/Normalizer/AppNormalizer.php b/src/Api/Management/Normalizer/AppNormalizer.php index c5d036d7..5010f277 100644 --- a/src/Api/Management/Normalizer/AppNormalizer.php +++ b/src/Api/Management/Normalizer/AppNormalizer.php @@ -51,4 +51,14 @@ public function normalize($object, $format = null, array $context = []) return $normalized; } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + AppInterface::class => true, + ]; + } } diff --git a/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php b/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php index c4f856a9..02377355 100644 --- a/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php +++ b/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php @@ -19,6 +19,7 @@ namespace Apigee\Edge\Api\Management\Normalizer; use Apigee\Edge\Api\Management\Structure\CompanyMembership; +use ArrayObject; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class CompanyMembershipNormalizer implements NormalizerInterface @@ -39,9 +40,9 @@ public function normalize($object, $format = null, array $context = []) $normalized['developer'][] = (object) ['email' => $member, 'role' => $role]; } - //convert to ArrayObject as symfony normalizer throws error for std object. - //set ARRAY_AS_PROPS flag as we need entries to be accessed as properties. - return new \ArrayObject($normalized, \ArrayObject::ARRAY_AS_PROPS); + // convert to ArrayObject as symfony normalizer throws error for std object. + // set ARRAY_AS_PROPS flag as we need entries to be accessed as properties. + return new ArrayObject($normalized, ArrayObject::ARRAY_AS_PROPS); } /** @@ -51,4 +52,14 @@ public function supportsNormalization($data, $format = null) { return $data instanceof CompanyMembership; } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + CompanyMembership::class => true, + ]; + } } diff --git a/src/Api/Monetization/Denormalizer/DateTimeZoneDenormalizer.php b/src/Api/Monetization/Denormalizer/DateTimeZoneDenormalizer.php index 3f91ed78..049c807a 100644 --- a/src/Api/Monetization/Denormalizer/DateTimeZoneDenormalizer.php +++ b/src/Api/Monetization/Denormalizer/DateTimeZoneDenormalizer.php @@ -19,6 +19,7 @@ namespace Apigee\Edge\Api\Monetization\Denormalizer; use DateTimeZone; +use Exception; use Symfony\Component\Serializer\Exception\UnexpectedValueException; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -31,7 +32,7 @@ public function denormalize($data, $type, $format = null, array $context = []) { try { return new DateTimeZone($data); - } catch (\Exception $e) { + } catch (Exception $e) { throw new UnexpectedValueException(sprintf('"%s" is not a valid timezone.', $data), (int) $e->getCode(), $e); } } @@ -48,4 +49,14 @@ public function supportsDenormalization($data, $type, $format = null) return DateTimeZone::class === $type || $type instanceof DateTimeZone; } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + DateTimeZone::class => true, + ]; + } } diff --git a/src/Api/Monetization/Denormalizer/RatePlanDenormalizerFactory.php b/src/Api/Monetization/Denormalizer/RatePlanDenormalizerFactory.php index 035e97c8..b425f999 100644 --- a/src/Api/Monetization/Denormalizer/RatePlanDenormalizerFactory.php +++ b/src/Api/Monetization/Denormalizer/RatePlanDenormalizerFactory.php @@ -90,4 +90,14 @@ public function setSerializer(SerializerInterface $serializer): void } } } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + '*' => false, + ]; + } } diff --git a/src/Api/Monetization/Normalizer/DateTimeZoneNormalizer.php b/src/Api/Monetization/Normalizer/DateTimeZoneNormalizer.php index bbd72c38..8eba9f35 100644 --- a/src/Api/Monetization/Normalizer/DateTimeZoneNormalizer.php +++ b/src/Api/Monetization/Normalizer/DateTimeZoneNormalizer.php @@ -38,4 +38,14 @@ public function supportsNormalization($data, $format = null) { return $data instanceof DateTimeZone; } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + DateTimeZone::class => true, + ]; + } } diff --git a/src/Api/Monetization/Normalizer/RatePlanNormalizerFactory.php b/src/Api/Monetization/Normalizer/RatePlanNormalizerFactory.php index ff21c8bf..0af7aff6 100644 --- a/src/Api/Monetization/Normalizer/RatePlanNormalizerFactory.php +++ b/src/Api/Monetization/Normalizer/RatePlanNormalizerFactory.php @@ -90,4 +90,14 @@ public function setSerializer(SerializerInterface $serializer): void } } } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + '*' => false, + ]; + } } diff --git a/src/Denormalizer/AttributesPropertyDenormalizer.php b/src/Denormalizer/AttributesPropertyDenormalizer.php index 90299901..72b204ed 100644 --- a/src/Denormalizer/AttributesPropertyDenormalizer.php +++ b/src/Denormalizer/AttributesPropertyDenormalizer.php @@ -63,4 +63,14 @@ public function denormalize($data, $type, $format = null, array $context = []) return parent::denormalize($data, $type, $format, $context); } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + AttributesProperty::class => true, + ]; + } } diff --git a/src/Denormalizer/CredentialProductDenormalizer.php b/src/Denormalizer/CredentialProductDenormalizer.php index 34dd0440..43cd89de 100644 --- a/src/Denormalizer/CredentialProductDenormalizer.php +++ b/src/Denormalizer/CredentialProductDenormalizer.php @@ -47,4 +47,14 @@ public function denormalize($data, $type, $format = null, array $context = []) { return new CredentialProduct($data->apiproduct, $data->status); } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + CredentialProductInterface::class => true, + ]; + } } diff --git a/src/Denormalizer/EdgeDateDenormalizer.php b/src/Denormalizer/EdgeDateDenormalizer.php index a87dfc61..02ff769d 100644 --- a/src/Denormalizer/EdgeDateDenormalizer.php +++ b/src/Denormalizer/EdgeDateDenormalizer.php @@ -18,6 +18,10 @@ namespace Apigee\Edge\Denormalizer; +use DateTime; +use DateTimeImmutable; +use DateTimeInterface; +use DateTimeZone; use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -27,9 +31,9 @@ class EdgeDateDenormalizer implements DenormalizerInterface { private static $supportedTypes = [ - \DateTimeInterface::class => true, - \DateTimeImmutable::class => true, - \DateTime::class => true, + DateTimeInterface::class => true, + DateTimeImmutable::class => true, + DateTime::class => true, ]; /** @var \Symfony\Component\Serializer\Normalizer\DateTimeNormalizer */ @@ -58,9 +62,9 @@ public function denormalize($data, $type, $format = null, array $context = []) return null; } $context[$this->normalizer::FORMAT_KEY] = 'U'; - $context[$this->normalizer::TIMEZONE_KEY] = new \DateTimeZone('UTC'); + $context[$this->normalizer::TIMEZONE_KEY] = new DateTimeZone('UTC'); - //convert data in string format for denormalizer. + // convert data in string format for denormalizer. $data = (string) intval($data / 1000); return $this->normalizer->denormalize($data, $type, $format, $context); @@ -73,4 +77,14 @@ public function supportsDenormalization($data, $type, $format = null) { return isset(self::$supportedTypes[$type]); } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + '*' => false, + ]; + } } diff --git a/src/Denormalizer/KeyValueMapDenormalizer.php b/src/Denormalizer/KeyValueMapDenormalizer.php index af17052b..cdc0027f 100644 --- a/src/Denormalizer/KeyValueMapDenormalizer.php +++ b/src/Denormalizer/KeyValueMapDenormalizer.php @@ -46,4 +46,14 @@ public function supportsDenormalization($data, $type, $format = null) return KeyValueMapInterface::class === $type || $type instanceof KeyValueMapInterface || in_array(KeyValueMapInterface::class, class_implements($type)); } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + KeyValueMapInterface::class => true, + ]; + } } diff --git a/src/Denormalizer/ObjectDenormalizer.php b/src/Denormalizer/ObjectDenormalizer.php index 4aaf0200..c0865d60 100644 --- a/src/Denormalizer/ObjectDenormalizer.php +++ b/src/Denormalizer/ObjectDenormalizer.php @@ -133,4 +133,14 @@ public function setSerializer(SerializerInterface $serializer): void $this->serializer = $serializer; $this->objectNormalizer->setSerializer($this->serializer); } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + '*' => false, + ]; + } } diff --git a/src/Denormalizer/PropertiesPropertyDenormalizer.php b/src/Denormalizer/PropertiesPropertyDenormalizer.php index 9910d712..32d02590 100644 --- a/src/Denormalizer/PropertiesPropertyDenormalizer.php +++ b/src/Denormalizer/PropertiesPropertyDenormalizer.php @@ -53,4 +53,14 @@ public function denormalize($data, $type, $format = null, array $context = []) return parent::denormalize($data, $type, $format, $context); } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + PropertiesProperty::class => true, + ]; + } } diff --git a/src/Normalizer/CredentialProductNormalizer.php b/src/Normalizer/CredentialProductNormalizer.php index 2f882a70..7a1b1adb 100644 --- a/src/Normalizer/CredentialProductNormalizer.php +++ b/src/Normalizer/CredentialProductNormalizer.php @@ -19,6 +19,7 @@ namespace Apigee\Edge\Normalizer; use Apigee\Edge\Structure\CredentialProductInterface; +use ArrayObject; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; /** @@ -40,9 +41,9 @@ public function normalize($object, $format = null, array $context = []) 'status' => $object->getStatus(), ]; - //Need to convert to ArrayObject as symfony normalizer throws error for std object. - //Need to set ARRAY_AS_PROPS flag as we need Entries to be accessed as properties. - return new \ArrayObject($asObject, \ArrayObject::ARRAY_AS_PROPS); + // Need to convert to ArrayObject as symfony normalizer throws error for std object. + // Need to set ARRAY_AS_PROPS flag as we need Entries to be accessed as properties. + return new ArrayObject($asObject, ArrayObject::ARRAY_AS_PROPS); } /** @@ -52,4 +53,14 @@ public function supportsNormalization($data, $format = null) { return $data instanceof CredentialProductInterface; } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + CredentialProductInterface::class => true, + ]; + } } diff --git a/src/Normalizer/EdgeDateNormalizer.php b/src/Normalizer/EdgeDateNormalizer.php index 9443d847..77025207 100644 --- a/src/Normalizer/EdgeDateNormalizer.php +++ b/src/Normalizer/EdgeDateNormalizer.php @@ -18,6 +18,7 @@ namespace Apigee\Edge\Normalizer; +use DateTimeInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class EdgeDateNormalizer implements NormalizerInterface @@ -27,7 +28,7 @@ class EdgeDateNormalizer implements NormalizerInterface */ public function supportsNormalization($data, $format = null) { - return $data instanceof \DateTimeInterface; + return $data instanceof DateTimeInterface; } /** @@ -38,4 +39,14 @@ public function normalize($object, $format = null, array $context = []) /* @var \DateTimeInterface $object */ return $object->getTimestamp() * 1000; } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + DateTimeInterface::class => true, + ]; + } } diff --git a/src/Normalizer/KeyValueMapNormalizer.php b/src/Normalizer/KeyValueMapNormalizer.php index 22d7fbd7..998c0427 100644 --- a/src/Normalizer/KeyValueMapNormalizer.php +++ b/src/Normalizer/KeyValueMapNormalizer.php @@ -46,4 +46,14 @@ public function supportsNormalization($data, $format = null) { return $data instanceof KeyValueMapInterface; } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + KeyValueMapInterface::class => true, + ]; + } } diff --git a/src/Normalizer/ObjectNormalizer.php b/src/Normalizer/ObjectNormalizer.php index f24e5ce4..f04f2d99 100644 --- a/src/Normalizer/ObjectNormalizer.php +++ b/src/Normalizer/ObjectNormalizer.php @@ -19,6 +19,7 @@ namespace Apigee\Edge\Normalizer; use Apigee\Edge\PropertyAccess\PropertyAccessorDecorator; +use ArrayObject; use Symfony\Component\PropertyAccess\PropertyAccess; use Symfony\Component\PropertyAccess\PropertyAccessorInterface; use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor; @@ -129,9 +130,19 @@ public function setSerializer(SerializerInterface $serializer): void /** * {@inheritDoc} */ - public function convertToArrayObject($normalized, $array_as_props = \ArrayObject::ARRAY_AS_PROPS) + public function convertToArrayObject($normalized, $array_as_props = ArrayObject::ARRAY_AS_PROPS) { - //default set ARRAY_AS_PROPS flag as we need entries to be accessed as properties. - return new \ArrayObject($normalized, $array_as_props); + // default set ARRAY_AS_PROPS flag as we need entries to be accessed as properties. + return new ArrayObject($normalized, $array_as_props); + } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + '*' => false, + ]; } }