TransferFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 6 1
1
<?php
2
/**
3
 * Copyright © Wirecard Brasil. All rights reserved.
4
 *
5
 * @author    Bruno Elisei <[email protected]>
6
 * See COPYING.txt for license details.
7
 */
8
9
namespace Moip\Magento2\Gateway\Http;
10
11
use Magento\Payment\Gateway\Http\TransferBuilder;
0 ignored issues
show
Bug introduced by
The type Magento\Payment\Gateway\Http\TransferBuilder 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 Magento\Payment\Gateway\Http\TransferFactoryInterface;
0 ignored issues
show
Bug introduced by
The type Magento\Payment\Gateway\...ransferFactoryInterface 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 Magento\Payment\Gateway\Http\TransferInterface;
0 ignored issues
show
Bug introduced by
The type Magento\Payment\Gateway\Http\TransferInterface 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...
14
15
/**
16
 * Class TransferFactory - Factors data transfer.
17
 */
18
class TransferFactory implements TransferFactoryInterface
19
{
20
    /**
21
     * @var TransferBuilder
22
     */
23
    private $transferBuilder;
24
25
    /**
26
     * @param TransferBuilder $transferBuilder
27
     */
28
    public function __construct(
29
        TransferBuilder $transferBuilder
30
    ) {
31
        $this->transferBuilder = $transferBuilder;
32
    }
33
34
    /**
35
     * Builds gateway transfer object     *.
36
     *
37
     * @param array $request
38
     *
39
     * @return TransferInterface
40
     */
41
    public function create(array $request)
42
    {
43
        return $this->transferBuilder
44
            ->setBody($request)
45
            ->setMethod('POST')
46
            ->build();
47
    }
48
}
49