Code Duplication    Length = 13-13 lines in 3 locations

_inc/lib/core-api/wpcom-endpoints/publicize-connections.php 1 location

@@ 171-183 (lines=13) @@
168
	 *
169
	 * @return true|WP_Error
170
	 */
171
	public function get_items_permission_check() {
172
		global $publicize;
173
174
		if ( $publicize->current_user_can_access_publicize_data() ) {
175
			return true;
176
		}
177
178
		return new WP_Error(
179
			'invalid_user_permission_publicize',
180
			__( 'Sorry, you are not allowed to access Publicize data on this site.', 'jetpack' ),
181
			array( 'status' => rest_authorization_required_code() )
182
		);
183
	}
184
}
185
186
wpcom_rest_api_v2_load_plugin( 'WPCOM_REST_API_V2_Endpoint_List_Publicize_Connections' );

_inc/lib/core-api/wpcom-endpoints/publicize-services.php 1 location

@@ 144-156 (lines=13) @@
141
	 *
142
	 * @return true|WP_Error
143
	 */
144
	public function get_items_permission_check() {
145
		global $publicize;
146
147
		if ( $publicize->current_user_can_access_publicize_data() ) {
148
			return true;
149
		}
150
151
		return new WP_Error(
152
			'invalid_user_permission_publicize',
153
			__( 'Sorry, you are not allowed to access Publicize data on this site.', 'jetpack' ),
154
			array( 'status' => rest_authorization_required_code() )
155
		);
156
	}
157
}
158
159
wpcom_rest_api_v2_load_plugin( 'WPCOM_REST_API_V2_Endpoint_List_Publicize_Services' );

_inc/lib/core-api/wpcom-endpoints/update-options.php 1 location

@@ 115-127 (lines=13) @@
112
	 *
113
	 * @return true|WP_Error
114
	 */
115
	public function get_items_permission_check() {
116
		global $publicize;
117
118
		if ( $publicize->current_user_can_access_publicize_data() ) {
119
			return true;
120
		}
121
122
		return new WP_Error(
123
			'invalid_user_permission_publicize',
124
			__( 'Sorry, you are not allowed to access Publicize data on this site.', 'jetpack' ),
125
			array( 'status' => rest_authorization_required_code() )
126
		);
127
	}
128
}
129
130
wpcom_rest_api_v2_load_plugin( 'WPCOM_REST_API_V2_Endpoint_Options' );