| Conditions | 15 |
| Paths | 16 |
| Total Lines | 74 |
| Code Lines | 30 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
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 |
||
| 71 | public function block_page_content($context, array $blocks = array()) |
||
| 72 | { |
||
| 73 | // line 17 |
||
| 74 | echo " |
||
| 75 | <div class=\"page-header\"> |
||
| 76 | <h1>"; |
||
| 77 | // line 19 |
||
| 78 | echo (isset($context["namespace"]) ? $context["namespace"] : $this->getContext($context, "namespace")); |
||
| 79 | echo "</h1> |
||
| 80 | </div> |
||
| 81 | |||
| 82 | "; |
||
| 83 | // line 22 |
||
| 84 | if ((isset($context["subnamespaces"]) ? $context["subnamespaces"] : $this->getContext($context, "subnamespaces"))) { |
||
| 85 | // line 23 |
||
| 86 | echo " <h2>Namespaces</h2> |
||
| 87 | <div class=\"namespace-list\"> |
||
| 88 | "; |
||
| 89 | // line 25 |
||
| 90 | $context['_parent'] = $context; |
||
| 91 | $context['_seq'] = twig_ensure_traversable((isset($context["subnamespaces"]) ? $context["subnamespaces"] : $this->getContext($context, "subnamespaces"))); |
||
| 92 | foreach ($context['_seq'] as $context["_key"] => $context["ns"]) { |
||
| 93 | echo $context["__internal_360c4d2c1ef9dd65dd45aaadc2d4a9e62e6355bc0be40451e5bf0f8f47a4d0fe"]->getnamespace_link($context["ns"]); |
||
| 94 | } |
||
| 95 | $_parent = $context['_parent']; |
||
| 96 | unset($context['_seq'], $context['_iterated'], $context['_key'], $context['ns'], $context['_parent'], $context['loop']); |
||
| 97 | $context = array_intersect_key($context, $_parent) + $_parent; |
||
| 98 | // line 26 |
||
| 99 | echo " </div> |
||
| 100 | "; |
||
| 101 | } |
||
| 102 | // line 28 |
||
| 103 | echo " |
||
| 104 | "; |
||
| 105 | // line 29 |
||
| 106 | if ((isset($context["classes"]) ? $context["classes"] : $this->getContext($context, "classes"))) { |
||
| 107 | // line 30 |
||
| 108 | echo " <h2>Classes</h2> |
||
| 109 | "; |
||
| 110 | // line 31 |
||
| 111 | echo $context["__internal_360c4d2c1ef9dd65dd45aaadc2d4a9e62e6355bc0be40451e5bf0f8f47a4d0fe"]->getrender_classes((isset($context["classes"]) ? $context["classes"] : $this->getContext($context, "classes"))); |
||
| 112 | echo " |
||
| 113 | "; |
||
| 114 | } |
||
| 115 | // line 33 |
||
| 116 | echo " |
||
| 117 | "; |
||
| 118 | // line 34 |
||
| 119 | if ((isset($context["interfaces"]) ? $context["interfaces"] : $this->getContext($context, "interfaces"))) { |
||
| 120 | // line 35 |
||
| 121 | echo " <h2>Interfaces</h2> |
||
| 122 | "; |
||
| 123 | // line 36 |
||
| 124 | echo $context["__internal_360c4d2c1ef9dd65dd45aaadc2d4a9e62e6355bc0be40451e5bf0f8f47a4d0fe"]->getrender_classes((isset($context["interfaces"]) ? $context["interfaces"] : $this->getContext($context, "interfaces"))); |
||
| 125 | echo " |
||
| 126 | "; |
||
| 127 | } |
||
| 128 | // line 38 |
||
| 129 | echo " |
||
| 130 | "; |
||
| 131 | // line 39 |
||
| 132 | if ((isset($context["exceptions"]) ? $context["exceptions"] : $this->getContext($context, "exceptions"))) { |
||
| 133 | // line 40 |
||
| 134 | echo " <h2>Exceptions</h2> |
||
| 135 | "; |
||
| 136 | // line 41 |
||
| 137 | echo $context["__internal_360c4d2c1ef9dd65dd45aaadc2d4a9e62e6355bc0be40451e5bf0f8f47a4d0fe"]->getrender_classes((isset($context["exceptions"]) ? $context["exceptions"] : $this->getContext($context, "exceptions"))); |
||
| 138 | echo " |
||
| 139 | "; |
||
| 140 | } |
||
| 141 | // line 43 |
||
| 142 | echo " |
||
| 143 | "; |
||
| 144 | } |
||
| 145 | |||
| 206 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.