Code Duplication    Length = 13-14 lines in 2 locations

core/Container/User_Meta_Container.php 1 location

@@ 98-110 (lines=13) @@
95
	 *
96
	 * @param int $user_id ID of the user against which save() is ran
97
	 **/
98
	public function save( $user_id ) {
99
		// Unhook action to garantee single save
100
		remove_action( 'profile_update', array( $this, '_save' ) );
101
102
		$this->set_user_id( $user_id );
103
104
		foreach ( $this->fields as $field ) {
105
			$field->set_value_from_input();
106
			$field->save();
107
		}
108
109
		do_action( 'carbon_after_save_user_meta', $user_id );
110
	}
111
112
	/**
113
	 * Perform checks whether the container should be attached during the current request

core/Container/Post_Meta_Container.php 1 location

@@ 89-102 (lines=14) @@
86
	 *
87
	 * @param int $post_id ID of the post against which save() is ran
88
	 **/
89
	public function save( $post_id ) {
90
		// Unhook action to garantee single save
91
		remove_action( 'save_post', array( $this, '_save' ) );
92
93
		$this->set_post_id( $post_id );
94
95
		foreach ( $this->fields as $field ) {
96
			$field->set_value_from_input();
97
			$field->save();
98
		}
99
100
		do_action( 'carbon_after_save_custom_fields', $post_id );
101
		do_action( 'carbon_after_save_post_meta', $post_id );
102
	}
103
104
	/**
105
	 * Perform checks whether the current save() request is valid