IpagEnvironment   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 10
c 2
b 0
f 0
dl 0
loc 20
rs 10
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isValidEnv() 0 3 3
A __construct() 0 6 2
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
}