Code Duplication    Length = 25-28 lines in 2 locations

src/classes/un/installer/base.php 2 locations

@@ 1660-1687 (lines=28) @@
1657
	 *
1658
	 * @param string $option The option to uninstall.
1659
	 */
1660
	protected function uninstall_option( $option ) {
1661
1662
		if ( 'network' === $this->context ) {
1663
			$this->uninstall_network_option( $option );
1664
			return;
1665
		}
1666
1667
		if ( false !== strpos( $option, '%' ) ) {
1668
1669
			global $wpdb;
1670
1671
			$options = $wpdb->get_col(
1672
				$wpdb->prepare(
1673
					"
1674
						SELECT `option_name`
1675
						FROM `{$wpdb->options}`
1676
						WHERE `option_name` LIKE %s
1677
					"
1678
					, $option
1679
				)
1680
			); // WPCS: cache pass.
1681
1682
		} else {
1683
			$options = array( $option );
1684
		}
1685
1686
		array_map( 'delete_option', $options );
1687
	}
1688
1689
	/**
1690
	 * Uninstall a network option.
@@ 1698-1722 (lines=25) @@
1695
	 *
1696
	 * @param string $option The network option to uninstall.
1697
	 */
1698
	protected function uninstall_network_option( $option ) {
1699
1700
		if ( false !== strpos( $option, '%' ) ) {
1701
1702
			global $wpdb;
1703
1704
			$options = $wpdb->get_col(
1705
				$wpdb->prepare(
1706
					"
1707
						SELECT `meta_key`
1708
						FROM `{$wpdb->sitemeta}`
1709
						WHERE `meta_key` LIKE %s
1710
							AND `site_id` = %d
1711
					"
1712
					, $option
1713
					, $wpdb->siteid
1714
				)
1715
			); // WPCS: cache pass.
1716
1717
		} else {
1718
			$options = array( $option );
1719
		}
1720
1721
		array_map( 'delete_site_option', $options );
1722
	}
1723
1724
	/**
1725
	 * Uninstall a transient.