Code Duplication    Length = 17-18 lines in 2 locations

includes/class-wc-webhook.php 2 locations

@@ 640-656 (lines=17) @@
637
	 */
638
	public function get_status() {
639
640
		switch ( $this->get_post_data()->post_status ) {
641
642
			case 'publish':
643
				$status = 'active';
644
				break;
645
646
			case 'draft':
647
				$status = 'paused';
648
				break;
649
650
			case 'pending':
651
				$status = 'disabled';
652
				break;
653
654
			default:
655
				$status = 'paused';
656
		}
657
658
		return apply_filters( 'woocommerce_webhook_status', $status, $this->id );
659
	}
@@ 682-699 (lines=18) @@
679
	public function update_status( $status ) {
680
		global $wpdb;
681
682
		switch ( $status ) {
683
684
			case 'active' :
685
				$post_status = 'publish';
686
				break;
687
688
			case 'paused' :
689
				$post_status = 'draft';
690
				break;
691
692
			case 'disabled' :
693
				$post_status = 'pending';
694
				break;
695
696
			default :
697
				$post_status = 'draft';
698
				break;
699
		}
700
701
		$wpdb->update( $wpdb->posts, array( 'post_status' => $post_status ), array( 'ID' => $this->id ) );
702
		clean_post_cache( $this->id );