| Conditions | 34 |
| Paths | > 20000 |
| Total Lines | 110 |
| Code Lines | 74 |
| 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 |
||
| 151 | public function normalize($object, $format = null, array $context = []) |
||
| 152 | { |
||
| 153 | $data = new \stdClass(); |
||
| 154 | if (null !== $object->getTargetUri()) { |
||
| 155 | $data->{'TargetUri'} = $object->getTargetUri(); |
||
| 156 | } |
||
| 157 | if (null !== $object->getAdditionalWebsites()) { |
||
| 158 | $values = []; |
||
| 159 | foreach ($object->getAdditionalWebsites() as $value) { |
||
| 160 | $values[] = $this->normalizer->normalize($value, 'json', $context); |
||
| 161 | } |
||
| 162 | $data->{'AdditionalWebsites'} = $values; |
||
| 163 | } |
||
| 164 | if (null !== $object->getBasicAuthenticationApiModel()) { |
||
| 165 | $data->{'BasicAuthenticationApiModel'} = $this->normalizer->normalize($object->getBasicAuthenticationApiModel(), 'json', $context); |
||
| 166 | } |
||
| 167 | if (null !== $object->getClientCertificateAuthenticationSetting()) { |
||
| 168 | $data->{'ClientCertificateAuthenticationSetting'} = $this->normalizer->normalize($object->getClientCertificateAuthenticationSetting(), 'json', $context); |
||
| 169 | } |
||
| 170 | if (null !== $object->getCookies()) { |
||
| 171 | $data->{'Cookies'} = $object->getCookies(); |
||
| 172 | } |
||
| 173 | if (null !== $object->getCrawlAndAttack()) { |
||
| 174 | $data->{'CrawlAndAttack'} = $object->getCrawlAndAttack(); |
||
| 175 | } |
||
| 176 | if (null !== $object->getEnableHeuristicChecksInCustomUrlRewrite()) { |
||
| 177 | $data->{'EnableHeuristicChecksInCustomUrlRewrite'} = $object->getEnableHeuristicChecksInCustomUrlRewrite(); |
||
| 178 | } |
||
| 179 | if (null !== $object->getExcludedLinks()) { |
||
| 180 | $values_1 = []; |
||
| 181 | foreach ($object->getExcludedLinks() as $value_1) { |
||
| 182 | $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); |
||
| 183 | } |
||
| 184 | $data->{'ExcludedLinks'} = $values_1; |
||
| 185 | } |
||
| 186 | if (null !== $object->getDisallowedHttpMethods()) { |
||
| 187 | $values_2 = []; |
||
| 188 | foreach ($object->getDisallowedHttpMethods() as $value_2) { |
||
| 189 | $values_2[] = $value_2; |
||
| 190 | } |
||
| 191 | $data->{'DisallowedHttpMethods'} = $values_2; |
||
| 192 | } |
||
| 193 | if (null !== $object->getExcludeLinks()) { |
||
| 194 | $data->{'ExcludeLinks'} = $object->getExcludeLinks(); |
||
| 195 | } |
||
| 196 | if (null !== $object->getFindAndFollowNewLinks()) { |
||
| 197 | $data->{'FindAndFollowNewLinks'} = $object->getFindAndFollowNewLinks(); |
||
| 198 | } |
||
| 199 | if (null !== $object->getFormAuthenticationSettingModel()) { |
||
| 200 | $data->{'FormAuthenticationSettingModel'} = $this->normalizer->normalize($object->getFormAuthenticationSettingModel(), 'json', $context); |
||
| 201 | } |
||
| 202 | if (null !== $object->getHeaderAuthentication()) { |
||
| 203 | $data->{'HeaderAuthentication'} = $this->normalizer->normalize($object->getHeaderAuthentication(), 'json', $context); |
||
| 204 | } |
||
| 205 | if (null !== $object->getImportedLinks()) { |
||
| 206 | $values_3 = []; |
||
| 207 | foreach ($object->getImportedLinks() as $value_3) { |
||
| 208 | $values_3[] = $value_3; |
||
| 209 | } |
||
| 210 | $data->{'ImportedLinks'} = $values_3; |
||
| 211 | } |
||
| 212 | if (null !== $object->getImportedFiles()) { |
||
| 213 | $values_4 = []; |
||
| 214 | foreach ($object->getImportedFiles() as $value_4) { |
||
| 215 | $values_4[] = $this->normalizer->normalize($value_4, 'json', $context); |
||
| 216 | } |
||
| 217 | $data->{'ImportedFiles'} = $values_4; |
||
| 218 | } |
||
| 219 | if (null !== $object->getIsMaxScanDurationEnabled()) { |
||
| 220 | $data->{'IsMaxScanDurationEnabled'} = $object->getIsMaxScanDurationEnabled(); |
||
| 221 | } |
||
| 222 | if (null !== $object->getMaxDynamicSignatures()) { |
||
| 223 | $data->{'MaxDynamicSignatures'} = $object->getMaxDynamicSignatures(); |
||
| 224 | } |
||
| 225 | if (null !== $object->getMaxScanDuration()) { |
||
| 226 | $data->{'MaxScanDuration'} = $object->getMaxScanDuration(); |
||
| 227 | } |
||
| 228 | if (null !== $object->getPolicyId()) { |
||
| 229 | $data->{'PolicyId'} = $object->getPolicyId(); |
||
| 230 | } |
||
| 231 | if (null !== $object->getReportPolicyId()) { |
||
| 232 | $data->{'ReportPolicyId'} = $object->getReportPolicyId(); |
||
| 233 | } |
||
| 234 | if (null !== $object->getScope()) { |
||
| 235 | $data->{'Scope'} = $object->getScope(); |
||
| 236 | } |
||
| 237 | if (null !== $object->getSubPathMaxDynamicSignatures()) { |
||
| 238 | $data->{'SubPathMaxDynamicSignatures'} = $object->getSubPathMaxDynamicSignatures(); |
||
| 239 | } |
||
| 240 | if (null !== $object->getTimeWindow()) { |
||
| 241 | $data->{'TimeWindow'} = $this->normalizer->normalize($object->getTimeWindow(), 'json', $context); |
||
| 242 | } |
||
| 243 | if (null !== $object->getUrlRewriteAnalyzableExtensions()) { |
||
| 244 | $data->{'UrlRewriteAnalyzableExtensions'} = $object->getUrlRewriteAnalyzableExtensions(); |
||
| 245 | } |
||
| 246 | if (null !== $object->getUrlRewriteBlockSeparators()) { |
||
| 247 | $data->{'UrlRewriteBlockSeparators'} = $object->getUrlRewriteBlockSeparators(); |
||
| 248 | } |
||
| 249 | if (null !== $object->getUrlRewriteMode()) { |
||
| 250 | $data->{'UrlRewriteMode'} = $object->getUrlRewriteMode(); |
||
| 251 | } |
||
| 252 | if (null !== $object->getUrlRewriteRules()) { |
||
| 253 | $values_5 = []; |
||
| 254 | foreach ($object->getUrlRewriteRules() as $value_5) { |
||
| 255 | $values_5[] = $this->normalizer->normalize($value_5, 'json', $context); |
||
| 256 | } |
||
| 257 | $data->{'UrlRewriteRules'} = $values_5; |
||
| 258 | } |
||
| 259 | |||
| 260 | return $data; |
||
| 261 | } |
||
| 263 |