Passed
Branch [email protected] (aae97d)
by Bruno
10:40
created

Wallet   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getLabel() 0 3 1
A getValueView() 0 7 2
A getImageQrCode() 0 3 1
1
<?php
2
/**
3
 * Copyright © Getnet. All rights reserved.
4
 *
5
 * @author    Bruno Elisei <[email protected]>
6
 * See LICENSE for license details.
7
 */
8
9
namespace Getnet\PaymentMagento\Block\Sales\Info;
10
11
use Magento\Framework\Phrase;
12
use Magento\Payment\Block\ConfigurableInfo;
13
14
/**
15
 * Class Wallet - Wallet payment information.
16
 */
17
class Wallet extends ConfigurableInfo
18
{
19
    /**
20
     * Wallet Info template.
21
     *
22
     * @var string
23
     */
24
    protected $_template = 'Getnet_PaymentMagento::info/wallet/instructions.phtml';
25
26
    /**
27
     * Returns label.
28
     *
29
     * @param string $field
30
     *
31
     * @return Phrase
32
     */
33
    protected function getLabel($field)
34
    {
35
        return __($field);
36
    }
37
38
    /**
39
     * Returns value view.
40
     *
41
     * @param string $field
42
     * @param string $value
43
     *
44
     * @return string | Phrase
45
     */
46
    protected function getValueView($field, $value)
47
    {
48
        if ($field === 'qr_code_image') {
49
            return $this->getImageQrCode($value);
50
        }
51
52
        return parent::getValueView($field, $value);
53
    }
54
55
    /**
56
     * Get Url to Image Qr Code.
57
     *
58
     * @param string $qrCode
59
     *
60
     * @return string
61
     */
62
    public function getImageQrCode($qrCode)
63
    {
64
        return $this->_urlBuilder->getBaseUrl(['_type' => \Magento\Framework\UrlInterface::URL_TYPE_MEDIA]).$qrCode;
65
    }
66
}
67