Code Duplication    Length = 3-3 lines in 3 locations

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

@@ 1716-1718 (lines=3) @@
1713
	 * @return bool
1714
	 */
1715
	public static function validate_posint( $value = 0, $request, $param ) {
1716
		if ( ! is_numeric( $value ) || $value <= 0 ) {
1717
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a positive integer.', 'jetpack' ), $param ) );
1718
		}
1719
		return true;
1720
	}
1721
@@ 1851-1853 (lines=3) @@
1848
		if ( ! is_array( $value ) ) {
1849
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array of post types.', 'jetpack' ), $param ) );
1850
		}
1851
		if ( ! array_intersect( $views, $value ) ) {
1852
			return new WP_Error( 'invalid_param', sprintf(
1853
				/* Translators: first variable is the name of a parameter passed to endpoint holding the post type where Sharing will be displayed, the second is a list of post types where Sharing can be displayed */
1854
				esc_html__( '%1$s must be %2$s.', 'jetpack' ), $param, join( ', ', $views )
1855
			) );
1856
		}
@@ 1997-1999 (lines=3) @@
1994
	 * @return bool
1995
	 */
1996
	public static function validate_string( $value = '', $request, $param ) {
1997
		if ( ! is_string( $value ) ) {
1998
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a string.', 'jetpack' ), $param ) );
1999
		}
2000
		return true;
2001
	}
2002