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