JavaScriptSettingsModelNormalizer::denormalize()   F
last analyzed

Complexity

Conditions 22
Paths > 20000

Size

Total Lines 68
Code Lines 44

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 44
dl 0
loc 68
rs 0
c 0
b 0
f 0
cc 22
nc 1048577
nop 4

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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 JavaScriptSettingsModelNormalizer 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\\JavaScriptSettingsModel';
29
    }
30
31
    public function supportsNormalization($data, $format = null)
32
    {
33
        return $data instanceof \Montross50\NetsparkerCloud\SDK\Model\JavaScriptSettingsModel;
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\JavaScriptSettingsModel();
42
        if (property_exists($data, 'BailThreshold')) {
43
            $object->setBailThreshold($data->{'BailThreshold'});
44
        }
45
        if (property_exists($data, 'ConfirmOpenRedirectSimulateTimeout')) {
46
            $object->setConfirmOpenRedirectSimulateTimeout($data->{'ConfirmOpenRedirectSimulateTimeout'});
47
        }
48
        if (property_exists($data, 'ConfirmXssSimulateTimeout')) {
49
            $object->setConfirmXssSimulateTimeout($data->{'ConfirmXssSimulateTimeout'});
50
        }
51
        if (property_exists($data, 'DomParserAllowOutOfScopeXmlHttpRequests')) {
52
            $object->setDomParserAllowOutOfScopeXmlHttpRequests($data->{'DomParserAllowOutOfScopeXmlHttpRequests'});
53
        }
54
        if (property_exists($data, 'DomParserDfsLimit')) {
55
            $object->setDomParserDfsLimit($data->{'DomParserDfsLimit'});
56
        }
57
        if (property_exists($data, 'DomParserDotify')) {
58
            $object->setDomParserDotify($data->{'DomParserDotify'});
59
        }
60
        if (property_exists($data, 'DomParserExclusionCssSelector')) {
61
            $object->setDomParserExclusionCssSelector($data->{'DomParserExclusionCssSelector'});
62
        }
63
        if (property_exists($data, 'DomParserExtractResources')) {
64
            $object->setDomParserExtractResources($data->{'DomParserExtractResources'});
65
        }
66
        if (property_exists($data, 'DomParserFilterColonEvents')) {
67
            $object->setDomParserFilterColonEvents($data->{'DomParserFilterColonEvents'});
68
        }
69
        if (property_exists($data, 'DomParserFilterDocumentEvents')) {
70
            $object->setDomParserFilterDocumentEvents($data->{'DomParserFilterDocumentEvents'});
71
        }
72
        if (property_exists($data, 'DomParserIgnoreDocumentEvents')) {
73
            $object->setDomParserIgnoreDocumentEvents($data->{'DomParserIgnoreDocumentEvents'});
74
        }
75
        if (property_exists($data, 'DomParserLoadUrlTimeout')) {
76
            $object->setDomParserLoadUrlTimeout($data->{'DomParserLoadUrlTimeout'});
77
        }
78
        if (property_exists($data, 'DomParserMaxOptionElementsPerSelect')) {
79
            $object->setDomParserMaxOptionElementsPerSelect($data->{'DomParserMaxOptionElementsPerSelect'});
80
        }
81
        if (property_exists($data, 'DomParserPersistentJavaScriptCookies')) {
82
            $object->setDomParserPersistentJavaScriptCookies($data->{'DomParserPersistentJavaScriptCookies'});
83
        }
84
        if (property_exists($data, 'DomParserPreSimulateWait')) {
85
            $object->setDomParserPreSimulateWait($data->{'DomParserPreSimulateWait'});
86
        }
87
        if (property_exists($data, 'DomParserSimulationTimeout')) {
88
            $object->setDomParserSimulationTimeout($data->{'DomParserSimulationTimeout'});
89
        }
90
        if (property_exists($data, 'EnableDomParser')) {
91
            $object->setEnableDomParser($data->{'EnableDomParser'});
92
        }
93
        if (property_exists($data, 'IntereventTimeout')) {
94
            $object->setIntereventTimeout($data->{'IntereventTimeout'});
95
        }
96
        if (property_exists($data, 'SkipElementCount')) {
97
            $object->setSkipElementCount($data->{'SkipElementCount'});
98
        }
99
        if (property_exists($data, 'SkipThreshold')) {
100
            $object->setSkipThreshold($data->{'SkipThreshold'});
101
        }
102
103
        return $object;
104
    }
