| Conditions | 11 | 
| Paths | 20 | 
| Total Lines | 35 | 
| Code Lines | 15 | 
| 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 | ||
| 79 | public function hasIncludes(): bool | ||
| 80 |     { | ||
| 81 | $seenExtends = false; | ||
| 82 | $seenBlock = false; | ||
| 83 | |||
| 84 |         foreach ($this->nodeList as $token) { | ||
| 85 |             if ($token instanceof ExtendsTag) { | ||
| 86 | $seenExtends = true; | ||
| 87 |             } elseif ($token instanceof BlockTag) { | ||
| 88 | $seenBlock = true; | ||
| 89 | } | ||
| 90 | } | ||
| 91 | |||
| 92 | /* | ||
| 93 | * We try to keep the base templates in cache (that not extend anything). | ||
| 94 | * | ||
| 95 | * At the same time if we re-render all other blocks we see, we avoid most | ||
| 96 | * if not all related caching quirks. This may be suboptimal. | ||
| 97 | */ | ||
| 98 |         if ($seenBlock && !$seenExtends) { | ||
| 99 | return true; | ||
| 100 | } | ||
| 101 | |||
| 102 |         foreach ($this->nodeList as $token) { | ||
| 103 | // check any of the tokens for includes | ||
| 104 |             if ($token instanceof IncludeTag && $token->hasIncludes()) { | ||
| 105 | return true; | ||
| 106 | } | ||
| 107 | |||
| 108 |             if ($token instanceof ExtendsTag && $token->hasIncludes()) { | ||
| 109 | return true; | ||
| 110 | } | ||
| 111 | } | ||
| 112 | |||
| 113 | return false; | ||
| 114 | } | ||
| 134 |