puerari /
cwp_api
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Puerari\Cwp; |
||||
| 4 | |||||
| 5 | /** |
||||
| 6 | * @trait Cronjob |
||||
| 7 | * @package Puerari\Cwp |
||||
| 8 | * @author Leandro Puerari <[email protected]> |
||||
| 9 | */ |
||||
| 10 | trait Cronjob |
||||
| 11 | { |
||||
| 12 | /** |
||||
| 13 | * @param string $user : User owners of the scheduled tasks |
||||
| 14 | * @param string $execute : Frequency with which to execute the cron Example: * * * * * * |
||||
| 15 | * @param string $command : Command to execute, Example: /usr/bin/php test.php |
||||
| 16 | * @return string|bool: false on failure, result on success (JSON / XML) |
||||
| 17 | * status -> OK |
||||
| 18 | * status -> Error -> user does not exist |
||||
| 19 | */ |
||||
| 20 | public function createCronJob(string $user, string $execute, string $command) |
||||
| 21 | { |
||||
| 22 | $this->data = compact('user', 'execute', 'command'); |
||||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||||
| 23 | $this->data['debug'] = $this->debug; |
||||
| 24 | $this->data['action'] = 'add'; |
||||
| 25 | $this->cwpuri = 'cronjobsusers'; |
||||
|
0 ignored issues
–
show
|
|||||
| 26 | 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...
|
|||||
| 27 | } |
||||
| 28 | |||||
| 29 | /** |
||||
| 30 | * @param string $user : User owners of the scheduled tasks |
||||
| 31 | * @param string $execute : Frequency with which to execute the cron Example: * * * * * * |
||||
| 32 | * @param string $command : Command to execute, Example: /usr/bin/php test.php |
||||
| 33 | * @return string|bool: false on failure, result on success (JSON / XML) |
||||
| 34 | * status -> OK |
||||
| 35 | * status -> Error -> user does not exist |
||||
| 36 | * status -> Error -> domain does not exist |
||||
| 37 | */ |
||||
| 38 | public function deleteCronJob(string $user, string $execute, string $command) |
||||
| 39 | { |
||||
| 40 | $this->data = compact('user', 'execute', 'command'); |
||||
|
0 ignored issues
–
show
|
|||||
| 41 | $this->data['debug'] = $this->debug; |
||||
| 42 | $this->data['action'] = 'del'; |
||||
| 43 | $this->cwpuri = 'cronjobsusers'; |
||||
|
0 ignored issues
–
show
|
|||||
| 44 | return $this->execCurl(); |
||||
| 45 | } |
||||
| 46 | |||||
| 47 | /** |
||||
| 48 | * @param string $user : Account user name |
||||
| 49 | * @return string|bool: false on failure, result on success (JSON / XML) |
||||
| 50 | * status -> OK |
||||
| 51 | * status -> Error -> user does not exist |
||||
| 52 | */ |
||||
| 53 | public function listCronJobs(string $user) |
||||
| 54 | { |
||||
| 55 | $this->data = compact('user'); |
||||
|
0 ignored issues
–
show
|
|||||
| 56 | $this->data['debug'] = $this->debug; |
||||
| 57 | $this->data['action'] = 'list'; |
||||
| 58 | $this->cwpuri = 'cronjobsusers'; |
||||
|
0 ignored issues
–
show
|
|||||
| 59 | return $this->execCurl(); |
||||
| 60 | } |
||||
| 61 | } |
||||
| 62 |