Code Duplication    Length = 34-35 lines in 5 locations

src/Eccube/Service/MailService.php 5 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
    /**
@@ 406-439 (lines=34) @@
403
     *
404
     * @param $Customer 会員情報
405
     */
406
    public function sendPasswordResetCompleteMail(\Eccube\Entity\Customer $Customer, $password)
407
    {
408
        log_info('パスワード変更完了メール送信開始');
409
410
        $body = $this->app->renderView('Mail/reset_complete_mail.twig', array(
411
            'Customer' => $Customer,
412
            'password' => $password,
413
        ));
414
415
        $message = \Swift_Message::newInstance()
416
            ->setSubject('[' . $this->BaseInfo->getShopName() . '] パスワード変更のお知らせ')
417
            ->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))
418
            ->setTo(array($Customer->getEmail()))
419
            ->setReplyTo($this->BaseInfo->getEmail03())
420
            ->setReturnPath($this->BaseInfo->getEmail04())
421
            ->setBody($body);
422
423
        $event = new EventArgs(
424
            array(
425
                'message' => $message,
426
                'Customer' => $Customer,
427
                'BaseInfo' => $this->BaseInfo,
428
                'password' => $password,
429
            ),
430
            null
431
        );
432
        $this->app['eccube.event.dispatcher']->dispatch(EccubeEvents::MAIL_PASSWORD_RESET_COMPLETE, $event);
433
434
        $count = $this->app->mail($message);
435
436
        log_info('パスワード変更完了メール送信完了', array('count' => $count));
437
438
        return $count;
439
    }
440
441
}
442