Conditions | 15 |
Paths | 15 |
Total Lines | 22 |
Code Lines | 18 |
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 |
||
52 | public static function isValidCalendarName(string $calendarname): bool |
||
53 | { |
||
54 | switch ($calendarname) { |
||
55 | case self::BUDDHIST: |
||
56 | case self::CHINESE: |
||
57 | case self::COPTIC: |
||
58 | case self::ETHIOPIAN: |
||
59 | case self::GREGORIAN: |
||
60 | case self::HEBREW: |
||
61 | case self::INDIAN: |
||
62 | case self::ISLAMIC: |
||
63 | case self::ISLAMIC_CIVIL: |
||
64 | case self::ISLAMIC_RGSA: |
||
65 | case self::ISLAMIC_TBLA: |
||
66 | case self::ISLAMIC_UMALQURA: |
||
67 | case self::JAPANESE: |
||
68 | case self::PERSIAN: |
||
69 | return true; |
||
70 | default: |
||
71 | } |
||
72 | |||
73 | return false; |
||
74 | } |
||
76 |