Code Duplication    Length = 13-14 lines in 2 locations

core/Container/Post_Meta_Container.php 1 location

@@ 136-149 (lines=14) @@
133
	 *
134
	 * @param int $post_id ID of the post against which save() is ran
135
	 **/
136
	public function save( $post_id ) {
137
		// Unhook action to garantee single save
138
		remove_action( 'save_post', array( $this, '_save' ) );
139
140
		$this->set_post_id( $post_id );
141
142
		foreach ( $this->fields as $field ) {
143
			$field->set_value_from_input();
144
			$field->save();
145
		}
146
147
		do_action( 'carbon_after_save_custom_fields', $post_id );
148
		do_action( 'carbon_after_save_post_meta', $post_id );
149
	}
150
151
	/**
152
	 * Perform checks whether the current save() request is valid

core/Container/User_Meta_Container.php 1 location

@@ 45-57 (lines=13) @@
42
	 *
43
	 * @param int $user_id ID of the user against which save() is ran
44
	 **/
45
	public function save( $user_id ) {
46
		// Unhook action to garantee single save
47
		remove_action( 'profile_update', array( $this, '_save' ) );
48
49
		$this->set_user_id( $user_id );
50
51
		foreach ( $this->fields as $field ) {
52
			$field->set_value_from_input();
53
			$field->save();
54
		}
55
56
		do_action( 'carbon_after_save_user_meta', $user_id );
57
	}
58
59
	/**
60
	 * Checks whether the current request is valid