Passed
Push[email protected] ( 6f4930...6fef5b )
by Bruno
13:24 queued 10:12
created

Totals   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 48
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getInvoice() 0 3 1
A getSource() 0 3 1
A initTotals() 0 21 2
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\Block\Adminhtml\Sales\Order\Invoice;
12
13
use Magento\Framework\DataObject;
0 ignored issues
show
Bug introduced by
The type Magento\Framework\DataObject 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 Magento\Framework\View\Element\Template;
0 ignored issues
show
Bug introduced by
The type Magento\Framework\View\Element\Template 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...
15
16
/**
17
 * Class Totals - Invoice.
18
 */
19
class Totals extends Template
20
{
21
    /**
22
     * Get data (totals) source model.
23
     *
24
     * @return DataObject
25
     */
26
    public function getSource()
27
    {
28
        return $this->getParentBlock()->getSource();
29
    }
30
31
    /**
32
     * Get Invoice data.
33
     *
34
     * @return invoice
0 ignored issues
show
Bug introduced by
The type Moip\Magento2\Block\Admi...s\Order\Invoice\invoice 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...
35
     */
36
    public function getInvoice()
37
    {
38
        return $this->getParentBlock()->getInvoice();
39
    }
40
41
    /**
42
     * Initialize payment moip_interest totals.
43
     *
44
     * @return $this
45
     */
46
    public function initTotals()
47
    {
48
        $this->getParentBlock();
49
        $this->getInvoice();
50
        $this->getSource();
51
52
        if (!$this->getSource()->getMoipInterestAmount()) {
53
            return $this;
54
        }
55
56
        $total = new DataObject(
57
            [
58
                'code'  => 'moip_interest',
59
                'value' => $this->getSource()->getMoipInterestAmount(),
60
                'label' => __('Moip Interest Amount'),
0 ignored issues
show
Bug introduced by
The function __ was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

60
                'label' => /** @scrutinizer ignore-call */ __('Moip Interest Amount'),
Loading history...
61
            ]
62
        );
63
64
        $this->getParentBlock()->addTotalBefore($total, 'grand_total');
65
66
        return $this;
67
    }
68
}
69