| Conditions | 12 | 
| Paths | 324 | 
| Total Lines | 68 | 
| Code Lines | 39 | 
| Lines | 10 | 
| Ratio | 14.71 % | 
| 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  | 
            ||
| 79 | 	function getButtons() { | 
            ||
| 80 | $buttons = '';  | 
            ||
| 81 | |||
| 82 | 		if ( $this->mShowSubmit ) { | 
            ||
| 83 | $attribs = [];  | 
            ||
| 84 | |||
| 85 | 			if ( isset( $this->mSubmitID ) ) { | 
            ||
| 86 | $attribs['id'] = $this->mSubmitID;  | 
            ||
| 87 | }  | 
            ||
| 88 | |||
| 89 | 			if ( isset( $this->mSubmitName ) ) { | 
            ||
| 90 | $attribs['name'] = $this->mSubmitName;  | 
            ||
| 91 | }  | 
            ||
| 92 | |||
| 93 | 			if ( isset( $this->mSubmitTooltip ) ) { | 
            ||
| 94 | $attribs += Linker::tooltipAndAccesskeyAttribs( $this->mSubmitTooltip );  | 
            ||
| 95 | }  | 
            ||
| 96 | |||
| 97 | $attribs['class'] = [  | 
            ||
| 98 | 'mw-htmlform-submit',  | 
            ||
| 99 | 'mw-ui-button mw-ui-big mw-ui-block',  | 
            ||
| 100 | ];  | 
            ||
| 101 | 			foreach ( $this->mSubmitFlags as $flag ) { | 
            ||
| 102 | $attribs['class'][] = 'mw-ui-' . $flag;  | 
            ||
| 103 | }  | 
            ||
| 104 | |||
| 105 | $buttons .= Xml::submitButton( $this->getSubmitText(), $attribs ) . "\n";  | 
            ||
| 106 | }  | 
            ||
| 107 | |||
| 108 | View Code Duplication | 		if ( $this->mShowReset ) { | 
            |
| 109 | $buttons .= Html::element(  | 
            ||
| 110 | 'input',  | 
            ||
| 111 | [  | 
            ||
| 112 | 'type' => 'reset',  | 
            ||
| 113 | 'value' => $this->msg( 'htmlform-reset' )->text(),  | 
            ||
| 114 | 'class' => 'mw-ui-button mw-ui-big mw-ui-block',  | 
            ||
| 115 | ]  | 
            ||
| 116 | ) . "\n";  | 
            ||
| 117 | }  | 
            ||
| 118 | |||
| 119 | 		foreach ( $this->mButtons as $button ) { | 
            ||
| 120 | $attrs = [  | 
            ||
| 121 | 'type' => 'submit',  | 
            ||
| 122 | 'name' => $button['name'],  | 
            ||
| 123 | 'value' => $button['value']  | 
            ||
| 124 | ];  | 
            ||
| 125 | |||
| 126 | 			if ( $button['attribs'] ) { | 
            ||
| 127 | $attrs += $button['attribs'];  | 
            ||
| 128 | }  | 
            ||
| 129 | |||
| 130 | 			if ( isset( $button['id'] ) ) { | 
            ||
| 131 | $attrs['id'] = $button['id'];  | 
            ||
| 132 | }  | 
            ||
| 133 | |||
| 134 | $attrs['class'] = isset( $attrs['class'] ) ? (array)$attrs['class'] : [];  | 
            ||
| 135 | $attrs['class'][] = 'mw-ui-button mw-ui-big mw-ui-block';  | 
            ||
| 136 | |||
| 137 | $buttons .= Html::element( 'input', $attrs ) . "\n";  | 
            ||
| 138 | }  | 
            ||
| 139 | |||
| 140 | 		if ( !$buttons ) { | 
            ||
| 141 | return '';  | 
            ||
| 142 | }  | 
            ||
| 143 | |||
| 144 | return Html::rawElement( 'div',  | 
            ||
| 145 | [ 'class' => 'mw-htmlform-submit-buttons' ], "\n$buttons" ) . "\n";  | 
            ||
| 146 | }  | 
            ||
| 147 | }  | 
            ||
| 148 |