| Conditions | 10 |
| Paths | 7 |
| Total Lines | 18 |
| Code Lines | 11 |
| 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 |
||
| 20 | public function satisfy($node) |
||
| 21 | { |
||
| 22 | if (!$this->allowProtected && $node->isProtected()) { |
||
| 23 | return false; |
||
| 24 | } |
||
| 25 | if (!$this->allowPrivate && $node->isPrivate()) { |
||
| 26 | return false; |
||
| 27 | } |
||
| 28 | if ($node instanceof MethodData) { |
||
| 29 | if ($node->isMagic() && !$this->magic) { |
||
| 30 | return false; |
||
| 31 | } |
||
| 32 | } |
||
| 33 | if ($this->showStatic < 2 && $node->isStatic() != $this->showStatic) { |
||
| 34 | return false; |
||
| 35 | } |
||
| 36 | return true; |
||
| 37 | } |
||
| 38 | public function isStatic() |
||
| 71 |