| Conditions | 3 |
| Paths | 3 |
| Total Lines | 60 |
| Code Lines | 46 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
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 |
||
| 74 | protected static function ru() |
||
| 75 | { |
||
| 76 | $result = [ |
||
| 77 | 'values' => [ |
||
| 78 | 'and' => 'и', |
||
| 79 | 'Left' => 'Осталось' |
||
| 80 | ] |
||
| 81 | ]; |
||
| 82 | |||
| 83 | $n = '%n '; |
||
| 84 | $values = [ |
||
| 85 | $n . 'days' => [ |
||
| 86 | 0 => $n . 'дней', |
||
| 87 | 1 => $n . 'день', |
||
| 88 | 2 => $n . 'дня', |
||
| 89 | ], |
||
| 90 | $n . 'hours' => [ |
||
| 91 | 0 => $n . 'часов', |
||
| 92 | 1 => $n . 'час', |
||
| 93 | 2 => $n . 'часа', |
||
| 94 | ], |
||
| 95 | $n . 'minutes' => [ |
||
| 96 | 0 => $n . 'минут', |
||
| 97 | 1 => $n . 'минута', |
||
| 98 | 2 => $n . 'минуты', |
||
| 99 | ], |
||
| 100 | $n . 'seconds' => [ |
||
| 101 | 0 => $n . 'секунд', |
||
| 102 | 1 => $n . 'секунда', |
||
| 103 | 2 => $n . 'секунды', |
||
| 104 | ] |
||
| 105 | ]; |
||
| 106 | |||
| 107 | foreach ($values as $key => $value) { |
||
| 108 | foreach ($value as $count => $item) { |
||
| 109 | $result['values'][$key] = [ |
||
| 110 | [0, 0, $values[$key][0]], |
||
| 111 | [1, 1, $values[$key][1]], |
||
| 112 | [5, 20, $values[$key][0]], |
||
| 113 | [21, 21, $values[$key][1]], |
||
| 114 | [25, 30, $values[$key][0]], |
||
| 115 | [31, 31, $values[$key][1]], |
||
| 116 | [35, 40, $values[$key][0]], |
||
| 117 | [41, 41, $values[$key][1]], |
||
| 118 | [45, 50, $values[$key][0]], |
||
| 119 | [51, 51, $values[$key][1]], |
||
| 120 | [55, 60, $values[$key][0]], |
||
| 121 | [61, 61, $values[$key][1]], |
||
| 122 | [65, 70, $values[$key][0]], |
||
| 123 | [71, 71, $values[$key][1]], |
||
| 124 | [75, 80, $values[$key][0]], |
||
| 125 | [81, 81, $values[$key][1]], |
||
| 126 | [85, 90, $values[$key][0]], |
||
| 127 | [91, 91, $values[$key][1]], |
||
| 128 | [95, 100, $values[$key][0]], |
||
| 129 | [2, null, $values[$key][2]] |
||
| 130 | ]; |
||
| 131 | } |
||
| 132 | } |
||
| 133 | return $result; |
||
| 134 | } |
||
| 136 |