| Conditions | 35 |
| Paths | > 20000 |
| Total Lines | 113 |
| Code Lines | 76 |
| 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\NewScanTaskApiModel(); |
||
| 42 | if (property_exists($data, 'TargetUri')) { |
||
| 43 | $object->setTargetUri($data->{'TargetUri'}); |
||
| 44 | } |
||
| 45 | if (property_exists($data, 'AdditionalWebsites')) { |
||
| 46 | $values = []; |
||
| 47 | foreach ($data->{'AdditionalWebsites'} as $value) { |
||
| 48 | $values[] = $this->denormalizer->denormalize($value, 'Montross50\\NetsparkerCloud\\SDK\\Model\\AdditionalWebsiteModel', 'json', $context); |
||
| 49 | } |
||
| 50 | $object->setAdditionalWebsites($values); |
||
| 51 | } |
||
| 52 | if (property_exists($data, 'BasicAuthenticationApiModel')) { |
||
| 53 | $object->setBasicAuthenticationApiModel($this->denormalizer->denormalize($data->{'BasicAuthenticationApiModel'}, 'Montross50\\NetsparkerCloud\\SDK\\Model\\BasicAuthenticationSettingModel', 'json', $context)); |
||
| 54 | } |
||
| 55 | if (property_exists($data, 'ClientCertificateAuthenticationSetting')) { |
||
| 56 | $object->setClientCertificateAuthenticationSetting($this->denormalizer->denormalize($data->{'ClientCertificateAuthenticationSetting'}, 'Montross50\\NetsparkerCloud\\SDK\\Model\\ClientCertificateAuthenticationApiModel', 'json', $context)); |
||
| 57 | } |
||
| 58 | if (property_exists($data, 'Cookies')) { |
||
| 59 | $object->setCookies($data->{'Cookies'}); |
||
| 60 | } |
||
| 61 | if (property_exists($data, 'CrawlAndAttack')) { |
||
| 62 | $object->setCrawlAndAttack($data->{'CrawlAndAttack'}); |
||
| 63 | } |
||
| 64 | if (property_exists($data, 'EnableHeuristicChecksInCustomUrlRewrite')) { |
||
| 65 | $object->setEnableHeuristicChecksInCustomUrlRewrite($data->{'EnableHeuristicChecksInCustomUrlRewrite'}); |
||
| 66 | } |
||
| 67 | if (property_exists($data, 'ExcludedLinks')) { |
||
| 68 | $values_1 = []; |
||
| 69 | foreach ($data->{'ExcludedLinks'} as $value_1) { |
||
| 70 | $values_1[] = $this->denormalizer->denormalize($value_1, 'Montross50\\NetsparkerCloud\\SDK\\Model\\ExcludedLinkModel', 'json', $context); |
||
| 71 | } |
||
| 72 | $object->setExcludedLinks($values_1); |
||
| 73 | } |
||
| 74 | if (property_exists($data, 'DisallowedHttpMethods')) { |
||
| 75 | $values_2 = []; |
||
| 76 | foreach ($data->{'DisallowedHttpMethods'} as $value_2) { |
||
| 77 | $values_2[] = $value_2; |
||
| 78 | } |
||
| 79 | $object->setDisallowedHttpMethods($values_2); |
||
| 80 | } |
||
| 81 | if (property_exists($data, 'ExcludeLinks')) { |
||
| 82 | $object->setExcludeLinks($data->{'ExcludeLinks'}); |
||
| 83 | } |
||
| 84 | if (property_exists($data, 'FindAndFollowNewLinks')) { |
||
| 85 | $object->setFindAndFollowNewLinks($data->{'FindAndFollowNewLinks'}); |
||
| 86 | } |
||
| 87 | if (property_exists($data, 'FormAuthenticationSettingModel')) { |
||
| 88 | $object->setFormAuthenticationSettingModel($this->denormalizer->denormalize($data->{'FormAuthenticationSettingModel'}, 'Montross50\\NetsparkerCloud\\SDK\\Model\\FormAuthenticationSettingModel', 'json', $context)); |
||
| 89 | } |
||
| 90 | if (property_exists($data, 'HeaderAuthentication')) { |
||
| 91 | $object->setHeaderAuthentication($this->denormalizer->denormalize($data->{'HeaderAuthentication'}, 'Montross50\\NetsparkerCloud\\SDK\\Model\\HeaderAuthenticationModel', 'json', $context)); |
||
| 92 | } |
||
| 93 | if (property_exists($data, 'ImportedLinks')) { |
||
| 94 | $values_3 = []; |
||
| 95 | foreach ($data->{'ImportedLinks'} as $value_3) { |
||
| 96 | $values_3[] = $value_3; |
||
| 97 | } |
||
| 98 | $object->setImportedLinks($values_3); |
||
| 99 | } |
||
| 100 | if (property_exists($data, 'ImportedFiles')) { |
||
| 101 | $values_4 = []; |
||
| 102 | foreach ($data->{'ImportedFiles'} as $value_4) { |
||
| 103 | $values_4[] = $this->denormalizer->denormalize($value_4, 'Montross50\\NetsparkerCloud\\SDK\\Model\\ApiFileModel', 'json', $context); |
||
| 104 | } |
||
| 105 | $object->setImportedFiles($values_4); |
||
| 106 | } |
||
| 107 | if (property_exists($data, 'IsMaxScanDurationEnabled')) { |
||
| 108 | $object->setIsMaxScanDurationEnabled($data->{'IsMaxScanDurationEnabled'}); |
||
| 109 | } |
||
| 110 | if (property_exists($data, 'MaxDynamicSignatures')) { |
||
| 111 | $object->setMaxDynamicSignatures($data->{'MaxDynamicSignatures'}); |
||
| 112 | } |
||
| 113 | if (property_exists($data, 'MaxScanDuration')) { |
||
| 114 | $object->setMaxScanDuration($data->{'MaxScanDuration'}); |
||
| 115 | } |
||
| 116 | if (property_exists($data, 'PolicyId')) { |
||
| 117 | $object->setPolicyId($data->{'PolicyId'}); |
||
| 118 | } |
||
| 119 | if (property_exists($data, 'ReportPolicyId')) { |
||
| 120 | $object->setReportPolicyId($data->{'ReportPolicyId'}); |
||
| 121 | } |
||
| 122 | if (property_exists($data, 'Scope')) { |
||
| 123 | $object->setScope($data->{'Scope'}); |
||
| 124 | } |
||
| 125 | if (property_exists($data, 'SubPathMaxDynamicSignatures')) { |
||
| 126 | $object->setSubPathMaxDynamicSignatures($data->{'SubPathMaxDynamicSignatures'}); |
||
| 127 | } |
||
| 128 | if (property_exists($data, 'TimeWindow')) { |
||
| 129 | $object->setTimeWindow($this->denormalizer->denormalize($data->{'TimeWindow'}, 'Montross50\\NetsparkerCloud\\SDK\\Model\\ScanTimeWindowModel', 'json', $context)); |
||
| 130 | } |
||
| 131 | if (property_exists($data, 'UrlRewriteAnalyzableExtensions')) { |
||
| 132 | $object->setUrlRewriteAnalyzableExtensions($data->{'UrlRewriteAnalyzableExtensions'}); |
||
| 133 | } |
||
| 134 | if (property_exists($data, 'UrlRewriteBlockSeparators')) { |
||
| 135 | $object->setUrlRewriteBlockSeparators($data->{'UrlRewriteBlockSeparators'}); |
||
| 136 | } |
||
| 137 | if (property_exists($data, 'UrlRewriteMode')) { |
||
| 138 | $object->setUrlRewriteMode($data->{'UrlRewriteMode'}); |
||
| 139 | } |
||
| 140 | if (property_exists($data, 'UrlRewriteRules')) { |
||
| 141 | $values_5 = []; |
||
| 142 | foreach ($data->{'UrlRewriteRules'} as $value_5) { |
||
| 143 | $values_5[] = $this->denormalizer->denormalize($value_5, 'Montross50\\NetsparkerCloud\\SDK\\Model\\UrlRewriteRuleModel', 'json', $context); |
||
| 144 | } |
||
| 145 | $object->setUrlRewriteRules($values_5); |
||
| 146 | } |
||
| 147 | |||
| 148 | return $object; |
||
| 149 | } |
||
| 263 |