CrifSaver   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A save() 0 5 1
A saveComputopDetails() 0 8 1
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\Computop\Business\RiskCheck\Saver;
9
10
use Generated\Shared\Transfer\ComputopApiCrifResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ApiCrifResponseTransfer 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\QuoteTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\QuoteTransfer 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 Orm\Zed\Computop\Persistence\SpyPaymentComputopCrifDetails;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Computop\Persist...mentComputopCrifDetails 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 Spryker\Zed\Kernel\Persistence\EntityManager\TransactionTrait;
14
15
class CrifSaver extends AbstractSaver
16
{
17
    use TransactionTrait;
18
19
    protected const METHOD = 'CRIF';
20
21
    /**
22
     * @param \Generated\Shared\Transfer\ComputopApiCrifResponseTransfer $responseTransfer
23
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
24
     *
25
     * @return void
26
     */
27
    public function save(ComputopApiCrifResponseTransfer $responseTransfer, QuoteTransfer $quoteTransfer): void
28
    {
29
        $this->getTransactionHandler()->handleTransaction(
30
            function () use ($responseTransfer) {
31
                $this->saveComputopDetails($responseTransfer);
32
            }
33
        );
34
    }
35
36
    /**
37
     * @param \Generated\Shared\Transfer\ComputopApiCrifResponseTransfer $responseTransfer
38
     *
39
     * @return void
40
     */
41
    protected function saveComputopDetails(
42
        ComputopApiCrifResponseTransfer $responseTransfer
43
    ): void {
44
        $this->logHeader($responseTransfer->getHeader(), static::METHOD);
45
46
        $paymentEntityDetails = new SpyPaymentComputopCrifDetails();
47
        $paymentEntityDetails->fromArray($responseTransfer->toArray());
48
        $paymentEntityDetails->save();
49
    }
50
}
51