Code Duplication    Length = 11-11 lines in 4 locations

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/Comment_Meta_Container.php 1 location

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

core/Container/Term_Meta_Container.php 1 location

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

core/Container/Post_Meta_Container.php 1 location

@@ 248-258 (lines=11) @@
245
	 *
246
	 * @param int $post_id
247
	 */
248
	public function set_post_id( $post_id ) {
249
		$this->post_id = $post_id;
250
		$this->get_datastore()->set_object_id( $post_id );
251
252
		foreach ( $this->fields as $field ) {
253
			$datastore = $field->get_datastore();
254
			if ( $datastore->get_object_id() === 0 ) {
255
				$datastore->set_object_id( $post_id );
256
			}
257
		}
258
	}
259
260
	/**
261
	 * Get array of post types this container can appear on conditionally