| Conditions | 4 | 
| Paths | 4 | 
| Total Lines | 118 | 
| Code Lines | 109 | 
| 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  | 
            ||
| 14 | public function remplacerLesCaracteresSpeciaux($contenu)  | 
            ||
| 15 |     { | 
            ||
| 16 | // Gestion des accents.  | 
            ||
| 17 | $findAccent = array(  | 
            ||
| 18 | 'Â',  | 
            ||
| 19 | 'â',  | 
            ||
| 20 | 'Á',  | 
            ||
| 21 | 'á',  | 
            ||
| 22 | 'Ã',  | 
            ||
| 23 | 'ã',  | 
            ||
| 24 | 'Ᾱ',  | 
            ||
| 25 | 'ᾱ',  | 
            ||
| 26 | 'Ç',  | 
            ||
| 27 | 'ç',  | 
            ||
| 28 | 'Č',  | 
            ||
| 29 | 'č',  | 
            ||
| 30 | 'Ć',  | 
            ||
| 31 | 'ć',  | 
            ||
| 32 | 'Ê',  | 
            ||
| 33 | 'ê',  | 
            ||
| 34 | 'Ë',  | 
            ||
| 35 | 'ë',  | 
            ||
| 36 | 'Ė',  | 
            ||
| 37 | 'ė',  | 
            ||
| 38 | 'ï',  | 
            ||
| 39 | 'Î',  | 
            ||
| 40 | 'î',  | 
            ||
| 41 | 'Í',  | 
            ||
| 42 | 'í',  | 
            ||
| 43 | 'ń',  | 
            ||
| 44 | 'Ô',  | 
            ||
| 45 | 'ô',  | 
            ||
| 46 | 'Ó',  | 
            ||
| 47 | 'ó',  | 
            ||
| 48 | 'Õ',  | 
            ||
| 49 | 'õ',  | 
            ||
| 50 | 'Œ',  | 
            ||
| 51 | 'œ',  | 
            ||
| 52 | 'Ō',  | 
            ||
| 53 | 'ō',  | 
            ||
| 54 | 'Ś',  | 
            ||
| 55 | 'ś',  | 
            ||
| 56 | 'Š',  | 
            ||
| 57 | 'š',  | 
            ||
| 58 | 'Û',  | 
            ||
| 59 | 'û',  | 
            ||
| 60 | 'Ū',  | 
            ||
| 61 | 'ū',  | 
            ||
| 62 | 'Ӱ',  | 
            ||
| 63 | 'ӱ',  | 
            ||
| 64 | );  | 
            ||
| 65 | $replaceAccent = array(  | 
            ||
| 66 | 'A',  | 
            ||
| 67 | 'a',  | 
            ||
| 68 | 'A',  | 
            ||
| 69 | 'a',  | 
            ||
| 70 | 'A',  | 
            ||
| 71 | 'a',  | 
            ||
| 72 | 'A',  | 
            ||
| 73 | 'a',  | 
            ||
| 74 | 'C',  | 
            ||
| 75 | 'c',  | 
            ||
| 76 | 'C',  | 
            ||
| 77 | 'c',  | 
            ||
| 78 | 'C',  | 
            ||
| 79 | 'c',  | 
            ||
| 80 | 'E',  | 
            ||
| 81 | 'e',  | 
            ||
| 82 | 'E',  | 
            ||
| 83 | 'e',  | 
            ||
| 84 | 'E',  | 
            ||
| 85 | 'e',  | 
            ||
| 86 | 'i',  | 
            ||
| 87 | 'I',  | 
            ||
| 88 | 'i',  | 
            ||
| 89 | 'I',  | 
            ||
| 90 | 'i',  | 
            ||
| 91 | 'n',  | 
            ||
| 92 | 'O',  | 
            ||
| 93 | 'o',  | 
            ||
| 94 | 'O',  | 
            ||
| 95 | 'o',  | 
            ||
| 96 | 'O',  | 
            ||
| 97 | 'o',  | 
            ||
| 98 | 'oe',  | 
            ||
| 99 | 'oe',  | 
            ||
| 100 | 'O',  | 
            ||
| 101 | 'o',  | 
            ||
| 102 | 'S',  | 
            ||
| 103 | 's',  | 
            ||
| 104 | 'S',  | 
            ||
| 105 | 's',  | 
            ||
| 106 | 'U',  | 
            ||
| 107 | 'u',  | 
            ||
| 108 | 'U',  | 
            ||
| 109 | 'u',  | 
            ||
| 110 | 'Y',  | 
            ||
| 111 | 'y',  | 
            ||
| 112 | );  | 
            ||
| 113 | $contenu = str_replace($findAccent, $replaceAccent, $contenu);  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 114 | // Gestion des autres caractères.  | 
            ||
| 115 |         $find = array('€', '‘', '$', '£', '`', '"', '#'); | 
            ||
| 116 |         $replace = array('E', '', 'USD', 'GBP', '', ' ', ''); | 
            ||
| 117 | $contenu = str_replace($find, $replace, $contenu);  | 
            ||
| 118 | $contenu = str_replace([' ', ' '], ' ', $contenu);  | 
            ||
| 119 | $out = [];  | 
            ||
| 120 |         preg_match_all("#[^0-9a-zA-Zéèà\,\!\?\'\(\)\_\%\/\+\=\:\.\-\@\;\<\>\*\ ]#u", $contenu, $out); // Suppresion du caractère \& | 
            ||
| 121 | $outTmp = array_filter($out[0]);  | 
            ||
| 122 |         if (empty($outTmp)) { | 
            ||
| 123 | return $contenu;  | 
            ||
| 124 | }  | 
            ||
| 125 |         foreach ($outTmp as $element) { | 
            ||
| 126 |             $elementVide = empty($element) ? $element : iconv('UTF-8', 'ASCII//TRANSLIT', $element); | 
            ||
| 127 | $contenu = str_replace($element, $elementVide, $contenu);  | 
            ||
| 128 | }  | 
            ||
| 129 | |||
| 130 | return $contenu;  | 
            ||
| 131 | }  | 
            ||
| 132 | |||
| 138 |