| 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 |
||
| 70 | } |
||
| 71 | |||
| 72 | public function SocialNetworks() |
||
| 73 | { |
||
| 74 | Requirements::themedCSS('SocialNetworking', "sharethis"); |
||
| 75 | if (Config::inst()->get(SocialNetworksSTE::class, "use_font_awesome")) { |
||
| 76 | Requirements::css("//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css"); |
||
| 77 | } |
||
| 78 | return SocialNetworkingLinksDataObject::get(); |
||
| 79 | } |
||
| 80 | |||
| 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)) { |
||
| 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.