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 Jetpack_WordAds_Shortcode { | ||
| 8 | |||
| 9 | private $scripts_and_style_included = false; | ||
|  | |||
| 10 | |||
| 11 | 	function __construct() { | ||
| 14 | |||
| 15 | /** | ||
| 16 | * Register our shortcode and enqueue necessary files. | ||
| 17 | */ | ||
| 18 | 	function action_init() { | ||
| 21 | |||
| 22 | /** | ||
| 23 | * Add hooks according to screen. | ||
| 24 | * | ||
| 25 | * @param WP_Screen $screen Data about current screen. | ||
| 26 | */ | ||
| 27 | 	public static function add_hooks( $screen ) { | ||
| 33 | |||
| 34 | /** | ||
| 35 | * WordPress Shortcode Editor View JS Code | ||
| 36 | */ | ||
| 37 | 	public static function handle_editor_view_js() { | ||
| 51 | |||
| 52 | /** | ||
| 53 | * Our [wordad] shortcode. | ||
| 54 | * Prints a WordAds Ad. | ||
| 55 | * | ||
| 56 | * @param array $atts Array of shortcode attributes. | ||
| 57 | * @param string $content Post content. | ||
| 58 | * | ||
| 59 | * @return string HTML for WordAds shortcode. | ||
| 60 | */ | ||
| 61 | 	static function wordads_shortcode( $atts, $content = '' ) { | ||
| 69 | |||
| 70 | /** | ||
| 71 | * The shortcode output | ||
| 72 | * | ||
| 73 | * @param array $atts Array of shortcode attributes. | ||
| 74 | * @param string $content Post content. | ||
| 75 | * | ||
| 76 | * @return string HTML output | ||
| 77 | */ | ||
| 78 | 	static function wordads_shortcode_html( $atts, $content = '' ) { | ||
| 93 | |||
| 94 | 	public static function admin_head() { | ||
| 98 | |||
| 99 | View Code Duplication | 	public static function wordads_media_button() { | |
| 110 | } | ||
| 111 | |||
| 114 | 
This check marks private properties in classes that are never used. Those properties can be removed.