ModeDetector::getMode()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 9
rs 10
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\Payone\Business\Mode;
9
10
use SprykerEco\Shared\Payone\Dependency\ModeDetectorInterface;
11
use SprykerEco\Zed\Payone\PayoneConfig;
12
13
class ModeDetector implements ModeDetectorInterface
14
{
15
    /**
16
     * @var \SprykerEco\Zed\Payone\PayoneConfig
17
     */
18
    protected $config;
19
20
    /**
21
     * @param \SprykerEco\Zed\Payone\PayoneConfig $config
22
     */
23
    public function __construct(PayoneConfig $config)
24
    {
25
        $this->config = $config;
26
    }
27
28
    /**
29
     * @return string
30
     */
31
    public function getMode(): string
32
    {
33
        $mode = $this->config->getMode();
34
35
        if ($mode === static::MODE_LIVE) {
36
            return static::MODE_LIVE;
37
        }
38
39
        return static::MODE_TEST;
40
    }
41
}
42