AttackingSettingModelNormalizer::normalize()   F
last analyzed

Complexity

Conditions 12
Paths 2048

Size

Total Lines 38
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 24
dl 0
loc 38
rs 2.8
c 0
b 0
f 0
cc 12
nc 2048
nop 3

How to fix   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 AttackingSettingModelNormalizer 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\\AttackingSettingModel';
29
    }
30
31
    public function supportsNormalization($data, $format = null)
32
    {
33
        return $data instanceof \Montross50\NetsparkerCloud\SDK\Model\AttackingSettingModel;
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\AttackingSettingModel();
42
        if (property_exists($data, 'AntiCsrfTokenNames')) {
43
            $object->setAntiCsrfTokenNames($data->{'AntiCsrfTokenNames'});
44
        }
45
        if (property_exists($data, 'AttackParameterName')) {
46
            $object->setAttackParameterName($data->{'AttackParameterName'});
47
        }
48
        if (property_exists($data, 'AttackRefererHeader')) {
49
            $object->setAttackRefererHeader($data->{'AttackRefererHeader'});
50
        }
51
        if (property_exists($data, 'AttackUserAgentHeader')) {
52
            $object->setAttackUserAgentHeader($data->{'AttackUserAgentHeader'});
53
        }
54
        if (property_exists($data, 'AttackCookies')) {
55
            $object->setAttackCookies($data->{'AttackCookies'});
56
        }
57
        if (property_exists($data, 'MaxParametersToAttack')) {
58
            $object->setMaxParametersToAttack($data->{'MaxParametersToAttack'});
59
        }
60
        if (property_exists($data, 'OptimizeAttacksToRecurringParameters')) {
61
            $object->setOptimizeAttacksToRecurringParameters($data->{'OptimizeAttacksToRecurringParameters'});
62
        }
63
        if (property_exists($data, 'OptimizeHeaderAttacks')) {
64
            $object->setOptimizeHeaderAttacks($data->{'OptimizeHeaderAttacks'});
65
        }
66
        if (property_exists($data, 'ProofGenerationEnabled')) {
67
            $object->setProofGenerationEnabled($data->{'ProofGenerationEnabled'});
68
        }
69
        if (property_exists($data, 'RecurringParametersPageAttackLimit')) {
70
            $object->setRecurringParametersPageAttackLimit($data->{'RecurringParametersPageAttackLimit'});
71
        }
72
        if (property_exists($data, 'UseExtraParameters')) {
73
            $object->setUseExtraParameters($data->{'UseExtraParameters'});
74
        }
75
76
        return $object;
77
    }
78
79
    public function normalize($object, $format = null, array $context = [])
80
    {
81
        $data = new \stdClass();
82
        if (null !== $object->getAntiCsrfTokenNames()) {
83
            $data->{'AntiCsrfTokenNames'} = $object->getAntiCsrfTokenNames();
84
        }
85
        if (null !== $object->getAttackParameterName()) {
86
            $data->{'AttackParameterName'} = $object->getAttackParameterName();
87
        }
88
        if (null !== $object->getAttackRefererHeader()) {
89
            $data->{'AttackRefererHeader'} = $object->getAttackRefererHeader();
90
        }
91
        if (null !== $object->getAttackUserAgentHeader()) {
92
            $data->{'AttackUserAgentHeader'} = $object->getAttackUserAgentHeader();
93
        }
94
        if (null !== $object->getAttackCookies()) {
95
            $data->{'AttackCookies'} = $object->getAttackCookies();
96
        }
97
        if (null !== $object->getMaxParametersToAttack()) {
98
            $data->{'MaxParametersToAttack'} = $object->getMaxParametersToAttack();
99
        }
100
        if (null !== $object->getOptimizeAttacksToRecurringParameters()) {
101
            $data->{'OptimizeAttacksToRecurringParameters'} = $object->getOptimizeAttacksToRecurringParameters();
102
        }
103
        if (null !== $object->getOptimizeHeaderAttacks()) {
104
            $data->{'OptimizeHeaderAttacks'} = $object->getOptimizeHeaderAttacks();
105
        }
106
        if (null !== $object->getProofGenerationEnabled()) {
107
            $data->{'ProofGenerationEnabled'} = $object->getProofGenerationEnabled();
108
        }
109
        if (null !== $object->getRecurringParametersPageAttackLimit()) {
110
            $data->{'RecurringParametersPageAttackLimit'} = $object->getRecurringParametersPageAttackLimit();
111
        }
112
        if (null !== $object->getUseExtraParameters()) {
113
            $data->{'UseExtraParameters'} = $object->getUseExtraParameters();
114
        }
115
116
        return $data;
117
    }
118
}
119