Code Duplication    Length = 13-14 lines in 2 locations

core/Container/Post_Meta_Container.php 1 location

@@ 145-158 (lines=14) @@
142
	 *
143
	 * @param int $post_id ID of the post against which save() is ran
144
	 **/
145
	public function save( $post_id ) {
146
		// Unhook action to garantee single save
147
		remove_action( 'save_post', array( $this, '_save' ) );
148
149
		$this->set_post_id( $post_id );
150
151
		foreach ( $this->fields as $field ) {
152
			$field->set_value_from_input();
153
			$field->save();
154
		}
155
156
		do_action( 'carbon_after_save_custom_fields', $post_id );
157
		do_action( 'carbon_after_save_post_meta', $post_id );
158
	}
159
160
	/**
161
	 * Perform checks whether the current save() request is valid

core/Container/User_Meta_Container.php 1 location

@@ 54-66 (lines=13) @@
51
	 *
52
	 * @param int $user_id ID of the user against which save() is ran
53
	 **/
54
	public function save( $user_id ) {
55
		// Unhook action to garantee single save
56
		remove_action( 'profile_update', array( $this, '_save' ) );
57
58
		$this->set_user_id( $user_id );
59
60
		foreach ( $this->fields as $field ) {
61
			$field->set_value_from_input();
62
			$field->save();
63
		}
64
65
		do_action( 'carbon_after_save_user_meta', $user_id );
66
	}
67
68
	/**
69
	 * Checks whether the current request is valid