HeidelpayWriter::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
nc 1
nop 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