CustomerEventHandler   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 9
c 1
b 0
f 0
dl 0
loc 51
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A map() 0 3 1
A send() 0 3 1
A handle() 0 4 1
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\Inxmail\Business\Handler\Customer;
9
10
use Generated\Shared\Transfer\CustomerTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\CustomerTransfer 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\InxmailRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\InxmailRequestTransfer 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 Psr\Http\Message\StreamInterface;
13
use SprykerEco\Zed\Inxmail\Business\Api\Adapter\AdapterInterface;
14
use SprykerEco\Zed\Inxmail\Business\Mapper\Customer\CustomerMapperInterface;
15
16
class CustomerEventHandler implements CustomerEventHandlerInterface
17
{
18
    /**
19
     * @var \SprykerEco\Zed\Inxmail\Business\Mapper\Customer\CustomerMapperInterface
20
     */
21
    protected $mapper;
22
23
    /**
24
     * @var \SprykerEco\Zed\Inxmail\Business\Api\Adapter\AdapterInterface
25
     */
26
    protected $adapter;
27
28
    /**
29
     * @param \SprykerEco\Zed\Inxmail\Business\Mapper\Customer\CustomerMapperInterface $mapper
30
     * @param \SprykerEco\Zed\Inxmail\Business\Api\Adapter\AdapterInterface $adapter
31
     */
32
    public function __construct(CustomerMapperInterface $mapper, AdapterInterface $adapter)
33
    {
34
        $this->mapper = $mapper;
35
        $this->adapter = $adapter;
36
    }
37
38
    /**
39
     * @param \Generated\Shared\Transfer\CustomerTransfer $customerTransfer
40
     *
41
     * @return void
42
     */
43
    public function handle(CustomerTransfer $customerTransfer): void
44
    {
45
        $transfer = $this->map($customerTransfer);
46
        $this->send($transfer);
47
    }
48
49
    /**
50
     * @param \Generated\Shared\Transfer\CustomerTransfer $customerTransfer
51
     *
52
     * @return \Generated\Shared\Transfer\InxmailRequestTransfer
53
     */
54
    protected function map(CustomerTransfer $customerTransfer): InxmailRequestTransfer
55
    {
56
        return $this->mapper->map($customerTransfer);
57
    }
58
59
    /**
60
     * @param \Generated\Shared\Transfer\InxmailRequestTransfer $inxmailRequestTransfer
61
     *
62
     * @return \Psr\Http\Message\StreamInterface
63
     */
64
    protected function send(InxmailRequestTransfer $inxmailRequestTransfer): StreamInterface
65
    {
66
        return $this->adapter->sendRequest($inxmailRequestTransfer);
67
    }
68
}
69