| Conditions | 13 |
| Paths | 2049 |
| Total Lines | 41 |
| Code Lines | 26 |
| 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\AttackingSettingModel(); |
||
| 42 | if (property_exists($data, 'AntiCsrfTokenNames')) { |
||
| 43 | $object->setAntiCsrfTokenNames($data->{'AntiCsrfTokenNames'}); |
||
| 44 | } |
||
| 45 | if (property_exists($data, 'AttackParameterName')) { |
||
| 46 | $object->setAttackParameterName($data->{'AttackParameterName'}); |
||
| 47 | } |
||
| 48 | if (property_exists($data, 'AttackRefererHeader')) { |
||
| 49 | $object->setAttackRefererHeader($data->{'AttackRefererHeader'}); |
||
| 50 | } |
||
| 51 | if (property_exists($data, 'AttackUserAgentHeader')) { |
||
| 52 | $object->setAttackUserAgentHeader($data->{'AttackUserAgentHeader'}); |
||
| 53 | } |
||
| 54 | if (property_exists($data, 'AttackCookies')) { |
||
| 55 | $object->setAttackCookies($data->{'AttackCookies'}); |
||
| 56 | } |
||
| 57 | if (property_exists($data, 'MaxParametersToAttack')) { |
||
| 58 | $object->setMaxParametersToAttack($data->{'MaxParametersToAttack'}); |
||
| 59 | } |
||
| 60 | if (property_exists($data, 'OptimizeAttacksToRecurringParameters')) { |
||
| 61 | $object->setOptimizeAttacksToRecurringParameters($data->{'OptimizeAttacksToRecurringParameters'}); |
||
| 62 | } |
||
| 63 | if (property_exists($data, 'OptimizeHeaderAttacks')) { |
||
| 64 | $object->setOptimizeHeaderAttacks($data->{'OptimizeHeaderAttacks'}); |
||
| 65 | } |
||
| 66 | if (property_exists($data, 'ProofGenerationEnabled')) { |
||
| 67 | $object->setProofGenerationEnabled($data->{'ProofGenerationEnabled'}); |
||
| 68 | } |
||
| 69 | if (property_exists($data, 'RecurringParametersPageAttackLimit')) { |
||
| 70 | $object->setRecurringParametersPageAttackLimit($data->{'RecurringParametersPageAttackLimit'}); |
||
| 71 | } |
||
| 72 | if (property_exists($data, 'UseExtraParameters')) { |
||
| 73 | $object->setUseExtraParameters($data->{'UseExtraParameters'}); |
||
| 74 | } |
||
| 75 | |||
| 76 | return $object; |
||
| 77 | } |
||
| 119 |