Code Duplication    Length = 30-31 lines in 6 locations

src/Eccube/Service/MailService.php 6 locations

@@ 89-118 (lines=30) @@
86
     *
87
     * @param $Customer 会員情報
88
     */
89
    public function sendCustomerCompleteMail(\Eccube\Entity\Customer $Customer)
90
    {
91
92
        $body = $this->app->renderView('Mail/entry_complete.twig', array(
93
            'Customer' => $Customer,
94
            'BaseInfo' => $this->BaseInfo,
95
        ));
96
97
        $message = \Swift_Message::newInstance()
98
            ->setSubject('[' . $this->BaseInfo->getShopName() . '] 会員登録が完了しました。')
99
            ->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))
100
            ->setTo(array($Customer->getEmail()))
101
            ->setBcc($this->BaseInfo->getEmail01())
102
            ->setReplyTo($this->BaseInfo->getEmail03())
103
            ->setReturnPath($this->BaseInfo->getEmail04())
104
            ->setBody($body);
105
106
        $event = new EventArgs(
107
            array(
108
                'message' => $message,
109
                'Customer' => $Customer,
110
                'BaseInfo' => $this->BaseInfo,
111
            ),
112
            $this->app['request']
113
        );
114
        $this->app['eccube.event.dispatcher']->dispatch(EccubeEvents::MAIL_CUSTOMER_COMPLETE, $event);
115
116
        $this->app->mail($message);
117
118
    }
119
120
121
    /**
@@ 127-157 (lines=31) @@
124
     * @param $Customer 会員情報
125
     * @param $email 会員email
126
     */
127
    public function sendCustomerWithdrawMail(\Eccube\Entity\Customer $Customer, $email)
128
    {
129
130
        $body = $this->app->renderView('Mail/customer_withdraw_mail.twig', array(
131
            'Customer' => $Customer,
132
            'BaseInfo' => $this->BaseInfo,
133
        ));
134
135
        $message = \Swift_Message::newInstance()
136
            ->setSubject('[' . $this->BaseInfo->getShopName() . '] 退会手続きのご完了')
137
            ->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))
138
            ->setTo(array($email))
139
            ->setBcc($this->BaseInfo->getEmail01())
140
            ->setReplyTo($this->BaseInfo->getEmail03())
141
            ->setReturnPath($this->BaseInfo->getEmail04())
142
            ->setBody($body);
143
144
        $event = new EventArgs(
145
            array(
146
                'message' => $message,
147
                'Customer' => $Customer,
148
                'BaseInfo' => $this->BaseInfo,
149
                'email' => $email,
150
            ),
151
            $this->app['request']
152
        );
153
        $this->app['eccube.event.dispatcher']->dispatch(EccubeEvents::MAIL_CUSTOMER_WITHDRAW, $event);
154
155
        $this->app->mail($message);
156
157
    }
158
159
160
    /**
@@ 165-195 (lines=31) @@
162
     *
163
     * @param $formData お問い合わせ内容
164
     */
165
    public function sendContactMail($formData)
166
    {
167
168
        $body = $this->app->renderView('Mail/contact_mail.twig', array(
169
            'data' => $formData,
170
            'BaseInfo' => $this->BaseInfo,
171
        ));
172
173
        // 問い合わせ者にメール送信
174
        $message = \Swift_Message::newInstance()
175
            ->setSubject('[' . $this->BaseInfo->getShopName() . '] お問い合わせを受け付けました。')
176
            ->setFrom(array($this->BaseInfo->getEmail02() => $this->BaseInfo->getShopName()))
177
            ->setTo(array($formData['email']))
178
            ->setBcc($this->BaseInfo->getEmail02())
179
            ->setReplyTo($this->BaseInfo->getEmail02())
180
            ->setReturnPath($this->BaseInfo->getEmail04())
181
            ->setBody($body);
182
183
        $event = new EventArgs(
184
            array(
185
                'message' => $message,
186
                'data' => $formData,
187
                'BaseInfo' => $this->BaseInfo,
188
            ),
189
            $this->app['request']
190
        );
191
        $this->app['eccube.event.dispatcher']->dispatch(EccubeEvents::MAIL_CONTACT, $event);
192
193
        $this->app->mail($message);
194
195
    }
