Code Duplication    Length = 3-3 lines in 3 locations

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

@@ 1672-1674 (lines=3) @@
1669
	 * @return bool
1670
	 */
1671
	public static function validate_posint( $value = 0, $request, $param ) {
1672
		if ( ! is_numeric( $value ) || $value <= 0 ) {
1673
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a positive integer.', 'jetpack' ), $param ) );
1674
		}
1675
		return true;
1676
	}
1677
@@ 1789-1791 (lines=3) @@
1786
		if ( ! is_array( $value ) ) {
1787
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array of post types.', 'jetpack' ), $param ) );
1788
		}
1789
		if ( ! array_intersect( $views, $value ) ) {
1790
			return new WP_Error( 'invalid_param', sprintf(
1791
				/* 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 */
1792
				esc_html__( '%1$s must be %2$s.', 'jetpack' ), $param, join( ', ', $views )
1793
			) );
1794
		}
@@ 1935-1937 (lines=3) @@
1932
	 * @return bool
1933
	 */
1934
	public static function validate_string( $value = '', $request, $param ) {
1935
		if ( ! is_string( $value ) ) {
1936
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a string.', 'jetpack' ), $param ) );
1937
		}
1938
		return true;
1939
	}
1940