Conditions | 39 |
Paths | > 20000 |
Total Lines | 129 |
Code Lines | 88 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
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:
If many parameters/temporary variables are present:
1 | <?php |
||
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\ScanPolicySettingApiModel(); |
||
42 | if (property_exists($data, 'IsReadonly')) { |
||
43 | $object->setIsReadonly($data->{'IsReadonly'}); |
||
44 | } |
||
45 | if (property_exists($data, 'Id')) { |
||
46 | $object->setId($data->{'Id'}); |
||
47 | } |
||
48 | if (property_exists($data, 'IsShared')) { |
||
49 | $object->setIsShared($data->{'IsShared'}); |
||
50 | } |
||
51 | if (property_exists($data, 'DesktopId')) { |
||
52 | $object->setDesktopId($data->{'DesktopId'}); |
||
53 | } |
||
54 | if (property_exists($data, 'AttackingSettings')) { |
||
55 | $object->setAttackingSettings($this->denormalizer->denormalize($data->{'AttackingSettings'}, 'Montross50\\NetsparkerCloud\\SDK\\Model\\AttackingSettingModel', 'json', $context)); |
||
56 | } |
||
57 | if (property_exists($data, 'AutoCompleteSettings')) { |
||
58 | $values = []; |
||
59 | foreach ($data->{'AutoCompleteSettings'} as $value) { |
||
60 | $values[] = $this->denormalizer->denormalize($value, 'Montross50\\NetsparkerCloud\\SDK\\Model\\AutoCompleteSettingModel', 'json', $context); |
||
61 | } |
||
62 | $object->setAutoCompleteSettings($values); |
||
63 | } |
||
64 | if (property_exists($data, 'BruteForceSettings')) { |
||
65 | $object->setBruteForceSettings($this->denormalizer->denormalize($data->{'BruteForceSettings'}, 'Montross50\\NetsparkerCloud\\SDK\\Model\\BruteForceSettingModel', 'json', $context)); |
||
66 | } |
||
67 | if (property_exists($data, 'CrawlingSettings')) { |
||
68 | $object->setCrawlingSettings($this->denormalizer->denormalize($data->{'CrawlingSettings'}, 'Montross50\\NetsparkerCloud\\SDK\\Model\\CrawlingSettingModel', 'json', $context)); |
||
69 | } |
||
70 | if (property_exists($data, 'CsrfSettings')) { |
||
71 | $object->setCsrfSettings($this->denormalizer->denormalize($data->{'CsrfSettings'}, 'Montross50\\NetsparkerCloud\\SDK\\Model\\CsrfSettingModel', 'json', $context)); |
||
72 | } |
||
73 | if (property_exists($data, 'Custom404Settings')) { |
||
74 | $object->setCustom404Settings($this->denormalizer->denormalize($data->{'Custom404Settings'}, 'Montross50\\NetsparkerCloud\\SDK\\Model\\Custom404SettingModel', 'json', $context)); |
||
75 | } |
||
76 | if (property_exists($data, 'CustomHttpHeaderSettings')) { |
||
77 | $values_1 = []; |
||
78 | foreach ($data->{'CustomHttpHeaderSettings'} as $value_1) { |
||
79 | $values_1[] = $this->denormalizer->denormalize($value_1, 'Montross50\\NetsparkerCloud\\SDK\\Model\\CustomHttpHeaderSetting', 'json', $context); |
||
80 | } |
||
81 | $object->setCustomHttpHeaderSettings($values_1); |
||
82 | } |
||
83 | if (property_exists($data, 'Description')) { |
||
84 | $object->setDescription($data->{'Description'}); |
||
85 | } |
||
86 | if (property_exists($data, 'EnableKnowledgebase')) { |
||
87 | $object->setEnableKnowledgebase($data->{'EnableKnowledgebase'}); |
||
88 | } |
||
89 | if (property_exists($data, 'FormValueSettings')) { |
||
90 | $values_2 = []; |
||
91 | foreach ($data->{'FormValueSettings'} as $value_2) { |
||
92 | $values_2[] = $this->denormalizer->denormalize($value_2, 'Montross50\\NetsparkerCloud\\SDK\\Model\\FormValueSettingModel', 'json', $context); |
||
93 | } |
||
94 | $object->setFormValueSettings($values_2); |
||
95 | } |
||
96 | if (property_exists($data, 'HttpRequestSettings')) { |
||
97 | $object->setHttpRequestSettings($this->denormalizer->denormalize($data->{'HttpRequestSettings'}, 'Montross50\\NetsparkerCloud\\SDK\\Model\\HttpRequestSettingModel', 'json', $context)); |
||
98 | } |
||
99 | if (property_exists($data, 'IgnoredEmailPatterns')) { |
||
100 | $values_3 = []; |
||
101 | foreach ($data->{'IgnoredEmailPatterns'} as $value_3) { |
||
102 | $values_3[] = $this->denormalizer->denormalize($value_3, 'Montross50\\NetsparkerCloud\\SDK\\Model\\EmailPatternSetting', 'json', $context); |
||
103 | } |
||
104 | $object->setIgnoredEmailPatterns($values_3); |
||
105 | } |
||
106 | if (property_exists($data, 'IgnorePatternSettings')) { |
||
107 | $values_4 = []; |
||
108 | foreach ($data->{'IgnorePatternSettings'} as $value_4) { |
||
109 | $values_4[] = $this->denormalizer->denormalize($value_4, 'Montross50\\NetsparkerCloud\\SDK\\Model\\IgnorePatternSettingModel', 'json', $context); |
||
110 | } |
||
111 | $object->setIgnorePatternSettings($values_4); |
||
112 | } |
||
113 | if (property_exists($data, 'JavaScriptSettings')) { |
||
114 | $object->setJavaScriptSettings($this->denormalizer->denormalize($data->{'JavaScriptSettings'}, 'Montross50\\NetsparkerCloud\\SDK\\Model\\JavaScriptSettingsModel', 'json', $context)); |
||
115 | } |
||
116 | if (property_exists($data, 'Name')) { |
||
117 | $object->setName($data->{'Name'}); |
||
118 | } |
||
119 | if (property_exists($data, 'ProxySettings')) { |
||
120 | $object->setProxySettings($this->denormalizer->denormalize($data->{'ProxySettings'}, 'Montross50\\NetsparkerCloud\\SDK\\Model\\ProxySettingsModel', 'json', $context)); |
||
121 | } |
||
122 | if (property_exists($data, 'ScopeSettings')) { |
||
123 | $object->setScopeSettings($this->denormalizer->denormalize($data->{'ScopeSettings'}, 'Montross50\\NetsparkerCloud\\SDK\\Model\\ScopeSettingModel', 'json', $context)); |
||
124 | } |
||
125 | if (property_exists($data, 'SecurityCheckGroups')) { |
||
126 | $values_5 = []; |
||
127 | foreach ($data->{'SecurityCheckGroups'} as $value_5) { |
||
128 | $values_5[] = $this->denormalizer->denormalize($value_5, 'Montross50\\NetsparkerCloud\\SDK\\Model\\SecurityCheckGroupModel', 'json', $context); |
||
129 | } |
||
130 | $object->setSecurityCheckGroups($values_5); |
||
131 | } |
||
132 | if (property_exists($data, 'SelectedGroups')) { |
||
133 | $values_6 = []; |
||
134 | foreach ($data->{'SelectedGroups'} as $value_6) { |
||
135 | $values_6[] = $value_6; |
||
136 | } |
||
137 | $object->setSelectedGroups($values_6); |
||
138 | } |
||
139 | if (property_exists($data, 'SensitiveKeywordSettings')) { |
||
140 | $values_7 = []; |
||
141 | foreach ($data->{'SensitiveKeywordSettings'} as $value_7) { |
||
142 | $values_7[] = $this->denormalizer->denormalize($value_7, 'Montross50\\NetsparkerCloud\\SDK\\Model\\SensitiveKeywordSettingModel', 'json', $context); |
||
143 | } |
||
144 | $object->setSensitiveKeywordSettings($values_7); |
||
145 | } |
||
146 | if (property_exists($data, 'SslTlsSettingModel')) { |
||
147 | $object->setSslTlsSettingModel($this->denormalizer->denormalize($data->{'SslTlsSettingModel'}, 'Montross50\\NetsparkerCloud\\SDK\\Model\\SslTlsSettingModel', 'json', $context)); |
||
148 | } |
||
149 | if (property_exists($data, 'WebStorageSettings')) { |
||
150 | $values_8 = []; |
||
151 | foreach ($data->{'WebStorageSettings'} as $value_8) { |
||
152 | $values_8[] = $this->denormalizer->denormalize($value_8, 'Montross50\\NetsparkerCloud\\SDK\\Model\\WebStorageSetting', 'json', $context); |
||
153 | } |
||
154 | $object->setWebStorageSettings($values_8); |
||
155 | } |
||
156 | if (property_exists($data, 'ExtensionSettings')) { |
||
157 | $values_9 = []; |
||
158 | foreach ($data->{'ExtensionSettings'} as $value_9) { |
||
159 | $values_9[] = $this->denormalizer->denormalize($value_9, 'Montross50\\NetsparkerCloud\\SDK\\Model\\ExtensionSettingModel', 'json', $context); |
||
160 | } |
||
161 | $object->setExtensionSettings($values_9); |
||
162 | } |
||
163 | |||
164 | return $object; |
||
165 | } |
||
295 |