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