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

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

core/Container/User_Meta_Container.php 1 location

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