Conditions | 10 |
Paths | 10 |
Total Lines | 42 |
Code Lines | 21 |
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 |
||
106 | public function toDOMElement (\DOMDocument $doc): \DOMElement |
||
107 | { |
||
108 | $el = $this->createElement($doc); |
||
109 | $this->renderIds($el, $doc); |
||
110 | if ($this->hasAct()) |
||
111 | { |
||
112 | $this->renderAct($el, $doc); |
||
113 | } |
||
114 | elseif ($this->hasEncounter()) |
||
115 | { |
||
116 | $this->renderEncounter($el, $doc); |
||
117 | } |
||
118 | elseif ($this->hasObservation()) |
||
119 | { |
||
120 | $this->renderObservation($el, $doc); |
||
121 | } |
||
122 | elseif ($this->hasObservationMedia()) |
||
123 | { |
||
124 | $this->renderObservationMedia($el, $doc); |
||
125 | } |
||
126 | elseif ($this->hasOrganizer()) |
||
127 | { |
||
128 | $this->renderOrganizer($el, $doc); |
||
129 | } |
||
130 | elseif ($this->hasProcedure()) |
||
131 | { |
||
132 | $this->renderProcedure($el, $doc); |
||
133 | } |
||
134 | elseif ($this->hasRegionOfInterest()) |
||
135 | { |
||
136 | $this->renderRegionOfInterest($el, $doc); |
||
137 | } |
||
138 | elseif ($this->hasSubstanceAdministration()) |
||
139 | { |
||
140 | $this->renderSubstanceAdministration($el, $doc); |
||
141 | } |
||
142 | elseif ($this->hasSupply()) |
||
143 | { |
||
144 | $this->renderSupply($el, $doc); |
||
145 | } |
||
146 | |||
147 | return $el; |
||
148 | } |
||
160 |