|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* This file has been auto generated by Jane, |
|
7
|
|
|
* |
|
8
|
|
|
* Do no edit it directly. |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace Montross50\NetsparkerCloud\SDK\Normalizer; |
|
12
|
|
|
|
|
13
|
|
|
use Symfony\Component\Serializer\Exception\InvalidArgumentException; |
|
14
|
|
|
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; |
|
15
|
|
|
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; |
|
16
|
|
|
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; |
|
17
|
|
|
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; |
|
18
|
|
|
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; |
|
19
|
|
|
use Symfony\Component\Serializer\Normalizer\NormalizerInterface; |
|
20
|
|
|
|
|
21
|
|
|
class WebsiteApiModelNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface |
|
22
|
|
|
{ |
|
23
|
|
|
use DenormalizerAwareTrait; |
|
24
|
|
|
use NormalizerAwareTrait; |
|
25
|
|
|
|
|
26
|
|
|
public function supportsDenormalization($data, $type, $format = null) |
|
27
|
|
|
{ |
|
28
|
|
|
return $type === 'Montross50\\NetsparkerCloud\\SDK\\Model\\WebsiteApiModel'; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function supportsNormalization($data, $format = null) |
|
32
|
|
|
{ |
|
33
|
|
|
return $data instanceof \Montross50\NetsparkerCloud\SDK\Model\WebsiteApiModel; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
public function denormalize($data, $class, $format = null, array $context = []) |
|
37
|
|
|
{ |
|
38
|
|
|
if (!is_object($data)) { |
|
39
|
|
|
throw new InvalidArgumentException(); |
|
40
|
|
|
} |
|
41
|
|
|
$object = new \Montross50\NetsparkerCloud\SDK\Model\WebsiteApiModel(); |
|
42
|
|
|
if (property_exists($data, 'Id')) { |
|
43
|
|
|
$object->setId($data->{'Id'}); |
|
44
|
|
|
} |
|
45
|
|
|
if (property_exists($data, 'CreatedAt')) { |
|
46
|
|
|
$object->setCreatedAt(\DateTime::createFromFormat("Y-m-d\TH:i:sP", $data->{'CreatedAt'})); |
|
|
|
|
|
|
47
|
|
|
} |
|
48
|
|
|
if (property_exists($data, 'UpdatedAt')) { |
|
49
|
|
|
$object->setUpdatedAt(\DateTime::createFromFormat("Y-m-d\TH:i:sP", $data->{'UpdatedAt'})); |
|
|
|
|
|
|
50
|
|
|
} |
|
51
|
|
|
if (property_exists($data, 'RootUrl')) { |
|
52
|
|
|
$object->setRootUrl($data->{'RootUrl'}); |
|
53
|
|
|
} |
|
54
|
|
|
if (property_exists($data, 'Name')) { |
|
55
|
|
|
$object->setName($data->{'Name'}); |
|
56
|
|
|
} |
|
57
|
|
|
if (property_exists($data, 'Groups')) { |
|
58
|
|
|
$values = []; |
|
59
|
|
|
foreach ($data->{'Groups'} as $value) { |
|
60
|
|
|
$values[] = $this->denormalizer->denormalize($value, 'Montross50\\NetsparkerCloud\\SDK\\Model\\IdNamePair', 'json', $context); |
|
61
|
|
|
} |
|
62
|
|
|
$object->setGroups($values); |
|
63
|
|
|
} |
|
64
|
|
|
if (property_exists($data, 'IsVerified')) { |
|
65
|
|
|
$object->setIsVerified($data->{'IsVerified'}); |
|
66
|
|
|
} |
|
67
|
|
|
if (property_exists($data, 'LicenseType')) { |
|
68
|
|
|
$object->setLicenseType($data->{'LicenseType'}); |
|
69
|
|
|
} |
|
70
|
|
|
if (property_exists($data, 'AgentMode')) { |
|
71
|
|
|
$object->setAgentMode($data->{'AgentMode'}); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
return $object; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
public function normalize($object, $format = null, array $context = []) |
|
78
|
|
|
{ |
|
79
|
|
|
$data = new \stdClass(); |
|
80
|
|
|
if (null !== $object->getId()) { |
|
81
|
|
|
$data->{'Id'} = $object->getId(); |
|
82
|
|
|
} |
|
83
|
|
|
if (null !== $object->getCreatedAt()) { |
|
84
|
|
|
$data->{'CreatedAt'} = $object->getCreatedAt()->format("Y-m-d\TH:i:sP"); |
|
85
|
|
|
} |
|
86
|
|
|
if (null !== $object->getUpdatedAt()) { |
|
87
|
|
|
$data->{'UpdatedAt'} = $object->getUpdatedAt()->format("Y-m-d\TH:i:sP"); |
|
88
|
|
|
} |
|
89
|
|
|
if (null !== $object->getRootUrl()) { |
|
90
|
|
|
$data->{'RootUrl'} = $object->getRootUrl(); |
|
91
|
|
|
} |
|
92
|
|
|
if (null !== $object->getName()) { |
|
93
|
|
|
$data->{'Name'} = $object->getName(); |
|
94
|
|
|
} |
|
95
|
|
|
if (null !== $object->getGroups()) { |
|
96
|
|
|
$values = []; |
|
97
|
|
|
foreach ($object->getGroups() as $value) { |
|
98
|
|
|
$values[] = $this->normalizer->normalize($value, 'json', $context); |
|
99
|
|
|
} |
|
100
|
|
|
$data->{'Groups'} = $values; |
|
101
|
|
|
} |
|
102
|
|
|
if (null !== $object->getIsVerified()) { |
|
103
|
|
|
$data->{'IsVerified'} = $object->getIsVerified(); |
|
104
|
|
|
} |
|
105
|
|
|
if (null !== $object->getLicenseType()) { |
|
106
|
|
|
$data->{'LicenseType'} = $object->getLicenseType(); |
|
107
|
|
|
} |
|
108
|
|
|
if (null !== $object->getAgentMode()) { |
|
109
|
|
|
$data->{'AgentMode'} = $object->getAgentMode(); |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
return $data; |
|
113
|
|
|
} |
|
114
|
|
|
} |
|
115
|
|
|
|