Completed
Pull Request — 1.11.x (#1599)
by José
28:19
created

Culqi   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 51
rs 10
c 0
b 0
f 0
wmc 7
lcom 1
cbo 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 2
A setApiKey() 0 3 1
A setEnv() 0 13 3
A getEnv() 0 4 1
1
<?php
2
namespace Culqi;
3
4
class Culqi
5
{
6
7
    public $api_key;
8
    public static $api_base = "https://integ-pago.culqi.com/api/v1";
9
10
11
    // Constructor
12
    public function __construct($options)
13
    {
14
        $this->api_key = $options["api_key"];
15
        if (!$this->api_key) {
16
            throw new InvalidApiKey();
17
        }
18
19
        $this->Cargos = new Cargos($this);
20
        $this->Suscripciones = new Suscripciones($this);
21
        $this->Devoluciones = new Devoluciones($this);
22
        $this->Planes = new Planes($this);
23
24
    }
25
26
    // To-do: setAPIKey
27
    public function setApiKey()
28
    {
29
    }
30
31
    // setEnv
32
    public function setEnv($entorno)
33
    {
34
        if ($entorno == 'INTEG') {
35
            self::$api_base = "https://integ-pago.culqi.com/api/v1";
36
        }
37
        elseif ($entorno == 'PRODUC') {
38
            self::$api_base = "https://pago.culqi.com/api/v1";
39
        }
40
        else {
41
             self::$api_base = "https://integ-pago.culqi.com/api/v1";
42
        }
43
44
    }
45
46
    // To-do: getEnv
47
    public function getEnv()
48
    {
49
        //this->api_base;
50
    }
51
52
53
54
}
55