| Conditions | 11 | 
| Paths | 6 | 
| Total Lines | 43 | 
| Code Lines | 26 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| 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  | 
            ||
| 110 | private function checkAltered(array $data, string $text): int  | 
            ||
| 111 |     { | 
            ||
| 112 |         if (count($data) === 0) { | 
            ||
| 113 | return 99;  | 
            ||
| 114 | }  | 
            ||
| 115 | $found = 0;  | 
            ||
| 116 | $count = 0;  | 
            ||
| 117 | $text = mb_strtolower($text);  | 
            ||
| 118 |         foreach ($data as $dat) { | 
            ||
| 119 |             if (1 === intval($dat['skip']) || empty($dat['edited'])) { | 
            ||
| 120 | continue;  | 
            ||
| 121 | }  | 
            ||
| 122 | $count++;  | 
            ||
| 123 |             if (empty($dat['opti'])) { | 
            ||
| 124 | echo 'opti vide';  | 
            ||
| 125 | continue;  | 
            ||
| 126 | }  | 
            ||
| 127 | |||
| 128 | // compte pas différence Unicode entre BD et wiki  | 
            ||
| 129 | $opti = Normalizer::normalize($dat['opti']); // hack  | 
            ||
| 130 | // compte pas les changements de typo majuscule/minuscule  | 
            ||
| 131 | $optiLower = mb_strtolower($opti);  | 
            ||
| 132 | // compte pas la correction sur ouvrage avec commentaire HTML  | 
            ||
| 133 | $optiComment = WikiTextUtil::removeHTMLcomments($opti);  | 
            ||
| 134 | // compte pas la suppression de langue=fr : provisoire (fix on SQL)  | 
            ||
| 135 |             $optiLanfr = preg_replace('#\|[\n ]*langue=fr[\n ]*#', '', $opti); | 
            ||
| 136 | |||
| 137 | if (!empty($opti)  | 
            ||
| 138 | && (mb_strpos($text, $opti) !== false  | 
            ||
| 139 | || mb_strpos(mb_strtolower($text), $optiLower) !== false  | 
            ||
| 140 | || mb_strpos($text, $optiComment) !== false  | 
            ||
| 141 | || mb_strpos($text, $optiLanfr) !== false)  | 
            ||
| 142 |             ) { | 
            ||
| 143 | echo '+';  | 
            ||
| 144 | $found++;  | 
            ||
| 145 |             } else { | 
            ||
| 146 | echo '-';  | 
            ||
| 147 | }  | 
            ||
| 148 | // ici update DB  | 
            ||
| 149 | |||
| 150 | }  | 
            ||
| 151 | |||
| 152 | return (int)round(($count - $found) / count($data) * 100);  | 
            ||
| 153 | }  | 
            ||
| 156 |