Code Duplication    Length = 7-7 lines in 3 locations

_inc/lib/core-api/class.jetpack-core-api-module-endpoints.php 3 locations

@@ 63-69 (lines=7) @@
60
			? $data['slug']
61
			: $data;
62
63
		if ( ! Jetpack::is_module( $module_slug ) ) {
64
			return new WP_Error(
65
				'not_found',
66
				esc_html__( 'The requested Jetpack module was not found.', 'jetpack' ),
67
				array( 'status' => 404 )
68
			);
69
		}
70
71
		if (
72
			in_array( $module_slug, $this->modules_requiring_public )
@@ 114-120 (lines=7) @@
111
			? $data['slug']
112
			: $data;
113
114
		if ( ! Jetpack::is_module( $module_slug ) ) {
115
			return new WP_Error(
116
				'not_found',
117
				esc_html__( 'The requested Jetpack module was not found.', 'jetpack' ),
118
				array( 'status' => 404 )
119
			);
120
		}
121
122
		if ( ! Jetpack::is_module_active( $module_slug ) ) {
123
			return new WP_Error(
@@ 399-405 (lines=7) @@
396
			// It will not be passed. It's just checked in this method to pass that method a string or array.
397
			$data['slug'] = 'any';
398
		} else {
399
			if ( ! Jetpack::is_module( $data['slug'] ) ) {
400
				return new WP_Error( 'not_found', esc_html__( 'The requested Jetpack module was not found.', 'jetpack' ), array( 'status' => 404 ) );
401
			}
402
403
			if ( ! Jetpack::is_module_active( $data['slug'] ) ) {
404
				return new WP_Error( 'inactive', esc_html__( 'The requested Jetpack module is inactive.', 'jetpack' ), array( 'status' => 409 ) );
405
			}
406
		}
407
408
		// Get parameters to update the module.