Success::getInfo()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
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\Block;
10
11
/**
12
 * Class Success - Success page information.
13
 */
14
class Success extends \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
     * @var \Magento\Checkout\Model\Session
0 ignored issues
show
Bug introduced by
The type Magento\Checkout\Model\Session 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...
18
     */
19
    protected $_checkoutSession;
20
21
    /**
22
     * @var \Magento\Sales\Model\Order\Config
0 ignored issues
show
Bug introduced by
The type Magento\Sales\Model\Order\Config 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...
23
     */
24
    protected $_orderConfig;
25
26
    /**
27
     * @var \Magento\Framework\App\Http\Context
0 ignored issues
show
Bug introduced by
The type Magento\Framework\App\Http\Context 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...
28
     */
29
    protected $httpContext;
30
31
    /**
32
     * @param \Magento\Framework\View\Element\Template\Context $context
33
     * @param \Magento\Checkout\Model\Session                  $checkoutSession
34
     * @param \Magento\Sales\Model\Order\Config                $orderConfig
35
     * @param \Magento\Framework\App\Http\Context              $httpContext
36
     * @param array                                            $data
37
     */
38
    public function __construct(
39
        \Magento\Framework\View\Element\Template\Context $context,
0 ignored issues
show
Bug introduced by
The type Magento\Framework\View\Element\Template\Context 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...
40
        \Magento\Checkout\Model\Session $checkoutSession,
41
        \Magento\Sales\Model\Order\Config $orderConfig,
42
        \Magento\Framework\App\Http\Context $httpContext,
43
        array $data = []
44
    ) {
45
        parent::__construct($context, $data);
46
        $this->_checkoutSession = $checkoutSession;
47
        $this->_orderConfig = $orderConfig;
48
        $this->_isScopePrivate = true;
0 ignored issues
show
Bug Best Practice introduced by
The property _isScopePrivate does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
49
        $this->httpContext = $httpContext;
50
    }
51
52
    /**
53
     * getPayment.
54
     *
55
     * @return MethodInstance
0 ignored issues
show
Bug introduced by
The type Moip\Magento2\Block\MethodInstance 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...
56
     */
57
    public function getPayment()
58
    {
59
        $order = $this->_checkoutSession->getLastRealOrder();
60
61
        return $order->getPayment()->getMethodInstance();
62
    }
63
64
    /**
65
     * Method Code.
66
     *
67
     * @return string
68
     */
69
    public function getMethodCode()
70
    {
71
        return $this->getPayment()->getCode();
72
    }
73
74
    /**
75
     * Info payment.
76
     *
77
     * @param  $info
78
     *
79
     * @return string
80
     */
81
    public function getInfo($info)
82
    {
83
        return  $this->getPayment()->getInfoInstance()->getAdditionalInformation($info);
84
    }
85
}
86