Issues (107)

src/Autossl.php (9 issues)

1
<?php
2
3
namespace Puerari\Cwp;
4
5
/**
6
 * @trait Autossl
7
 * @package Puerari\Cwp
8
 * @author Leandro Puerari <[email protected]>
9
 */
10
trait Autossl
11
{
12
    /**
13
     * @param string $user : Account username
14
     * @param string $name : Name of the domain or subdomain to generate the autossl
15
     * @return string|bool: false on failure, result on success (JSON / XML)
16
     * status -> OK
17
     * status -> Error, msj ->(array).
18
     */
19
    public function createAutoSsl(string $user, string $name)
20
    {
21
        $this->data = compact('user', 'name');
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...
22
        $this->data['action'] = 'add';
23
        $this->cwpuri = 'autossl';
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...
24
        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

24
        return $this->/** @scrutinizer ignore-call */ execCurl();
Loading history...
25
    }
26
27
    /**
28
     * @param string $user : Account user name
29
     * @param string $name : Name of the domain or subdomain to delete the autossl
30
     * @return string|bool: false on failure, result on success (JSON / XML)
31
     * status -> OK, msj -> Deleted Autossl
32
     * status -> Error, msj -> Error description
33
     */
34
    public function deleteAutoSsl(string $user, string $name)
35
    {
36
        $this->data = compact('user', 'name');
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...
37
        $this->data['action'] = 'del';
38
        $this->cwpuri = 'autossl';
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...
39
        return $this->execCurl();
40
    }
41
42
    /**
43
     * @param string $user : Account username (If the user name is omitted, all AutoSSLs are listed)
44
     * @return string|bool: false on failure, result on success (JSON / XML)
45
     * status -> OK, msj -> Array with the different data of the certificate
46
     * status -> Error, msj -> Error description
47
     */
48
    public function listAutoSsl(string $user = null)
49
    {
50
        $this->data = compact('user');
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...
51
        $this->data['action'] = 'list';
52
        $this->cwpuri = 'autossl';
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...
53
        return $this->execCurl();
54
    }
55
56
    /**
57
     * @param string $user : Account user name
58
     * @param string $name : Name of the domain or subdomain to renew
59
     * @return string|bool: false on failure, result on success (JSON / XML)
60
     * status -> OK
61
     * status -> Error, msj -> Error description
62
     */
63
    public function renewAutoSsl(string $user, string $name)
64
    {
65
        $this->data = compact('user', 'name');
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...
66
        $this->data['action'] = 'del';
67
        $this->cwpuri = 'autossl';
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