Code Duplication    Length = 3-3 lines in 3 locations

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

@@ 1516-1518 (lines=3) @@
1513
	 * @return bool
1514
	 */
1515
	public static function validate_posint( $value = 0, $request, $param ) {
1516
		if ( ! is_numeric( $value ) || $value <= 0 ) {
1517
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a positive integer.', 'jetpack' ), $param ) );
1518
		}
1519
		return true;
1520
	}
1521
@@ 1630-1632 (lines=3) @@
1627
	 */
1628
	public static function validate_sharing_show( $value, $request, $param ) {
1629
		$views = array( 'index', 'post', 'page', 'attachment', 'jetpack-portfolio' );
1630
		if ( ! array_intersect( $views, $value ) ) {
1631
			return new WP_Error( 'invalid_param', sprintf(
1632
				/* 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 */
1633
				esc_html__( '%1$s must be %2$s.', 'jetpack' ), $param, join( ', ', $views )
1634
			) );
1635
		}
@@ 1776-1778 (lines=3) @@
1773
	 * @return bool
1774
	 */
1775
	public static function validate_string( $value = '', $request, $param ) {
1776
		if ( ! is_string( $value ) ) {
1777
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a string.', 'jetpack' ), $param ) );
1778
		}
1779
		return true;
1780
	}
1781