Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
||
| 11 | class EE_Button_Input extends EE_Form_Input_Base{ |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var string of HTML to put between the button tags |
||
| 15 | */ |
||
| 16 | protected $_button_content; |
||
| 17 | /** |
||
| 18 | * @param array $options |
||
| 19 | */ |
||
| 20 | View Code Duplication | public function __construct($options = array()){ |
|
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | /** |
||
| 33 | * Sets the button content |
||
| 34 | * @see EE_Button_Input::$_button_content |
||
| 35 | * @param string $new_content |
||
| 36 | */ |
||
| 37 | public function set_button_content($new_content) |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Gets the button content |
||
| 44 | * @return string |
||
| 45 | */ |
||
| 46 | public function button_content() |
||
| 50 | } |
||
| 51 |