Code Duplication    Length = 3-3 lines in 3 locations

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

@@ 1619-1621 (lines=3) @@
1616
	 * @return bool
1617
	 */
1618
	public static function validate_posint( $value = 0, $request, $param ) {
1619
		if ( ! is_numeric( $value ) || $value <= 0 ) {
1620
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a positive integer.', 'jetpack' ), $param ) );
1621
		}
1622
		return true;
1623
	}
1624
@@ 1733-1735 (lines=3) @@
1730
	 */
1731
	public static function validate_sharing_show( $value, $request, $param ) {
1732
		$views = array( 'index', 'post', 'page', 'attachment', 'jetpack-portfolio' );
1733
		if ( ! array_intersect( $views, $value ) ) {
1734
			return new WP_Error( 'invalid_param', sprintf(
1735
				/* 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 */
1736
				esc_html__( '%1$s must be %2$s.', 'jetpack' ), $param, join( ', ', $views )
1737
			) );
1738
		}
@@ 1879-1881 (lines=3) @@
1876
	 * @return bool
1877
	 */
1878
	public static function validate_string( $value = '', $request, $param ) {
1879
		if ( ! is_string( $value ) ) {
1880
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a string.', 'jetpack' ), $param ) );
1881
		}
1882
		return true;
1883
	}
1884