| Conditions | 13 | 
| Paths | 90 | 
| Total Lines | 47 | 
| Code Lines | 34 | 
| 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  | 
            ||
| 56 | public function loadTranslatedValues($countryID = 0, $variableOrMethod = '')  | 
            ||
| 57 |     { | 
            ||
| 58 | $translation = null;  | 
            ||
| 59 |         if (! $countryID) { | 
            ||
| 60 | $countryObject = CountryPrice_EcommerceCountry::get_real_country();  | 
            ||
| 61 |             if ($countryObject) { | 
            ||
| 62 | $countryID = $countryObject->ID;  | 
            ||
| 63 | }  | 
            ||
| 64 | }  | 
            ||
| 65 |         if ($countryID) { | 
            ||
| 66 | $key = $this->owner->ID.'_'.$countryID;  | 
            ||
| 67 |             if (isset(self::$_translations[$key])) { | 
            ||
| 68 | $translation = self::$_translations[$key];  | 
            ||
| 69 |             } else { | 
            ||
| 70 | $translation = $this->owner->getRealEcommerceTranslation($countryID);  | 
            ||
| 71 | self::$_translations[$key] = $translation;  | 
            ||
| 72 | }  | 
            ||
| 73 | }  | 
            ||
| 74 |         if ($translation) { | 
            ||
| 75 | $fieldsToReplace = $translation->FieldsToReplace();  | 
            ||
| 76 |             foreach ($fieldsToReplace as $replaceFields) { | 
            ||
| 77 | $pageField = $replaceFields->PageField;  | 
            ||
| 78 | $pageFieldTranslated = $pageField . 'Translated';  | 
            ||
| 79 | $translationField = $replaceFields->TranslationField;  | 
            ||
| 80 |                 if (! $variableOrMethod || $variableOrMethod === $pageField) { | 
            ||
| 81 |                     if ($translation->hasMethod($translationField)) { | 
            ||
| 82 | $this->owner->$pageField = $translation->$translationField();  | 
            ||
| 83 | $this->owner->$pageFieldTranslated = $translation->$translationField();  | 
            ||
| 84 |                     } else { | 
            ||
| 85 | $this->owner->$pageField = $translation->$translationField;  | 
            ||
| 86 | $this->owner->$pageFieldTranslated = $translation->$translationField;  | 
            ||
| 87 | }  | 
            ||
| 88 | }  | 
            ||
| 89 |                 if ($variableOrMethod) { | 
            ||
| 90 | return $this->owner->$pageField;  | 
            ||
| 91 | }  | 
            ||
| 92 | }  | 
            ||
| 93 |         } else { | 
            ||
| 94 |             if ($variableOrMethod) { | 
            ||
| 95 |                 if ($translation->hasMethod($variableOrMethod)) { | 
            ||
| 96 | return $this->owner->$variableOrMethod();  | 
            ||
| 97 |                 } else { | 
            ||
| 98 | return $this->owner->$variableOrMethod;  | 
            ||
| 99 | }  | 
            ||
| 100 | }  | 
            ||
| 101 | }  | 
            ||
| 102 | }  | 
            ||
| 103 | |||
| 153 | 
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.