AddMoipInterestToOrderObserver   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 13 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
declare(strict_types=1);
10
11
namespace Moip\Magento2\Observer;
12
13
use Magento\Framework\Event\ObserverInterface;
0 ignored issues
show
Bug introduced by
The type Magento\Framework\Event\ObserverInterface 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
use Moip\Magento2\Api\Data\MoipInterestInterface;
15
16
/**
17
 * Class AddMoipInterestToOrderObserver - Converte quote total in order.
18
 */
19
class AddMoipInterestToOrderObserver implements ObserverInterface
20
{
21
    /**
22
     * @param \Magento\Framework\Event\Observer $observer
23
     */
24
    public function execute(\Magento\Framework\Event\Observer $observer)
0 ignored issues
show
Bug introduced by
The type Magento\Framework\Event\Observer 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...
25
    {
26
        /* @var \Magento\Sales\Model\Order $order */
27
        $order = $observer->getEvent()->getData('order');
28
        /* @var \Magento\Quote\Model\Quote $quote */
29
        $quote = $observer->getEvent()->getData('quote');
30
31
        $moipInterest = $quote->getData(MoipInterestInterface::MOIP_INTEREST_AMOUNT);
32
        $baseMoipInterest = $quote->getData(MoipInterestInterface::BASE_MOIP_INTEREST_AMOUNT);
33
        $order->setData(MoipInterestInterface::MOIP_INTEREST_AMOUNT, $moipInterest);
34
        $order->setData(MoipInterestInterface::BASE_MOIP_INTEREST_AMOUNT, $baseMoipInterest);
35
36
        return $this;
37
    }
38
}
39