| Conditions | 13 |
| Paths | 9 |
| Total Lines | 31 |
| Lines | 23 |
| Ratio | 74.19 % |
| 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 |
||
| 81 | private function applyToOwnerClass() |
||
| 82 | { |
||
| 83 | $always = Config::inst()->get(SocialNetworksSTE::class, "always_include_in"); |
||
| 84 | $never = Config::inst()->get(SocialNetworksSTE::class, "never_include_in"); |
||
| 85 | if (count($always) == 0 && count($never) == 0) { |
||
| 86 | return true; |
||
| 87 | } |
||
| 88 | View Code Duplication | if (count($never) && count($always) == 0) { |
|
| 89 | if (in_array($this->owner->ClassName, $never)) { |
||
| 90 | return false; |
||
| 91 | } |
||
| 92 | return true; |
||
| 93 | } |
||
| 94 | View Code Duplication | if (count($always) && count($never) == 0) { |
|
| 95 | if (in_array($this->owner->ClassName, $always)) { |
||
| 96 | return true; |
||
| 97 | } |
||
| 98 | return false; |
||
| 99 | } |
||
| 100 | View Code Duplication | if (count($never) && count($always)) { |
|
| 101 | if (in_array($this->owner->ClassName, $never)) { |
||
| 102 | return false; |
||
| 103 | } |
||
| 104 | if (in_array($this->owner->ClassName, $always)) { |
||
| 105 | return true; |
||
| 106 | } |
||
| 107 | //exception... if dev sets both always and never |
||
| 108 | //then the ones not set will be included by default. |
||
| 109 | return true; |
||
| 110 | } |
||
| 111 | } |
||
| 112 | } |
||
| 113 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@returnannotation as described here.