| Conditions | 12 |
| Paths | 40 |
| Total Lines | 30 |
| Code Lines | 24 |
| 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 |
||
| 97 | public function toDOMElement(\DOMDocument $doc): \DOMElement |
||
| 98 | { |
||
| 99 | $el = $this->createElement($doc); |
||
| 100 | if ($this->hasSequenceNumber()) { |
||
| 101 | $el->appendChild($this->getSequenceNumber()->toDOMElement($doc)); |
||
| 102 | } |
||
| 103 | if ($this->hasSeperatableInd()) { |
||
| 104 | $el->appendChild($this->getSeperatableInd()->toDOMElement($doc)); |
||
| 105 | } |
||
| 106 | if ($this->hasAct()) { |
||
| 107 | $el->appendChild($this->getAct()->toDOMElement($doc)); |
||
| 108 | } elseif ($this->hasEncounter()) { |
||
| 109 | $el->appendChild($this->getEncounter()->toDOMElement($doc)); |
||
| 110 | } elseif ($this->hasObservation()) { |
||
| 111 | $el->appendChild($this->getObservation()->toDOMElement($doc)); |
||
| 112 | } elseif ($this->hasObservationMedia()) { |
||
| 113 | $el->appendChild($this->getObservationMedia()->toDOMElement($doc)); |
||
| 114 | } elseif ($this->hasOrganizer()) { |
||
| 115 | $el->appendChild($this->getOrganizer()->toDOMElement($doc)); |
||
| 116 | } elseif ($this->hasProcedure()) { |
||
| 117 | $el->appendChild($this->getProcedure()->toDOMElement($doc)); |
||
| 118 | } elseif ($this->hasRegionOfInterest()) { |
||
| 119 | $el->appendChild($this->getRegionOfInterest()->toDOMElement($doc)); |
||
| 120 | } elseif ($this->hasSubstanceAdministration()) { |
||
| 121 | $el->appendChild($this->getSubstanceAdministration()->toDOMElement($doc)); |
||
| 122 | } elseif ($this->hasSupply()) { |
||
| 123 | $el->appendChild($this->getSupply()->toDOMElement($doc)); |
||
| 124 | } |
||
| 125 | |||
| 126 | return $el; |
||
| 127 | } |
||
| 137 | } |