Code Duplication    Length = 34-35 lines in 6 locations

src/Eccube/Service/MailService.php 6 locations

@@ 114-147 (lines=34) @@
111
     *
112
     * @param $Customer 会員情報
113
     */
114
    public function sendCustomerCompleteMail(\Eccube\Entity\Customer $Customer)
115
    {
116
        log_info('会員登録完了メール送信開始');
117
118
        $body = $this->app->renderView('Mail/entry_complete.twig', array(
119
            'Customer' => $Customer,
120
            'BaseInfo' => $this->BaseInfo,
121
        ));
122
123
        $message = \Swift_Message::newInstance()
124
            ->setSubject('[' . $this->BaseInfo->getShopName() . '] 会員登録が完了しました。')
125
            ->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))
126
            ->setTo(array($Customer->getEmail()))
127
            ->setBcc($this->BaseInfo->getEmail01())
128
            ->setReplyTo($this->BaseInfo->getEmail03())
129
            ->setReturnPath($this->BaseInfo->getEmail04())
130
            ->setBody($body);
131
132
        $event = new EventArgs(
133
            array(
134
                'message' => $message,
135
                'Customer' => $Customer,
136
                'BaseInfo' => $this->BaseInfo,
137
            ),
138
            null
139
        );
140
        $this->eventDispatcher->dispatch(EccubeEvents::MAIL_CUSTOMER_COMPLETE, $event);
141
142
        $count = $this->app->mail($message);
143
144
        log_info('会員登録完了メール送信完了', array('count' => $count));
145
146
        return $count;
147
    }
148
149
150
    /**
@@ 156-190 (lines=35) @@
153
     * @param $Customer 会員情報
154
     * @param $email 会員email
155
     */
156
    public function sendCustomerWithdrawMail(\Eccube\Entity\Customer $Customer, $email)
157
    {
158
        log_info('退会手続き完了メール送信開始');
159
160
        $body = $this->app->renderView('Mail/customer_withdraw_mail.twig', array(
161
            'Customer' => $Customer,
162
            'BaseInfo' => $this->BaseInfo,
163
        ));
164
165
        $message = \Swift_Message::newInstance()
166
            ->setSubject('[' . $this->BaseInfo->getShopName() . '] 退会手続きのご完了')
167
            ->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))
168
            ->setTo(array($email))
169
            ->setBcc($this->BaseInfo->getEmail01())
170
            ->setReplyTo($this->BaseInfo->getEmail03())
171
            ->setReturnPath($this->BaseInfo->getEmail04())
172
            ->setBody($body);
173
174
        $event = new EventArgs(
175
            array(
176
                'message' => $message,
177
                'Customer' => $Customer,
178
                'BaseInfo' => $this->BaseInfo,
179
                'email' => $email,
180
            ),
181
            null
182
        );
183
        $this->eventDispatcher->dispatch(EccubeEvents::MAIL_CUSTOMER_WITHDRAW, $event);
184
185
        $count = $this->app->mail($message);
186
187
        log_info('退会手続き完了メール送信完了', array('count' => $count));
188
189
        return $count;
190
    }
191
192
193
    /**
@@ 198-232 (lines=35) @@
195
     *
196
     * @param $formData お問い合わせ内容
197
     */
198
    public function sendContactMail($formData)
199
    {
200
        log_info('お問い合わせ受付メール送信開始');
201
202
        $body = $this->app->renderView('Mail/contact_mail.twig', array(
203
            'data' => $formData,
204
            'BaseInfo' => $this->BaseInfo,
205
        ));
206
207
        // 問い合わせ者にメール送信
208
        $message = \Swift_Message::newInstance()
209
            ->setSubject('[' . $this->BaseInfo->getShopName() . '] お問い合わせを受け付けました。')
210
            ->setFrom(array($this->BaseInfo->getEmail02() => $this->BaseInfo->getShopName()))
211
            ->setTo(array($formData['email']))
212
            ->setBcc($this->BaseInfo->getEmail02())
213
            ->setReplyTo($this->BaseInfo->getEmail02())
214
            ->setReturnPath($this->BaseInfo->getEmail04())
215
            ->setBody($body);
216
217
        $event = new EventArgs(
218
            array(
219
                'message' => $message,
220
                'formData' => $formData,
221
                'BaseInfo' => $this->BaseInfo,
222
            ),
223
            null
224
        );
225
        $this->eventDispatcher->dispatch(EccubeEvents::MAIL_CONTACT, $event);
226
227
        $count = $this->app->mail($message);
228
229
        log_info('お問い合わせ受付メール送信完了', array('count' => $count));
230
231
        return $count;
232
    }
233
234
    /**
235
     * Alias of sendContactMail().
@@ 300-334 (lines=35) @@
297
     * @param $Customer 会員情報
298
     * @param $activateUrl アクティベート用url
299
     */
