Code Duplication    Length = 7-7 lines in 3 locations

includes/api/class-wpinv-rest-items-controller.php 3 locations

@@ 801-807 (lines=7) @@
798
			'editable'
799
		);
800
801
		foreach( $item_properties as $property ) {
802
803
			if ( rest_is_field_included( $property, $fields ) && method_exists( $item, 'get_' . $property ) ) {
804
				$data[$property] = call_user_func( array( $item, 'get_' . $property ) );
805
			}
806
807
		}
808
809
		// Dynamic pricing.
810
		if( $item->supports_dynamic_pricing() ) {
@@ 829-835 (lines=7) @@
826
		if( $item->is_recurring() ) {
827
828
			$recurring_fields = array( 'is_recurring', 'recurring_period', 'recurring_interval', 'recurring_limit', 'free_trial' );
829
			foreach( $recurring_fields as $field ) {
830
831
				if ( rest_is_field_included( $field, $fields ) && method_exists( $item, 'get_' . $field ) ) {
832
					$data[$field] = call_user_func( array( $item, 'get_' . $field ) );
833
				}
834
	
835
			}
836
837
			if( $item->has_free_trial() ) {
838
@@ 840-846 (lines=7) @@
837
			if( $item->has_free_trial() ) {
838
839
				$trial_fields = array( 'trial_period', 'trial_interval' );
840
				foreach( $trial_fields as $field ) {
841
842
					if ( rest_is_field_included( $field, $fields ) && method_exists( $item, 'get_' . $field ) ) {
843
						$data[$field] = call_user_func( array( $item, 'get_' . $field ) );
844
					}
845
	
846
				}
847
848
			}
849