Info   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getLabel() 0 3 1
A getValueView() 0 7 2
1
<?php
2
3
namespace Pagantis\Pagantis\Block;
4
5
use Magento\Framework\Phrase;
6
use Magento\Payment\Block\ConfigurableInfo;
7
use Pagantis\Pagantis\Gateway\Response\FraudHandler;
8
9
/**
10
 * Class Info
11
 * @package Pagantis\Pagantis\Block
12
 */
13
class Info extends ConfigurableInfo
14
{
15
    /**
16
     * Returns label
17
     *
18
     * @param string $field
19
     * @return Phrase
20
     */
21
    protected function getLabel($field)
22
    {
23
        return __($field);
24
    }
25
26
    /**
27
     * Returns value view
28
     *
29
     * @param string $field
30
     * @param string | array $value
31
     * @return string | Phrase
32
     */
33
    protected function getValueView($field, $value)
34
    {
35
        switch ($field) {
36
            case FraudHandler::FRAUD_MSG_LIST:
37
                return implode('; ', $value);
0 ignored issues
show
Bug introduced by
It seems like $value can also be of type string; however, parameter $pieces of implode() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

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

37
                return implode('; ', /** @scrutinizer ignore-type */ $value);
Loading history...
38
        }
39
        return parent::getValueView($field, $value);
0 ignored issues
show
Bug introduced by
It seems like $value can also be of type array; however, parameter $value of Magento\Payment\Block\Co...bleInfo::getValueView() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

39
        return parent::getValueView($field, /** @scrutinizer ignore-type */ $value);
Loading history...
40
    }
41
}
42