| Conditions | 12 |
| Paths | 1024 |
| Total Lines | 39 |
| Code Lines | 25 |
| 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 |
||
| 80 | public function normalize($object, $format = null, array $context = []) |
||
| 81 | { |
||
| 82 | $data = new \stdClass(); |
||
| 83 | if (null !== $object->getSubscriptionMaximumSiteLimit()) { |
||
| 84 | $data->{'SubscriptionMaximumSiteLimit'} = $object->getSubscriptionMaximumSiteLimit(); |
||
| 85 | } |
||
| 86 | if (null !== $object->getSubscriptionSiteCount()) { |
||
| 87 | $data->{'SubscriptionSiteCount'} = $object->getSubscriptionSiteCount(); |
||
| 88 | } |
||
| 89 | if (null !== $object->getSubscriptionEndDate()) { |
||
| 90 | $data->{'SubscriptionEndDate'} = $object->getSubscriptionEndDate(); |
||
| 91 | } |
||
| 92 | if (null !== $object->getSubscriptionStartDate()) { |
||
| 93 | $data->{'SubscriptionStartDate'} = $object->getSubscriptionStartDate(); |
||
| 94 | } |
||
| 95 | if (null !== $object->getIsAccountWhitelisted()) { |
||
| 96 | $data->{'IsAccountWhitelisted'} = $object->getIsAccountWhitelisted(); |
||
| 97 | } |
||
| 98 | if (null !== $object->getUsedScanCreditCount()) { |
||
| 99 | $data->{'UsedScanCreditCount'} = $object->getUsedScanCreditCount(); |
||
| 100 | } |
||
| 101 | if (null !== $object->getScanCreditCount()) { |
||
| 102 | $data->{'ScanCreditCount'} = $object->getScanCreditCount(); |
||
| 103 | } |
||
| 104 | if (null !== $object->getIsCreditScanEnabled()) { |
||
| 105 | $data->{'IsCreditScanEnabled'} = $object->getIsCreditScanEnabled(); |
||
| 106 | } |
||
| 107 | if (null !== $object->getIsSubscriptionEnabled()) { |
||
| 108 | $data->{'IsSubscriptionEnabled'} = $object->getIsSubscriptionEnabled(); |
||
| 109 | } |
||
| 110 | if (null !== $object->getPreVerifiedWebsites()) { |
||
| 111 | $values = []; |
||
| 112 | foreach ($object->getPreVerifiedWebsites() as $value) { |
||
| 113 | $values[] = $value; |
||
| 114 | } |
||
| 115 | $data->{'PreVerifiedWebsites'} = $values; |
||
| 116 | } |
||
| 117 | |||
| 118 | return $data; |
||
| 119 | } |
||
| 121 |