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 | View Code Duplication | final class InsertAction extends AbstractAction |
|
18 | { |
||
19 | /** The output action socket. */ |
||
20 | const SOCKET_OUTPUT = 'out'; |
||
21 | |||
22 | /** The array variable socket. */ |
||
23 | const SOCKET_ARRAY = 'array'; |
||
24 | |||
25 | /** The index variable socket. */ |
||
26 | const SOCKET_INDEX = 'index'; |
||
27 | |||
28 | /** The value variable socket. */ |
||
29 | const SOCKET_VALUE = 'value'; |
||
30 | |||
31 | /** |
||
32 | * Initializes a new instance of this class. |
||
33 | */ |
||
34 | public function __construct() |
||
43 | |||
44 | /** |
||
45 | * Executes the node's logic. |
||
46 | */ |
||
47 | public function execute() |
||
70 | } |
||
71 |