supportsNormalization()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
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 SaveScanProfileApiModelNormalizer 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\\SaveScanProfileApiModel';
29
    }
30
31
    public function supportsNormalization($data, $format = null)
32
    {
33
        return $data instanceof \Montross50\NetsparkerCloud\SDK\Model\SaveScanProfileApiModel;
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\SaveScanProfileApiModel();
42
        if (property_exists($data, 'AgentGroupId')) {
43
            $object->setAgentGroupId($data->{'AgentGroupId'});
44
        }
45
        if (property_exists($data, 'AgentId')) {
46
            $object->setAgentId($data->{'AgentId'});
47
        }
48
        if (property_exists($data, 'CreateType')) {
49
            $object->setCreateType($data->{'CreateType'});
50
        }
51
        if (property_exists($data, 'IsPrimary')) {
52
            $object->setIsPrimary($data->{'IsPrimary'});
53
        }
54
        if (property_exists($data, 'IsShared')) {
55
            $object->setIsShared($data->{'IsShared'});
56
        }
57
        if (property_exists($data, 'IsTimeWindowEnabled')) {
58
            $object->setIsTimeWindowEnabled($data->{'IsTimeWindowEnabled'});
59
        }
60
        if (property_exists($data, 'PolicyId')) {
61
            $object->setPolicyId($data->{'PolicyId'});
62
        }
63
        if (property_exists($data, 'ProfileId')) {
64
            $object->setProfileId($data->{'ProfileId'});
65
        }
66
        if (property_exists($data, 'ProfileName')) {
67
            $object->setProfileName($data->{'ProfileName'});
68
        }
69
        if (property_exists($data, 'ReportPolicyId')) {
70
            $object->setReportPolicyId($data->{'ReportPolicyId'});
71
        }
72
        if (property_exists($data, 'TargetUri')) {
73
            $object->setTargetUri($data->{'TargetUri'});
74
        }
75
        if (property_exists($data, 'UserId')) {
76
            $object->setUserId($data->{'UserId'});
77
        }
78
        if (property_exists($data, 'AdditionalWebsites')) {
79
            $values = [];
80
            foreach ($data->{'AdditionalWebsites'} as $value) {
81
                $values[] = $this->denormalizer->denormalize($value, 'Montross50\\NetsparkerCloud\\SDK\\Model\\AdditionalWebsiteModel', 'json', $context);
82
            }
83
            $object->setAdditionalWebsites($values);
84
        }
85
        if (property_exists($data, 'BasicAuthenticationApiModel')) {
86
            $object->setBasicAuthenticationApiModel($this->denormalizer->denormalize($data->{'BasicAuthenticationApiModel'}, 'Montross50\\NetsparkerCloud\\SDK\\Model\\BasicAuthenticationSettingModel', 'json', $context));
87
        }
88
        if (property_exists($data, 'ClientCertificateAuthenticationSetting')) {
89
            $object->setClientCertificateAuthenticationSetting($this->denormalizer->denormalize($data->{'ClientCertificateAuthenticationSetting'}, 'Montross50\\NetsparkerCloud\\SDK\\Model\\ClientCertificateAuthenticationApiModel', 'json', $context));
90
        }
91
        if (property_exists($data, 'Cookies')) {
92
            $object->setCookies($data->{'Cookies'});
93
        }
94
        if (property_exists($data, 'CrawlAndAttack')) {
95
            $object->setCrawlAndAttack($data->{'CrawlAndAttack'});
96
        }
97
        if (property_exists($data, 'EnableHeuristicChecksInCustomUrlRewrite')) {
98
            $object->setEnableHeuristicChecksInCustomUrlRewrite($data->{'EnableHeuristicChecksInCustomUrlRewrite'});
99
        }
100
        if (property_exists($data, 'ExcludedLinks')) {
101
            $values_1 = [];
102
            foreach ($data->{'ExcludedLinks'} as $value_1) {
103
                $values_1[] = $this->denormalizer->denormalize($value_1, 'Montross50\\NetsparkerCloud\\SDK\\Model\\ExcludedLinkModel', 'json', $context);
104
            }
105
            $object->setExcludedLinks($values_1);
106
        }
107
        if (property_exists($data, 'DisallowedHttpMethods')) {
108
            $values_2 = [];
109
            foreach ($data->{'DisallowedHttpMethods'} as $value_2) {
110
                $values_2[] = $value_2;
111
            }
112
            $object->setDisallowedHttpMethods($values_2);
113
        }
114
        if (property_exists($data, 'ExcludeLinks')) {
115
            $object->setExcludeLinks($data->{'ExcludeLinks'});
116
        }
117
        if (property_exists($data, 'FindAndFollowNewLinks')) {
118
            $object->setFindAndFollowNewLinks($data->{'FindAndFollowNewLinks'});
119
        }
120
        if (property_exists($data, 'FormAuthenticationSettingModel')) {
121
            $object->setFormAuthenticationSettingModel($this->denormalizer->denormalize($data->{'FormAuthenticationSettingModel'}, 'Montross50\\NetsparkerCloud\\SDK\\Model\\FormAuthenticationSettingModel', 'json', $context));
122
        }
123
        if (property_exists($data, 'HeaderAuthentication')) {
124
            $object->setHeaderAuthentication($this->denormalizer->denormalize($data->{'HeaderAuthentication'}, 'Montross50\\NetsparkerCloud\\SDK\\Model\\HeaderAuthenticationModel', 'json', $context));
125
        }
126
        if (property_exists($data, 'ImportedLinks')) {
127
            $values_3 = [];
128
            foreach ($data->{'ImportedLinks'} as $value_3) {
129
                $values_3[] = $value_3;
130
            }
131
            $object->setImportedLinks($values_3);
132
        }
133
        if (property_exists($data, 'ImportedFiles')) {
134
            $values_4 = [];
135
            foreach ($data->{'ImportedFiles'} as $value_4) {
136
                $values_4[] = $this->denormalizer->denormalize($value_4, 'Montross50\\NetsparkerCloud\\SDK\\Model\\ApiFileModel', 'json', $context);
137
            }
138
            $object->setImportedFiles($values_4);
139
        }
140
        if (property_exists($data, 'IsMaxScanDurationEnabled')) {
141
            $object->setIsMaxScanDurationEnabled($data->{'IsMaxScanDurationEnabled'});
142
        }
143
        if (property_exists($data, 'MaxDynamicSignatures')) {
144
            $object->setMaxDynamicSignatures($data->{'MaxDynamicSignatures'});
145
        }
146
        if (property_exists($data, 'MaxScanDuration')) {
147
            $object->setMaxScanDuration($data->{'MaxScanDuration'});
148
        }
149
        if (property_exists($data, 'Scope')) {
150
            $object->setScope($data->{'Scope'});
151
        }
152
        if (property_exists($data, 'SubPathMaxDynamicSignatures')) {
153
            $object->setSubPathMaxDynamicSignatures($data->{'SubPathMaxDynamicSignatures'});
154
        }
155
        if (property_exists($data, 'TimeWindow')) {
156
            $object->setTimeWindow($this->denormalizer->denormalize($data->{'TimeWindow'}, 'Montross50\\NetsparkerCloud\\SDK\\Model\\ScanTimeWindowModel', 'json', $context));
157
        }
158
        if (property_exists($data, 'UrlRewriteAnalyzableExtensions')) {
159
            $object->setUrlRewriteAnalyzableExtensions($data->{'UrlRewriteAnalyzableExtensions'});
160
        }
161
        if (property_exists($data, 'UrlRewriteBlockSeparators')) {
162
            $object->setUrlRewriteBlockSeparators($data->{'UrlRewriteBlockSeparators'});
163
        }
164
        if (property_exists($data, 'UrlRewriteMode')) {
165
            $object->setUrlRewriteMode($data->{'UrlRewriteMode'});
166
        }
167
        if (property_exists($data, 'UrlRewriteRules')) {
168
            $values_5 = [];
169
            foreach ($data->{'UrlRewriteRules'} as $value_5) {
170
                $values_5[] = $this->denormalizer->denormalize($value_5, 'Montross50\\NetsparkerCloud\\SDK\\Model\\UrlRewriteRuleModel', 'json', $context);
171
            }
172
            $object->setUrlRewriteRules($values_5);
173
        }
174
175
        return $object;
176
    }
