| Conditions | 12 | 
| Paths | 513 | 
| 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 | ||
| 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\WebsiteApiModel(); | ||
| 42 |         if (property_exists($data, 'Id')) { | ||
| 43 |             $object->setId($data->{'Id'}); | ||
| 44 | } | ||
| 45 |         if (property_exists($data, 'CreatedAt')) { | ||
| 46 |             $object->setCreatedAt(\DateTime::createFromFormat("Y-m-d\TH:i:sP", $data->{'CreatedAt'})); | ||
|  | |||
| 47 | } | ||
| 48 |         if (property_exists($data, 'UpdatedAt')) { | ||
| 49 |             $object->setUpdatedAt(\DateTime::createFromFormat("Y-m-d\TH:i:sP", $data->{'UpdatedAt'})); | ||
| 50 | } | ||
| 51 |         if (property_exists($data, 'RootUrl')) { | ||
| 52 |             $object->setRootUrl($data->{'RootUrl'}); | ||
| 53 | } | ||
| 54 |         if (property_exists($data, 'Name')) { | ||
| 55 |             $object->setName($data->{'Name'}); | ||
| 56 | } | ||
| 57 |         if (property_exists($data, 'Groups')) { | ||
| 58 | $values = []; | ||
| 59 |             foreach ($data->{'Groups'} as $value) { | ||
| 60 | $values[] = $this->denormalizer->denormalize($value, 'Montross50\\NetsparkerCloud\\SDK\\Model\\IdNamePair', 'json', $context); | ||
| 61 | } | ||
| 62 | $object->setGroups($values); | ||
| 63 | } | ||
| 64 |         if (property_exists($data, 'IsVerified')) { | ||
| 65 |             $object->setIsVerified($data->{'IsVerified'}); | ||
| 66 | } | ||
| 67 |         if (property_exists($data, 'LicenseType')) { | ||
| 68 |             $object->setLicenseType($data->{'LicenseType'}); | ||
| 69 | } | ||
| 70 |         if (property_exists($data, 'AgentMode')) { | ||
| 71 |             $object->setAgentMode($data->{'AgentMode'}); | ||
| 72 | } | ||
| 73 | |||
| 74 | return $object; | ||
| 75 | } | ||
| 115 |