WHM   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 20 4
A getPackages() 0 3 1
A createAccount() 0 9 2
1
<?php
2
3
namespace ExpressApi\Apis;
4
5
class WHM extends xmlapi {
6
7
    const DEBUG = 0;
8
9
    private $ip;
10
    private $user;
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
11
    private $pass;
12
13
    public function __construct($param) {
14
15
        $this->ip = $param["reseller"]["server_ip"];
16
        $this->user = $param["reseller"]["reseller_user"];
17
        $this->pass = $param["reseller"]["reseller_pass"];
18
19
20
        if(empty($this->ip)) {
21
            $this->ip = $_SERVER['SERVER_ADDR'];
22
        }
23
24
        parent::__construct($this->ip);
25
        if(!empty($this->user) && !empty($this->pass)) {
26
            $this->password_auth($this->user, $this->pass);
27
        }
28
29
        $this->set_output($param["whm"]["output"]);
30
        $this->set_port($param["whm"]["port"]);
31
        $this->set_debug($param["whm"]["debug"]);
32
    }
33
34
    public function getPackages() {
35
        return $this->listpkgs();
36
    }
37
38
    public function createAccount($param) {
39
        $retorno = false;
40
        $this->user = $this->get_user();
41
        if(!empty($this->user)) {
42
            $retorno = $this->createacct($param);
43
        }
44
45
        return json_decode($retorno);
46
    }
47
}
48