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 all 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,
];
}
}
17 changes: 14 additions & 3 deletions src/Api/Management/Normalizer/CompanyMembershipNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}

/**
Expand All @@ -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,
];
}
}
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,
];
}
}
24 changes: 19 additions & 5 deletions src/Denormalizer/EdgeDateDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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 */
Expand Down Expand Up @@ -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);
Expand All @@ -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,
];
}
}
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,
];
}
}
17 changes: 14 additions & 3 deletions src/Normalizer/CredentialProductNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
namespace Apigee\Edge\Normalizer;

use Apigee\Edge\Structure\CredentialProductInterface;
use ArrayObject;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

/**
Expand All @@ -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);
}

/**
Expand All @@ -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,
];
}
}
Loading
Loading