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