| Conditions | 12 |
| Paths | 12 |
| Total Lines | 29 |
| Code Lines | 26 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 84 | 28 | private function getChangeFreqFromPriority($priority) |
|
| 85 | { |
||
| 86 | $change_freq_priority = [ |
||
| 87 | 28 | '1.0' => self::CHANGE_FREQ_HOURLY, |
|
| 88 | 28 | '0.9' => self::CHANGE_FREQ_DAILY, |
|
| 89 | 28 | '0.8' => self::CHANGE_FREQ_DAILY, |
|
| 90 | 28 | '0.7' => self::CHANGE_FREQ_WEEKLY, |
|
| 91 | 28 | '0.6' => self::CHANGE_FREQ_WEEKLY, |
|
| 92 | 28 | '0.5' => self::CHANGE_FREQ_WEEKLY, |
|
| 93 | 28 | '0.4' => self::CHANGE_FREQ_MONTHLY, |
|
| 94 | 28 | '0.3' => self::CHANGE_FREQ_MONTHLY, |
|
| 95 | 28 | '0.2' => self::CHANGE_FREQ_YEARLY, |
|
| 96 | 28 | '0.1' => self::CHANGE_FREQ_YEARLY, |
|
| 97 | 28 | '0.0' => self::CHANGE_FREQ_NEVER, |
|
| 98 | ]; |
||
| 99 | |||
| 100 | 28 | if (isset($change_freq_priority[$priority])) { |
|
| 101 | 27 | return $change_freq_priority[$priority]; |
|
| 102 | } |
||
| 103 | |||
| 104 | 1 | return null; |
|
| 105 | } |
||
| 106 | } |
||
| 107 |