puerari /
cwp_api
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Puerari\Cwp; |
||||
| 4 | |||||
| 5 | /** |
||||
| 6 | * @trait Ftp |
||||
| 7 | * @package Puerari\Cwp |
||||
| 8 | * @author Leandro Puerari <[email protected]> |
||||
| 9 | */ |
||||
| 10 | trait Ftp |
||||
| 11 | { |
||||
| 12 | /** |
||||
| 13 | * @param string $user : User name |
||||
| 14 | * @param string $userftp : FTP User |
||||
| 15 | * @param string $passftp : Ftp user password |
||||
| 16 | * @param string $domainftp : Domain name |
||||
| 17 | * @param string $pathftp : Path allowed |
||||
| 18 | * @return string|bool: false on failure, result on success (JSON / XML) |
||||
| 19 | * status => "OK", msj => ftp account created successfully |
||||
| 20 | * status => "Error", msj => You must enter a password" |
||||
| 21 | * status => "Error", msj => You must indicate a path" |
||||
| 22 | * status => "Error", msj => You must enter userftp" |
||||
| 23 | * status => "Error", msj => You must enter username" |
||||
| 24 | * status => "Error", msj => You must enter domain" |
||||
| 25 | * status => "Error", msj => You must enter a valid username" |
||||
| 26 | * status => "Error", msj => invalid domain name" |
||||
| 27 | * status => "Error", msj => User package error" |
||||
| 28 | * status => "Error", msj => Package quota exceeded" |
||||
| 29 | * status => "Error", msj => Ftp account already exists" |
||||
| 30 | */ |
||||
| 31 | public function createFtp(string $user, string $userftp, string $passftp, string $domainftp, string $pathftp) |
||||
| 32 | { |
||||
| 33 | $this->data = compact('user', 'userftp', 'passftp', 'domainftp', 'pathftp'); |
||||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||||
| 34 | $this->data['debug'] = $this->debug; |
||||
| 35 | $this->data['action'] = 'add'; |
||||
| 36 | $this->cwpuri = 'ftp'; |
||||
|
0 ignored issues
–
show
|
|||||
| 37 | 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
Loading history...
|
|||||
| 38 | } |
||||
| 39 | |||||
| 40 | /** |
||||
| 41 | * @param string $user : User name |
||||
| 42 | * @param string $userftp : FTP User |
||||
| 43 | * @param string $passftp : New Ftp user password |
||||
| 44 | * @return string|bool: false on failure, result on success (JSON / XML) |
||||
| 45 | * status => "OK", msj => Successful update |
||||
| 46 | * status => "Error", msj => Unknown user |
||||
| 47 | */ |
||||
| 48 | public function updateFtp(string $user, string $userftp, string $passftp) |
||||
| 49 | { |
||||
| 50 | $this->data = compact('user', 'userftp', 'passftp'); |
||||
|
0 ignored issues
–
show
|
|||||
| 51 | $this->data['debug'] = $this->debug; |
||||
| 52 | $this->data['action'] = 'udp'; |
||||
| 53 | $this->cwpuri = 'ftp'; |
||||
|
0 ignored issues
–
show
|
|||||
| 54 | return $this->execCurl(); |
||||
| 55 | } |
||||
| 56 | |||||
| 57 | /** |
||||
| 58 | * @param string $user : Account username |
||||
| 59 | * @param string $userftp : FTP User |
||||
| 60 | * @return string|bool: false on failure, result on success (JSON / XML) |
||||
| 61 | * status => "OK", msj => Ftp account successfully removed |
||||
| 62 | * status => "Error", msj => FTP user does not exist |
||||
| 63 | * status => "Error", msj => FTP account does not belong to the user |
||||
| 64 | * status => "Error", msj => Unknown user |
||||
| 65 | */ |
||||
| 66 | public function deleteFtp(string $user, string $userftp) |
||||
| 67 | { |
||||
| 68 | $this->data = compact('user', 'userftp'); |
||||
|
0 ignored issues
–
show
|
|||||
| 69 | $this->data['debug'] = $this->debug; |
||||
| 70 | $this->data['action'] = 'del'; |
||||
| 71 | $this->cwpuri = 'ftp'; |
||||
|
0 ignored issues
–
show
|
|||||
| 72 | return $this->execCurl(); |
||||
| 73 | } |
||||
| 74 | |||||
| 75 | /** |
||||
| 76 | * @param string $user : User name |
||||
| 77 | * @param string $filter : keyword to filter |
||||
| 78 | * @return string|bool: false on failure, result on success (JSON / XML) |
||||
| 79 | * status -> OK, msj -> array |
||||
| 80 | * status -> OK, msj -> No packages found |
||||
| 81 | */ |
||||
| 82 | public function listFtps(string $user, string $filter) |
||||
| 83 | { |
||||
| 84 | $this->data = compact('user', 'filter'); |
||||
|
0 ignored issues
–
show
|
|||||
| 85 | $this->data['debug'] = $this->debug; |
||||
| 86 | $this->data['action'] = 'list'; |
||||
| 87 | $this->cwpuri = 'ftp'; |
||||
|
0 ignored issues
–
show
|
|||||
| 88 | return $this->execCurl(); |
||||
| 89 | } |
||||
| 90 | } |
||||
| 91 |