CustomerEventMailer::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 2
c 1
b 1
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
/**
4
 * MIT License
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
namespace SprykerEco\Zed\Episerver\Business\Handler\Customer;
9
10
use Generated\Shared\Transfer\EpiserverRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\EpiserverRequestTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Generated\Shared\Transfer\EpiserverResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...iserverResponseTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Generated\Shared\Transfer\MailTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\MailTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use SprykerEco\Zed\Episerver\Business\Api\Adapter\EpiserverApiAdapterInterface;
14
use SprykerEco\Zed\Episerver\Business\Mapper\Customer\CustomerMapperInterface;
15
16
class CustomerEventMailer implements CustomerEventMailerInterface
17
{
18
    /**
19
     * @var \SprykerEco\Zed\Episerver\Business\Mapper\Customer\CustomerMapperInterface
20
     */
21
    protected $mapper;
22
23
    /**
24
     * @var \SprykerEco\Zed\Episerver\Business\Api\Adapter\EpiserverApiAdapterInterface
25
     */
26
    protected $adapter;
27
28
    /**
29
     * @param \SprykerEco\Zed\Episerver\Business\Mapper\Customer\CustomerMapperInterface $mapper
30
     * @param \SprykerEco\Zed\Episerver\Business\Api\Adapter\EpiserverApiAdapterInterface $adapter
31
     */
32
    public function __construct(CustomerMapperInterface $mapper, EpiserverApiAdapterInterface $adapter)
33
    {
34
        $this->mapper = $mapper;
35
        $this->adapter = $adapter;
36
    }
37
38
    /**
39
     * @param \Generated\Shared\Transfer\MailTransfer $mailTransfer
40
     *
41
     * @return void
42
     */
43
    public function mail(MailTransfer $mailTransfer): void
44
    {
45
        $requestTransfer = new EpiserverRequestTransfer();
46
        $mailTransfer = $this->mapMailTransferToEpiserverRequestTransfer($mailTransfer, $requestTransfer);
47
48
        $this->send($mailTransfer);
49
    }
50
51
    /**
52
     * @param \Generated\Shared\Transfer\MailTransfer $mailTransfer
53
     * @param \Generated\Shared\Transfer\EpiserverRequestTransfer $requestTransfer
54
     *
55
     * @return \Generated\Shared\Transfer\EpiserverRequestTransfer
56
     */
57
    protected function mapMailTransferToEpiserverRequestTransfer(MailTransfer $mailTransfer, EpiserverRequestTransfer $requestTransfer): EpiserverRequestTransfer
58
    {
59
        return $this->mapper->mapMailTransferToEpiserverRequestTransfer($mailTransfer, $requestTransfer);
60
    }
61
62
    /**
63
     * @param \Generated\Shared\Transfer\EpiserverRequestTransfer $requestTransfer
64
     *
65
     * @return \Generated\Shared\Transfer\EpiserverResponseTransfer
66
     */
67
    protected function send(EpiserverRequestTransfer $requestTransfer): EpiserverResponseTransfer
68
    {
69
        return $this->adapter->sendRequest($requestTransfer);
70
    }
71
}
72