Code Duplication    Length = 6-11 lines in 2 locations

includes/rest-api/CMB2_REST_Controller_Boxes.php 1 location

@@ 129-139 (lines=11) @@
126
127
		// Loop and prepare boxes data.
128
		foreach ( $boxes as $this->rest_box ) {
129
			if (
130
				// Make sure this box can be read
131
				$this->rest_box->rest_read
132
				// And make sure current user can view this box.
133
				&& $this->get_item_permissions_check_filter( $this->request )
134
			) {
135
				$boxes_data[] = $this->server->response_to_data(
136
					$this->get_rest_box(),
137
					isset( $this->request['_embed'] )
138
				);
139
			}
140
		}
141
142
		return $this->prepare_item( $boxes_data );

includes/rest-api/CMB2_REST_Controller_Fields.php 1 location

@@ 128-133 (lines=6) @@
125
			$this->field = $this->rest_box->field_can_read( $field['id'], true );
126
127
			// And make sure current user can view this box.
128
			if ( $this->field && $this->get_item_permissions_check_filter() ) {
129
				$fields[ $field['id'] ] = $this->server->response_to_data(
130
					$this->prepare_field_response(),
131
					isset( $this->request['_embed'] )
132
				);
133
			}
134
		}
135
136
		return $this->prepare_item( $fields );