IpagEnvironment::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 6
rs 10
1
<?php
2
3
namespace Ipag\Sdk\Core;
4
5
final class IpagEnvironment extends Environment
6
{
7
    public const VERSION = '2';
8
    public const LOCAL = 'api.ipag.test';
9
    public const PRODUCTION = 'https://api.ipag.com.br';
10
    public const SANDBOX = 'https://sandbox.ipag.com.br';
11
12
    private string $serviceUrl;
0 ignored issues
show
introduced by
The private property $serviceUrl is not used, and could be removed.
Loading history...
13
14
    public function __construct(string $environment)
15
    {
16
        if (!$this->isValidEnv($environment))
17
            throw new \UnexpectedValueException("The environment must be valid");
18
19
        parent::__construct($environment);
20
    }
21
22
    private function isValidEnv(string $value)
23
    {
24
        return $value === self::LOCAL || $value === self::SANDBOX || $value === self::PRODUCTION;
25
    }
26
27
}