Code Duplication    Length = 3-3 lines in 7 locations

includes/api/class-wc-api-resource.php 3 locations

@@ 151-153 (lines=3) @@
148
			}
149
150
			// resources created before specified date
151
			if ( ! empty( $request_args['created_at_max'] ) ) {
152
				$args['date_query'][] = array( 'column' => 'post_date_gmt', 'before' => $this->server->parse_datetime( $request_args['created_at_max'] ), 'inclusive' => true );
153
			}
154
155
			// resources updated after specified date
156
			if ( ! empty( $request_args['updated_at_min'] ) ) {
@@ 156-158 (lines=3) @@
153
			}
154
155
			// resources updated after specified date
156
			if ( ! empty( $request_args['updated_at_min'] ) ) {
157
				$args['date_query'][] = array( 'column' => 'post_modified_gmt', 'after' => $this->server->parse_datetime( $request_args['updated_at_min'] ), 'inclusive' => true );
158
			}
159
160
			// resources updated before specified date
161
			if ( ! empty( $request_args['updated_at_max'] ) ) {
@@ 161-163 (lines=3) @@
158
			}
159
160
			// resources updated before specified date
161
			if ( ! empty( $request_args['updated_at_max'] ) ) {
162
				$args['date_query'][] = array( 'column' => 'post_modified_gmt', 'before' => $this->server->parse_datetime( $request_args['updated_at_max'] ), 'inclusive' => true );
163
			}
164
		}
165
166
		// search

includes/cli/class-wc-cli-command.php 4 locations

@@ 38-40 (lines=3) @@
35
			}
36
37
			// resources created before specified date
38
			if ( ! empty( $assoc_args['created_at_max'] ) ) {
39
				$args['date_query'][] = array( 'column' => 'post_date_gmt', 'before' => $this->parse_datetime( $assoc_args['created_at_max'] ), 'inclusive' => true );
40
			}
41
42
			// resources updated after specified date
43
			if ( ! empty( $assoc_args['updated_at_min'] ) ) {
@@ 43-45 (lines=3) @@
40
			}
41
42
			// resources updated after specified date
43
			if ( ! empty( $assoc_args['updated_at_min'] ) ) {
44
				$args['date_query'][] = array( 'column' => 'post_modified_gmt', 'after' => $this->parse_datetime( $assoc_args['updated_at_min'] ), 'inclusive' => true );
45
			}
46
47
			// resources updated before specified date
48
			if ( ! empty( $assoc_args['updated_at_max'] ) ) {
@@ 48-50 (lines=3) @@
45
			}
46
47
			// resources updated before specified date
48
			if ( ! empty( $assoc_args['updated_at_max'] ) ) {
49
				$args['date_query'][] = array( 'column' => 'post_modified_gmt', 'before' => $this->parse_datetime( $assoc_args['updated_at_max'] ), 'inclusive' => true );
50
			}
51
		}
52
53
		// Search.
@@ 151-153 (lines=3) @@
148
			}
149
150
			// resources created before specified date
151
			if ( ! empty( $assoc_args['created_at_max'] ) ) {
152
				$args['date_query'][] = array( 'before' => $this->parse_datetime( $assoc_args['created_at_max'] ), 'inclusive' => true );
153
			}
154
		}
155
156
		// Order (ASC or DESC, ASC by default).