| Conditions | 13 |
| Paths | 16 |
| Total Lines | 26 |
| Code Lines | 15 |
| 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 |
||
| 111 | protected function sanitizeDescription($string) |
||
| 112 | { |
||
| 113 | $descriptionStart = $descriptionEnd = ''; |
||
| 114 | $description = parent::sanitizeDescription($string); |
||
| 115 | if (strpos($description, '/PREF/') !== false |
||
| 116 | && preg_match('#/PREF/(.*?)/#s', $description, $results) && !empty($results[1]) |
||
| 117 | ) { |
||
| 118 | $descriptionStart = $results[1]; |
||
| 119 | } |
||
| 120 | if (strpos($description, '/EREF/') !== false |
||
| 121 | && preg_match('#/EREF/(.*?)/#s', $description, $results) && !empty($results[1]) |
||
| 122 | ) { |
||
| 123 | $descriptionStart = $results[1]; |
||
| 124 | } |
||
| 125 | if (strpos($description, '/REMI/USTD//') !== false |
||
| 126 | && preg_match('#/REMI/USTD//(.*?)/$#s', $description, $results) && !empty($results[1]) |
||
| 127 | ) { |
||
| 128 | $descriptionEnd = $results[1]; |
||
| 129 | } |
||
| 130 | if (strpos($description, '/REMI/STRD/CUR/') !== false |
||
| 131 | && preg_match('#/REMI/STRD/CUR/(.*?)/#s', $description, $results) && !empty($results[1]) |
||
| 132 | ) { |
||
| 133 | $descriptionEnd = $results[1]; |
||
| 134 | } |
||
| 135 | |||
| 136 | return trim($descriptionStart.' '.$descriptionEnd); |
||
| 137 | } |
||
| 151 |