177
178
    public function normalize($object, $format = null, array $context = [])
179
    {
180
        $data = new \stdClass();
181
        if (null !== $object->getAgentGroupId()) {
182
            $data->{'AgentGroupId'} = $object->getAgentGroupId();
183
        }
184
        if (null !== $object->getAgentId()) {
185
            $data->{'AgentId'} = $object->getAgentId();
186
        }
187
        if (null !== $object->getCreateType()) {
188
            $data->{'CreateType'} = $object->getCreateType();
189
        }
190
        if (null !== $object->getIsPrimary()) {
191
            $data->{'IsPrimary'} = $object->getIsPrimary();
192
        }
193
        if (null !== $object->getIsShared()) {
194
            $data->{'IsShared'} = $object->getIsShared();
195
        }
196
        if (null !== $object->getIsTimeWindowEnabled()) {
197
            $data->{'IsTimeWindowEnabled'} = $object->getIsTimeWindowEnabled();
198
        }
199
        if (null !== $object->getPolicyId()) {
200
            $data->{'PolicyId'} = $object->getPolicyId();
201
        }
202
        if (null !== $object->getProfileId()) {
203
            $data->{'ProfileId'} = $object->getProfileId();
204
        }
205
        if (null !== $object->getProfileName()) {
206
            $data->{'ProfileName'} = $object->getProfileName();
207
        }
208
        if (null !== $object->getReportPolicyId()) {
209
            $data->{'ReportPolicyId'} = $object->getReportPolicyId();
210
        }
211
        if (null !== $object->getTargetUri()) {
212
            $data->{'TargetUri'} = $object->getTargetUri();
213
        }
214
        if (null !== $object->getUserId()) {
215
            $data->{'UserId'} = $object->getUserId();
216
        }
217
        if (null !== $object->getAdditionalWebsites()) {
218
            $values = [];
219
            foreach ($object->getAdditionalWebsites() as $value) {
220
                $values[] = $this->normalizer->normalize($value, 'json', $context);
221
            }
222
            $data->{'AdditionalWebsites'} = $values;
223
        }
224
        if (null !== $object->getBasicAuthenticationApiModel()) {
225
            $data->{'BasicAuthenticationApiModel'} = $this->normalizer->normalize($object->getBasicAuthenticationApiModel(), 'json', $context);
226
        }
227
        if (null !== $object->getClientCertificateAuthenticationSetting()) {
228
            $data->{'ClientCertificateAuthenticationSetting'} = $this->normalizer->normalize($object->getClientCertificateAuthenticationSetting(), 'json', $context);
229
        }
230
        if (null !== $object->getCookies()) {
231
            $data->{'Cookies'} = $object->getCookies();
232
        }
233
        if (null !== $object->getCrawlAndAttack()) {
234
            $data->{'CrawlAndAttack'} = $object->getCrawlAndAttack();
235
        }
236
        if (null !== $object->getEnableHeuristicChecksInCustomUrlRewrite()) {
237
            $data->{'EnableHeuristicChecksInCustomUrlRewrite'} = $object->getEnableHeuristicChecksInCustomUrlRewrite();
238
        }
239
        if (null !== $object->getExcludedLinks()) {
240
            $values_1 = [];
241
            foreach ($object->getExcludedLinks() as $value_1) {
242
                $values_1[] = $this->normalizer->normalize($value_1, 'json', $context);
243
            }
244
            $data->{'ExcludedLinks'} = $values_1;
245
        }
246
        if (null !== $object->getDisallowedHttpMethods()) {
247
            $values_2 = [];
248
            foreach ($object->getDisallowedHttpMethods() as $value_2) {
249
                $values_2[] = $value_2;
250
            }
251
            $data->{'DisallowedHttpMethods'} = $values_2;
252
        }
253
        if (null !== $object->getExcludeLinks()) {
254
            $data->{'ExcludeLinks'} = $object->getExcludeLinks();
255
        }
256
        if (null !== $object->getFindAndFollowNewLinks()) {
257
            $data->{'FindAndFollowNewLinks'} = $object->getFindAndFollowNewLinks();
258
        }
259
        if (null !== $object->getFormAuthenticationSettingModel()) {
260
            $data->{'FormAuthenticationSettingModel'} = $this->normalizer->normalize($object->getFormAuthenticationSettingModel(), 'json', $context);
261
        }
262
        if (null !== $object->getHeaderAuthentication()) {
263
            $data->{'HeaderAuthentication'} = $this->normalizer->normalize($object->getHeaderAuthentication(), 'json', $context);
264
        }
265
        if (null !== $object->getImportedLinks()) {
266
            $values_3 = [];
267
            foreach ($object->getImportedLinks() as $value_3) {
268
                $values_3[] = $value_3;
269
            }
270
            $data->{'ImportedLinks'} = $values_3;
271
        }
272
        if (null !== $object->getImportedFiles()) {
273
            $values_4 = [];
274
            foreach ($object->getImportedFiles() as $value_4) {
275
                $values_4[] = $this->normalizer->normalize($value_4, 'json', $context);
276
            }
277
            $data->{'ImportedFiles'} = $values_4;
278
        }
279
        if (null !== $object->getIsMaxScanDurationEnabled()) {
280
            $data->{'IsMaxScanDurationEnabled'} = $object->getIsMaxScanDurationEnabled();
281
        }
282
        if (null !== $object->getMaxDynamicSignatures()) {
283
            $data->{'MaxDynamicSignatures'} = $object->getMaxDynamicSignatures();
284
        }
285
        if (null !== $object->getMaxScanDuration()) {
286
            $data->{'MaxScanDuration'} = $object->getMaxScanDuration();
287
        }
288
        if (null !== $object->getScope()) {
289
            $data->{'Scope'} = $object->getScope();
290
        }
291
        if (null !== $object->getSubPathMaxDynamicSignatures()) {
292
            $data->{'SubPathMaxDynamicSignatures'} = $object->getSubPathMaxDynamicSignatures();
293
        }
294
        if (null !== $object->getTimeWindow()) {
295
            $data->{'TimeWindow'} = $this->normalizer->normalize($object->getTimeWindow(), 'json', $context);
296
        }
297
        if (null !== $object->getUrlRewriteAnalyzableExtensions()) {
298
            $data->{'UrlRewriteAnalyzableExtensions'} = $object->getUrlRewriteAnalyzableExtensions();
299
        }
300
        if (null !== $object->getUrlRewriteBlockSeparators()) {
301
            $data->{'UrlRewriteBlockSeparators'} = $object->getUrlRewriteBlockSeparators();
302
        }
303
        if (null !== $object->getUrlRewriteMode()) {
304
            $data->{'UrlRewriteMode'} = $object->getUrlRewriteMode();
305
        }
306
        if (null !== $object->getUrlRewriteRules()) {
307
            $values_5 = [];
308
            foreach ($object->getUrlRewriteRules() as $value_5) {
309
                $values_5[] = $this->normalizer->normalize($value_5, 'json', $context);
310
            }
311
            $data->{'UrlRewriteRules'} = $values_5;
312
        }
313
314
        return $data;
315
    }
316
}
317