Code Duplication    Length = 34-35 lines in 6 locations

src/Eccube/Service/MailService.php 6 locations

@@ 95-128 (lines=34) @@
92
     *
93
     * @param $Customer 会員情報
94
     */
95
    public function sendCustomerCompleteMail(\Eccube\Entity\Customer $Customer)
96
    {
97
        log_info('会員登録完了メール送信開始');
98
99
        $body = $this->app->renderView('Mail/entry_complete.twig', array(
100
            'Customer' => $Customer,
101
            'BaseInfo' => $this->BaseInfo,
102
        ));
103
104
        $message = \Swift_Message::newInstance()
105
            ->setSubject('[' . $this->BaseInfo->getShopName() . '] 会員登録が完了しました。')
106
            ->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))
107
            ->setTo(array($Customer->getEmail()))
108
            ->setBcc($this->BaseInfo->getEmail01())
109
            ->setReplyTo($this->BaseInfo->getEmail03())
110
            ->setReturnPath($this->BaseInfo->getEmail04())
111
            ->setBody($body);
112
113
        $event = new EventArgs(
114
            array(
115
                'message' => $message,
116
                'Customer' => $Customer,
117
                'BaseInfo' => $this->BaseInfo,
118
            ),
119
            null
120
        );
121
        $this->app['eccube.event.dispatcher']->dispatch(EccubeEvents::MAIL_CUSTOMER_COMPLETE, $event);
122
123
        $count = $this->app->mail($message);
124
125
        log_info('会員登録完了メール送信完了', array('count' => $count));
126
127
        return $count;
128
    }
129
130
131
    /**
@@ 137-171 (lines=35) @@
134
     * @param $Customer 会員情報
135
     * @param $email 会員email
136
     */
137
    public function sendCustomerWithdrawMail(\Eccube\Entity\Customer $Customer, $email)
138
    {
139
        log_info('退会手続き完了メール送信開始');
140
141
        $body = $this->app->renderView('Mail/customer_withdraw_mail.twig', array(
142
            'Customer' => $Customer,
143
            'BaseInfo' => $this->BaseInfo,
144
        ));
145
146
        $message = \Swift_Message::newInstance()
147
            ->setSubject('[' . $this->BaseInfo->getShopName() . '] 退会手続きのご完了')
148
            ->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))
149
            ->setTo(array($email))
150
            ->setBcc($this->BaseInfo->getEmail01())
151
            ->setReplyTo($this->BaseInfo->getEmail03())
152
            ->setReturnPath($this->BaseInfo->getEmail04())
153
            ->setBody($body);
154
155
        $event = new EventArgs(
156
            array(
157
                'message' => $message,
158
                'Customer' => $Customer,
159
                'BaseInfo' => $this->BaseInfo,
160
                'email' => $email,
161
            ),
162
            null
163
        );
164
        $this->app['eccube.event.dispatcher']->dispatch(EccubeEvents::MAIL_CUSTOMER_WITHDRAW, $event);
165
166
        $count = $this->app->mail($message);
167
168
        log_info('退会手続き完了メール送信完了', array('count' => $count));
169
170
        return $count;
171
    }
172
173
174
    /**
@@ 179-213 (lines=35) @@
176
     *
177
     * @param $formData お問い合わせ内容
178
     */
179
    public function sendContactMail($formData)
180
    {
181
        log_info('お問い合わせ受付メール送信開始');
182
183
        $body = $this->app->renderView('Mail/contact_mail.twig', array(
184
            'data' => $formData,
185
            'BaseInfo' => $this->BaseInfo,
186
        ));
187
188
        // 問い合わせ者にメール送信
189
        $message = \Swift_Message::newInstance()
190
            ->setSubject('[' . $this->BaseInfo->getShopName() . '] お問い合わせを受け付けました。')
191
            ->setFrom(array($this->BaseInfo->getEmail02() => $this->BaseInfo->getShopName()))
192
            ->setTo(array($formData['email']))
193
            ->setBcc($this->BaseInfo->getEmail02())
194
            ->setReplyTo($this->BaseInfo->getEmail02())
195
            ->setReturnPath($this->BaseInfo->getEmail04())
196
            ->setBody($body);
197
198
        $event = new EventArgs(
199
            array(
200
                'message' => $message,
201
                'formData' => $formData,
202
                'BaseInfo' => $this->BaseInfo,
203
            ),
204
            null
205
        );
206
        $this->app['eccube.event.dispatcher']->dispatch(EccubeEvents::MAIL_CONTACT, $event);
207
208
        $count = $this->app->mail($message);
209
210
        log_info('お問い合わせ受付メール送信完了', array('count' => $count));
211
212
        return $count;
213
    }
