Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added method getSupportedTypes which is added in symfony 6.3 #315

Merged
merged 5 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Api/ApigeeX/Denormalizer/AppDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
}
}
10 changes: 10 additions & 0 deletions src/Api/ApigeeX/Denormalizer/RatePlanDenormalizerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,14 @@ public function setSerializer(SerializerInterface $serializer): void
}
}
}

/**
* {@inheritdoc}
*/
public function getSupportedTypes(?string $format): array
{
return [
'*' => false,
];
}
}
10 changes: 10 additions & 0 deletions src/Api/ApigeeX/Normalizer/AppNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
}
}
10 changes: 10 additions & 0 deletions src/Api/ApigeeX/Normalizer/RatePlanNormalizerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,14 @@ public function setSerializer(SerializerInterface $serializer): void
}
}
}

/**
* {@inheritdoc}
*/
public function getSupportedTypes(?string $format): array
{
return [
'*' => false,
];
}
}
10 changes: 10 additions & 0 deletions src/Api/Management/Denormalizer/CompanyMembershipDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
}
}
10 changes: 10 additions & 0 deletions src/Api/Management/Normalizer/AppCredentialNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
}
}
10 changes: 10 additions & 0 deletions src/Api/Management/Normalizer/AppNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
}
}
14 changes: 12 additions & 2 deletions src/Api/Management/Normalizer/CompanyMembershipNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ 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.
// 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);
}

Expand All @@ -51,4 +51,14 @@ public function supportsNormalization($data, $format = null)
{
return $data instanceof CompanyMembership;
}

/**
* {@inheritdoc}
*/
public function getSupportedTypes(?string $format): array
{
return [
CompanyMembership::class => true,
];
}
}
13 changes: 12 additions & 1 deletion src/Api/Monetization/Denormalizer/DateTimeZoneDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}
}
Expand All @@ -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,
];
}
}
10 changes: 10 additions & 0 deletions src/Api/Monetization/Denormalizer/RatePlanDenormalizerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,14 @@ public function setSerializer(SerializerInterface $serializer): void
}
}
}

/**
* {@inheritdoc}
*/
public function getSupportedTypes(?string $format): array
{
return [
'*' => false,
];
}
}
10 changes: 10 additions & 0 deletions src/Api/Monetization/Normalizer/DateTimeZoneNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
}
}
10 changes: 10 additions & 0 deletions src/Api/Monetization/Normalizer/RatePlanNormalizerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,14 @@ public function setSerializer(SerializerInterface $serializer): void
}
}
}

/**
* {@inheritdoc}
*/
public function getSupportedTypes(?string $format): array
{
return [
'*' => false,
];
}
}
10 changes: 10 additions & 0 deletions src/Denormalizer/AttributesPropertyDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
}
}
10 changes: 10 additions & 0 deletions src/Denormalizer/CredentialProductDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
}
}
12 changes: 11 additions & 1 deletion src/Denormalizer/EdgeDateDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function denormalize($data, $type, $format = null, array $context = [])
$context[$this->normalizer::FORMAT_KEY] = 'U';
$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);
Expand All @@ -73,4 +73,14 @@ public function supportsDenormalization($data, $type, $format = null)
{
return isset(self::$supportedTypes[$type]);
}

/**
* {@inheritdoc}
*/
public function getSupportedTypes(?string $format): array
{
return [
'*' => false,
];
}
}
10 changes: 10 additions & 0 deletions src/Denormalizer/KeyValueMapDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
}
}
10 changes: 10 additions & 0 deletions src/Denormalizer/ObjectDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
}
}
10 changes: 10 additions & 0 deletions src/Denormalizer/PropertiesPropertyDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
}
}
14 changes: 12 additions & 2 deletions src/Normalizer/CredentialProductNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ 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.
// 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);
}

Expand All @@ -52,4 +52,14 @@ public function supportsNormalization($data, $format = null)
{
return $data instanceof CredentialProductInterface;
}

/**
* {@inheritdoc}
*/
public function getSupportedTypes(?string $format): array
{
return [
CredentialProductInterface::class => true,
];
}
}
10 changes: 10 additions & 0 deletions src/Normalizer/EdgeDateNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,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,
];
}
}
10 changes: 10 additions & 0 deletions src/Normalizer/KeyValueMapNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
}
}
12 changes: 11 additions & 1 deletion src/Normalizer/ObjectNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,17 @@ public function setSerializer(SerializerInterface $serializer): void
*/
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.
// 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,
];
}
}
Loading