Completed
Push — master ( ec1dbf...510cdb )
by Gabriel
04:59 queued 51s
created

MutableScopeConfigMock::isSetFlag()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 9
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 3
dl 9
loc 9
ccs 0
cts 5
cp 0
crap 6
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
4
namespace Stockbase\Integration\Test\Unit\Model\Config\Stub;
5
6
use Magento\Framework\App\Config\MutableScopeConfigInterface;
7
use Magento\Framework\App\Config\ScopeConfigInterface;
8
9
/**
10
 * Class MutableScopeConfigMock
11
 */
12
class MutableScopeConfigMock implements MutableScopeConfigInterface
13
{
14
    private $data = [];
15
16
    /**
17
     * {@inheritdoc}
18
     */
19 1
    public function setValue(
20
        $path,
21
        $value,
22
        $scopeType = \Magento\Framework\App\Config\ScopeConfigInterface::SCOPE_TYPE_DEFAULT,
23
        $scopeCode = null
24
    ) {
25 1
        $key = sprintf('%s|%s|%s', $path, $scopeType, $scopeCode);
26 1
        $this->data[$key] = $value;
27 1
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32 2 View Code Duplication
    public function getValue($path, $scopeType = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeCode = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
33
    {
34 2
        $key = sprintf('%s|%s|%s', $path, $scopeType, $scopeCode);
35 2
        if (isset($this->data[$key])) {
36 1
            return $this->data[$key];
37
        }
38
        
39 1
        return null;
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45 View Code Duplication
    public function isSetFlag($path, $scopeType = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeCode = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
46
    {
47
        $key = sprintf('%s|%s|%s', $path, $scopeType, $scopeCode);
48
        if (isset($this->data[$key])) {
49
            return $this->data[$key];
50
        }
51
        
52
        return null;
53
    }
54
}
55