src/Modules/Endpoint.php
private function validate_params( \WP_REST_Request $data, $params ) {
		$collect = array();
		foreach ( $params as $param ) {
			$value = sanitize_text_field( $data[ $param ] );
			if ( empty( $value ) ) {
				return rest_ensure_response(
					new \WP_Error(
						'themeisle_' . $param . '_invalid',
						sprintf( 'Invalid %', $param ),
						array(
							'status' => 403,
						)
					)
				);
			} else {
				$collect[ $param ] = $value;
			}
		}

		return $collect;
	}
private function validate_params( \WP_REST_Request $data, $params ) {
		$collect = array();
		foreach ( $params as $param ) {
			$value = sanitize_text_field( $data[ $param ] );
			if ( empty( $value ) ) {
				return rest_ensure_response(
					new \WP_Error(
						'themeisle_' . $param . '_invalid',
						sprintf( 'Invalid %', $param ),
						array(
							'status' => 403,
						)
					)
				);
			} else {
				$collect[ $param ] = $value;
			}
		}

		return $collect;
	}
private function validate_params ( \ WP_REST_Request $ data , $ params ) { $ collect = array ( ) ; foreach ( $ params as $ param ) { $ value = sanitize_text_field ( $ data [ $ param ] ) ; if ( empty ( $ value ) ) { return rest_ensure_response ( new \ WP_Error ( 'themeisle_' . $ param . '_invalid' , sprintf ( 'Invalid %' , $ param ) , array ( 'status' => 403 , ) ) ) ; } else { $ collect [ $ param ] = $ value ; } } return $ collect ; }
Validates the parameters to the API

@param \WP_REST_Request $data the request.
@param array            $params the parameters to validate.

@return array of parameter name=>value
Validates the parameters to the API