WHM::getPackages()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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