Code Duplication    Length = 3-3 lines in 3 locations

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

@@ 1700-1702 (lines=3) @@
1697
	 * @return bool
1698
	 */
1699
	public static function validate_posint( $value = 0, $request, $param ) {
1700
		if ( ! is_numeric( $value ) || $value <= 0 ) {
1701
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a positive integer.', 'jetpack' ), $param ) );
1702
		}
1703
		return true;
1704
	}
1705
@@ 1817-1819 (lines=3) @@
1814
		if ( ! is_array( $value ) ) {
1815
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array of post types.', 'jetpack' ), $param ) );
1816
		}
1817
		if ( ! array_intersect( $views, $value ) ) {
1818
			return new WP_Error( 'invalid_param', sprintf(
1819
				/* 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 */
1820
				esc_html__( '%1$s must be %2$s.', 'jetpack' ), $param, join( ', ', $views )
1821
			) );
1822
		}
@@ 1963-1965 (lines=3) @@
1960
	 * @return bool
1961
	 */
1962
	public static function validate_string( $value = '', $request, $param ) {
1963
		if ( ! is_string( $value ) ) {
1964
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a string.', 'jetpack' ), $param ) );
1965
		}
1966
		return true;
1967
	}
1968