| Conditions | 1 |
| Paths | 1 |
| Total Lines | 51 |
| Code Lines | 44 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | 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 |
||
| 130 | protected function transliterated($string) |
||
| 131 | { |
||
| 132 | return str_replace( |
||
| 133 | ' ', |
||
| 134 | '', |
||
| 135 | ucwords(iconv("UTF-8", "UTF-8//IGNORE", strtr($string, array( |
||
| 136 | "'" => "", |
||
| 137 | "`" => "", |
||
| 138 | "-" => " ", |
||
| 139 | "_" => " ", |
||
| 140 | "а" => "a", "А" => "a", |
||
| 141 | "б" => "b", "Б" => "b", |
||
| 142 | "в" => "v", "В" => "v", |
||
| 143 | "г" => "g", "Г" => "g", |
||
| 144 | "д" => "d", "Д" => "d", |
||
| 145 | "е" => "e", "Е" => "e", |
||
| 146 | "ж" => "zh", "Ж" => "zh", |
||
| 147 | "з" => "z", "З" => "z", |
||
| 148 | "и" => "i", "И" => "i", |
||
| 149 | "й" => "y", "Й" => "y", |
||
| 150 | "к" => "k", "К" => "k", |
||
| 151 | "л" => "l", "Л" => "l", |
||
| 152 | "м" => "m", "М" => "m", |
||
| 153 | "н" => "n", "Н" => "n", |
||
| 154 | "о" => "o", "О" => "o", |
||
| 155 | "п" => "p", "П" => "p", |
||
| 156 | "р" => "r", "Р" => "r", |
||
| 157 | "с" => "s", "С" => "s", |
||
| 158 | "т" => "t", "Т" => "t", |
||
| 159 | "у" => "u", "У" => "u", |
||
| 160 | "ф" => "f", "Ф" => "f", |
||
| 161 | "х" => "h", "Х" => "h", |
||
| 162 | "ц" => "c", "Ц" => "c", |
||
| 163 | "ч" => "ch", "Ч" => "ch", |
||
| 164 | "ш" => "sh", "Ш" => "sh", |
||
| 165 | "щ" => "sch", "Щ" => "sch", |
||
| 166 | "ъ" => "", "Ъ" => "", |
||
| 167 | "ы" => "y", "Ы" => "y", |
||
| 168 | "ь" => "", "Ь" => "", |
||
| 169 | "э" => "e", "Э" => "e", |
||
| 170 | "ю" => "yu", "Ю" => "yu", |
||
| 171 | "я" => "ya", "Я" => "ya", |
||
| 172 | "і" => "i", "І" => "i", |
||
| 173 | "ї" => "yi", "Ї" => "yi", |
||
| 174 | "є" => "e", "Є" => "e" |
||
| 175 | ) |
||
| 176 | ) |
||
| 177 | ) |
||
| 178 | ) |
||
| 179 | ); |
||
| 180 | } |
||
| 181 | } |
||
| 182 | //[PHPCOMPRESSOR(remove,end)] |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.