105
106
    public function normalize($object, $format = null, array $context = [])
107
    {
108
        $data = new \stdClass();
109
        if (null !== $object->getBailThreshold()) {
110
            $data->{'BailThreshold'} = $object->getBailThreshold();
111
        }
112
        if (null !== $object->getConfirmOpenRedirectSimulateTimeout()) {
113
            $data->{'ConfirmOpenRedirectSimulateTimeout'} = $object->getConfirmOpenRedirectSimulateTimeout();
114
        }
115
        if (null !== $object->getConfirmXssSimulateTimeout()) {
116
            $data->{'ConfirmXssSimulateTimeout'} = $object->getConfirmXssSimulateTimeout();
117
        }
118
        if (null !== $object->getDomParserAllowOutOfScopeXmlHttpRequests()) {
119
            $data->{'DomParserAllowOutOfScopeXmlHttpRequests'} = $object->getDomParserAllowOutOfScopeXmlHttpRequests();
120
        }
121
        if (null !== $object->getDomParserDfsLimit()) {
122
            $data->{'DomParserDfsLimit'} = $object->getDomParserDfsLimit();
123
        }
124
        if (null !== $object->getDomParserDotify()) {
125
            $data->{'DomParserDotify'} = $object->getDomParserDotify();
126
        }
127
        if (null !== $object->getDomParserExclusionCssSelector()) {
128
            $data->{'DomParserExclusionCssSelector'} = $object->getDomParserExclusionCssSelector();
129
        }
130
        if (null !== $object->getDomParserExtractResources()) {
131
            $data->{'DomParserExtractResources'} = $object->getDomParserExtractResources();
132
        }
133
        if (null !== $object->getDomParserFilterColonEvents()) {
134
            $data->{'DomParserFilterColonEvents'} = $object->getDomParserFilterColonEvents();
135
        }
136
        if (null !== $object->getDomParserFilterDocumentEvents()) {
137
            $data->{'DomParserFilterDocumentEvents'} = $object->getDomParserFilterDocumentEvents();
138
        }
139
        if (null !== $object->getDomParserIgnoreDocumentEvents()) {
140
            $data->{'DomParserIgnoreDocumentEvents'} = $object->getDomParserIgnoreDocumentEvents();
141
        }
142
        if (null !== $object->getDomParserLoadUrlTimeout()) {
143
            $data->{'DomParserLoadUrlTimeout'} = $object->getDomParserLoadUrlTimeout();
144
        }
145
        if (null !== $object->getDomParserMaxOptionElementsPerSelect()) {
146
            $data->{'DomParserMaxOptionElementsPerSelect'} = $object->getDomParserMaxOptionElementsPerSelect();
147
        }
148
        if (null !== $object->getDomParserPersistentJavaScriptCookies()) {
149
            $data->{'DomParserPersistentJavaScriptCookies'} = $object->getDomParserPersistentJavaScriptCookies();
150
        }
151
        if (null !== $object->getDomParserPreSimulateWait()) {
152
            $data->{'DomParserPreSimulateWait'} = $object->getDomParserPreSimulateWait();
153
        }
154
        if (null !== $object->getDomParserSimulationTimeout()) {
155
            $data->{'DomParserSimulationTimeout'} = $object->getDomParserSimulationTimeout();
156
        }
157
        if (null !== $object->getEnableDomParser()) {
158
            $data->{'EnableDomParser'} = $object->getEnableDomParser();
159
        }
160
        if (null !== $object->getIntereventTimeout()) {
161
            $data->{'IntereventTimeout'} = $object->getIntereventTimeout();
162
        }
163
        if (null !== $object->getSkipElementCount()) {
164
            $data->{'SkipElementCount'} = $object->getSkipElementCount();
165
        }
166
        if (null !== $object->getSkipThreshold()) {
167
            $data->{'SkipThreshold'} = $object->getSkipThreshold();
168
        }
169
170
        return $data;
171
    }
172
}
173