Passed
Pull Request — master (#4)
by Aleksey
09:02
created

mapSpySalesOrderToOrderTransfer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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