| Conditions | 1 |
| Paths | 1 |
| Total Lines | 51 |
| Code Lines | 44 |
| 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 |
||
| 60 | protected function transliterated($string) |
||
| 61 | { |
||
| 62 | return str_replace( |
||
| 63 | ' ', |
||
| 64 | '', |
||
| 65 | ucwords(iconv("UTF-8", "UTF-8//IGNORE", strtr($string, array( |
||
| 66 | "'" => "", |
||
| 67 | "`" => "", |
||
| 68 | "-" => " ", |
||
| 69 | "_" => " ", |
||
| 70 | "а" => "a", "А" => "a", |
||
| 71 | "б" => "b", "Б" => "b", |
||
| 72 | "в" => "v", "В" => "v", |
||
| 73 | "г" => "g", "Г" => "g", |
||
| 74 | "д" => "d", "Д" => "d", |
||
| 75 | "е" => "e", "Е" => "e", |
||
| 76 | "ж" => "zh", "Ж" => "zh", |
||
| 77 | "з" => "z", "З" => "z", |
||
| 78 | "и" => "i", "И" => "i", |
||
| 79 | "й" => "y", "Й" => "y", |
||
| 80 | "к" => "k", "К" => "k", |
||
| 81 | "л" => "l", "Л" => "l", |
||
| 82 | "м" => "m", "М" => "m", |
||
| 83 | "н" => "n", "Н" => "n", |
||
| 84 | "о" => "o", "О" => "o", |
||
| 85 | "п" => "p", "П" => "p", |
||
| 86 | "р" => "r", "Р" => "r", |
||
| 87 | "с" => "s", "С" => "s", |
||
| 88 | "т" => "t", "Т" => "t", |
||
| 89 | "у" => "u", "У" => "u", |
||
| 90 | "ф" => "f", "Ф" => "f", |
||
| 91 | "х" => "h", "Х" => "h", |
||
| 92 | "ц" => "c", "Ц" => "c", |
||
| 93 | "ч" => "ch", "Ч" => "ch", |
||
| 94 | "ш" => "sh", "Ш" => "sh", |
||
| 95 | "щ" => "sch", "Щ" => "sch", |
||
| 96 | "ъ" => "", "Ъ" => "", |
||
| 97 | "ы" => "y", "Ы" => "y", |
||
| 98 | "ь" => "", "Ь" => "", |
||
| 99 | "э" => "e", "Э" => "e", |
||
| 100 | "ю" => "yu", "Ю" => "yu", |
||
| 101 | "я" => "ya", "Я" => "ya", |
||
| 102 | "і" => "i", "І" => "i", |
||
| 103 | "ї" => "yi", "Ї" => "yi", |
||
| 104 | "є" => "e", "Є" => "e" |
||
| 105 | ) |
||
| 106 | ) |
||
| 107 | ) |
||
| 108 | ) |
||
| 109 | ); |
||
| 110 | } |
||
| 111 | |||
| 184 | //[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.