| Conditions | 11 | 
| Paths | 384 | 
| Total Lines | 43 | 
| Code Lines | 32 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 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 | ||
| 78 | public function getHTML() : string | ||
| 79 |     { | ||
| 80 | // no container div! | ||
| 81 |         $this->addStyle('float', 'left'); | ||
| 82 | $strWidth = ($this->oParent ? $this->oParent->getColWidth($this->iCol) : ''); | ||
| 83 |         if (!empty($strWidth)) { | ||
| 84 |             $this->addStyle('width', $strWidth); | ||
| 85 | } | ||
| 86 |         if ($this->oFlags->isSet(FormFlags::ALIGN_RIGHT)) { | ||
| 87 |             $this->addStyle('text-align', 'right'); | ||
| 88 |         } else if ($this->oFlags->isSet(FormFlags::ALIGN_CENTER)) { | ||
| 89 |             $this->addStyle('text-align', 'center'); | ||
| 90 | } | ||
| 91 |         if ($this->oFlags->isSet(FormFlags::BOLD)) { | ||
| 92 |             $this->addStyle('font-weight', 'bold'); | ||
| 93 | } | ||
| 94 | $strSep = ''; | ||
| 95 |         if (strlen($this->strClass) !== 0) { | ||
| 96 | $strSep = ' '; | ||
| 97 | } | ||
| 98 |         if ($this->oFlags->isSet(FormFlags::ERROR)) { | ||
| 99 | $this->strClass .= $strSep . 'error'; | ||
| 100 |         } else if ($this->oFlags->isSet(FormFlags::HINT)) { | ||
| 101 | $this->strClass = $strSep . 'hint'; | ||
| 102 |         } else if ($this->oFlags->isSet(FormFlags::INFO)) { | ||
| 103 | $this->strClass = $strSep . 'forminfo'; | ||
| 104 | } | ||
| 105 | |||
| 106 | $strHTML = ''; | ||
| 107 | $strHTML .= '<div'; | ||
| 108 | $strHTML .= $this->buildID(); | ||
| 109 | $strHTML .= $this->buildClass(); | ||
| 110 | $strHTML .= $this->buildStyle(); | ||
| 111 | $strHTML .= $this->buildAttributes(); | ||
| 112 | $strHTML .= '>'; | ||
| 113 |         if (strlen($this->strLabelFor) > 0 ) { | ||
| 114 | $strHTML .= '<label for="' . $this->strLabelFor . '">' . $this->strText . '</label>'; | ||
| 115 |         } else { | ||
| 116 | $strHTML .= $this->strText; | ||
| 117 | } | ||
| 118 | $strHTML .= '</div>' . PHP_EOL; | ||
| 119 | |||
| 120 | return $strHTML; | ||
| 121 | } | ||
| 123 |