Code Duplication    Length = 3-3 lines in 2 locations

_inc/lib/class.core-rest-api-endpoints.php 2 locations

@@ 1815-1817 (lines=3) @@
1812
	 * @return bool
1813
	 */
1814
	public static function validate_services( $value, $request, $param ) {
1815
		if ( ! is_array( $value ) || ! isset( $value['visible'] ) || ! isset( $value['hidden'] ) ) {
1816
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with visible and hidden items.', 'jetpack' ), $param ) );
1817
		}
1818
1819
		// Allow to clear everything.
1820
		if ( empty( $value['visible'] ) && empty( $value['hidden'] ) ) {
@@ 1855-1857 (lines=3) @@
1852
	 * @return bool
1853
	 */
1854
	public static function validate_custom_service( $value, $request, $param ) {
1855
		if ( ! is_array( $value ) || ! isset( $value['sharing_name'] ) || ! isset( $value['sharing_url'] ) || ! isset( $value['sharing_icon'] ) ) {
1856
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with sharing name, url and icon.', 'jetpack' ), $param ) );
1857
		}
1858
1859
		// Allow to clear everything.
1860
		if ( empty( $value['sharing_name'] ) && empty( $value['sharing_url'] ) && empty( $value['sharing_icon'] ) ) {