Conditions | 12 |
Paths | 2048 |
Total Lines | 38 |
Code Lines | 24 |
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 |
||
79 | public function normalize($object, $format = null, array $context = []) |
||
80 | { |
||
81 | $data = new \stdClass(); |
||
82 | if (null !== $object->getAntiCsrfTokenNames()) { |
||
83 | $data->{'AntiCsrfTokenNames'} = $object->getAntiCsrfTokenNames(); |
||
84 | } |
||
85 | if (null !== $object->getAttackParameterName()) { |
||
86 | $data->{'AttackParameterName'} = $object->getAttackParameterName(); |
||
87 | } |
||
88 | if (null !== $object->getAttackRefererHeader()) { |
||
89 | $data->{'AttackRefererHeader'} = $object->getAttackRefererHeader(); |
||
90 | } |
||
91 | if (null !== $object->getAttackUserAgentHeader()) { |
||
92 | $data->{'AttackUserAgentHeader'} = $object->getAttackUserAgentHeader(); |
||
93 | } |
||
94 | if (null !== $object->getAttackCookies()) { |
||
95 | $data->{'AttackCookies'} = $object->getAttackCookies(); |
||
96 | } |
||
97 | if (null !== $object->getMaxParametersToAttack()) { |
||
98 | $data->{'MaxParametersToAttack'} = $object->getMaxParametersToAttack(); |
||
99 | } |
||
100 | if (null !== $object->getOptimizeAttacksToRecurringParameters()) { |
||
101 | $data->{'OptimizeAttacksToRecurringParameters'} = $object->getOptimizeAttacksToRecurringParameters(); |
||
102 | } |
||
103 | if (null !== $object->getOptimizeHeaderAttacks()) { |
||
104 | $data->{'OptimizeHeaderAttacks'} = $object->getOptimizeHeaderAttacks(); |
||
105 | } |
||
106 | if (null !== $object->getProofGenerationEnabled()) { |
||
107 | $data->{'ProofGenerationEnabled'} = $object->getProofGenerationEnabled(); |
||
108 | } |
||
109 | if (null !== $object->getRecurringParametersPageAttackLimit()) { |
||
110 | $data->{'RecurringParametersPageAttackLimit'} = $object->getRecurringParametersPageAttackLimit(); |
||
111 | } |
||
112 | if (null !== $object->getUseExtraParameters()) { |
||
113 | $data->{'UseExtraParameters'} = $object->getUseExtraParameters(); |
||
114 | } |
||
115 | |||
116 | return $data; |
||
117 | } |
||
119 |