1 | <?php |
||||
2 | |||||
3 | namespace Puerari\Cwp; |
||||
4 | |||||
5 | /** |
||||
6 | * @trait Domain |
||||
7 | * @package Puerari\Cwp |
||||
8 | * @author Leandro Puerari <[email protected]> |
||||
9 | */ |
||||
10 | trait Domain |
||||
11 | { |
||||
12 | /** |
||||
13 | * @param string $user : User owners of the scheduled tasks |
||||
14 | * @param string $type : (domain or subdomain) |
||||
15 | * @param string $name : Domain Name or Subdomain Example: my.subdomain.com |
||||
16 | * @param string $path : Path where the domain or subdomain points, Example: /public_html/my subdomain/ |
||||
17 | * @param bool $autossl : true or false [You can Generate an AutoSSL (The domain must be pointing to the Server)] |
||||
18 | * @return string|bool: false on failure, result on success (JSON / XML) |
||||
19 | * status -> OK |
||||
20 | * status -> Error -> user does not exist |
||||
21 | */ |
||||
22 | public function createDomain(string $user, string $type, string $name, string $path, bool $autossl = false) |
||||
23 | { |
||||
24 | $autossl = intval($autossl); |
||||
25 | $this->data = compact('user', 'type', 'name', 'path', 'autossl'); |
||||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||||
26 | $this->data['action'] = 'add'; |
||||
27 | $this->cwpuri = 'admindomains'; |
||||
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 : Account user name |
||||
33 | * @param string $type : (domain or subdomain) |
||||
34 | * @param string $name : Domain Name or Subdomain Example: my.subdomain.com |
||||
35 | * @return string|bool: false on failure, result on success (JSON / XML) |
||||
36 | * status -> OK |
||||
37 | * status -> Error -> user does not exist |
||||
38 | * status -> Error -> domain does not exist |
||||
39 | */ |
||||
40 | public function deleteDomain(string $user, string $type, string $name) |
||||
41 | { |
||||
42 | $this->data = compact('user', 'type', 'name'); |
||||
0 ignored issues
–
show
|
|||||
43 | $this->data['action'] = 'del'; |
||||
44 | $this->cwpuri = 'admindomains'; |
||||
0 ignored issues
–
show
|
|||||
45 | return $this->execCurl(); |
||||
46 | } |
||||
47 | |||||
48 | /** |
||||
49 | * @param string $user : Account user name |
||||
50 | * @param string $type : (domain or subdomain) |
||||
51 | * @return string|bool: false on failure, result on success (JSON / XML) |
||||
52 | * status -> OK |
||||
53 | * status -> Error -> user does not exist |
||||
54 | */ |
||||
55 | public function listDomains(string $user, string $type) |
||||
56 | { |
||||
57 | $this->data = compact('user', 'type'); |
||||
0 ignored issues
–
show
|
|||||
58 | $this->data['action'] = 'list'; |
||||
59 | $this->cwpuri = 'admindomains'; |
||||
0 ignored issues
–
show
|
|||||
60 | return $this->execCurl(); |
||||
61 | } |
||||
62 | |||||
63 | /** |
||||
64 | * @param string $user : User name |
||||
65 | * @param string $domain : Domain for mail user |
||||
66 | * @return string|bool: false on failure, result on success (JSON / XML) |
||||
67 | * status -> OK |
||||
68 | */ |
||||
69 | public function createDkimDomain(string $user, string $domain) |
||||
70 | { |
||||
71 | $this->data = compact('user', 'domain'); |
||||
0 ignored issues
–
show
|
|||||
72 | $this->data['debug'] = $this->debug; |
||||
73 | $this->data['action'] = 'add'; |
||||
74 | $this->cwpuri = 'dkim'; |
||||
0 ignored issues
–
show
|
|||||
75 | return $this->execCurl(); |
||||
76 | } |
||||
77 | } |
||||
78 |