Notification::render()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 22
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 14
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 22
rs 9.7998
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\Model\Adminhtml\Source;
10
11
use Getnet\PaymentMagento\Gateway\Config\Config;
12
use Magento\Framework\Data\Form\Element\AbstractElement;
13
14
/**
15
 * Notification Block - Information to Notification.
16
 */
17
class Notification extends \Magento\Config\Block\System\Config\Form\Field
18
{
19
    /**
20
     * @var Config
21
     */
22
    protected $config;
23
24
    /**
25
     * @param Config $config
26
     */
27
    public function __construct(
28
        Config $config
29
    ) {
30
        $this->config = $config;
31
    }
32
33
    /**
34
     * Render element value.
35
     *
36
     * @param AbstractElement $element
37
     *
38
     * @return string
39
     */
40
    public function render(AbstractElement $element)
41
    {
42
        $sellerId = $this->config->getMerchantGatewaySellerId();
43
        $output = '<div class="getnet-featured-session">';
44
        $output .= '<h2 class="getnet-sub-title">'.__('Configure credentials first').'</h2>';
45
        $output .= '</div>';
46
        if ($sellerId) {
47
            $output = '<div class="getnet-featured-session">';
48
            $output .= '<h2 class="getnet-sub-title">'.__('Payment callback PIX').'</h2>';
49
            // phpcs:ignore Generic.Files.LineLength
50
            $output .= '<div>'.__('Enter your store url followed by "getnet/notification/pix/seller_id/%1/', $sellerId).'</div>';
51
            // phpcs:ignore Generic.Files.LineLength
52
            $output .= '<p>'.__('Example: https://yourstoreurl.com/getnet/notification/pix/seller_id/%1/', $sellerId).'</p>';
53
            $output .= '<h2 class="getnet-sub-title">'.__('Callback from boleto').'</h2>';
54
            // phpcs:ignore Generic.Files.LineLength
55
            $output .= '<div>'.__('Enter your store url followed by "getnet/notification/boleto/seller_id/%1/', $sellerId).'"</div>';
56
            // phpcs:ignore Generic.Files.LineLength
57
            $output .= '<p>'.__('Example: https://yourstoreurl.com/getnet/notification/boleto/seller_id/%1/', $sellerId).'</p>';
58
            $output .= '</div>';
59
        }
60
61
        return '<div id="row_'.$element->getHtmlId().'">'.$output.'</div>';
62
    }
63
}
64