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

@@ 1030-1038 (lines=9) @@
1027
1028
	if ( ! empty( $cached_options ) ) {
1029
		foreach ( $cached_options as $option ) {
1030
			switch ( true ) {
1031
				case ( false !== strpos( $option, 'transient' ) ):
1032
					$option = str_replace( '_transient_', '', $option );
1033
					delete_transient( $option );
1034
					break;
1035
1036
				default:
1037
					delete_option( $option );
1038
			}
1039
		}
1040
	}
1041
}