Code Duplication    Length = 9-9 lines in 2 locations

includes/class-give-cli-commands.php 1 location

@@ 794-802 (lines=9) @@
791
				$error       = false;
792
				$option_name = $option_name['option_name'];
793
794
				switch ( true ) {
795
					case ( false !== strpos( $option_name, 'transient' ) ):
796
						$option_name = str_replace( '_transient_', '', $option_name );
797
						$error       = delete_transient( $option_name );
798
						break;
799
800
					default:
801
						$error = delete_option( $option_name );
802
				}
803
804
				if ( $error ) {
805
					WP_CLI::log( $this->color_message( self::$counter, $option_name ) );

includes/admin/upgrades/upgrade-functions.php 1 location

@@ 1010-1018 (lines=9) @@
1007
1008
	if ( ! empty( $cached_options ) ) {
1009
		foreach ( $cached_options as $option ) {
1010
			switch ( true ) {
1011
				case ( false !== strpos( $option, 'transient' ) ):
1012
					$option = str_replace( '_transient_', '', $option );
1013
					delete_transient( $option );
1014
					break;
1015
1016
				default:
1017
					delete_option( $option );
1018
			}
1019
		}
1020
	}
1021
}