| Conditions | 18 |
| Paths | > 20000 |
| Total Lines | 56 |
| Code Lines | 36 |
| 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\VcsCommitInfo(); |
||
| 42 | if (property_exists($data, 'CiBuildConfigurationName')) { |
||
| 43 | $object->setCiBuildConfigurationName($data->{'CiBuildConfigurationName'}); |
||
| 44 | } |
||
| 45 | if (property_exists($data, 'CiBuildHasChange')) { |
||
| 46 | $object->setCiBuildHasChange($data->{'CiBuildHasChange'}); |
||
| 47 | } |
||
| 48 | if (property_exists($data, 'CiBuildId')) { |
||
| 49 | $object->setCiBuildId($data->{'CiBuildId'}); |
||
| 50 | } |
||
| 51 | if (property_exists($data, 'CiBuildServerName')) { |
||
| 52 | $object->setCiBuildServerName($data->{'CiBuildServerName'}); |
||
| 53 | } |
||
| 54 | if (property_exists($data, 'CiBuildServerVersion')) { |
||
| 55 | $object->setCiBuildServerVersion($data->{'CiBuildServerVersion'}); |
||
| 56 | } |
||
| 57 | if (property_exists($data, 'CiBuildUrl')) { |
||
| 58 | $object->setCiBuildUrl($data->{'CiBuildUrl'}); |
||
| 59 | } |
||
| 60 | if (property_exists($data, 'CiNcPluginVersion')) { |
||
| 61 | $object->setCiNcPluginVersion($data->{'CiNcPluginVersion'}); |
||
| 62 | } |
||
| 63 | if (property_exists($data, 'CiTimestamp')) { |
||
| 64 | $object->setCiTimestamp(\DateTime::createFromFormat("Y-m-d\TH:i:sP", $data->{'CiTimestamp'})); |
||
|
|
|||
| 65 | } |
||
| 66 | if (property_exists($data, 'ComitterId')) { |
||
| 67 | $object->setComitterId($data->{'ComitterId'}); |
||
| 68 | } |
||
| 69 | if (property_exists($data, 'Committer')) { |
||
| 70 | $object->setCommitter($data->{'Committer'}); |
||
| 71 | } |
||
| 72 | if (property_exists($data, 'CommitterName')) { |
||
| 73 | $object->setCommitterName($data->{'CommitterName'}); |
||
| 74 | } |
||
| 75 | if (property_exists($data, 'CommitterOverride')) { |
||
| 76 | $object->setCommitterOverride($data->{'CommitterOverride'}); |
||
| 77 | } |
||
| 78 | if (property_exists($data, 'IntegrationSystem')) { |
||
| 79 | $object->setIntegrationSystem($data->{'IntegrationSystem'}); |
||
| 80 | } |
||
| 81 | if (property_exists($data, 'IsCommiterExistAndAuthorizedInNc')) { |
||
| 82 | $object->setIsCommiterExistAndAuthorizedInNc($data->{'IsCommiterExistAndAuthorizedInNc'}); |
||
| 83 | } |
||
| 84 | if (property_exists($data, 'VcsName')) { |
||
| 85 | $object->setVcsName($data->{'VcsName'}); |
||
| 86 | } |
||
| 87 | if (property_exists($data, 'VcsVersion')) { |
||
| 88 | $object->setVcsVersion($data->{'VcsVersion'}); |
||
| 89 | } |
||
| 90 | |||
| 91 | return $object; |
||
| 92 | } |
||
| 149 |