1 | <?php |
||||
2 | |||||
3 | namespace Puerari\Cwp; |
||||
4 | |||||
5 | /** |
||||
6 | * @trait Email |
||||
7 | * @package Puerari\Cwp |
||||
8 | * @author Leandro Puerari <[email protected]> |
||||
9 | */ |
||||
10 | trait Email |
||||
11 | { |
||||
12 | /** |
||||
13 | * @param string $user : User name |
||||
14 | * @param string $email : Email account Ex: demo |
||||
15 | * @param string $domain : Domain for mail user |
||||
16 | * @param string $pass : Password for the email account |
||||
17 | * @param int $quotamail : Quota of space allocated to the email account, expressed in MB |
||||
18 | * @return string|bool: false on failure, result on success (JSON / XML) |
||||
19 | * status -> OK |
||||
20 | * status -> Error, msj -> msj Error. |
||||
21 | */ |
||||
22 | public function createEmail(string $user, string $email, string $domain, string $pass, int $quotamail = 1024) |
||||
23 | { |
||||
24 | $this->data = compact('user', 'email', 'domain', 'pass', 'quotamail'); |
||||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||||
25 | $this->data['debug'] = $this->debug; |
||||
26 | $this->data['action'] = 'add'; |
||||
27 | $this->cwpuri = 'email'; |
||||
0 ignored issues
–
show
|
|||||
28 | 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
![]() |
|||||
29 | } |
||||
30 | |||||
31 | /** |
||||
32 | * @param string $user : User name |
||||
33 | * @param string $mailbox : Mail account mailbox. In: [email protected] |
||||
34 | * @param string $password : Password to change |
||||
35 | * @param int $quota : Quota of space to be allocated to the email account, expressed in MB |
||||
36 | * @return string|bool: false on failure, result on success (JSON / XML) |
||||
37 | * status => "OK", msj => Successful update |
||||
38 | * status => "Error", msj => msj error |
||||
39 | */ |
||||
40 | public function updateEmail(string $user, string $mailbox, string $password, int $quota = 1024) |
||||
41 | { |
||||
42 | $this->data = compact('user', 'mailbox', 'password', 'quota'); |
||||
0 ignored issues
–
show
|
|||||
43 | $this->data['debug'] = $this->debug; |
||||
44 | $this->data['action'] = 'udp'; |
||||
45 | $this->cwpuri = 'email'; |
||||
0 ignored issues
–
show
|
|||||
46 | return $this->execCurl(); |
||||
47 | } |
||||
48 | |||||
49 | /** |
||||
50 | * @param string $user : Account username |
||||
51 | * @param string $mailbox : Mail account mailbox. In: [email protected] |
||||
52 | * @return string|bool: false on failure, result on success (JSON / XML) |
||||
53 | * status -> OK |
||||
54 | * status -> "Error", msj => msj error |
||||
55 | */ |
||||
56 | public function deleteEmail(string $user, string $mailbox) |
||||
57 | { |
||||
58 | $this->data = compact('user', 'mailbox'); |
||||
0 ignored issues
–
show
|
|||||
59 | $this->data['debug'] = $this->debug; |
||||
60 | $this->data['action'] = 'del'; |
||||
61 | $this->cwpuri = 'email'; |
||||
0 ignored issues
–
show
|
|||||
62 | return $this->execCurl(); |
||||
63 | } |
||||
64 | |||||
65 | /** |
||||
66 | * @param string $user : User name |
||||
67 | * @return string|bool: false on failure, result on success (JSON / XML) |
||||
68 | * status -> OK, msj -> array |
||||
69 | */ |
||||
70 | public function listEmails(string $user) |
||||
71 | { |
||||
72 | $this->data = compact('user'); |
||||
0 ignored issues
–
show
|
|||||
73 | $this->data['debug'] = $this->debug; |
||||
74 | $this->data['action'] = 'list'; |
||||
75 | $this->cwpuri = 'email'; |
||||
0 ignored issues
–
show
|
|||||
76 | return $this->execCurl(); |
||||
77 | } |
||||
78 | |||||
79 | /** |
||||
80 | * @param string $user : Account username |
||||
81 | * @param string $mailbox : Mail account mailbox. In: [email protected] |
||||
82 | * @return string|bool: false on failure, result on success (JSON / XML) |
||||
83 | * status -> OK |
||||
84 | */ |
||||
85 | public function suspendEmail(string $user, string $mailbox) |
||||
86 | { |
||||
87 | $this->data = compact('user', 'mailbox'); |
||||
0 ignored issues
–
show
|
|||||
88 | $this->data['debug'] = $this->debug; |
||||
89 | $this->data['action'] = 'susp'; |
||||
90 | $this->cwpuri = 'email'; |
||||
0 ignored issues
–
show
|
|||||
91 | return $this->execCurl(); |
||||
92 | } |
||||
93 | |||||
94 | /** |
||||
95 | * @param string $user : Account username |
||||
96 | * @param string $mailbox : Mail account mailbox. In: [email protected] |
||||
97 | * @return string|bool: false on failure, result on success (JSON / XML) |
||||
98 | * status -> OK |
||||
99 | */ |
||||
100 | public function unsuspendEmail(string $user, string $mailbox) |
||||
101 | { |
||||
102 | $this->data = compact('user', 'mailbox'); |
||||
0 ignored issues
–
show
|
|||||
103 | $this->data['debug'] = $this->debug; |
||||
104 | $this->data['action'] = 'unsp'; |
||||
105 | $this->cwpuri = 'email'; |
||||
0 ignored issues
–
show
|
|||||
106 | return $this->execCurl(); |
||||
107 | } |
||||
108 | |||||
109 | /** |
||||
110 | * @return string|bool: false on failure, result on success (JSON / XML) |
||||
111 | * status -> OK, emailadmin -> [email protected] |
||||
112 | */ |
||||
113 | public function listEmailAdmin() |
||||
114 | { |
||||
115 | $this->data['debug'] = $this->debug; |
||||
0 ignored issues
–
show
|
|||||
116 | $this->data['action'] = 'list'; |
||||
117 | $this->cwpuri = 'emailadmin'; |
||||
0 ignored issues
–
show
|
|||||
118 | return $this->execCurl(); |
||||
119 | } |
||||
120 | } |
||||
121 |