Code Duplication    Length = 3-3 lines in 3 locations

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

@@ 1685-1687 (lines=3) @@
1682
	 * @return bool
1683
	 */
1684
	public static function validate_posint( $value = 0, $request, $param ) {
1685
		if ( ! is_numeric( $value ) || $value <= 0 ) {
1686
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a positive integer.', 'jetpack' ), $param ) );
1687
		}
1688
		return true;
1689
	}
1690
@@ 1802-1804 (lines=3) @@
1799
		if ( ! is_array( $value ) ) {
1800
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array of post types.', 'jetpack' ), $param ) );
1801
		}
1802
		if ( ! array_intersect( $views, $value ) ) {
1803
			return new WP_Error( 'invalid_param', sprintf(
1804
				/* 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 */
1805
				esc_html__( '%1$s must be %2$s.', 'jetpack' ), $param, join( ', ', $views )
1806
			) );
1807
		}
@@ 1948-1950 (lines=3) @@
1945
	 * @return bool
1946
	 */
1947
	public static function validate_string( $value = '', $request, $param ) {
1948
		if ( ! is_string( $value ) ) {
1949
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a string.', 'jetpack' ), $param ) );
1950
		}
1951
		return true;
1952
	}
1953