Code Duplication    Length = 33-55 lines in 2 locations

includes/admin/emails/class-donation-receipt-email.php 1 location

@@ 205-259 (lines=55) @@
202
		 *
203
		 * @since 2.0
204
		 */
205
		public function setup_email_data() {
206
			// Set recipient email.
207
			$this->recipient_email = $this->payment->email;
208
209
			/**
210
			 * Filters the from name.
211
			 *
212
			 * @param int   $payment_id   Payment id.
213
			 * @param mixed $payment_data Payment meta data.
214
			 *
215
			 * @since 1.0
216
			 */
217
			$from_name = apply_filters(
218
				'give_donation_from_name',
219
				Give()->emails->get_from_name(),
220
				$this->payment->ID,
221
				$this->payment->payment_meta
222
			);
223
224
			/**
225
			 * Filters the from email.
226
			 *
227
			 * @param int   $payment_id   Payment id.
228
			 * @param mixed $payment_data Payment meta data.
229
			 *
230
			 * @since 1.0
231
			 */
232
			$from_email = apply_filters(
233
				'give_donation_from_address',
234
				Give()->emails->get_from_address(),
235
				$this->payment->ID,
236
				$this->payment->payment_meta
237
			);
238
239
			Give()->emails->__set( 'from_name', $from_name );
240
			Give()->emails->__set( 'from_email', $from_email );
241
			Give()->emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) );
242
243
			/**
244
			 * Filters the donation receipt's email headers.
245
			 *
246
			 * @param int   $payment_id   Payment id.
247
			 * @param mixed $payment_data Payment meta data.
248
			 *
249
			 * @since 1.0
250
			 */
251
			$headers = apply_filters(
252
				'give_receipt_headers',
253
				Give()->emails->get_headers(),
254
				$this->payment->ID,
255
				$this->payment->payment_meta
256
			);
257
258
			Give()->emails->__set( 'headers', $headers );
259
		}
260
261
		/**
262
		 * Send donation receipt

includes/admin/emails/class-offline-donation-instruction-email.php 1 location

@@ 177-209 (lines=33) @@
174
		 *
175
		 * @since 2.0
176
		 */
177
		public function setup_email_data() {
178
			// Set recipient email.
179
			$this->recipient_email = $this->payment->email;
180
181
			/**
182
			 * Filters the from name.
183
			 *
184
			 * @since 1.7
185
			 */
186
			$from_name = apply_filters(
187
				'give_donation_from_name',
188
				Give()->emails->get_from_name(),
189
				$this->payment->ID,
190
				$this->payment->payment_meta
191
			);
192
193
			/**
194
			 * Filters the from email.
195
			 *
196
			 * @since 1.7
197
			 */
198
			$from_email = apply_filters(
199
				'give_donation_from_address',
200
				Give()->emails->get_from_address(),
201
				$this->payment->ID,
202
				$this->payment->payment_meta
203
			);
204
205
			Give()->emails->__set( 'from_name', $from_name );
206
			Give()->emails->__set( 'from_email', $from_email );
207
			Give()->emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) );
208
			Give()->emails->__set( 'headers', apply_filters( 'give_receipt_headers', Give()->emails->get_headers(), $this->payment->ID, $this->payment->payment_meta ) );
209
		}
210
211
		/**
212
		 * Setup email notification.