HeidelpayWriter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 7
c 1
b 0
f 1
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A createNotificationEntity() 0 5 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\Heidelpay\Business\Writer;
9
10
use Generated\Shared\Transfer\HeidelpayNotificationTransfer;
11
use Spryker\Zed\Kernel\Persistence\EntityManager\TransactionTrait;
12
use SprykerEco\Zed\Heidelpay\Persistence\HeidelpayEntityManagerInterface;
13
14
class HeidelpayWriter implements HeidelpayWriterInterface
15
{
16
    use TransactionTrait;
17
18
    /**
19
     * @var \SprykerEco\Zed\Heidelpay\Persistence\HeidelpayEntityManagerInterface
20
     */
21
    protected $entityManager;
22
23
    /**
24
     * @param \SprykerEco\Zed\Heidelpay\Persistence\HeidelpayEntityManagerInterface $entityManager
25
     */
26
    public function __construct(HeidelpayEntityManagerInterface $entityManager)
27
    {
28
        $this->entityManager = $entityManager;
29
    }
30
31
    /**
32
     * @param \Generated\Shared\Transfer\HeidelpayNotificationTransfer $notificationTransfer
33
     *
34
     * @return void
35
     */
36
    public function createNotificationEntity(HeidelpayNotificationTransfer $notificationTransfer): void
37
    {
38
        $this->getTransactionHandler()->handleTransaction(
39
            function () use ($notificationTransfer) {
40
                $this->entityManager->savePaymentHeidelpayNotificationEntity($notificationTransfer);
41
            }
42
        );
43
    }
44
}
45