Completed
Push — template-events ( d018fc...2e9f01 )
by Kamil
65:59 queued 42:59
created

ShipmentEmailManager   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 29
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A sendConfirmationEmail() 0 10 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Bundle\AdminBundle\EmailManager;
13
14
use Sylius\Bundle\CoreBundle\Mailer\Emails;
15
use Sylius\Component\Core\Model\OrderInterface;
16
use Sylius\Component\Core\Model\ShipmentInterface;
17
use Sylius\Component\Mailer\Sender\SenderInterface;
18
19
/**
20
 * @author Hussein Jafferjee <[email protected]>
21
 */
22
final class ShipmentEmailManager implements ShipmentEmailManagerInterface
23
{
24
    /**
25
     * @var SenderInterface
26
     */
27
    private $emailSender;
28
29
    /**
30
     * @param SenderInterface $emailSender
31
     */
32
    public function __construct(SenderInterface $emailSender)
33
    {
34
        $this->emailSender = $emailSender;
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function sendConfirmationEmail(ShipmentInterface $shipment)
41
    {
42
        /** @var OrderInterface $order */
43
        $order = $shipment->getOrder();
44
45
        $this->emailSender->send(Emails::SHIPMENT_CONFIRMATION, [$order->getCustomer()->getEmail()], [
46
            'shipment' => $shipment,
47
            'order' => $order,
48
        ]);
49
    }
50
}
51