1 | <?php |
||
9 | class RestClient |
||
10 | { |
||
11 | public $host = 'localhost'; |
||
12 | public $port = '9090'; |
||
13 | public $plugin = '/plugins/restapi/v1'; |
||
14 | public $secret = 'SuperSecret'; |
||
15 | public $useSSL = false; |
||
16 | protected $params = array(); |
||
17 | private $client; |
||
18 | public $bcastRoles = array(); |
||
19 | public $useBasicAuth = false; |
||
20 | public $basicUser = 'admin'; |
||
21 | public $basicPwd = '1234'; |
||
22 | |||
23 | function __construct() |
||
27 | |||
28 | public function geti() |
||
32 | |||
33 | |||
34 | |||
35 | /** |
||
36 | * Make the request and analyze the result |
||
37 | * |
||
38 | * @param string $type Request method |
||
39 | * @param string $endpoint Api request endpoint |
||
40 | * @param array $params Parameters |
||
41 | * @return array|false Array with data or error, or False when something went fully wrong |
||
42 | */ |
||
43 | protected function doRequest($type, $endpoint, $params=[]) |
||
77 | |||
78 | |||
79 | } |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.