Conditions | 12 |
Paths | 40 |
Total Lines | 49 |
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 |
||
110 | public function toDOMElement (\DOMDocument $doc): \DOMElement |
||
111 | { |
||
112 | $el = $this->createElement($doc); |
||
113 | if ($this->hasSequenceNumber()) |
||
114 | { |
||
115 | $el->appendChild($this->getSequenceNumber()->toDOMElement($doc)); |
||
116 | } |
||
117 | if ($this->hasSeperatableInd()) |
||
118 | { |
||
119 | $el->appendChild($this->getSeperatableInd()->toDOMElement($doc)); |
||
120 | } |
||
121 | if ($this->hasAct()) |
||
122 | { |
||
123 | $el->appendChild($this->getAct()->toDOMElement($doc)); |
||
124 | } |
||
125 | elseif ($this->hasEncounter()) |
||
126 | { |
||
127 | $el->appendChild($this->getEncounter()->toDOMElement($doc)); |
||
128 | } |
||
129 | elseif ($this->hasObservation()) |
||
130 | { |
||
131 | $el->appendChild($this->getObservation()->toDOMElement($doc)); |
||
132 | } |
||
133 | elseif ($this->hasObservationMedia()) |
||
134 | { |
||
135 | $el->appendChild($this->getObservationMedia()->toDOMElement($doc)); |
||
136 | } |
||
137 | elseif ($this->hasOrganizer()) |
||
138 | { |
||
139 | $el->appendChild($this->getOrganizer()->toDOMElement($doc)); |
||
140 | } |
||
141 | elseif ($this->hasProcedure()) |
||
142 | { |
||
143 | $el->appendChild($this->getProcedure()->toDOMElement($doc)); |
||
144 | } |
||
145 | elseif ($this->hasRegionOfInterest()) |
||
146 | { |
||
147 | $el->appendChild($this->getRegionOfInterest()->toDOMElement($doc)); |
||
148 | } |
||
149 | elseif ($this->hasSubstanceAdministration()) |
||
150 | { |
||
151 | $el->appendChild($this->getSubstanceAdministration()->toDOMElement($doc)); |
||
152 | } |
||
153 | elseif ($this->hasSupply()) |
||
154 | { |
||
155 | $el->appendChild($this->getSupply()->toDOMElement($doc)); |
||
156 | } |
||
157 | |||
158 | return $el; |
||
159 | } |
||
169 | } |