Code Duplication    Length = 8-8 lines in 2 locations

json-endpoints/class.wpcom-json-api-update-post-v1-1-endpoint.php 1 location

@@ 38-45 (lines=8) @@
35
		$args = $this->query_args();
36
37
		// unhook publicize, it's hooked again later -- without this, skipping services is impossible
38
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
39
			remove_action( 'save_post', array( $GLOBALS['publicize_ui']->publicize, 'async_publicize_post' ), 100, 2 );
40
			add_action( 'rest_api_inserted_post', array( $GLOBALS['publicize_ui']->publicize, 'async_publicize_post' ) );
41
42
			if ( $this->should_load_theme_functions( $post_id ) ) {
43
				$this->load_theme_functions();
44
			}
45
		}
46
47
48
		if ( $new ) {

json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php 1 location

@@ 13-20 (lines=8) @@
10
		$args = $this->query_args();
11
12
		// unhook publicize, it's hooked again later -- without this, skipping services is impossible
13
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
14
			remove_action( 'save_post', array( $GLOBALS['publicize_ui']->publicize, 'async_publicize_post' ), 100, 2 );
15
			add_action( 'rest_api_inserted_post', array( $GLOBALS['publicize_ui']->publicize, 'async_publicize_post' ) );
16
17
			if ( $this->should_load_theme_functions( $post_id ) ) {
18
				$this->load_theme_functions();
19
			}
20
		}
21
22
		if ( $new ) {
23
			$input = $this->input( true );