Conditions | 11 |
Paths | 4 |
Total Lines | 23 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 132 |
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 |
||
35 | public function enterNode(Node $node) |
||
36 | { |
||
37 | if ($node instanceof FullyQualified |
||
38 | && $node->isFullyQualified() |
||
39 | && 1 === count($node->parts) |
||
40 | && (false === ($this->whitelister)($node->getFirst())) |
||
41 | ) { |
||
42 | $node->setAttribute('phpscoper_ignore', true); |
||
43 | } |
||
44 | |||
45 | if ($node instanceof UseUse |
||
46 | && $node->hasAttribute('parent') |
||
47 | && false === ($node->getAttribute('parent') instanceof GroupUse) |
||
48 | && ( |
||
49 | (1 === count($node->name->parts) && false === ($this->whitelister)($node->name->getFirst())) |
||
50 | || 'Composer' === $node->name->getFirst() |
||
51 | ) |
||
52 | ) { |
||
53 | $node->setAttribute('phpscoper_ignore', true); |
||
54 | } |
||
55 | |||
56 | return $node; |
||
57 | } |
||
58 | } |
||
59 |