Code Duplication    Length = 12-17 lines in 2 locations

classes/models/FrmInbox.php 2 locations

@@ 173-184 (lines=12) @@
170
	/**
171
	 * @param string $key
172
	 */
173
	public function mark_read( $key ) {
174
		if ( ! isset( $this->messages[ $key ] ) ) {
175
			return;
176
		}
177
178
		if ( ! isset( $this->messages[ $key ]['read'] ) ) {
179
			$this->messages[ $key ]['read'] = array();
180
		}
181
		$this->messages[ $key ]['read'][ get_current_user_id() ] = time();
182
183
		$this->update_list();
184
	}
185
186
	/**
187
	 * @param string $key
@@ 202-218 (lines=17) @@
199
	/**
200
	 * @param string $key
201
	 */
202
	public function dismiss( $key ) {
203
		if ( $key === 'all' ) {
204
			$this->dismiss_all();
205
			return;
206
		}
207
208
		if ( ! isset( $this->messages[ $key ] ) ) {
209
			return;
210
		}
211
212
		if ( ! isset( $this->messages[ $key ]['dismissed'] ) ) {
213
			$this->messages[ $key ]['dismissed'] = array();
214
		}
215
		$this->messages[ $key ]['dismissed'][ get_current_user_id() ] = time();
216
217
		$this->update_list();
218
	}
219
220
	/**
221
	 * @since 4.06