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 |
||
| 17 | final class RangeCondition extends AbstractAction |
||
| 18 | { |
||
| 19 | /** The socket that is activated when the result is true. */ |
||
| 20 | const SOCKET_TRUE = 'true'; |
||
| 21 | |||
| 22 | /** The socket that is activated when the result is false. */ |
||
| 23 | const SOCKET_FALSE = 'false'; |
||
| 24 | |||
| 25 | /** The socket for the minimum value variable. */ |
||
| 26 | const SOCKET_MIN = 'minimum'; |
||
| 27 | |||
| 28 | /** The socket for the maximum value variable. */ |
||
| 29 | const SOCKET_MAX = 'maximum'; |
||
| 30 | |||
| 31 | /** The socket for the value that should be compared.. */ |
||
| 32 | const SOCKET_VALUE = 'value'; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Initializes a new instance of this class. |
||
| 36 | */ |
||
| 37 | View Code Duplication | public function __construct() |
|
| 47 | |||
| 48 | /** |
||
| 49 | * Executes the node's logic. |
||
| 50 | */ |
||
| 51 | public function execute() |
||
| 63 | } |
||
| 64 |