196
197
    /**
198
     * Alias of sendContactMail().
@@ 257-287 (lines=31) @@
254
     * @param $Customer 会員情報
255
     * @param $activateUrl アクティベート用url
256
     */
257
    public function sendAdminCustomerConfirmMail(\Eccube\Entity\Customer $Customer, $activateUrl)
258
    {
259
260
        $body = $this->app->renderView('Mail/entry_confirm.twig', array(
261
            'Customer' => $Customer,
262
            'activateUrl' => $activateUrl,
263
        ));
264
265
        $message = \Swift_Message::newInstance()
266
            ->setSubject('[' . $this->BaseInfo->getShopName() . '] 会員登録のご確認')
267
            ->setFrom(array($this->BaseInfo->getEmail03() => $this->BaseInfo->getShopName()))
268
            ->setTo(array($Customer->getEmail()))
269
            ->setBcc($this->BaseInfo->getEmail01())
270
            ->setReplyTo($this->BaseInfo->getEmail03())
271
            ->setReturnPath($this->BaseInfo->getEmail04())
272
            ->setBody($body);
273
274
        $event = new EventArgs(
275
            array(
276
                'message' => $message,
277
                'Customer' => $Customer,
278
                'BaseInfo' => $this->BaseInfo,
279
                'activateUrl' => $activateUrl,
280
            ),
281
            $this->app['request']
282
        );
283
        $this->app['eccube.event.dispatcher']->dispatch(EccubeEvents::MAIL_ADMIN_CUSTOMER_CONFIRM, $event);
284
285
        $this->app->mail($message);
286
287
    }
288
289
290
    /**
@@ 334-363 (lines=30) @@
331
     *
332
     * @param $Customer 会員情報
333
     */
334
    public function sendPasswordResetNotificationMail(\Eccube\Entity\Customer $Customer, $reset_url)
335
    {
336
        $body = $this->app->renderView('Mail/forgot_mail.twig', array(
337
            'Customer' => $Customer,
338
            'reset_url' => $reset_url
339
        ));
340
341
        $message = \Swift_Message::newInstance()
342
            ->setSubject('[' . $this->BaseInfo->getShopName() . '] パスワード変更のご確認')
343
            ->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))
344
            ->setTo(array($Customer->getEmail()))
345
            ->setBcc($this->BaseInfo->getEmail01())
346
            ->setReplyTo($this->BaseInfo->getEmail03())
347
            ->setReturnPath($this->BaseInfo->getEmail04())
348
            ->setBody($body);
349
350
        $event = new EventArgs(
351
            array(
352
                'message' => $message,
353
                'Customer' => $Customer,
354
                'BaseInfo' => $this->BaseInfo,
355
                'resetUrl' => $reset_url,
356
            ),
357
            $this->app['request']
358
        );
359
        $this->app['eccube.event.dispatcher']->dispatch(EccubeEvents::MAIL_PASSWORD_RESET, $event);
360
361
        $this->app->mail($message);
362
363
    }
364
365
    /**
366
     * Send password reset notification mail.
@@ 370-399 (lines=30) @@
367
     *
368
     * @param $Customer 会員情報
369
     */
370
    public function sendPasswordResetCompleteMail(\Eccube\Entity\Customer $Customer, $password)
371
    {
372
        $body = $this->app->renderView('Mail/reset_complete_mail.twig', array(
373
            'Customer' => $Customer,
374
            'password' => $password,
375
        ));
376
377
        $message = \Swift_Message::newInstance()
378
            ->setSubject('[' . $this->BaseInfo->getShopName() . '] パスワード変更のお知らせ')
379
            ->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))
380
            ->setTo(array($Customer->getEmail()))
381
            ->setBcc($this->BaseInfo->getEmail01())
382
            ->setReplyTo($this->BaseInfo->getEmail03())
383
            ->setReturnPath($this->BaseInfo->getEmail04())
384
            ->setBody($body);
385
386
        $event = new EventArgs(
387
            array(
388
                'message' => $message,
389
                'Customer' => $Customer,
390
                'BaseInfo' => $this->BaseInfo,
391
                'password' => $password,
392
            ),
393
            $this->app['request']
394
        );
395
        $this->app['eccube.event.dispatcher']->dispatch(EccubeEvents::MAIL_PASSWORD_RESET_COMPLETE, $event);
396
397
        $this->app->mail($message);
398
399
    }
400
401
}
402