| Conditions | 11 |
| Paths | 7 |
| Total Lines | 29 |
| Code Lines | 24 |
| 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 |
||
| 37 | protected function doEnterNode(Twig_Node $node, Twig_Environment $env) |
||
| 38 | { |
||
| 39 | if ($node instanceof XlsDocumentNode) { |
||
| 40 | $this->checkAllowedParents($node, []); |
||
| 41 | } elseif ($node instanceof XlsSheetNode) { |
||
| 42 | $this->checkAllowedParents($node, |
||
| 43 | ['MewesK\TwigExcelBundle\Twig\Node\XlsDocumentNode']); |
||
| 44 | } elseif ($node instanceof XlsRowNode || $node instanceof XlsFooterNode || $node instanceof XlsHeaderNode) { |
||
| 45 | $this->checkAllowedParents($node, |
||
| 46 | ['MewesK\TwigExcelBundle\Twig\Node\XlsSheetNode']); |
||
| 47 | } elseif ($node instanceof XlsLeftNode || $node instanceof XlsCenterNode || $node instanceof XlsRightNode) { |
||
| 48 | $this->checkAllowedParents($node, |
||
| 49 | ['MewesK\TwigExcelBundle\Twig\Node\XlsFooterNode', |
||
| 50 | 'MewesK\TwigExcelBundle\Twig\Node\XlsHeaderNode']); |
||
| 51 | } elseif ($node instanceof XlsCellNode) { |
||
| 52 | $this->checkAllowedParents($node, |
||
| 53 | ['MewesK\TwigExcelBundle\Twig\Node\XlsRowNode']); |
||
| 54 | } elseif ($node instanceof XlsDrawingNode) { |
||
| 55 | $this->checkAllowedParents($node, |
||
| 56 | ['MewesK\TwigExcelBundle\Twig\Node\XlsSheetNode', |
||
| 57 | 'MewesK\TwigExcelBundle\Twig\Node\XlsLeftNode', |
||
| 58 | 'MewesK\TwigExcelBundle\Twig\Node\XlsCenterNode', |
||
| 59 | 'MewesK\TwigExcelBundle\Twig\Node\XlsRightNode']); |
||
| 60 | } |
||
| 61 | |||
| 62 | $this->path[] = get_class($node); |
||
| 63 | |||
| 64 | return $node; |
||
| 65 | } |
||
| 66 | |||
| 119 |