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  | 
            ||
| 7 | class Files_Handler { | 
            ||
| 8 | |||
| 9 | /**  | 
            ||
| 10 | * The Plugins_Handler object.  | 
            ||
| 11 | *  | 
            ||
| 12 | * @var Plugins_Handler  | 
            ||
| 13 | */  | 
            ||
| 14 | private $plugins_handler = null;  | 
            ||
| 15 | |||
| 16 | /**  | 
            ||
| 17 | * The Version_Selector object.  | 
            ||
| 18 | *  | 
            ||
| 19 | * @var Version_Selector  | 
            ||
| 20 | */  | 
            ||
| 21 | private $version_selector = null;  | 
            ||
| 22 | |||
| 23 | /**  | 
            ||
| 24 | * The constructor.  | 
            ||
| 25 | *  | 
            ||
| 26 | * @param Plugins_Handler $plugins_handler The Plugins_Handler object.  | 
            ||
| 27 | * @param Version_Selector $version_selector The Version_Selector object.  | 
            ||
| 28 | */  | 
            ||
| 29 | 	public function __construct( $plugins_handler, $version_selector ) { | 
            ||
| 33 | |||
| 34 | /**  | 
            ||
| 35 | * Adds the version of a package file to the $jetpack_packages_filemap global  | 
            ||
| 36 | * array so that we can load the most recent version.  | 
            ||
| 37 | *  | 
            ||
| 38 | * @param string $file_identifier Unique id to file assigned by composer based on package name and filename.  | 
            ||
| 39 | * @param string $version Version of the file.  | 
            ||
| 40 | * @param string $path Absolute path to the file so that we can load it.  | 
            ||
| 41 | */  | 
            ||
| 42 | View Code Duplication | 	public function enqueue_package_file( $file_identifier, $version, $path ) { | 
            |
| 58 | |||
| 59 | /**  | 
            ||
| 60 | * Creates a path to the plugin's filemap. The filemap filename is the filename  | 
            ||
| 61 | * generated by Jetpack Autoloader version >= 2.0.  | 
            ||
| 62 | *  | 
            ||
| 63 | * @param String $plugin_path The plugin path.  | 
            ||
| 64 | *  | 
            ||
| 65 | * @return String The filemap path  | 
            ||
| 66 | */  | 
            ||
| 67 | 	public function create_filemap_path( $plugin_path ) { | 
            ||
| 70 | |||
| 71 | /**  | 
            ||
| 72 | * Initializes the filemap.  | 
            ||
| 73 | */  | 
            ||
| 74 | View Code Duplication | 	public function set_file_paths() { | 
            |
| 90 | |||
| 91 | /**  | 
            ||
| 92 | * Include latest version of all enqueued files.  | 
            ||
| 93 | */  | 
            ||
| 94 | 	public function file_loader() { | 
            ||
| 104 | }  | 
            ||
| 105 |