| Conditions | 13 |
| Paths | 9 |
| Total Lines | 29 |
| Code Lines | 18 |
| 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 |
||
| 99 | private function applyToOwnerClass() |
||
| 100 | { |
||
| 101 | $always = Config::inst()->get(SocialNetworksSTE::class, "always_include_in"); |
||
| 102 | $never = Config::inst()->get(SocialNetworksSTE::class, "never_include_in"); |
||
| 103 | if (count($always) == 0 && count($never) == 0) { |
||
| 104 | return true; |
||
| 105 | } |
||
| 106 | if (count($never) && count($always) == 0) { |
||
| 107 | if (in_array($this->owner->ClassName, $never)) { |
||
| 108 | return false; |
||
| 109 | } |
||
| 110 | return true; |
||
| 111 | } |
||
| 112 | if (count($always) && count($never) == 0) { |
||
| 113 | if (in_array($this->owner->ClassName, $always)) { |
||
| 114 | return true; |
||
| 115 | } |
||
| 116 | return false; |
||
| 117 | } |
||
| 118 | if (count($never) && count($always)) { |
||
| 119 | if (in_array($this->owner->ClassName, $never)) { |
||
| 120 | return false; |
||
| 121 | } |
||
| 122 | if (in_array($this->owner->ClassName, $always)) { |
||
| 123 | return true; |
||
| 124 | } |
||
| 125 | //exception... if dev sets both always and never |
||
| 126 | //then the ones not set will be included by default. |
||
| 127 | return true; |
||
| 128 | } |
||
| 131 |