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