| Conditions | 22 |
| Paths | > 20000 |
| Total Lines | 68 |
| Code Lines | 44 |
| 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\JavaScriptSettingsModel(); |
||
| 42 | if (property_exists($data, 'BailThreshold')) { |
||
| 43 | $object->setBailThreshold($data->{'BailThreshold'}); |
||
| 44 | } |
||
| 45 | if (property_exists($data, 'ConfirmOpenRedirectSimulateTimeout')) { |
||
| 46 | $object->setConfirmOpenRedirectSimulateTimeout($data->{'ConfirmOpenRedirectSimulateTimeout'}); |
||
| 47 | } |
||
| 48 | if (property_exists($data, 'ConfirmXssSimulateTimeout')) { |
||
| 49 | $object->setConfirmXssSimulateTimeout($data->{'ConfirmXssSimulateTimeout'}); |
||
| 50 | } |
||
| 51 | if (property_exists($data, 'DomParserAllowOutOfScopeXmlHttpRequests')) { |
||
| 52 | $object->setDomParserAllowOutOfScopeXmlHttpRequests($data->{'DomParserAllowOutOfScopeXmlHttpRequests'}); |
||
| 53 | } |
||
| 54 | if (property_exists($data, 'DomParserDfsLimit')) { |
||
| 55 | $object->setDomParserDfsLimit($data->{'DomParserDfsLimit'}); |
||
| 56 | } |
||
| 57 | if (property_exists($data, 'DomParserDotify')) { |
||
| 58 | $object->setDomParserDotify($data->{'DomParserDotify'}); |
||
| 59 | } |
||
| 60 | if (property_exists($data, 'DomParserExclusionCssSelector')) { |
||
| 61 | $object->setDomParserExclusionCssSelector($data->{'DomParserExclusionCssSelector'}); |
||
| 62 | } |
||
| 63 | if (property_exists($data, 'DomParserExtractResources')) { |
||
| 64 | $object->setDomParserExtractResources($data->{'DomParserExtractResources'}); |
||
| 65 | } |
||
| 66 | if (property_exists($data, 'DomParserFilterColonEvents')) { |
||
| 67 | $object->setDomParserFilterColonEvents($data->{'DomParserFilterColonEvents'}); |
||
| 68 | } |
||
| 69 | if (property_exists($data, 'DomParserFilterDocumentEvents')) { |
||
| 70 | $object->setDomParserFilterDocumentEvents($data->{'DomParserFilterDocumentEvents'}); |
||
| 71 | } |
||
| 72 | if (property_exists($data, 'DomParserIgnoreDocumentEvents')) { |
||
| 73 | $object->setDomParserIgnoreDocumentEvents($data->{'DomParserIgnoreDocumentEvents'}); |
||
| 74 | } |
||
| 75 | if (property_exists($data, 'DomParserLoadUrlTimeout')) { |
||
| 76 | $object->setDomParserLoadUrlTimeout($data->{'DomParserLoadUrlTimeout'}); |
||
| 77 | } |
||
| 78 | if (property_exists($data, 'DomParserMaxOptionElementsPerSelect')) { |
||
| 79 | $object->setDomParserMaxOptionElementsPerSelect($data->{'DomParserMaxOptionElementsPerSelect'}); |
||
| 80 | } |
||
| 81 | if (property_exists($data, 'DomParserPersistentJavaScriptCookies')) { |
||
| 82 | $object->setDomParserPersistentJavaScriptCookies($data->{'DomParserPersistentJavaScriptCookies'}); |
||
| 83 | } |
||
| 84 | if (property_exists($data, 'DomParserPreSimulateWait')) { |
||
| 85 | $object->setDomParserPreSimulateWait($data->{'DomParserPreSimulateWait'}); |
||
| 86 | } |
||
| 87 | if (property_exists($data, 'DomParserSimulationTimeout')) { |
||
| 88 | $object->setDomParserSimulationTimeout($data->{'DomParserSimulationTimeout'}); |
||
| 89 | } |
||
| 90 | if (property_exists($data, 'EnableDomParser')) { |
||
| 91 | $object->setEnableDomParser($data->{'EnableDomParser'}); |
||
| 92 | } |
||
| 93 | if (property_exists($data, 'IntereventTimeout')) { |
||
| 94 | $object->setIntereventTimeout($data->{'IntereventTimeout'}); |
||
| 95 | } |
||
| 96 | if (property_exists($data, 'SkipElementCount')) { |
||
| 97 | $object->setSkipElementCount($data->{'SkipElementCount'}); |
||
| 98 | } |
||
| 99 | if (property_exists($data, 'SkipThreshold')) { |
||
| 100 | $object->setSkipThreshold($data->{'SkipThreshold'}); |
||
| 101 | } |
||
| 102 | |||
| 103 | return $object; |
||
| 104 | } |
||
| 173 |