214
215
    /**
216
     * Alias of sendContactMail().
@@ 281-315 (lines=35) @@
278
     * @param $Customer 会員情報
279
     * @param $activateUrl アクティベート用url
280
     */
281
    public function sendAdminCustomerConfirmMail(\Eccube\Entity\Customer $Customer, $activateUrl)
282
    {
283
        log_info('仮会員登録再送メール送信開始');
284
285
        $body = $this->app->renderView('Mail/entry_confirm.twig', array(
286
            'Customer' => $Customer,
287
            'activateUrl' => $activateUrl,
288
        ));
289
290
        $message = \Swift_Message::newInstance()
291
            ->setSubject('[' . $this->BaseInfo->getShopName() . '] 会員登録のご確認')
292
            ->setFrom(array($this->BaseInfo->getEmail03() => $this->BaseInfo->getShopName()))
293
            ->setTo(array($Customer->getEmail()))
294
            ->setBcc($this->BaseInfo->getEmail01())
295
            ->setReplyTo($this->BaseInfo->getEmail03())
296
            ->setReturnPath($this->BaseInfo->getEmail04())
297
            ->setBody($body);
298
299
        $event = new EventArgs(
300
            array(
301
                'message' => $message,
302
                'Customer' => $Customer,
303
                'BaseInfo' => $this->BaseInfo,
304
                'activateUrl' => $activateUrl,
305
            ),
306
            null
307
        );
308
        $this->app['eccube.event.dispatcher']->dispatch(EccubeEvents::MAIL_ADMIN_CUSTOMER_CONFIRM, $event);
309
310
        $count = $this->app->mail($message);
311
312
        log_info('仮会員登録再送メール送信完了', array('count' => $count));
313
314
        return $count;
315
    }
316
317
318
    /**
@@ 366-400 (lines=35) @@
363
     *
364
     * @param $Customer 会員情報
365
     */
366
    public function sendPasswordResetNotificationMail(\Eccube\Entity\Customer $Customer, $reset_url)
367
    {
368
        log_info('パスワード再発行メール送信開始');
369
370
        $body = $this->app->renderView('Mail/forgot_mail.twig', array(
371
            'Customer' => $Customer,
372
            'reset_url' => $reset_url
373
        ));
374
375
        $message = \Swift_Message::newInstance()
376
            ->setSubject('[' . $this->BaseInfo->getShopName() . '] パスワード変更のご確認')
377
            ->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))
378
            ->setTo(array($Customer->getEmail()))
379
            ->setBcc($this->BaseInfo->getEmail01())
380
            ->setReplyTo($this->BaseInfo->getEmail03())
381
            ->setReturnPath($this->BaseInfo->getEmail04())
382
            ->setBody($body);
383
384
        $event = new EventArgs(
385
            array(
386
                'message' => $message,
387
                'Customer' => $Customer,
388
                'BaseInfo' => $this->BaseInfo,
389
                'resetUrl' => $reset_url,
390
            ),
391
            null
392
        );
393
        $this->app['eccube.event.dispatcher']->dispatch(EccubeEvents::MAIL_PASSWORD_RESET, $event);
394
395
        $count = $this->app->mail($message);
396
397
        log_info('パスワード再発行メール送信完了', array('count' => $count));
398
399
        return $count;
400
    }
401
402
    /**
403
     * Send password reset notification mail.
@@ 407-441 (lines=35) @@
404
     *
405
     * @param $Customer 会員情報
406
     */
407
    public function sendPasswordResetCompleteMail(\Eccube\Entity\Customer $Customer, $password)
408
    {
409
        log_info('パスワード変更完了メール送信開始');
410
411
        $body = $this->app->renderView('Mail/reset_complete_mail.twig', array(
412
            'Customer' => $Customer,
413
            'password' => $password,
414
        ));
415
416
        $message = \Swift_Message::newInstance()
417
            ->setSubject('[' . $this->BaseInfo->getShopName() . '] パスワード変更のお知らせ')
418
            ->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))
419
            ->setTo(array($Customer->getEmail()))
420
            ->setBcc($this->BaseInfo->getEmail01())
421
            ->setReplyTo($this->BaseInfo->getEmail03())
422
            ->setReturnPath($this->BaseInfo->getEmail04())
423
            ->setBody($body);
424
425
        $event = new EventArgs(
426
            array(
427
                'message' => $message,
428
                'Customer' => $Customer,
429
                'BaseInfo' => $this->BaseInfo,
430
                'password' => $password,
431
            ),
432
            null
433
        );
434
        $this->app['eccube.event.dispatcher']->dispatch(EccubeEvents::MAIL_PASSWORD_RESET_COMPLETE, $event);
435
436
        $count = $this->app->mail($message);
437
438
        log_info('パスワード変更完了メール送信完了', array('count' => $count));
439
440
        return $count;
441
    }
442
443
}
444