Code Duplication    Length = 3-4 lines in 2 locations

core/libraries/rest_api/controllers/config/Read.php 1 location

@@ 28-30 (lines=3) @@
25
		$cap = \EE_Restriction_Generator_Base::get_default_restrictions_cap();
26
		if( \EE_Capabilities::instance()->current_user_can( $cap, 'read_over_api' ) ){
27
			return \EE_Config::instance();
28
		}else{
29
			return new \WP_Error(
30
				'cannot_read_config',
31
				sprintf(
32
					__(
33
						'You do not have the necessary capabilities (%s) to read Event Espresso Configuration data',

core/libraries/rest_api/controllers/model/Read.php 1 location

@@ 531-534 (lines=4) @@
528
					),
529
					array( 'status' => 403 )
530
				);
531
			} else {
532
				//it's not you. It just doesn't exist
533
				return new \WP_Error(
534
					sprintf( 'rest_%s_invalid_id', $lowercase_model_name ),
535
					sprintf( __( 'Invalid %s ID.', 'event_espresso' ), $lowercase_model_name ),
536
					array( 'status' => 404 )
537
				);