| Conditions | 2 |
| Paths | 2 |
| Total Lines | 54 |
| Code Lines | 42 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 0 | Features | 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 |
||
| 109 | private function resolveRequestParameters(array $parameters) |
||
| 110 | { |
||
| 111 | $resolver = new OptionsResolver(); |
||
| 112 | |||
| 113 | // Defines parameters keys to enable them. |
||
| 114 | foreach (array_keys($parameters) as $key) { |
||
| 115 | $resolver->setDefined($key); |
||
| 116 | } |
||
| 117 | |||
| 118 | $resolver |
||
|
1 ignored issue
–
show
|
|||
| 119 | ->setAllowedTypesIfDefined('ACQUEREUR', 'string') |
||
| 120 | ->setAllowedTypesIfDefined('ACTIVITE', 'int') |
||
| 121 | ->setAllowedTypesIfDefined('ARCHIVAGE', 'string') |
||
| 122 | ->setAllowedTypesIfDefined('AUTORISATION', 'string') |
||
| 123 | ->setAllowedTypesIfDefined('CVV', 'string') |
||
| 124 | ->setAllowedTypesIfDefined('DATENAISS', 'string') |
||
| 125 | ->setAllowedTypesIfDefined('DATEQ', ['string', 'null']) |
||
| 126 | ->setAllowedTypesIfDefined('DATEVAL', 'string') |
||
| 127 | ->setAllowedTypesIfDefined('DEVISE', ['int', 'null']) |
||
| 128 | ->setAllowedTypesIfDefined('DIFFERE', 'int') |
||
| 129 | ->setAllowedTypesIfDefined('ERRORCODETEST', 'int') |
||
| 130 | ->setAllowedTypesIfDefined('ID3D', 'string') |
||
| 131 | ->setAllowedTypesIfDefined('MONTANT', 'int') |
||
| 132 | ->setAllowedTypesIfDefined('NUMAPPEL', 'int') |
||
| 133 | ->setAllowedTypesIfDefined('NUMTRANS', 'int') |
||
| 134 | ->setAllowedTypesIfDefined('PORTEUR', 'string') |
||
| 135 | ->setAllowedTypesIfDefined('PRIV_CODETRAITEMENT', 'string') |
||
| 136 | ->setAllowedTypesIfDefined('REFABONNE', 'string') |
||
| 137 | ->setAllowedTypesIfDefined('REFERENCE', 'string') // TODO: Auto-generated if not provided? |
||
| 138 | ; |
||
| 139 | |||
| 140 | $resolver |
||
| 141 | ->setAllowedValuesIfDefined('ACQUEREUR', ['PAYPAL', 'EMS', 'ATOSBE', 'BCMC', 'PSC', 'FINAREF', 'BUYSTER', '34ONEY']) |
||
| 142 | ->setAllowedValuesIfDefined('ACTIVITE', [ |
||
| 143 | Activity::NOT_SPECIFIED, |
||
| 144 | Activity::PHONE_REQUEST, |
||
| 145 | Activity::MAIL_REQUEST, |
||
| 146 | Activity::MINITEL_REQUEST, |
||
| 147 | Activity::WEB_REQUEST, |
||
| 148 | Activity::RECURRING_PAYMENT, |
||
| 149 | ]) |
||
| 150 | ->setAllowedValuesIfDefined('DEVISE', [ |
||
| 151 | null, |
||
| 152 | Currency::EURO, |
||
| 153 | Currency::US_DOLLAR, |
||
| 154 | Currency::CFA, |
||
| 155 | ]) |
||
| 156 | ->setAllowedValuesIfDefined('PAYS', '') |
||
| 157 | ->setAllowedValuesIfDefined('SHA-1', '') |
||
| 158 | ->setAllowedValuesIfDefined('TYPECARTE', '') |
||
| 159 | ; |
||
| 160 | |||
| 161 | return $resolver->resolve($parameters); |
||
| 162 | } |
||
| 163 | } |
||
| 164 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.