Code Duplication    Length = 17-23 lines in 2 locations

projects/plugins/jetpack/modules/masterbar/admin-menu/class-admin-menu.php 2 locations

@@ 190-206 (lines=17) @@
187
	/**
188
	 * Adds Upgrades menu.
189
	 */
190
	public function add_upgrades_menu() {
191
		remove_menu_page( 'paid-upgrades.php' );
192
193
		$menu_slug = 'https://wordpress.com/plans/' . $this->domain;
194
195
		add_menu_page( __( 'Upgrades', 'jetpack' ), __( 'Upgrades', 'jetpack' ), 'manage_options', $menu_slug, null, 'dashicons-cart', 4 );
196
		add_submenu_page( $menu_slug, __( 'Plans', 'jetpack' ), __( 'Plans', 'jetpack' ), 'manage_options', $menu_slug, null, 5 );
197
		add_submenu_page( $menu_slug, __( 'Purchases', 'jetpack' ), __( 'Purchases', 'jetpack' ), 'manage_options', 'https://wordpress.com/purchases/subscriptions/' . $this->domain, null, 15 );
198
199
		$this->migrate_submenus( 'paid-upgrades.php', $menu_slug );
200
		add_filter(
201
			'parent_file',
202
			function ( $parent_file ) use ( $menu_slug ) {
203
				return 'paid-upgrades.php' === $parent_file ? $menu_slug : $parent_file;
204
			}
205
		);
206
	}
207
208
	/**
209
	 * Adds Posts menu.
@@ 613-635 (lines=23) @@
610
	 *
611
	 * @param bool $wp_admin Optional. Whether links should point to Calypso or wp-admin. Default false (Calypso).
612
	 */
613
	public function add_options_menu( $wp_admin = false ) {
614
		if ( $wp_admin ) {
615
			return;
616
		}
617
618
		$options_slug = 'https://wordpress.com/settings/general/' . $this->domain;
619
620
		remove_menu_page( 'options-general.php' );
621
		remove_submenu_page( 'options-general.php', 'options-general.php' );
622
		remove_submenu_page( 'options-general.php', 'options-discussion.php' );
623
		remove_submenu_page( 'options-general.php', 'options-writing.php' );
624
625
		add_menu_page( esc_attr__( 'Settings', 'jetpack' ), __( 'Settings', 'jetpack' ), 'manage_options', $options_slug, null, 'dashicons-admin-settings', 80 );
626
		add_submenu_page( $options_slug, esc_attr__( 'General', 'jetpack' ), __( 'General', 'jetpack' ), 'manage_options', $options_slug, null, 10 );
627
628
		$this->migrate_submenus( 'options-general.php', $options_slug );
629
		add_filter(
630
			'parent_file',
631
			function ( $parent_file ) use ( $options_slug ) {
632
				return 'options-general.php' === $parent_file ? $options_slug : $parent_file;
633
			}
634
		);
635
	}
636
637
	/**
638
	 * Migrates submenu items from wp-admin menu slugs to Calypso menu slugs.