| Conditions | 11 |
| Paths | 513 |
| Total Lines | 35 |
| Code Lines | 22 |
| 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\UpdateScanNotificationApiModel(); |
||
| 42 | if (property_exists($data, 'Id')) { |
||
| 43 | $object->setId($data->{'Id'}); |
||
| 44 | } |
||
| 45 | if (property_exists($data, 'Recipients')) { |
||
| 46 | $object->setRecipients($this->denormalizer->denormalize($data->{'Recipients'}, 'Montross50\\NetsparkerCloud\\SDK\\Model\\NewScanNotificationRecipientApiModel', 'json', $context)); |
||
| 47 | } |
||
| 48 | if (property_exists($data, 'WebsiteGroupName')) { |
||
| 49 | $object->setWebsiteGroupName($data->{'WebsiteGroupName'}); |
||
| 50 | } |
||
| 51 | if (property_exists($data, 'WebsiteRootUrl')) { |
||
| 52 | $object->setWebsiteRootUrl($data->{'WebsiteRootUrl'}); |
||
| 53 | } |
||
| 54 | if (property_exists($data, 'Disabled')) { |
||
| 55 | $object->setDisabled($data->{'Disabled'}); |
||
| 56 | } |
||
| 57 | if (property_exists($data, 'Event')) { |
||
| 58 | $object->setEvent($data->{'Event'}); |
||
| 59 | } |
||
| 60 | if (property_exists($data, 'LowestSeverity')) { |
||
| 61 | $object->setLowestSeverity($data->{'LowestSeverity'}); |
||
| 62 | } |
||
| 63 | if (property_exists($data, 'Name')) { |
||
| 64 | $object->setName($data->{'Name'}); |
||
| 65 | } |
||
| 66 | if (property_exists($data, 'Scope')) { |
||
| 67 | $object->setScope($data->{'Scope'}); |
||
| 68 | } |
||
| 69 | |||
| 70 | return $object; |
||
| 71 | } |
||
| 107 |