Passed
Pull Request — master (#4)
by Aleksey
07:29 queued 04:02
created

CrefoPayOmsMapper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A mapSpySalesOrderToOrderTransfer() 0 7 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\CrefoPay\Communication\Oms;
9
10
use Generated\Shared\Transfer\OrderTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\OrderTransfer 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 Orm\Zed\Sales\Persistence\SpySalesOrder;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Sales\Persistence\SpySalesOrder 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 SprykerEco\Zed\CrefoPay\Dependency\Facade\CrefoPayToCalculationFacadeInterface;
13
use SprykerEco\Zed\CrefoPay\Dependency\Facade\CrefoPayToSalesFacadeInterface;
14
15
class CrefoPayOmsMapper implements CrefoPayOmsMapperInterface
16
{
17
    /**
18
     * @var \SprykerEco\Zed\CrefoPay\Dependency\Facade\CrefoPayToSalesFacadeInterface
19
     */
20
    protected $salesFacade;
21
22
    /**
23
     * @var \SprykerEco\Zed\CrefoPay\Dependency\Facade\CrefoPayToCalculationFacadeInterface
24
     */
25
    protected $calculationFacade;
26
27
    /**
28
     * @param \SprykerEco\Zed\CrefoPay\Dependency\Facade\CrefoPayToSalesFacadeInterface $salesFacade
29
     * @param \SprykerEco\Zed\CrefoPay\Dependency\Facade\CrefoPayToCalculationFacadeInterface $calculationFacade
30
     */
31
    public function __construct(
32
        CrefoPayToSalesFacadeInterface $salesFacade,
33
        CrefoPayToCalculationFacadeInterface $calculationFacade
34
    ) {
35
        $this->salesFacade = $salesFacade;
36
        $this->calculationFacade = $calculationFacade;
37
    }
38
39
    /**
40
     * @param \Orm\Zed\Sales\Persistence\SpySalesOrder $orderEntity
41
     *
42
     * @return \Generated\Shared\Transfer\OrderTransfer
43
     */
44
    public function mapSpySalesOrderToOrderTransfer(SpySalesOrder $orderEntity): OrderTransfer
45
    {
46
        $orderTransfer = $this->salesFacade
47
            ->getOrderByIdSalesOrder($orderEntity->getIdSalesOrder());
48
49
        return $this->calculationFacade
50
            ->recalculateOrder($orderTransfer);
51
    }
52
}
53