| Conditions | 19 |
| Paths | 19 |
| Total Lines | 61 |
| Code Lines | 56 |
| Lines | 0 |
| Ratio | 0 % |
| 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 |
||
| 121 | protected function endElement($parser, $elementName) |
||
| 122 | { |
||
| 123 | switch ($elementName) { |
||
| 124 | case 'extension': |
||
| 125 | $this->resetProperties(true); |
||
| 126 | break; |
||
| 127 | case 'version': |
||
| 128 | $this->notify(); |
||
| 129 | $this->resetProperties(); |
||
| 130 | break; |
||
| 131 | case 'downloadcounter': |
||
| 132 | // downloadcounter could be a child node of |
||
| 133 | // extension or version |
||
| 134 | if ($this->version == null) { |
||
| 135 | $this->extensionDownloadCounter = $this->elementData; |
||
| 136 | } else { |
||
| 137 | $this->versionDownloadCounter = $this->elementData; |
||
| 138 | } |
||
| 139 | break; |
||
| 140 | case 'title': |
||
| 141 | $this->title = $this->elementData; |
||
| 142 | break; |
||
| 143 | case 'description': |
||
| 144 | $this->description = $this->elementData; |
||
| 145 | break; |
||
| 146 | case 'state': |
||
| 147 | $this->state = $this->elementData; |
||
| 148 | break; |
||
| 149 | case 'reviewstate': |
||
| 150 | $this->reviewstate = $this->elementData; |
||
| 151 | break; |
||
| 152 | case 'category': |
||
| 153 | $this->category = $this->elementData; |
||
| 154 | break; |
||
| 155 | case 'lastuploaddate': |
||
| 156 | $this->lastuploaddate = $this->elementData; |
||
| 157 | break; |
||
| 158 | case 'uploadcomment': |
||
| 159 | $this->uploadcomment = $this->elementData; |
||
| 160 | break; |
||
| 161 | case 'dependencies': |
||
| 162 | $this->dependencies = $this->convertDependencies($this->elementData); |
||
| 163 | break; |
||
| 164 | case 'authorname': |
||
| 165 | $this->authorname = $this->elementData; |
||
| 166 | break; |
||
| 167 | case 'authoremail': |
||
| 168 | $this->authoremail = $this->elementData; |
||
| 169 | break; |
||
| 170 | case 'authorcompany': |
||
| 171 | $this->authorcompany = $this->elementData; |
||
| 172 | break; |
||
| 173 | case 'ownerusername': |
||
| 174 | $this->ownerusername = $this->elementData; |
||
| 175 | break; |
||
| 176 | case 't3xfilemd5': |
||
| 177 | $this->t3xfilemd5 = $this->elementData; |
||
| 178 | break; |
||
| 179 | case 'documentation_link': |
||
| 180 | $this->documentationLink = $this->elementData; |
||
| 181 | break; |
||
| 182 | } |
||
| 196 |