| Conditions | 19 |
| Paths | 19 |
| Total Lines | 60 |
| Code Lines | 55 |
| 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 |
||
| 82 | protected function startElement($elementName) |
||
| 83 | { |
||
| 84 | switch ($elementName) { |
||
| 85 | case 'extension': |
||
| 86 | $this->extensionKey = $this->xmlReader->getAttribute('extensionkey'); |
||
| 87 | break; |
||
| 88 | case 'version': |
||
| 89 | $this->version = $this->xmlReader->getAttribute('version'); |
||
| 90 | break; |
||
| 91 | case 'downloadcounter': |
||
| 92 | // downloadcounter could be a child node of |
||
| 93 | // extension or version |
||
| 94 | if ($this->version == null) { |
||
| 95 | $this->extensionDownloadCounter = $this->getElementValue($elementName); |
||
| 96 | } else { |
||
| 97 | $this->versionDownloadCounter = $this->getElementValue($elementName); |
||
| 98 | } |
||
| 99 | break; |
||
| 100 | case 'title': |
||
| 101 | $this->title = $this->getElementValue($elementName); |
||
| 102 | break; |
||
| 103 | case 'description': |
||
| 104 | $this->description = $this->getElementValue($elementName); |
||
| 105 | break; |
||
| 106 | case 'state': |
||
| 107 | $this->state = $this->getElementValue($elementName); |
||
| 108 | break; |
||
| 109 | case 'reviewstate': |
||
| 110 | $this->reviewstate = $this->getElementValue($elementName); |
||
| 111 | break; |
||
| 112 | case 'category': |
||
| 113 | $this->category = $this->getElementValue($elementName); |
||
| 114 | break; |
||
| 115 | case 'lastuploaddate': |
||
| 116 | $this->lastuploaddate = $this->getElementValue($elementName); |
||
| 117 | break; |
||
| 118 | case 'uploadcomment': |
||
| 119 | $this->uploadcomment = $this->getElementValue($elementName); |
||
| 120 | break; |
||
| 121 | case 'dependencies': |
||
| 122 | $this->dependencies = $this->convertDependencies($this->getElementValue($elementName)); |
||
| 123 | break; |
||
| 124 | case 'authorname': |
||
| 125 | $this->authorname = $this->getElementValue($elementName); |
||
| 126 | break; |
||
| 127 | case 'authoremail': |
||
| 128 | $this->authoremail = $this->getElementValue($elementName); |
||
| 129 | break; |
||
| 130 | case 'authorcompany': |
||
| 131 | $this->authorcompany = $this->getElementValue($elementName); |
||
| 132 | break; |
||
| 133 | case 'ownerusername': |
||
| 134 | $this->ownerusername = $this->getElementValue($elementName); |
||
| 135 | break; |
||
| 136 | case 't3xfilemd5': |
||
| 137 | $this->t3xfilemd5 = $this->getElementValue($elementName); |
||
| 138 | break; |
||
| 139 | case 'documentation_link': |
||
| 140 | $this->documentationLink = $this->getElementValue($elementName); |
||
| 141 | break; |
||
| 142 | } |
||
| 191 |