Code Duplication    Length = 11-11 lines in 4 locations

core/Container/Comment_Meta_Container.php 1 location

@@ 147-157 (lines=11) @@
144
	 *
145
	 * @param int $comment_id
146
	 */
147
	protected function set_comment_id( $comment_id ) {
148
		$this->comment_id = $comment_id;
149
		$this->get_datastore()->set_object_id( $comment_id );
150
151
		foreach ( $this->fields as $field ) {
152
			$datastore = $field->get_datastore();
153
			if ( $datastore->get_object_id() === 0 ) {
154
				$datastore->set_object_id( $comment_id );
155
			}
156
		}
157
	}
158
}
159

core/Container/Post_Meta_Container.php 1 location

@@ 231-241 (lines=11) @@
228
	 *
229
	 * @param int $post_id
230
	 */
231
	protected function set_post_id( $post_id ) {
232
		$this->post_id = $post_id;
233
		$this->get_datastore()->set_object_id( $post_id );
234
235
		foreach ( $this->fields as $field ) {
236
			$datastore = $field->get_datastore();
237
			if ( $datastore->get_object_id() === 0 ) {
238
				$datastore->set_object_id( $post_id );
239
			}
240
		}
241
	}
242
243
	/**
244
	 * Get array of post types this container can appear on conditionally

core/Container/User_Meta_Container.php 1 location

@@ 188-198 (lines=11) @@
185
	 *
186
	 * @param int $user_id
187
	 */
188
	protected function set_user_id( $user_id ) {
189
		$this->user_id = $user_id;
190
		$this->get_datastore()->set_object_id( $user_id );
191
192
		foreach ( $this->fields as $field ) {
193
			$datastore = $field->get_datastore();
194
			if ( $datastore->get_object_id() === 0 ) {
195
				$datastore->set_object_id( $user_id );
196
			}
197
		}
198
	}
199
200
	/**
201
	 * Show the container only on users who have the $role role.

core/Container/Term_Meta_Container.php 1 location

@@ 173-183 (lines=11) @@
170
	 *
171
	 * @param int $term_id
172
	 */
173
	protected function set_term_id( $term_id ) {
174
		$this->term_id = $term_id;
175
		$this->get_datastore()->set_object_id( $term_id );
176
177
		foreach ( $this->fields as $field ) {
178
			$datastore = $field->get_datastore();
179
			if ( $datastore->get_object_id() === 0 ) {
180
				$datastore->set_object_id( $term_id );
181
			}
182
		}
183
	}
184
185
	/**
186
	 * Get array of taxonomies this container can appear on conditionally