Issues (107)

src/Package.php (9 issues)

1
<?php
2
3
namespace Puerari\Cwp;
4
5
/**
6
 * @trait Package
7
 * @package Puerari\Cwp
8
 * @author Leandro Puerari <[email protected]>
9
 */
10
trait Package
11
{
12
    /**
13
     * @param string $package_name : Package Name
14
     * @param int $disk_quota : MB disk space
15
     * @param int $bandwidth : Bandwidth
16
     * @param int $ftp_accounts : Number of FTP accounts
17
     * @param int $email_accounts : Number of e-mail accounts
18
     * @param int $email_lists : Number of email lists
19
     * @param int $databases : Number of Data Base Mysql/MariaDB
20
     * @param int $sub_domains : Number of Max Sub Domains
21
     * @param int $parked_domains : Number of Max Parked Domains
22
     * @param int $addons_domains : Number of Max Addons Domains
23
     * @param int $hourly_emails : Number of Max hourly emails
24
     * @param int $reseller : (1 = To resell, Account Reseller for a Reseller's Package, Empty for Standard Package)
25
     * @param int $accounts : Maximum number of accounts allowed for a reseller
26
     * @return string|bool: false on failure, result on success (JSON / XML)
27
     * status -> OK
28
     * status -> Error, msj -> Package name missing
29
     * status -> Error, msj -> You must specify the disk size
30
     * status -> Error, msj -> Name already exists
31
     */
32
    public function createPackage(string $package_name, int $disk_quota, int $bandwidth, int $ftp_accounts, int $email_accounts, int $email_lists,
33
                                  int $databases, int $sub_domains, int $parked_domains, int $addons_domains, int $hourly_emails, int $reseller, int $accounts)
34
    {
35
        $this->data = compact('package_name', 'disk_quota', 'bandwidth', 'ftp_accounts', 'quotamail', 'email_accounts', 'email_lists',
0 ignored issues
show
Bug Best Practice introduced by
The property data does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
36
            'databases', 'sub_domains', 'parked_domains', 'addons_domains', 'hourly_emails', 'reseller', 'accounts');
37
        $this->data['debug'] = $this->debug;
38
        $this->data['action'] = 'add';
39
        $this->cwpuri = 'packages';
0 ignored issues
show
Bug Best Practice introduced by
The property cwpuri does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
40
        return $this->execCurl();
0 ignored issues
show
It seems like execCurl() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

40
        return $this->/** @scrutinizer ignore-call */ execCurl();
Loading history...
41
    }
42
43
    /**
44
     * @param string $package_name : New Package Name
45
     * @param int $disk_quota : New MB disk space
46
     * @param int $bandwidth : New Bandwidth
47
     * @param int $ftp_accounts : New Number of FTP accounts
48
     * @param int $email_accounts : New Number of e-mail accounts
49
     * @param int $email_lists : New Number of email lists
50
     * @param int $databases : New Number of Data Base Mysql/MariaDB
51
     * @param int $sub_domains : New Number of Max Sub Domains
52
     * @param int $parked_domains : New Number of Max Parked Domains
53
     * @param int $addons_domains : New Number of Max Addons Domains
54
     * @param int $hourly_emails : New Number of Max hourly emails
55
     * @return string|bool: false on failure, result on success (JSON / XML)
56
     * status -> OK
57
     * status -> Error, msj => Package name missing
58
     * status => Error, msj => There is no package with this name
59
     */
60
    public function updatePackage(string $package_name, int $disk_quota, int $bandwidth, int $ftp_accounts, int $email_accounts, int $email_lists,
61
                                  int $databases, int $sub_domains, int $parked_domains, int $addons_domains, int $hourly_emails)
62
    {
63
        $this->data = compact('package_name', 'disk_quota', 'bandwidth', 'ftp_accounts', 'quotamail', 'email_accounts',
0 ignored issues
show
Bug Best Practice introduced by
The property data does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
64
            'email_lists', 'databases', 'sub_domains', 'parked_domains', 'addons_domains', 'hourly_emails');
65
        $this->data['debug'] = $this->debug;
66
        $this->data['action'] = 'udp';
67
        $this->cwpuri = 'packages';
0 ignored issues
show
Bug Best Practice introduced by
The property cwpuri does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
68
        return $this->execCurl();
69
    }
70
71
    /**
72
     * @param string $package_name : Package Name
73
     * @param int $id : Package ID
74
     * @return string|bool: false on failure, result on success (JSON / XML)
75
     * status -> OK
76
     * status -> Error, msj -> You need some of this data: Package name or ID
77
     * status => Error, msj -> accounts exist with this associated package
78
     */
79
    public function deletePackage(string $package_name, int $id)
80
    {
81
        $this->data = compact('package_name', 'id');
0 ignored issues
show
Bug Best Practice introduced by
The property data does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
82
        $this->data['debug'] = $this->debug;
83
        $this->data['action'] = 'del';
84
        $this->cwpuri = 'packages';
0 ignored issues
show
Bug Best Practice introduced by
The property cwpuri does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
85
        return $this->execCurl();
86
    }
87
88
    /**
89
     * @param string $reseller : Account Reseller for a Reseller's Package. 1 = To resell, Empty for Standard Package
90
     * @return string|bool: false on failure, result on success (JSON / XML)
91
     * status -> OK, msj -> array
92
     */
93
    public function listPackages(string $reseller = '')
94
    {
95
        $this->data = compact('reseller');
0 ignored issues
show
Bug Best Practice introduced by
The property data does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
96
        $this->data['debug'] = $this->debug;
97
        $this->data['action'] = 'list';
98
        $this->cwpuri = 'packages';
0 ignored issues
show
Bug Best Practice introduced by
The property cwpuri does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
99
        return $this->execCurl();
100
    }
101
}
102