| Conditions | 13 |
| Paths | 1025 |
| Total Lines | 42 |
| Code Lines | 27 |
| 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\AccountLicenseApiModel(); |
||
| 42 | if (property_exists($data, 'SubscriptionMaximumSiteLimit')) { |
||
| 43 | $object->setSubscriptionMaximumSiteLimit($data->{'SubscriptionMaximumSiteLimit'}); |
||
| 44 | } |
||
| 45 | if (property_exists($data, 'SubscriptionSiteCount')) { |
||
| 46 | $object->setSubscriptionSiteCount($data->{'SubscriptionSiteCount'}); |
||
| 47 | } |
||
| 48 | if (property_exists($data, 'SubscriptionEndDate')) { |
||
| 49 | $object->setSubscriptionEndDate($data->{'SubscriptionEndDate'}); |
||
| 50 | } |
||
| 51 | if (property_exists($data, 'SubscriptionStartDate')) { |
||
| 52 | $object->setSubscriptionStartDate($data->{'SubscriptionStartDate'}); |
||
| 53 | } |
||
| 54 | if (property_exists($data, 'IsAccountWhitelisted')) { |
||
| 55 | $object->setIsAccountWhitelisted($data->{'IsAccountWhitelisted'}); |
||
| 56 | } |
||
| 57 | if (property_exists($data, 'UsedScanCreditCount')) { |
||
| 58 | $object->setUsedScanCreditCount($data->{'UsedScanCreditCount'}); |
||
| 59 | } |
||
| 60 | if (property_exists($data, 'ScanCreditCount')) { |
||
| 61 | $object->setScanCreditCount($data->{'ScanCreditCount'}); |
||
| 62 | } |
||
| 63 | if (property_exists($data, 'IsCreditScanEnabled')) { |
||
| 64 | $object->setIsCreditScanEnabled($data->{'IsCreditScanEnabled'}); |
||
| 65 | } |
||
| 66 | if (property_exists($data, 'IsSubscriptionEnabled')) { |
||
| 67 | $object->setIsSubscriptionEnabled($data->{'IsSubscriptionEnabled'}); |
||
| 68 | } |
||
| 69 | if (property_exists($data, 'PreVerifiedWebsites')) { |
||
| 70 | $values = []; |
||
| 71 | foreach ($data->{'PreVerifiedWebsites'} as $value) { |
||
| 72 | $values[] = $value; |
||
| 73 | } |
||
| 74 | $object->setPreVerifiedWebsites($values); |
||
| 75 | } |
||
| 76 | |||
| 77 | return $object; |
||
| 78 | } |
||
| 121 |