300
    public function sendAdminCustomerConfirmMail(\Eccube\Entity\Customer $Customer, $activateUrl)
301
    {
302
        log_info('仮会員登録再送メール送信開始');
303
304
        $body = $this->app->renderView('Mail/entry_confirm.twig', array(
305
            'Customer' => $Customer,
306
            'activateUrl' => $activateUrl,
307
        ));
308
309
        $message = \Swift_Message::newInstance()
310
            ->setSubject('[' . $this->BaseInfo->getShopName() . '] 会員登録のご確認')
311
            ->setFrom(array($this->BaseInfo->getEmail03() => $this->BaseInfo->getShopName()))
312
            ->setTo(array($Customer->getEmail()))
313
            ->setBcc($this->BaseInfo->getEmail01())
314
            ->setReplyTo($this->BaseInfo->getEmail03())
315
            ->setReturnPath($this->BaseInfo->getEmail04())
316
            ->setBody($body);
317
318
        $event = new EventArgs(
319
            array(
320
                'message' => $message,
321
                'Customer' => $Customer,
322
                'BaseInfo' => $this->BaseInfo,
323
                'activateUrl' => $activateUrl,
324
            ),
325
            null
326
        );
327
        $this->eventDispatcher->dispatch(EccubeEvents::MAIL_ADMIN_CUSTOMER_CONFIRM, $event);
328
329
        $count = $this->app->mail($message);
330
331
        log_info('仮会員登録再送メール送信完了', array('count' => $count));
332
333
        return $count;
334
    }
335
336
337
    /**
@@ 385-419 (lines=35) @@
382
     *
383
     * @param $Customer 会員情報
384
     */
385
    public function sendPasswordResetNotificationMail(\Eccube\Entity\Customer $Customer, $reset_url)
386
    {
387
        log_info('パスワード再発行メール送信開始');
388
389
        $body = $this->app->renderView('Mail/forgot_mail.twig', array(
390
            'Customer' => $Customer,
391
            'reset_url' => $reset_url
392
        ));
393
394
        $message = \Swift_Message::newInstance()
395
            ->setSubject('[' . $this->BaseInfo->getShopName() . '] パスワード変更のご確認')
396
            ->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))
397
            ->setTo(array($Customer->getEmail()))
398
            ->setBcc($this->BaseInfo->getEmail01())
399
            ->setReplyTo($this->BaseInfo->getEmail03())
400
            ->setReturnPath($this->BaseInfo->getEmail04())
401
            ->setBody($body);
402
403
        $event = new EventArgs(
404
            array(
405
                'message' => $message,
406
                'Customer' => $Customer,
407
                'BaseInfo' => $this->BaseInfo,
408
                'resetUrl' => $reset_url,
409
            ),
410
            null
411
        );
412
        $this->eventDispatcher->dispatch(EccubeEvents::MAIL_PASSWORD_RESET, $event);
413
414
        $count = $this->app->mail($message);
415
416
        log_info('パスワード再発行メール送信完了', array('count' => $count));
417
418
        return $count;
419
    }
420
421
    /**
422
     * Send password reset notification mail.
@@ 426-460 (lines=35) @@
423
     *
424
     * @param $Customer 会員情報
425
     */
426
    public function sendPasswordResetCompleteMail(\Eccube\Entity\Customer $Customer, $password)
427
    {
428
        log_info('パスワード変更完了メール送信開始');
429
430
        $body = $this->app->renderView('Mail/reset_complete_mail.twig', array(
431
            'Customer' => $Customer,
432
            'password' => $password,
433
        ));
434
435
        $message = \Swift_Message::newInstance()
436
            ->setSubject('[' . $this->BaseInfo->getShopName() . '] パスワード変更のお知らせ')
437
            ->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))
438
            ->setTo(array($Customer->getEmail()))
439
            ->setBcc($this->BaseInfo->getEmail01())
440
            ->setReplyTo($this->BaseInfo->getEmail03())
441
            ->setReturnPath($this->BaseInfo->getEmail04())
442
            ->setBody($body);
443
444
        $event = new EventArgs(
445
            array(
446
                'message' => $message,
447
                'Customer' => $Customer,
448
                'BaseInfo' => $this->BaseInfo,
449
                'password' => $password,
450
            ),
451
            null
452
        );
453
        $this->eventDispatcher->dispatch(EccubeEvents::MAIL_PASSWORD_RESET_COMPLETE, $event);
454
455
        $count = $this->app->mail($message);
456
457
        log_info('パスワード変更完了メール送信完了', array('count' => $count));
458
459
        return $count;
460
    }
461
462
    /**
463
     * ポイントでマイナス発生時にメール通知する。