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